#========================================================= # Figure 11.1.R. # R script to calculate and plot age class sizes through # time for an age-structured wildlife population, using # the matrix projection model. Demographic rates for the # Northern Spotted Owl are from Noon and Biles # (Journal of Wildlife Management, 1990). #========================================================= num.times=20 num.ages=3 p1=.11 # Age-specific survival and fecundity rates. p2=.71 # p3=.94 # f=.24 # M=rbind(c(0,0,f),c(p1,0,0),c(0,p2,p3)) # Projection matrix. N=matrix(0,num.times,num.ages) # num.times X num.ages matrix of 0’s. # Rows of N will be the population # vectors through time. N[1,]=c(1200,800,2000) # First row of N contains initial sizes. for (t in 1:(num.times-1)) { N[t+1,]=M%*%N[t,] } N # Print N to the console. time.t=0:(num.times-1) #------------------------------------------------------------ # Following matplot() function plots every column of N (vertical # axis) versus time.t (horizontal axis) & accepts all graphical # arguments of the plot() function. #------------------------------------------------------------ matplot(time.t,N,type="l",lty=c("dashed","longdash","solid"), xlab="time in years",ylab="population size", ylim=c(0,2600),col="black")