make_Leslie_matrix: Create a Leslie Matrix Model

Description Usage Arguments Details Value Examples

View source: R/mpm_creation.R

Description

Create a Leslie matrix from a schedule of age-specific survival and birth rates. The age classes must be evenly spaced, and survival is from one age class to the next. The final age class may be terminal (no further survival) or can be constructed with a self-loop for indefinite age classes having the same demography as the final one.

Usage

1
make_Leslie_matrix(x, sx = NULL, mx = NULL, model = c("pre", "post"))

Arguments

x

Either (1) a data frame containing columns named "x" (age, starting with age zero), "sx" (containing one-timestep survival rates for each age) and "mx" (containing birth rates associated with each age); or (2) an integer giving the maximum age (in timesteps) for the model; or (3) a vector of ages.

sx

A vector of age-specific survival rates. Not needed if x is a data frame

mx

A vector of age-specific birth rates Not needed if x is a data frame

model

The type of model. Currently supported options are "pre" (prebreeding census model, the default) and "post" (postbreeding census model)

Details

If the survival of the final age class is non-zero, then a self-loop will be added that creates a final indefinite "stage". Note that if the final survival is zero and a postbreeding census model created, then the final column will be all zero. That's ok.

Value

A matrix containing the Leslie matrix model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Create a demography schedule, with juvenile and senescent age classes
demog_sched <- data.frame(x = 0:7,
                          sx = c(0.05, 0.2, 0.35, 0.8, 0.9, 0.9, 0.75, 0.4),
                          mx = c(0, 0, 0, 0.5, 1, 3, 3, 1.5))

# Make a Leslie matrix using the data frame and the default model structures
make_Leslie_matrix(demog_sched)

# Supply the vectors directly, and get a postbreeding census model
with(demog_sched, make_Leslie_matrix(0:7, sx, mx, model = "post"))

# Supply x as an integer, and get a terminal model ("true" Leslie matrix)
with(demog_sched, make_Leslie_matrix(8, c(sx, 0), c(mx, 1)))

BruceKendall/mpmtools documentation built on May 21, 2019, 1:42 a.m.