Site icon R-bloggers

Interactive stage-structured population model

[This article was first published on Ecology in silico, 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.

This is an example of interfacing R and shiny to allow users to explore a biological model often encountered in an introductory ecology class. We are interested the growth of a population that is composed of multiple, discrete stages or age classes. Patrick H. Leslie provides an in-depth derivation of the model in his 1945 paper “On the use of matrices in certain population mathematics”.

The population at time $t$ is represented by a vector $\bar{x}_t$, where each element of the vector represents the number of individuals in each age class (e.g. if a population has $n$ age classes, then $\bar{x}_t$ has $n$ elements). Time is considered discrete and we assume that the population is censused prior to breeding. We assume that individuals within each age class are identical, and that each has some probability of maturing to the next age class, surviving (staying in the same age class), and reproduction. Changes in the population from one timestep to another are represented as:

where $L$ is an $n$ x $n$ Leslie matrix (or more generally, a projection matrix) that describes the contribution of each age class to the population at time $t+1$.

Suppose we are tasked with modeling the annual dynamics of a population with four age classes, and $t$ represents years. For simplicity, we model only females and assume that plenty of males are available for breeding. Individuals in the first age class survive to class 2 with probability 0.1, class 2 individuals survive to class 3 with probability 0.5, class 3 individuals survive to class 4 with probability 0.9, and class four individuals survive each year with probability 0.7. Only the fourth age class is reproductive, with individuals producing 100 class 1 individuals per year. We can represent this population graphically as:

Equivalently, as a Leslie matrix:

The long term population growth rate is related to the dominant eigenvalue $\lambda_{1}$ of $L$. If , the population declines to extinction, and if the population increases.

From a management perspective, it is often useful to know how limited resources may be allocated to increase population growth or prevent extinction. In other words, if an element such as fecundity or survival could be manipulated by managers, how much would the long term population growth rate change? To this end, one can calculate the sensitivity of the dominant eigenvalue to small changes in $l_{ij}$:

where and are left and right eigenvectors, respectively, associated with the dominant eigenvalue. Because survival and fecundity are on different scales, sensitivity is often scaled by a factor of for a measure of elasticity.

Building the R shiny app

Files are accessible in this repository. Please feel free to clone for your own use and/or contribute.

Here is a link to the resulting graphical user interface for the model, with example output below.

To leave a comment for the author, please follow the link and comment on their blog: Ecology in silico.

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.