Front Matter


This book is dedicated to the people of Ukraine, who are teaching the world every day that all people have the inherent human right to self-determination.

About the author

Richard P. Shefferson earned his PhD in Integrative Biology and his MS in Range Management from the University of California at Berkeley. He is currently an associate professor at the University of Tokyo. His research is focused on evolutionary demography, life history evolution, and population dynamics, with particular interests in rare, long-lived plants, eco-evolutionary dynamics, and plant-fungal symbiosis. He spends his free time spreading world peace through computational population ecology, and occasional interludes of heavy metal guitar solos.


Matrix projection models (MPMs) have been used by ecologists for nearly a century now. Particularly since the 1990s, software packages have occasionally come onto the market offering students of population ecology a means of building or, more often, analyzing specific types of MPMs. However, as far as I am aware, no one has ever attempted to put together all the different forms of MPMs into one main package that would both build and analyze them. Package lefko3 is an attempt to fill that void. In filling that void, lefko3 provides a one-step programming environment for MPM analysis.

Package lefko3 not only builds all kinds of MPMs, including discretized IPMs, but also provides a variety of functions that standardize the process and make it easier. One perennial issue that crops up when population ecologists collaborate, for example, is that everyone has their own way of entering data, and translating that into the proper format can be truly time consuming. lefko3 offers functions that standardize demographic data regardless of what format that they are organized in, and also provides standardized programming objects for the matrix models and further analytical objects. Graduate students and natural areas managers should find lefko3 particularly useful for its simplicity in developing common analyses. Advanced population ecologists should find it useful for its flexibility in creating custom projections, including simulations of density dependent and stochastic runs involving patch dynamics.

lefko3 is a free, open-source package made for the R programming language. R is a free, open-source programming language based on the S+ programming language, and is now the most commonly used programming language for statistical analysis. Packages are available from a variety of sources, but the most stable and well-supported packages are available natively through CRAN, which also maintains R itself. Package lefko3 is available through R’s native install.packages() context and through CRAN’s lefko3 page, with developmental versions also available on R Forge’s lefko3 page.

This book was written as intro to MPM analysis using lefko3. It i based roughly on Evan Cooch and Gary White’s classic (and continually evolving) Program Mark: A Gentle Introduction ( As such, this book can be thought of as a short course on using lefko3, and just as in the program MARK case, this book will keep growing and evolving as we develop more content both for package lefko3 and for this book. Ultimately, this is because although vignettes are provided within lefko3, space limitations on CRAN-based vignettes prevent the incorporation of key details and lengthy explanations, and it is just these details and lengthy explanations that can often help students understand how to use new analytical software. This book attempts to deal with these weaknesses of the vignettes by taking users step by step through the building and analysis of MPMs, even offering some of the theory behind population ecology along the way. Note, however, that this book is not a substitute for a good ecology textbook, but should be used in conjunction with one for the best possible understanding.

As with all such projects, this book is a work in progress. The author encourages readers who find mistakes or issues, or who simply have questions along the way, to contact him.

Structure of this book

This book is organized into four main parts. Chapters 1, 2, and 3 deal with theory and data preparation required prior to the development of matrices. Chapters 4 through 7 introduce the different matrix projection models and illustrate how they are created. Chapters 8 through 10 are focused on analysis, currently including deterministic, stochastic, cyclical, and density dependent analyses, and custom projections. Finally, chapter 11 deals with issues and extensions in developing and analyzing MPMs.

We are planning to expand this book with several more chapters. Currently, these include planned chapters on LTRE and sLTRE analysis, transient dynamics, demographic stochasticity and individual-based simulation, and adaptive dynamics. These chapters and others will be developed as we introduce new functions and procedures to lefko3 itself.


I wish to thank all of the people who have contributed to this work. E. Holton provided discussion and feedback throughout the writing of this book, and also tested code and procedures. J. Nagata provided a sounding board for ideas. The University of Tokyo provided a place to sit and think. And the Japan Society for the Promotion of Science provided grant-in-aid 19H03298, which funded the development of this work and of lefko3 itself.

Book version history

1.0 14 Apr 2022 Original volume with 12 chapters (including front matter). Built with lefko3 v. 5.1.0 and R 4.1.3.
1.1 21 Apr 2022 Equations added to section on substochastic enforcement (chapter 10).
2.0 29 July 2022 New chapters added on LTRE analysis and on importing IPMs. New material added on function actualstage3(). Data object anthyllis added. Updated for lefko3 version 5.4.1.
2.1 14 Sept 2022 Material dealing with function modelsearch() updated to deal with changes to accuracy calculation. Also corrected f_projection3() section to deal with fixe bugs in vital rate density dependence. Updated to lefko3 version 5.5.0.