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!



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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s