# Create a 3x3 matrix
A <- matrix(c(0,1,2,0.5,0.1,0,0,0.6,0.6), byrow=TRUE, ncol=3)
A
# Create an initial stage structure
initial <- c(1,3,2)
initial
# Calculate the matrix of transfer functions for the upper bound on
# inertia, using default arguments
tfmat<-inertia.tfamatrix(A,bound="upper")
tfmat
# Plot the result
plot(tfmat)
# Plot inertia as a function of lambda
plot(tfmat, xvar="lambda", yvar="inertia")
# Plot the transfer function of element [3,2]
par(mfrow=c(1,1))
par(mar=c(5,4,4,2)+0.1)
plot(tfmat$inertia[3,2,]~tfmat$p[3,2,],xlab="p",ylab="lambda",type="l")
# Create a new matrix with fission of adults
B <- A
B[2,3] <- 0.9
B
# Calculate the matrix of transfer functions for specified
# initial stage structure, using chosen arguments
# that give the exact structure of the new matrix
# and perturb a minimum of half the value of an element and
# a maximum of double the value of an element
etype <- matrix(c(NA, "F", "F", "P", "P", "F", NA, "P", "P"),
ncol=3, byrow=TRUE)
etype
tfmat2 <- inertia.tfamatrix(B, vector=initial, elementtype=etype,
Flim=c(-0.5,2), Plim=c(-0.5,2))
tfmat2
# Plot the new matrix of transfer functions using default
# arguments
plot(tfmat2)
Run the code above in your browser using DataLab