Soay sheep: an organism that can be modelled with two-sex dynamics. ©Julian Paren
Soay sheep: an organism that can be modelled with two-sex dynamics. ©Julian Paren

Typically, ecology courses contain at least a day of matrix population models. So most ecologists are somewhat familiar with how simple life cycles (and complex ones) can be depicted and analysed using matrix models. Briefly, these models represent what happens to individuals over a certain time interval (do they die? do they reproduce? if so, how much?). What individuals do in the context of these models can then be used to study the dynamics of a population.

Often, individuals are classified by size in matrix models, as small individuals tend to have different survival, growth and reproduction rates than large ones. But how many classes do you need to model the dynamics of a size-structured population properly? Instead of choosing arbitrary size class boundaries, Easterling, Ellner and Dixon (2000) came up with the idea of using continuous size variables and integrals to define a population model… and that’s how the first Integral Projection Model (‘IPM’ for us friends) came to be.

Naturally, for the development of a new demographic tool to prove useful to the scientific community, it must be flexible enough to be ‘one-size-fits-all’… and the needs of ecologists, evolutionary biologists and conservation biologists – who have to date used extensively size-based matrix models – are rather variable in size, colour and shape.

Figure 1 from Merow et al. 2014 (Methods in Ecology and Evolution): Workflow for Integral Projection Models
Figure 1 from Merow et al. 2014 (Methods in Ecology and Evolution): Workflow for Integral Projection Models

Demographic data from some organisms, like Soay sheep and Great tits, allow for the modelling of two-sex dynamics (Childs et al. 2016). Others, such as trees, require the breaking of the state variable into two continuous variables, height of saplings and DBH (diameter at breast height) of adults (Zambrano & Salguero-Gómez 2014), or even the inclusion of discrete stages like seed banks (Shea et al. 2010). The recent British Ecological Society cross journal special feature ‘Demography beyond the population’ has some excellent studies on a wide variety of life history complexities with accompanying IPM structures (Griffith et al. 2016).

After a study on the survival and growth of Costa Rican trees (Metcalf et al. 2009), Jessica Metcalf developed object-oriented functions in the programming language R. The idea was born to this turn into an R package and collaborators were easily found. At the Max Planck Institute for Demographic Research we developed IPMpack (Metcalf et al. 2013), which now includes functions to construct and analyse IPMs with both a continuous state variable and multiple discrete stages. It can also be used to build models with sub-populations in different environments (and size-by-age models with the same tools), among many other functionalities.

Overall, IPMpack turned out really useful for two purposes:

Helping Novice Bio-demographers on Their Way to Mastering IPMs

As part of the support by the Max Planck Institute for Demographic Research (which funded the workshops for developing IPMpack) we gave week-long courses on the software in Rostock, Germany. After introductory lectures, participants spent most of their time on their own data: designing clever life cycle models representing their populations and then persuading their programming code to build these IPMs in R.

Functions in IPMpack are great to showcase the necessary steps to transition from data to IPM analyses. For example, makeGrowthObj allows you to parameterise a growth object from data, with various options, with makeIPMPmatrix you can construct a large transition matrix based on survival and growth objects or using sensParams you can calculate the sensitivity of population growth/net reproductive rate/life expectancy to chances in parameters of the IPM. The options built into these functions provide ample opportunities for explorations by, and discussions with, course participants.

Figure 1 from Metcalf et al. 2013 (Methods in Ecology and Evolution): Workflow diagram for IPMpack.
Figure 1 from Metcalf et al. 2013 (Methods in Ecology and Evolution): Workflow diagram for IPMpack.

Still, what we needed most dearly for teaching purposes were not ever-expanding complex functions, but rather the opposite: from-scratch exercises through which participants learn the basic ‘tricks’. Cory Merow et al. (2014) worked out many of these exercises as a ‘practical guide’ to building IPMs. The Methods in Ecology and Evolution Editors especially appreciated the 185-page appendix full with annotated R code for IPMs of various complexity. Cory was disappointed that we didn’t reach 200 pages.

