- Title, Copyright, and Preface The Basics
- Chapter 1: Introduction to R and lefko3
- Chapter 2: Life history models
- Chapter 3: Demographic data formatting Matrix Models
- Chapter 4: Raw matrix projection models
- Chapter 5: Function-based models
- Chapter 6: Age-by-stage models
- Chapter 7: Integral projection models Projection Analyses
- Chapter 8: Deterministic analysis
- Chapter 9: Temporal environmental stochasticity
- Chapter 10: General projection simulations (including density dependence) Special analysis
- Chapter 11: Life table response experiments (LTRE) Further issues
- Chapter 12: Importing and editing matrices
- Chapter 13: Importing IPMs and function-based MPMs
- References: Literature cited More chapters will be added over time (currently planned chapter topics include LTRE / sLTRE analysis, transient dynamics, and demographic stochasticity)
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: 5.5.0 (Sept 2022). Available on CRAN.
New in this stable version: Corrected issue causing tiny negative values to occasionally enter fbMPMs on Linux machines. Fixed vital rate density issue in f_projection3() when using density_vr(). Fixed accuracy estimation for zero-truncated models in modelsearch(), and switched to simple R-squared approach to assess accuracy of non-binomial models. Function density_input() now allows all shorthand codes from supplemental(). Function modelsearch() now allows a milepost option (given as "partial"), instead of simply quieting messages or not.
Current development version: 5.5.0 (Sept 2022). Available on R-Forge.
New in this development version:
Next stable version: 5.6.0 (expected Dec 2022).
Coming in next version:
On the drawing board: Individual resampling functions. Fast linear model search function. Bootstrapping functions for vertical datasets. Adaptive dynamics projection and pairwise invasion analysis.
lefko3: a gentle introduction: a free online book teaching the use of lefko3. The official html version is available through Bookdown on R Studio Connect, at this site. A full PDF version is also available. We also offer chapters individually in PDF format here:
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:
- Currently scheduled workshops are within the annual meetings of the Ecological Society of America and Ecological Society of Japan in 2022.
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