# 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 transfer function of upper bound on inertia
# given a perturbation to A[3,2]
transfer<-inertia.tfa(A, d=c(0,0,1), e=c(0,1,0), bound="upper",
prange=seq(-0.6,0.4,0.01))
transfer
# Plot the transfer function (defaults to p and inertia in
# this case)
plot(transfer)
# Plot lambda and inertia
plot(transfer, xvar="lambda", yvar="inertia")
# Calculate the transfer function of case-specific inertia
# given perturbation to A[3,2] and A[3,3] with perturbation
# to A[3,2] half that of A[3,3]
transfer2<-inertia.tfa(A, d=c(0,0,1), e=c(0,0.5,1), vector=initial,
prange=seq(-0.6,0.4,0.01))
transfer2
# Plot p and inertia
plot(transfer2)
# Plot lambda and inertia by hand
plot(transfer$inertia~transfer$lambda,type="l",
xlab=expression(lambda),ylab="inertia")
Run the code above in your browser using DataLab