Part II Stage Structured Matrix Models: Measuring the Intrinsic Rate of Increase in PopBio, R

Woohoo- I am officially done with my lab work for the population genetics study on the two biological control agents (Neochetina bruchi and N. eichhorniae) of the invasive water hyacinth. I will post a blog updating you on the how-to’s and my results soon! Finally – I am done driving back and forth to the Bay Area- and currently just working on data analysis and writing up everything here in LA. Stay tuned!


In the mean time…

As I promised, here is the Part II to my recent blog:  How-To: Stage-Structured Matrix Models. 

In this last blog, I discussed the importance of stage-structured matrix models in calculating the intrinsic rate of increase of organisms with developmental stages (such as the weevils!) and detailed how to construct a stage-structured matrix models in excel. Again here is that file: Julies_tutorial_example_matrix_for_popbio

So now that you have your matrix.. what do you do next?

1st: Convert your matrix into a csv file such as the one I created below based on the excel file above. Just remember- don’t include the headers or row names. I am unable to upload, so I am pasting a picture of the matrix in excel below. Screenshot 2018-01-29 11.24.16

2nd: Save this file as a csv to your working directory that you use in the R statistical program. If you haven’t used R before, then go to the R website to download the program, and refer to the below links on how to set up R, your working directory, and how to import files:



Also I highly recommend downloading R studio before you start as well -makes everything a lot easier- download R studio here

3rd: Install the ‘popbio’ package. You can read about this package here.

4th: Run the below code!

#below tutorial on getting a matrix model into R and analyzing with pop bio
help(popbio) #this provides more information on this package”tutorial_matrix_pop_bio.csv”, sep=”,”, header=FALSE)

#You should obtain an intrinsic rate of increase of  0.0217994

5th: If you want to analyze the stable stages, reproductive values, net reproductive rate , generation time,and conduct an eigen analysis…. Then you will also need to do the following: 

#below to get more information:
stages<-c(“egg”,”1st_2nd_larvae”,”3rd_larvae”, “pupae”,”pre_rep”, “adult”)

#Congratulations! You did it!



How-To: Stage-Structured Matrix Models

Happy Thanksgiving everyone!

So this week I constructed several stage-structured matrix models- aka Lefkovitch models- to estimate the finite and intrinsic rate of increase of the weevils Neochetina eichhorniae and N. bruchi under laboratory simulated Fall and Winter conditions in the Sacramento-San Joaquin River Delta. This work is in conjunction with a postdoctoral researcher- Angelica Reddy and Paul Pratt’s laboratory at the USDA to test the temperature performance of these biological control agents.

As you know, if insects are adapted to warm weather- they don’t perform very well in colder temperatures and this can be very applicable to biological control agents (such as the two Neochetina weevil species) that are brought from their tropical origins to colder regions to control invasive species.  Below is a cute cartoon I had a scientific illustrator Jacki Whisenant draw for me, and for a new children’s book we are writing…stay tuned!

Copyright 2017, illustration by Jacki Whisenant and made for Julie Hopper

Because we are working in the laboratory on these two species we are able to gather a lot of life history parameters of the weevils undergoing Fall and Winter conditions. These parameters include: development time and survivorship of the different insect stages (egg, III instars of larva, pupa, pre-reproductive adult and reproductive adult), as well as the emerging sex-ratios, and longevity and daily and lifetime fecundity of the reproductive female adults.

From these parameters we can conduct several different analyses to approximate the finite rate of increase, intrinsic rate of increase, generation time, doubling time and net reproductive rate of a species to understand more about their potential population growth rates (which of course is important for biological control).

My favorite way to approximate these population growth parameters for insects is to use a stage-structured matrix model (Lefkovitch model). There are other methods you can use as well- but I won’t go into that here. If you would like to read more see the citations at the end of this blog.

Instead, I will provide a how-to tutorial since while I was working on these matrix models as a graduate student- I realized there is a lack of tutorials on the web on how to construct these models in an intuitive manner. I got lucky  as both my PhD adviser and one of my lab mates (whom had already done the research on stage-structured matrix models) helped me understand how to construct and interpret the models. In the name of paying it forward- I am attaching here an excel worksheet that has all of the calculations and formulas that demonstrate how to construct these stage-structured matrix models (see link). 


In my next blog- I will detail how to use this resulting matrix and input it into the package popbio (Stubben and Milligan 2007) for calculation of finite rate of increase (lambda), intrinsic rate of increase (r), doubling time, generation time, net reproductive rate and much more!

Disclaimer- this is for insect stage-structured matrix models only as calculations differ for plants and vertebrates typically.

Here are some of the calculations that are built into the excel formulas: 

Screenshot 2017-11-22 12.53.45

Below is another screenshot of the file: 

Screenshot 2017-11-22 12.57.42

Below is a diagram from the famous study on Loggerhead sea turtles that explains the flow of this matrix better. However be aware that the matrix above and in the attached excel sheet-calculates gamma as 1/duration which is very different than the famous example on turtles (below), and from any matrix with plants- mainly due to life history differences among plant, invertebrates and vertebrates.

Screenshot 2017-11-22 13.10.04.png
A Stage-Based Population Model for Loggerhead Sea Turtles and Implications for Conservation Author(s): Deborah T. Crouse, Larry B. Crowder, Hal Caswell Source: Ecology, Vol. 68, No. 5, (Oct., 1987), pp. 1412-1423


Caswell H (2001) Matrix Population Models: Construction, Analysis, and Interpretation. Sinauer Associates, Sunderland


Awesome powerpoint by Chris Free at Rutgers 

Another awesome tutorial on primarily the Leslie matrix from UCSC