Chapter 6 Sensitivity analysis
This book is about MPM construction, not the analysis of such models.
Nevertheless, the construction of the annual projection matrix by way of separate birth and survival matrices creates a way to easily calculate the sensitivity and elasticity of the asymptotic growth rate (usually denoted \(\lambda\)) to changes in the age-specific birth and death rates.
Existing tools (e.g., the sensitivity() function in the popbio R package) can calculate sensitivities of \(\lambda\) to changes in the elements of an annual projection matrix (\(\mathbf{A_{post}}\) or \(\mathbf{A_{pre}}\)).
However, the matrix entries may be functions of multiple vital rates, and individual vital rates may appear in multiple matrix entries (see eqs. (3.2)).
Extracting the sensitivities of \(\lambda\) to vital rates from the sensitivities of \(\lambda\) to matrix elements requires careful accounting, as well as the application of basic differential calculus; doing this by hand is tedious and error prone.
Instead, we can make use of established procedures for sensitivity analysis of “periodic matrix products” (Caswell and Trevisan 1994). We will start with the age-structured model, for which the analysis is particularly straightforward, and then move on to the more complex models.
6.1 Sensitivity analysis of age-structured MPMs
Here, there are just two “seasons:” from the beginning of the breeding period to the end of the breeding period (represented by the matrix \(\mathbf{B}\)); and from the end of the breeding period in one year to the beginning of the breeding period in the next year (represented by the matrix \(\mathbf{P}\)).
The recipe is as follows:
- Construct both the postbreeding census and prebreeding census projection matrices (\(\mathbf{A_{post}}\) and \(\mathbf{A_{pre}}\)).
- Use a standard toolkit to construct the sensitivity matrices of the two projection matrices. We will call those \(\mathbf{S_A}^{\text{(post)}}\) and \(\mathbf{S_A}^{\text{(pre)}}\).
- Construct the transpose of the \(\mathbf{B}\) and \(\mathbf{P}\) matrices by swapping the rows and columns. We will call these \(\mathbf{B^T}\) and \(\mathbf{P^T}\). For the \(m=3\) example, these look like \[\begin{equation} \mathbf{B^T} = \begin{pmatrix} b_{(\text{1})} & 1 & 0 & 0\\ b_{(\text{2})} & 0 & 1 & 0\\ b_{(\text{3})} & 0 & 0 & 1 \end{pmatrix} \end{equation}\] and \[\begin{equation} \mathbf{P^T} = \begin{pmatrix} p_{(\text{0})} & 0 & 0\\ 0 & p_{(\text{1})} & 0\\ 0 & 0 & p_{(\text{1})}\\ 0 & 0 & 0 \end{pmatrix}. \end{equation}\]
- Matrix multiply \(\mathbf{P^T}\) by \(\mathbf{S_A}^{\text{(pre)}}\). The top row in the resulting matrix contains the sensitivities of \(\lambda\) to the age-specific birth rates.
- Matrix multiply \(\mathbf{B^T}\) by \(\mathbf{S_A}^{\text{(post)}}\). The diagonal entries in the resulting matrix contains the sensitivities of \(\lambda\) to the age-specific survival rates.
6.1.1 Example
We will revisit the lizard MPM from chapter X.
First we will clear the workspace of existing matrices and other relevant objects, and then attach the model we saved in chapter X, which will make objects like Apre available to us:
rm(list = names(lizard_age_mpm)) # Clear the workspace of potential name conflicts
attach(lizard_age_mpm) # Get the age structured lizard model from ch. 3.Now use the popbio library to calculate the matrix sensitivities of Apost and Apre:
library(popbio) # This library includes tools for calculating lambda and matrix sensitivities
# Calculate the sensitivity matrices
Spost <- sensitivity(Apost)
Spre <- sensitivity(Apre)Now we combine steps 3 and 4 to calculate the sensitivities of \(\lambda\) to survival.
To do a matrix transpose in R, use the t() function.
# Do the matrix multiplication to calculate the sensitivities to survival
Stemp1 <- t(B) %*% Spost
diag(Stemp1[, 1:m])## [1] 0.837520960 0.480823977 0.366397726 0.198614806 0.125950860 0.014929771
## [7] 0.008135051
And now we do the same to calculate the sensitivity of \(\lambda\) to age-specific birth rates:
# Do the matrix multiplication to calculate the sensitivities to birth rates
Stemp2 <- t(P) %*% Spre
Stemp2[1, ]## age 1 age 2 age 3 age 4 age 5 age 6
## 0.1507669993 0.1096028394 0.0563012534 0.0203518625 0.0035663265 0.0024997584
## age 7
## 0.0007158845
[Discuss; show how to get elasticities from these]
Finally, it’s always good practice to clean up the workspace!
References
Caswell, H., and M. C. Trevisan. 1994. “Sensitivity analysis of periodic matrix models.” Ecology 75: 1299–03.