Correspondence site: http://www.respond2articles.com/MEE/

APPLICATION

# popdemo: an R package for population demography using projection matrix analysis

Article first published online: 11 JUN 2012

DOI: 10.1111/j.2041-210X.2012.00222.x

© 2012 The Authors. Methods in Ecology and Evolution © 2012 British Ecological Society

Additional Information

#### How to Cite

Stott, I., Hodgson, D. J. and Townley, S. (2012), popdemo: an R package for population demography using projection matrix analysis. Methods in Ecology and Evolution, 3: 797–802. doi: 10.1111/j.2041-210X.2012.00222.x

#### Publication History

- Issue published online: 5 OCT 2012
- Article first published online: 11 JUN 2012
- Received 6 February 2012; Accepted 20 April 2012
*Handling Editor: Satu Ramula*

### Keywords:

- demography;
- matrix;
- perturbation analysis;
- popdemo;
- population management;
- R;
- sensitivity;
- transfer function;
- transient dynamics

### Summary

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

**1.** Effective population management requires accurate predictions of future population dynamics and how they may be manipulated to achieve management goals.

**2.** The R package popdemo provides software tools for novel analytical methods that aim to enhance the predictive power of basic population projection matrix models. These include indices of transient population dynamics and transfer function analyses.

**3.** We use a case study to demonstrate the use and importance of these methods for population management and briefly discuss their potential application outside population ecology.

### Introduction

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

