# NOT RUN {
### USING PROJECTION OBJECTS
# Create a 3x3 PPM
( A <- matrix(c(0,1,2,0.5,0.1,0,0,0.6,0.6), byrow=TRUE, ncol=3) )
# Project stage-biased dynamics of A over 70 intervals
( pr <- project(A, vector="n", time=70) )
plot(pr)
# Access other slots
vec(pr) #time sequence of population vectors
bounds(pr) #bounds on population dynamics
mat(pr) #matrix used to create projection
Aseq(pr) #sequence of matrices (more useful for stochastic projections)
projtype(pr) #type of projection
vectype(pr) #type of vector(s) initiating projection
# Extra information on the projection
nproj(pr) #number of projections
nmat(pr) #number of matrices (more usefulk for stochastic projections)
ntime(pr) #number of time intervals
# Select the projection of stage 2 bias
pr[,2]
# Project stage-biased dynamics of standardised A over 30 intervals
( pr2 <- project(A, vector="n", time=30, standard.A=TRUE) )
plot(pr2)
#Select the projection of stage 2 bias
pr2[,2]
# Select the density of stage 3 in bias 2 at time 10
vec(pr2)[11,3,2]
# Select the time series of densities of stage 2 in bias 1
vec(pr2)[,2,1]
#Select the matrix of population vectors for bias 2
vec(pr2)[,,2]
# Create an initial stage structure
( initial <- c(1,3,2) )
# Project A over 50 intervals using a specified population structure
( pr3 <- project(A, vector=initial, time=50) )
plot(pr3)
# Project standardised dynamics of A over 10 intervals using
# standardised initial structure and return demographic vectors
( pr4 <- project(A, vector=initial, time=10, standard.vec=TRUE,
standard.A=TRUE, return.vec=TRUE) )
plot(pr4)
# Select the time series for stage 1
vec(pr4)[,1]
# }
Run the code above in your browser using DataLab