R Package lefko3
Lefko3 is an R package designed to provide a complete working environment to create and analyze size-classified matrix projection models (MPMs), including Lefkovitch MPMs, integral projection models (IPMs), and age-by-stage MPMs, in both raw and function-based formats. It handles the entire workflow in MPM development, from formatting the demographic dataset, to building the life cycle graph, to parameterizing vital rate models, to contructing the MPM, and finally to analysis. It was originally designed to produce historical and ahsitorical matrix projection models (MPMs), where historical MPMs are large matrices that incorporate 3 consecutive time steps in each matrix. These matrices allow the history of the individual to be more completely modeled within population dynamics models. However, the package now covers all size-classified MPM types.
Package lefko3 works on R 3.6.3 or greater on all systems that support R, including Windows, MacOS, Linux, and Unix.
The project is hosted on R-Forge, with the most recent stable version of lefko3 available for download through CRAN, with documentation available here. The most recent development version is available through R-Forge here. Please also see our paper and cite our paper describing lefko3 in Methods in Ecology and Evolution.
Current stable version: 3.8.0 (Sept 2021). Available on CRAN.
New in this stable version: Replicated population projections. Functions to edit lefkoMat objects.
Current development version: 188.8.131.5201 (Oct 2021). Available on R-Forge.
New in this development version: Check back later....
Next stable version: 3.9.0 (expected October 2021).
Coming in next version: Density dependent projections. More quality control for vital rate models. Multipliers for survival terms in supplement tables.
On the drawing board: Bootstrapping functions for vertical datasets. Parallelization functions.
Tutorial materials already packaged with lefko3:
- Tutorial on theory, methods, and concepts
- Tutorial example of raw historical and ahistorical MPM analysis using Lathyrus vernus
- Tutorial example of function-based historical and ahistorical MPM analysis using Cypripedium candidum
- Tutorial example of historical and ahistorical IPM analysis using Lathyrus vernus
- Tutorial example of ahistorical age x stage MPM analysis using Lathyrus vernus
- Tutorial example of deterministic and stochastic LTRE analysis, and MPM import, using the Anthyllis vulneraria example published in Davison et al. 2010
Other tutorial materials:
- Long format tutorial on raw and function-based historical and ahistorical MPMs, using Cypripedium candidum
- Video tutorial: Intro to lefko3 with a short analysis of Cypripedium candidum
Current workshop schedule:
- Lefko3 Power Demography Workshop - an Intro to lefko3. 2 Sept 2021 at 4am GMT (1pm Tokyo time).
- Lefko3 Intro Workshop for North / South American users. 12 Sept at 11pm GMT (8am 13 Sept Tokyo time).
- Lefko3 Intro Workshop for European / African / Central Asian users. 27 Sept at 8am GMT (5pm Tokyo time).
Please contact the lab for further details about workshops.
Installation notes: Package lefko3 is available in its stable format on CRAN and can be downloaded with all relevant binaries from there. However, some users may occasionally wish to download and install the package from source. For example, Mac users wishing to install the development version from R Forge will need to be able to install from source. Package lefko3 is unlike the typical R package in that it relies on core kernels written in C++ to power its functions. This means that installation from source generally requires the installation of some development tools in order for R to install from source properly. If you are a Linux user, then your version of R is already set up to install lefko3 from source. However, if you are a Mac or Windows user, then you will need to complete a few extra steps to install lefko3 successfully from source.
Mac users: To set up your Mac to install lefko3 from source, please follow these steps:
- Download and install the latest Xcode from the Apple App Store. This is a very large program - over 10GB. It provides the compilers and interfaces that the Mac version of R relies on to compile code.
- Download and install Xcode Command Line Tools. To do so, please open the Mac terminal, and type "xcode-select --install". This may open a diaglog box asking you if you would like to install developer tools. If this happens, then please click "Yes" or "Install".
- Download and install the latest GNU Fortran Compiler, available here. Choose the most appropriate build given your architecture (pay special attention to the OS version, and to the type of microprocessor).
- Open the Mac terminal back up, and type "export PATH=$PATH:/usr/local/gfortran/bin". This command adds GNU Fortran to the command path, thus allowing R to use it.
- Congrats! You should now be able to install from source!
Windows users: To set up your PC to install lefko3 from source, please follow these steps:
- Download and install Rtools.
- Add Rtools to the command path. See the section on this in the Rtools download page.
Power Demography is a semiannual event incorporating workshops aimed at showcasing the cutting edge in demography, and at training the next generation of demographers. Meetings occur in May/June and November. All Power Demography events include workshops taught by leaders in the field, and the series is capped off in November with a symposium disseminating the best current research. Events are held at the University of Tokyo's Komaba Campus, and participants are asked to register.
Two workshops, including a 4 hour intro to lefko3 on 2 Sept and a 4 hour intro to using COMPADRE and COMADRE on 31 July. See this page for further details.
Speakers: T. Takada, H. Tomimatsu, F. Ishihama, H. Yokomizo, R.P. Shefferson
Speakers: H. Iijima, R. Kaneko, K. Morita, R. Oizumi, R.P. Shefferson, Y. Tachiki
Speakers: Y. Kawai, R. Shefferson, M. Shimada, T. Takada, M. Umezaki, H. Yokomizo