Learn R Programming

lefko3 (version 3.3.2)

sensitivity3.list: Estimate Sensitivity of Population Growth Rate of a List of Matrices

Description

sensitivity3.list() returns the sensitivities of population growth rate to elements of matrices supplied in a list. The sensitivity analysis can be deterministic or stochastic, but if the latter then at least two A matrices must be included in the list. This function can handle large and sparse matrices, and so can be used with large historical matrices, IPMs, age x stage matrices, as well as smaller ahistorical matrices.

Usage

# S3 method for list
sensitivity3(mats, stochastic = FALSE, steps = 10000, time_weights = NA, ...)

Arguments

mats

An object of class matrix.

stochastic

A logical value determining whether to conduct a deterministic (FALSE) or stochastic (TRUE) sensitivity analysis. Defaults to FALSE.

steps

The number of times to project forward in stochastic simulation. Defaults to 10,000.

time_weights

Numeric vector denoting the probabilistic weightings of annual matrices. Defaults to equal weighting among times.

...

Other parameters.

Value

This function returns an object of class lefkoSens, which is a list of 7 elements. The first, h_sensmats, is a list of historical sensitivity matrices (NULL if an ahMPM is used as input). The second, ah_elasmats, is a list of ahistorical sensitivity matrices if an ahMPM is used as input (NULL if an hMPM is used as input). The third element, h_stages, and the fourth element, ah_stages, are NULL. The last 3 elements include the original A matrices supplied (as the A element), followed by NULLs for the U and F elements.

Notes

Deterministic sensitivities are estimated as eqn. 9.14 in Caswell (2001, Matrix Population Models). Stochastic sensitivities are estimated as eqn. 14.97 in Caswell (2001). Note that stochastic sensitivities are with regard to the log of the stochastic \(\lambda\).

Determination of whether the input MPM is ahistorical or historical is made on the basis of the dimensionality of input matrices - fewer than 400 rows suggests an ahistorical MPM, while more indicates a historical MPM. This designation does not impact the underlying algorithms in any way, so mistaken calls can be fixed by moving the resulting sensitivity matrices to the correct element of the output list.

Currently, this function does not estimate equivalent ahistorical stochastic sensitivities for input historical matrices.

See Also

sensitivity3()

sensitivity3.lefkoMat()

sensitivity3.matrix()

Examples

Run this code
# NOT RUN {
data(lathyrus)

sizevector <- c(0, 100, 13, 127, 3730, 3800, 0)
stagevector <- c("Sd", "Sdl", "VSm", "Sm", "VLa", "Flo", "Dorm")
repvector <- c(0, 0, 0, 0, 0, 1, 0)
obsvector <- c(0, 1, 1, 1, 1, 1, 0)
matvector <- c(0, 0, 1, 1, 1, 1, 1)
immvector <- c(1, 1, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 1, 1, 1, 1, 1, 1)
binvec <- c(0, 100, 11, 103, 3500, 3800, 0.5)

lathframe <- sf_create(sizes = sizevector, stagenames = stagevector,
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector,
  immstatus = immvector, indataset = indataset, binhalfwidth = binvec,
  propstatus = propvector)

lathvert <- verticalize3(lathyrus, noyears = 4, firstyear = 1988,
  patchidcol = "SUBPLOT", individcol = "GENET", blocksize = 9,
  juvcol = "Seedling1988", sizeacol = "Volume88", repstracol = "FCODE88",
  fecacol = "Intactseed88", deadacol = "Dead1988",
  nonobsacol = "Dormant1988", stageassign = lathframe, stagesize = "sizea",
  censorcol = "Missing1988", censorkeep = NA, censor = TRUE)

lathrepm <- matrix(0, 7, 7)
lathrepm[1, 6] <- 0.345
lathrepm[2, 6] <- 0.054

lathover3 <- overwrite(stage3 = c("Sd", "Sd", "Sdl"),
  stage2 = c("Sd", "Sd", "Sd"), stage1 = c("Sd", "rep", "rep"),
  givenrate = c(0.345, 0.345, 0.054))

ehrlen3 <- rlefko3(data = lathvert, stageframe = lathframe,
  year = c(1989, 1990), stages = c("stage3", "stage2", "stage1"),
  repmatrix = lathrepm, overwrite = lathover3, yearcol = "year2",
  indivcol = "individ")

sensitivity3(ehrlen3$A)

# }

Run the code above in your browser using DataLab