Perturbs elements within a matrix population model and measures the response (sensitivity or elasticity) of the per-capita population growth rate at equilibrium (\(\lambda\)), or, with a user-supplied function, any other demographic statistic.
perturb_matrix(
matA,
pert = 1e-06,
type = "sensitivity",
demog_stat = "lambda",
...
)
A matrix population model (i.e., a square projection matrix).
Magnitude of the perturbation. Defaults to 1e-6
.
Whether to return sensitivity
or elasticity
values.
The demographic statistic to be used, as in "the
sensitivity/elasticity of demog_stat
to matrix element
perturbations." Defaults to the per-capita population growth rate at
equilibrium (\(\lambda\)). Also accepts a user-supplied function that
performs a calculation on a projection matrix and returns a single numeric
value.
Additional arguments passed to the function demog_stat
A sensitivity or elasticity matrix.
Caswell, H. 2001. Matrix Population Models: Construction, Analysis, and Interpretation. Sinauer Associates; 2nd edition. ISBN: 978-0878930968
Other perturbation analysis:
perturb_stochastic()
,
perturb_trans()
,
perturb_vr()
,
pop_vectors()
matA <- rbind(
c(0.1, 0, 1.5, 4.6),
c(0.5, 0.2, 0.1, 0),
c(0, 0.3, 0.3, 0.1),
c(0, 0, 0.5, 0.6)
)
perturb_matrix(matA)
#> [,1] [,2] [,3] [,4]
#> [1,] 0.1956454 0.1034597 0.03892421 0.03337485
#> [2,] 0.4238210 0.2241222 0.08432050 0.07229906
#> [3,] 1.3889133 0.7344748 0.27632874 0.23693290
#> [4,] 1.7815032 0.9420805 0.35443500 0.30390419
# use a larger perturbation than the default
perturb_matrix(matA, pert = 0.01)
#> [,1] [,2] [,3] [,4]
#> [1,] 0.1965109 0.1035815 0.03891965 0.03335242
#> [2,] 0.4210788 0.2251614 0.08436470 0.07224203
#> [3,] 1.3788340 0.7267363 0.27758497 0.23689003
#> [4,] 1.7863694 0.9339710 0.35225173 0.30591837
# calculate the sensitivity/elasticity of the damping ratio to perturbations
damping <- function(matA) { # define function for damping ratio
eig <- eigen(matA)$values
dm <- rle(Mod(eig))$values
return(dm[1] / dm[2])
}
perturb_matrix(matA, demog_stat = "damping")
#> [,1] [,2] [,3] [,4]
#> [1,] -0.1404735 0.543012141 0.1507766 -0.07610673
#> [2,] -0.2478520 -0.001715736 0.3708966 0.07466982
#> [3,] 3.0820361 -0.289454277 0.1468064 0.71772081
#> [4,] 6.2816365 1.540591979 -0.5566369 0.79082548