Matrix Population Models (MPMs) are widely used in population ecology to study how individuals transition between life stages and contribute to population growth.
In this tutorial, you’ll learn to:
matU) and reproduction
(matF) matricesmatA)popdemo and
Ragelibrary(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(Rage)
library(popdemo)
## Welcome to popdemo! This is version 1.3-0
## Use ?popdemo for an intro, or browseVignettes('popdemo') for vignettes
## Citation for popdemo is here: doi.org/10.1111/j.2041-210X.2012.00222.x
## Development and legacy versions are here: github.com/iainmstott/popdemo
I’m assuming you’ve calculated the transition rates as t1_1, t2_1, …, t3_3…:
matU)This matrix represents survival and growth transitions between stages (no reproduction yet).
matU <- matrix(
c(t1_1, t2_1, t3_1,
t1_2, t2_2, t3_2,
t1_3, t2_3, t3_3),
nrow = 3,
byrow = TRUE
)
matU
## [,1] [,2] [,3]
## [1,] 0.01351351 0.0000000 0.00000
## [2,] 0.06081081 0.2790698 0.00000
## [3,] 0.00000000 0.1569767 0.96875
plot_life_cycle(matU)
matF)We can make an additional reproduction matrix matF by
first making a 0 matrix, and then adding our calculated reproduction
data to the top row. This matrix includes only reproduction: how many
new individuals (e.g. seedlings) are added by individuals in each
stage.
matF <- matrix(rep(0, 9), nrow = 3)
matF[1, ] <- reprod$seedlingsPerIndiv
matF
## [,1] [,2] [,3]
## [1,] 0.417848 1.14445 2.764738
## [2,] 0.000000 0.00000 0.000000
## [3,] 0.000000 0.00000 0.000000
matA)The two matrices simply sum to make the full matrix.
matA <- matU + matF
matA
## [,1] [,2] [,3]
## [1,] 0.43136155 1.1444497 2.764738
## [2,] 0.06081081 0.2790698 0.000000
## [3,] 0.00000000 0.1569767 0.968750
This matrix defines all transitions in the population — both survival/growth and reproduction.
Here’s the full life cycle.
plot_life_cycle(matA)
Assume: - 50 individuals in stage 1 - 40 in stage 2 - 20 in stage 3
n0 <- c(50, 40, 20)
n1 <- matA %*% n0
n1
## [,1]
## [1,] 122.64084
## [2,] 14.20333
## [3,] 25.65407
Repeating this many times would be super-boring, but thankfully
there’s a package for that called popdemo.
Use popdemo::project() to simulate the population over
10 time steps.
pr <- project(matA, vector = n0, time = 10)
pr
## 1 deterministic population projection over 10 time intervals.
##
## [1] 110.0000 162.4982 178.5879 188.1077 196.1709 203.8915 211.6165 219.4921
## [9] 227.5913 235.9550 244.6092
Convert the output for plotting:
pop <- vec(pr)
matplot(pop, type = "l", log = "y", lty = 1, col = 1:3,
xlab = "Time", ylab = "Population size (log scale)")
legend("topleft", legend = paste("Stage", 1:3), col = 1:3, lty = 1)
eigs(matA)
## $lambda
## [1] 1.036612
##
## $ss
## [1] 0.78991278 0.06340935 0.14667786
##
## $rv
## [1] 0.1351935 1.3455809 5.5078967
Elasticity shows how sensitive population growth is to each element of the matrix.
popdemo::elas(matA)
## [,1] [,2] [,3]
## [1,] 0.04443859 0.009464327 0.05288815
## [2,] 0.06235248 0.022969941 0.00000000
## [3,] 0.00000000 0.052888148 0.75499837
In this tutorial, you:
These tools are fundamental for life history analysis, conservation planning, and understanding population processes.
Try modifying the matrix to simulate: - Reduced survival in stage 2 - Increased reproduction from stage 3 - A smaller initial population
Then re-run the simulation and see how population growth and elasticity change! ```