IPM course participants at the Max Planck Institute for Demographic Research, Rostock, Germany
IPM course participants at the Max Planck Institute for Demographic Research, Rostock, Germany

Since the initial courses in Rostock, we have taught the course in Amsterdam (Netherlands) and Bergen (Norway), Mexico City, and ‘down under’ (Brisbane and Melbourne), often with enthused participants from earlier courses. We’ve also given condensed workshops at conferences in Odense (Denmark), Sheffield (UK), Baltimore, Sacramento, Minneapolis and Portland (USA) and Dublin (Ireland). The next full-week course is scheduled for 17-21 October 2016, in Barcelona. Registration is now open for interested MSc/PhD students and postdocs (although faculty are welcome to apply too).

Providing R Code for Research Projects

In addition to teaching purposes, the IPMpack functions are also intended to assist demographers with analyses of the population dynamics of their study species.

Honestly, this is also a bit scary. Although we did our best to debug the R code in IPMpack – and tried to use, misuse and abuse all of the functions – in many ways, it is out of our control if someone uses them in unintended ways. Every time that we give IPM courses and interact with researchers keen to use IPMpack, we encourage them to ‘look under the hood’ of each function to see what is going on, rather than using them as a black box. After ‘ripping apart’ functions, users can then scavenge for the parts deemed useful for their project. As IPMpack catches on, the developing team is being asked to review some of the submitted publications to various journals, and we can honestly say that we are rather impressed with the creative ways in which the users are breaking IPMpack apart and re-assembling it to address their specific questions.

van der Meer's study on Lizard Orchids is a great example of how IPMpack can be used. © Bjorn S...
van der Meer’s study on Lizard Orchids is a great example of how IPMpack can be used. © Bjorn S…

Sascha van der Meer et al.’s 2016 study on the Lizard orchid in England is an excellent example of how IPMpack can be used. A rather remarkable dataset with 16 years of demography from two populations was used to relate each part of the orchid’s life cycle to seasonal temperature and rainfall. The fitted parameters were then coerced into IPMpack-style vital rates objects, after which the R package was used to construct large transition matrices. The analyses show that weather variation between years affects population growth mainly through effects on survival and seed production, although the two populations differed somewhat in their responses. Overall, model projections show that, thanks to climate change, the future of the Lizard orchid looks bright in the UK, as England is currently the Northern edge of the distribution of this species.

In the Norwegian mountains, Siri Lie Olsen et al. (2016) combined field demography of four herb species (Veronica and Viola) with experimental removal of grasses and grass-like plants. Their aim was to study the population-level effects of plant-plant interactions across a natural temperature gradient from the boreal to the alpine zone (a total of 12 sites). An IPM was constructed for each species-site combination using functions from IPMpack. Patterns in the resulting population growth projections showed that with increasing temperature the role of the dominant graminoids changes from facilitation to competition: for alpine herbs global warming might not be something to look forward to. The analyses also showed that the temperature effect mainly acts through changes in plant survival, as opposed to plant growth or vegetative propagation.

Both Sascha and Siri Lie attended the initial Rostock IPM course. To us, it is extremely rewarding to think that the course might have contributed a little bit to their research. That makes developing R code even more fun. Our hope is that researchers will continue to provide us with feedback for new functions that they would like to see developed in future versions of IPMpack (as well as report potential bugs!). Together we can continue contributing to the quantification of the wealth of demographic strategies that exist, from bacteria and fungi, to Nile crocodiles and extremely long-lived plants like Redwoods.

To find out more about IPMpack, read the Application Article ‘IPMpack: an R package for integral projection models’ by Jessica Metcalf et al.

This paper is part of our Demography Behind the Population Virtual Issue and can be accessed for free by anyone because it is an Applications article.