Learn R Programming

lefko3 (version 3.3.2)

supplemental: Create an Data Frame of Supplemental Data for MPM Development

Description

supplemental() provides all necessary supplemental data for matrix estimation, particularly bringing together data on proxy rates, data to overwrite existing rates, identified reproductive transitions complete, and fecundity multipliers.

Usage

supplemental(
  stage3,
  stage2,
  stage1 = NA,
  eststage3 = NA,
  eststage2 = NA,
  eststage1 = NA,
  givenrate = NA,
  multiplier = NA,
  type = NA,
  stageframe,
  historical = TRUE
)

Arguments

stage3

The name of the stage in time t+1 in the transition to be replaced.

stage2

The name of the stage in time t in the transition to be replaced.

stage1

The name of the stage in time t-1 in the transition to be replaced. Only needed if a historical matrix is to be produced. Use rep if all reproductive stages are to be used, mat if all mature stages are to be used, immat if all immature stages are to be used, prop if all propagule stages are to be used, and leave empty or use all if all stages in stageframe are to be used.

eststage3

The name of the stage to replace stage3. Only needed if a transition will be replaced by another estimated transition.

eststage2

The name of the stage to replace stage2. Only needed if a transition will be replaced by another estimated transition.

eststage1

The name of the stage to replace stage1. Only needed if a transition will be replaced by another estimated transition, and the matrix to be estimated is historical.

givenrate

A fixed rate or probability to replace for the transition described by stage3, stage2, and stage1.

multiplier

A vector of numeric multipliers for fecundity, and NA entries for all other terms.

type

A vector denoting the kind of replacement to be performed. This should be entered as 1, S, or s for the replacement of a survival transition; 2, F, or f for the replacement of a fecundity transition; or 3, R, or r for a fecundity multiplier. If empty or not provided, then defaults to 1 for survival transition.

stageframe

The stageframe being used to produce the MPMs in the study.

historical

A logical value indicating whether the MPMs intended will be historical or ahistorical. Defaults to TRUE.

Value

A data frame of class lefkoSD. This object can be used as input in flefko3(), flefko2(), rlefko3(), rlefko2(), and aflefko2().

Variables in this object include the following:

stage3

Stage at time t+1 in the transition to be replaced.

stage2

Stage at time t in the transition to be replaced.

stage1

Stage at time t-1 in the transition to be replaced.

eststage3

Stage at time t+1 in the transition to replace the transition designated by stage3, stage2, and stage1.

eststage2

Stage at time t in the transition to replace the transition designated by stage3, stage2, and stage1.

eststage1

Stage at time t-1 in the transition to replace the transition designated by stage3, stage2, and stage1.

givenrate

A constant to be used as the value of the transition.

convtype

Designates whether the transition is a survival transition probability (1), a fecundity rate (2), or a fecundity multiplier (3).

Notes

Fecundity multiplier data supplied via the supplemental() function acts in the same way as non-zero entries supplied via a reproductive matrix, but gets priority in all matrix creations. Thus, in cases where fecundity multipliers are provided for the same function via the reproductive matrix and function supplemental(), the latter is used.

Examples

Run this code
# NOT RUN {
data(cypdata)

sizevector <- c(0, 0, 0, 0, 0, 0, 1, 2.5, 4.5, 8, 17.5)
stagevector <- c("SD", "P1", "P2", "P3", "SL", "D", "XSm", "Sm", "Md", "Lg",
  "XLg")
repvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
obsvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
matvector <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
immvector <- c(0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
binvec <- c(0, 0, 0, 0, 0, 0.5, 0.5, 1, 1, 2.5, 7)

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

cypsupp2r <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D", 
    "XSm", "Sm", "SD", "P1"),
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", "XLg", "XLg"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "XSm", "Sm", NA, NA),
  eststage2 = c(NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm", NA, NA),
  givenrate = c(0.1, 0.2, 0.2, 0.2, 0.25, 0.4, NA, NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.50, 0.35),
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S", "R", "R"),
  stageframe = cypframe_raw, historical = FALSE)

cypsupp2r

cypsupp3r <- supplemental(stage3 = c("SD", "SD", "P1", "P1", "P2", "P3", "SL", 
  "SL", "SL", "D", "XSm", "Sm", "D", "XSm", "Sm", "SD", "P1"), 
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL",
   "SL", "SL", "SL", "SL", "SL", "XLg", "XLg"),
  stage1 = c("SD", "rep", "SD", "rep", "SD", "P1", "P2", "P3", "SL", "P3",
   "P3", "P3", "SL", "SL", "SL", "XLg", "XLg"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "XSm", "Sm", "D",
   "XSm", "Sm", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm",
   "XSm", "XSm", "XSm", NA, NA), 
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm",
    "XSm", "XSm", "XSm", NA, NA),
  givenrate = c(0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.25, 0.4, 0.4, NA, NA, NA, NA,
    NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
                 0.50, 0.35),
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
    "S", "S", "R", "R"),
  stageframe = cypframe_raw, historical = TRUE)

cypsupp3r

# }

Run the code above in your browser using DataLab