# Lab exercise 4 # Based on example in Chapter 3 # load library that contains many useful functions library(popbio) # provide names for the stages stages=c("seeds","seedlings","saplings","repro.trees","sensc.trees") # provide the values for the matrix A=matrix(c (0.30, 0.0, 0.0, 100.00, 0.00, 0.03, 0.3, 0.0, 0.00, 0.00, 0.00, 0.1, 0.1, 0.00, 0.00, 0.00, 0.0, 0.2, 0.90, 0.00, 0.00, 0.0, 0.0, 0.08, 0.82), nrow=5,byrow=T,dimnames=list(stages,stages)) # check that matrix is entered correctly A # project population forward using a starting population vector N=c(100,1,0,0,0) p<-pop.projection(A,N,13) p # create table of proportions using built-in R function prop.table(p$stage.vectors,2) # plot the proportion in each stage over time stage.vector.plot(p$stage.vectors, col=2:6) # plot the lambda values plot(1:12,p$pop.changes,typ='o',xlab='Time (years)', ylab='Population Growth Rate',ylim=c(0,max(p$pop.changes))) # conduct the eigen analysis E=eigen.analysis(A) E # print out rounded values of aspects of the eigen analysis round(E$lambda1,4) round(E$stable.stage,3) round(E$sensitivities,4) round(E$elasticities,4) # look at sensitivity values for transitions = 0 E2=eigen.analysis(A, zero=FALSE) round(E2$sensitivities,4) # Calculate net reproductive rate net.reproductive.rate(A) # Calculate generation time generation.time(A) # Calculate time spent in each stage class and # the mean and variance of the time to death # based on the survival data in the matrix fundamental.matrix(A)