# Visualizing Power Models in Species-Area Relationships Using R Shiny: An Interactive Educational Tool

**R Code – Geekcologist**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Considered one of the “few general rules” in ecology, the species-area relationship (SAR) – the ubiquitous pattern indicating that larger islands or habitat patches harbor more species than smaller ones – has played a pivotal role in shaping ecological theories (Lomolino 2000, 2001, Tjørve 2003, 2009, Dias et al. 2020). These theories aim not only to describe patterns of species diversity in patchy environments but also to comprehend the underlying mechanisms driving ecological community dynamics in space. Given its paramount importance for biodiversity, SAR has significantly influenced the development of biodiversity conservation strategies, particularly in the design of protected areas and the selection of habitat patches in fragmented landscapes.

Although a large plethora of models have been used to describe SAR (Tjørve2003, 2009), the relationship between area and species richness has been traditionally modeled as a power law, as first developed by Arrhenius (1921):

S=*c*A^{z}

where S represents the number of species in a habitat patch (or island), A denotes the area of the patch, and *c* and* z* are constants that govern the relationship.

As the use of simple linear models make it easy to estimate the model’s parameters, ecologists have traditionally used a log-linearizable power function, log-transforming both S and A. Under this approach, *z* and *c* (more specifically log[*c*]) are then estimated using the subsequent regression model:

log (S) = log(*c*) + *z* log(A)

In addition to simplifying parameter estimation, this log transformation also brings some biological meaning for model parameters, as in the logarithm space, log(*c*) now represents the expected number of species when the area is one unit, and the parameter *z* reflects the proportional change in species richness per unit change in log(area).

However, as has been pointed out by the now classic works of Gould (1979) and Lomolino (1989, 2000, 2001), the interpretation of parameters *c* and* z* in the context of SAR is often misunderstood, despite being crucial quantities in ecology. Solely relying on z values can lead to misinterpretations regarding the rate at which species richness increases with area, if *c* is not constant when comparing different archipelagos, formed by either true island or habitat patches. Therefore, it’s essential to consider both *c* and *z* values together, as they provide a more comprehensive understanding of the relationship.

Given that the species-area relationship (SAR) constitutes a central topic in undergraduate and graduate programs in ecology, biogeography, and conservation biology, being able to visualize the shape of this relationship and the effect of these two critical parameters on SAR models is crucial for student comprehension. With that in mind, I developed a simple R Shiny app to aid students in visualizing SAR in both arithmetic and logarithmic scales. This tool could prove useful for courses in biogeography, ecology, and related fields.

The R shiny app should look like this:

Here is the code!

#rm(list=ls()) ###Load packages require(shiny) require(ggplot2) ### Define user interface ui = fluidPage( titlePanel("Specie-Area Relationship - Power Model"), sidebarLayout( sidebarPanel( sliderInput("c", "Value of c:", min = 0.1, max = 10, value = 1), #bar to define values for c sliderInput("z", "Value of z:", min = 0.1, max = 2, value = 0.5),#bar to define values for z numericInput("area", "Area:", value = 1000, min = 1),#define range for area numericInput("num_species", "Number of Species:", value = 50, min = 1, max = 1000),#define rangefor species richness checkboxInput("loglog", "Log-Log Axes"), width = 3 ), mainPanel( plotOutput("species_area_plot") ) ) ) ### Define the server server = function(input, output) { output$species_area_plot <- renderPlot({ ### Generate data area <- seq(1, input$area, length.out = 1000) species <- input$c * area^input$z ### Create plot p = ggplot() + geom_line(aes(x = area, y = species), color = "blue") + geom_hline(yintercept = input$num_species, linetype = "dashed", color = "red") + labs(x = "Area", y = "Species") + theme_minimal() # Log-Log Axes if (input$loglog) { p <- p + scale_x_log10() + scale_y_log10() } print(p) }) } ### Execute app shinyApp(ui = ui, server = server)

References

Arrhenius, O. (1921). Species and area. *Journal of Ecology*, *9*(1), 95-99.

Dias, R. A., Bastazini, V. A. G., Knopp, B. D. C., Bonow, F. C., Gonçalves, M. S. S., & Gianuca, A. T. (2020). Species richness and patterns of overdispersion, clustering and randomness shape phylogenetic and functional diversity–area relationships in habitat islands. *Journal of Biogeography*, *47*(8), 1638-1648.

Gould, S. J. (1979). An allometric interpretation of species-area curves: the meaning of the coefficient. *The American Naturalist*, *114*(3), 335-343.

Lomolino, M. V. (2001). The species-area relationship: new challenges for an old pattern. *Progress in physical geography*, *25*(1), 1-21.

Lomolino, M. V. (1989). Interpretations and comparisons of constants in the species-area relationship: an additional caution. *The American Naturalist*, *133*(2), 277-280.

Lomolino, M. V. (2000). Ecology’s most general, yet protean pattern: The species–area relationship. *Journal of Biogeography*, 27, 17–26.

Tjørve E. (2003) Shapes and functions of species-area curves: a review of possible models. *J**ournal of** Biogeogr**aphy,* 30, 827– 835.

Tjørve, E. (2009). Shapes and functions of species–area curves (II): A review of new models and parameterizations. *Journal of Biogeography*, 36, 1435–1445.

**leave a comment**for the author, please follow the link and comment on their blog:

**R Code – Geekcologist**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.