popdemo is an R package (available at http://cran.R-project.org) that provides novel analytical methods for basic population projection matrix (PPM) models. These add to the more traditional approaches available in the package popbio (Stubben & Milligan 2007). In this study, we highlight key methods covered by popdemo and use a PPM case study to show how these may be used for population management. For detailed information, we point the reader in the direction of package demos that provide comprehensive coverage of functionality. Finally, we discuss how the tools in this package could find use outside population ecology.

### Population projection matrix models

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

Population projection matrix models are an important tool in ecological and evolutionary demography, for population management (Kareiva, Marvier & McClure 2000), comparative ecology (Buckley *et al.* 2010) and life history theory (Åberg *et al.* 2009). Many studies rely on basic density-independent, nonstochastic (linear, time-invariant) PPM models (e.g. Linkie *et al.* 2007), as data required by more complex density-dependent and stochastic models (e.g. Jensen 1996; Fieberg & Ellner 2001) are often difficult to provide. Our examples use a PPM for medium-fecundity desert tortoise (*Gopherus agassizii*) with eight size classes (Doak, Kareiva & Klepetka 1994). Once popdemo is installed and loaded, the matrix is created by running data(Tort):

Basic PPM models take the form **n**_{t} = **A**^{t}**n**_{0}, where **A** is the PPM describing the stage-structured life cycle of the organism, and **n**_{0} and **n**_{t} are vectors containing numbers or densities of individuals in each stage class (the demographic structure) of the current population and the population at time t in the future, respectively (see Caswell 2001). Projecting and graphing population dynamics using this equation is often the first step towards understanding the model. popdemo’s function project enables this [Fig. 1; see demo(projection)]:

n0 <- c(1,1,2,3,5,8,13,21)

pr1 <- project(Tort, vector=n0, time=50)

plot(pr1)

### Measuring population dynamics

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

Traditionally, analysis of basic PPM models has focussed on long-term (asymptotic) population dynamics. Assuming density-independence and a constant environment, any population is predicted to eventually settle to a stable state, with a stable demographic structure equal to the dominant right eigenvector **w** of the PPM, and a stable geometric growth rate equal to the dominant eigenvalue λ_{max} of the PPM (Caswell 2001). The stable growth rate is often used as an indicator of population viability and fitness: λ_{max} > 1 predicts long-term population increase, whereas λ_{max} < 1 predicts long-term decline. The desert tortoise PPM declines in the long term, with λ_{max} = 0·958 (Fig. 1; Appendix S1).

#### Model assumptions

Ideally, most PPMs should be *primitive*, like the desert tortoise PPM, with asymptotic dynamics conforming to the aforementioned description. In contrast, *imprimitive* PPMs exhibit periodic life cycle transitions (Otto & Day 2007), which cause cyclic long-term population dynamics rather than stable geometric growth. Imprimitive PPMs may also be *reducible* and *nonergodic*: such models can be decomposed into two or more parts, yielding several different potential long-term growth rates that depend on demographic structure (Stott *et al.* 2010a). Many analyses assume primitivity, irreducibility and/or ergodicity, so it is important to check these properties to ensure analyses are appropriate to the model. The functions is.matrix_primitive, is.matrix_irreducible and is.matrix_ergodic facilitate these checks [Appendix S1; see demo(matrixtools)].

#### Transient dynamics

Even if a model is primitive, analysing only long-term dynamics has significant drawbacks. Asymptotic analyses ignore *transient dynamics* of the population. Populations are frequently subject to environmental disturbances, so are rarely at stable state. Consequently, long-term growth rate is often a poor predictor of real-world population dynamics (Bierzychudek 1999). Short-term (transient) dynamics may differ drastically from long-term trends because of discrepancies between the current and stable demographic distributions. In the short term, populations may increase faster than their stable growth rate (amplify) if reproductive adults are overrepresented in the population (as is the case in Fig. 1). Alternatively, they may grow more slowly than their stable growth rate (attenuate) if immature juveniles are overrepresented.

popdemo includes functions to calculate three key pairs of indices that measure transient dynamics. Reactivity (reactivity) and first-timestep attenuation (firststepatt) represent immediate amplification/attenuation in the first timestep, respectively. Maximum amplification (maxamp) and maximum attenuation (maxatt) represent the largest/smallest possible amplification/attenuation, respectively (Townley & Hodgson 2008). Upper and lower inertia (inertia) represent fixed long-term amplification/attenuation, respectively (Koons, Holmes & Grand 2007). These indices are standardised to remove effects of asymptotic dynamics and to assume a total initial population density of 1, so they can be compared both amongst and within models where these may differ, thus offering advantages over analysing simulated dynamics (see Stott, Townley & Hodgson 2011). Each index therefore describes how much larger or smaller the nonstable population is at a certain point along the population projection, relative to the density of an equivalent population initiated at stable stage structure. Indices of amplification are >1, whilst indices of attenuation are <1, with the exact value of the index giving the magnitude of amplification or attenuation.

The desert tortoise population amplifies if adults are overrepresented:

n0.amp <- c(1,1,2,3,5,8,13,21)

reactivity(Tort, vector=n0.amp)

maxamp(Tort, vector=n0.amp)

inertia(Tort, vector=n0.amp)

This population amplifies (reactivity equals 2·6) and, because of this, settles to a density over four times that predicted by stable growth (inertia equals 4·1; Fig. 2a). As asymptotic analysis indicates population decline, basing management decisions on that alone could result in poor strategies that ignore the potential for transient population amplification.

The population attenuates if juveniles are overrepresented:

n0.att <- c(21,13,8,5,3,2,1,1)

firststepatt(Tort, vector=n0.att)

maxatt(Tort, vector=n0.att)

inertia(Tort, vector=n0.att)

This population attenuates (first-timestep attenuation equals 0·92) and settles to a density below that predicted by stable growth (inertia equals 0·91; Fig. 2a). In this case, asymptotic analysis would underestimate the severity of short-term decline, so that management efforts may fail to achieve desired goals.

Transient dynamics depend strongly on population structure. If population structure is not known, then *transient bounds* inform on the potential range of transient dynamics (Townley & Hodgson 2008; Stott, Townley & Hodgson 2011). Transient bounds on indices of amplification represent the largest possible values that those indices may take, whilst bounds on indices of attenuation represent the smallest possible values that those indices may take. These extreme values of amplification and attenuation result from projections of stage-biased demographic vectors (Townley & Hodgson 2008). A stage-biased vector contains 100% of individuals in a single-stage class, and there is one stage-biased vector for each stage of the life cycle (Fig. 2b). For example, a 3 × 3 matrix has a set of stage-biased vectors [1 0 0]; [0 1 0]; [0 0 1]. When using the aforementioned functions for generating transient indices, the relevant transient bound is returned if a demographic vector is not specified:

reactivity(Tort)

firststepatt(Tort)

maxamp(Tort)

maxatt(Tort)

inertia(Tort, bound= ‘ upper’)

inertia(Tort, bound=‘lower’)

For the desert tortoise, a bias towards the largest individuals results in amplification bounds, whilst a bias towards yearlings results in attenuation bounds (Fig. 2b). The population can grow to an absolute maximum of almost seven times its current size (maximum amplification bound equals 6·82) and an absolute minimum of 12% its current size (maximum attenuation bound equals 0·12; Fig. 2b). The information provided by these transient bounds therefore provides best- or worst-case scenarios.

There are further indices of transient density available in popdemo, and the functions described here have extra utilities [see demo(transient)]. popdemo also contains functions for transient indices that deal with model convergence [see demo(convergence) and Stott, Townley & Hodgson 2011 for a discussion on convergence indices].

### Perturbation analyses

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

For population management, it is important to know how population dynamics may be changed to achieve management goals. Perturbation analyses assess how changes to vital rates of the life cycle such as survival, fecundity or growth affect population dynamics. A classical approach is to conduct sensitivity analysis of the stable growth rate (asymptotic sensitivity analysis). This provides a linear estimate of the effect of perturbations on long-term population growth (Caswell 2001). Asymptotic sensitivity analyses have been used to prioritise potential management practises (e.g. Ratsirarson, Silander & Richard 1996) and analyse prospective population dynamics under varying environmental conditions (e.g. Abe, Nakashizuka & Tanaka 1998). Asymptotic sensitivity analysis of the desert tortoise PPM suggests that promoting growth of young adults (element [8,7] of the matrix) is an efficient way to encourage long-term population growth (Appendix S1). This could perhaps be achieved through protection and/or supplementary feeding of those individuals. Sensitivity analyses for transient dynamics also exist and provide a linear estimate of the effect of perturbations on short-term population density or growth (e.g. Caswell 2007).

#### Transfer function analyses

The linear relationships described by sensitivity analysis are tangents to more complicated nonlinear functions (Fig. 3). Because of this, sensitivity analyses may poorly describe the effect of larger perturbations on population dynamics. *Transfer function analyses* can model the exact nonlinear relationship between a perturbation and resulting population dynamics and require no more information than sensitivity analyses.

The function tfa models the transfer function of asymptotic growth (Hodgson & Townley 2004), and inertia.tfa models the transfer function of population inertia, providing a good indication of the effect of perturbation on transient dynamics (Stott, Hodgson & Townley 2012). Three parameters are required for these functions: the PPM, a perturbation structure and a range of perturbation magnitude. The perturbation structure is given with two vectors: d picks out the rows to be perturbed, and e picks out the columns to be perturbed. For example, to perturb element [3,2] of a 3 × 3 matrix, input d=c(0,0,1) and e=c(0,1,0) into the functions. The perturbation magnitude is a range of values that specifies how much to change the vital rate(s) by, and is given by a variable called prange. inertia.tfa also needs to either be given the demographic structure with which to calculate inertia, or be instructed to calculate the upper or lower bound on inertia.

The transfer function relating asymptotic growth to growth rate of young adult tortoises (element [8,7]) is modelled using the following code:

tf1 <- tfa(Tort, d=c(0,0,0,0,0,0,0,1), e=c(0,0,0,0,0,0,1,0),

prange=seq(0,0.25,0.01))

plot(tf1)

Sensitivity analysis of asymptotic growth underestimates the effort needed to reverse long-term population decline (Fig. 3a): sensitivity (dashed line) suggests that increasing growth of young adults by approximately 0·12 would achieve λ_{max} = 1, whereas the transfer function (solid line) indicates that an increase of approximately 0·25 is required. As this would bring the overall survival rate of young adults to above 1 (0·851 + 0·016 + 0·25 = 1·117), it is a biologically unrealistic solution.

For the same perturbation, the transfer function for inertia of a specified demographic structure is modelled using:

n0 <- c(1,1,2,3,5,8,13,21)

tf2 <- inertia.tfa(Tort, vector=n0, d=c(0,0,0,0,0,0,0,1),

e = c(0,0,0,0,0,0,1,0), prange = seq(0,0.25,0.01))

plot(tf2)

Sensitivity analysis of inertia overestimates the negative effect of larger perturbations (Fig. 3b): sensitivity predicts a decline in inertia with an increase in perturbation (dashed line), but the transfer function demonstrates a dramatic shift to increasing inertia at larger perturbation magnitudes (solid line). Nonlinear effects such as these highlight that management strategies based on sensitivity analyses may be ecologically and/or economically inefficient at achieving desired goals.

Deciding on potential management regimes can be difficult. To aid this process, popdemo provides functions to perform transfer function analyses across the whole life cycle. The functions tfamatrix and inertia.tfamatrix generate multiplots of transfer functions, one for every life cycle transition. These plots are laid out in the same way as the PPM, so that the position of each panel in the multiplot indicates which PPM element it corresponds to. Analysing such plots by eye gives an impression of which vital rates are best to target. We provide an example here for inertia.tfamatrix using the desert tortoise PPM:

tfmat <- inertia.tfamatrix(Tort, vector=n0)

plot(tfmat)

Overall, it seems that increasing fecundity may be the best way to promote population amplification (Fig. 4, top row). The plot also shows that most perturbations have a highly nonlinear effect on transient population dynamics.

Another key advantage of using transfer functions is that they can model complex perturbation structures, including simultaneous perturbation to multiple vital rates, different perturbation magnitudes for different vital rates and life cycle trade-offs (Hodgson & Townley 2004; Stott, Hodgson & Townley 2012). This means that transfer functions can accurately model the effect of complicated management regimes [see demo(transfer)].

### Conclusions

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

The tools provided in popdemo facilitate the use of novel analytical methods for basic PPM models. Used alongside traditional analytical approaches, these enable more comprehensive and more predictive analyses of population dynamics, without demand for extra data. The software tools showcased here will likely be of most use for informing population management for relatively data-deficient species. They are also likely to be of use in comparative ecology (Stott *et al.* 2010b). They have potential application in studying life history evolution: for example, transient dynamics can be used as a measure of resilience (Neubert & Caswell 1997) and transfer functions could be used to model life cycle trade-offs. Lastly, these methods could find application in modelling stage-structured ecological or evolutionary systems other than populations.

For a full index of functions available in popdemo and links to their documentation, run ?popdemo.

### Acknowledgements

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

We thank Jonathan Ramalheira-Tsu, Chris Coles, Mel Smee, Kim Stokes, Chris Beirne and Jenni Graham for helping to improve popdemo and for providing useful comments on this manuscript. Funding was provided by the European Social Fund.

### References

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

- 1998) Effects of canopy gaps on the demography of the subcanopy tree
*Styrax obassia*. Journal of Vegetation Science, 9, 787–796. , & ( - 2009) Environment-specific elasticity and sensitivity analysis of the stochastic growth rate. Ecological Modelling, 220, 605–610. , , & (
- 1999) Looking backwards: assessing the projections of a transition matrix model. Ecological Applications, 9, 1278–1287. (
- 2010) Causes and consequences of variation in plant population growth rate: a synthesis of matrix population models in a phylogenetic context. Ecology Letters, 13, 1182–1197. , , , , , , , , & (
- 2001) Matrix Population Models: Construction, Analysis and Interpretation, 2nd edn. Sinauer, Sunderland, Massachusetts, USA. (
- 2007) Sensitivity analysis of transient population dynamics. Ecology Letters, 10, 1–15. (
- 1994) Modeling population viability for the desert tortoise in the western Mojave Desert. Ecological Applications, 4, 446–460. , & (
- 2001) Stochastic matrix models for conservation and management: a comparative review of methods. Ecology Letters, 4, 244–266. & (
- 2004) Linking management changes to population dynamic responses: the transfer function of a projection matrix perturbation. Journal of Applied Ecology, 41, 1155–1161. & (
- 1996) Density-dependent matrix yield equation for optimal harvest of age-structured wildlife populations. Ecological Modelling, 88, 125–132. (
- 2000) Recovery and management options for spring/summer Chinook salmon in the Columbia River basin. Science, 290, 977–979. , & (
- 2007) Population inertia and its sensitivity to changes in vital rates and population structure. Ecology, 88, 2857–2867. , & (
- 2007) Estimating occupancy of a data deficient mammalian species living in tropical rainforests: sun bears in the Kerinci Seblat region, Sumatra. Biological Conservation, 137, 20–27. , , & (
- 1997) Alternatives to resilience for measuring the responses of ecological systems to perturbations. Ecology, 78, 653–665. & (
- 2007) A Biologist’s Guide to Mathematical Modelling in Ecology and Evolution. Princeton University Press, Princeton, New Jersey, USA. & (
- 1996) Conservation and management of a threatened Madagascar Palm species,
*Neodypsis decaryi*, Jumelle. Conservation Biology, 10, 40–52. , & ( - 2012) Beyond sensitivity: nonlinear perturbation analysis of transient dynamics. Methods in Ecology and Evolution,
**3**, doi: 10.1111/j.2041-210X.2012.00199.x. , & ( - 2011) A framework for studying transient dynamics of population projection matrix models. Ecology Letters, 14, 959–970. , & (
- 2010a) On reducibility and ergodicity of population projection matrix models. Methods in Ecology and Evolution, 1, 242–252. , , & (
- 2010b) Boom or bust? A comparative analysis of transient population dynamics in plants. Journal of Ecology, 98, 302–311. , , , & (
- 2007) Estimating and analyzing demographic models using the popbio package in R. Journal of Statistical Software, 22, 11. & (
- 2008) Erratum et addendum: transient amplification and attenuation in stage-structured population dynamics. Journal of Applied Ecology, 45, 1836–1839. & (

### Supporting Information

- Top of page
- Summary
- Introduction
- Population projection matrix models
- Measuring population dynamics
- Perturbation analyses
- Conclusions
- Acknowledgements
- References
- Supporting Information

**Appendix S1.** R code for figures.

As a service to our authors and readers, this journal provides supporting information supplied by the authors. Such materials may be re-organized for online delivery, but are not copy-edited or typeset. Technical support issues arising from supporting information (other than missing files) should be addressed to the authors.

Filename | Format | Size | Description |
---|---|---|---|

MEE3_222_sm_AppendixS1.txt | 11K | Supporting info item |

Please note: Wiley Blackwell is not responsible for the content or functionality of any supporting information supplied by the authors. Any queries (other than missing content) should be directed to the corresponding author for the article.