Function rleslie()
returns raw Leslie MPMs, including the
associated component transition and fecundity matrices, a data frame
describing the ages used, and a data frame describing the population, patch,
and occasion time associated with each matrix.
rleslie(
data,
start_age = NA,
last_age = NA,
continue = TRUE,
fecage_min = NA,
fecage_max = NA,
alive = c("alive3", "alive2", "alive1"),
repst = c("repstatus3", "repstatus2", "repstatus1"),
fec = c("feca3", "feca2", "feca1"),
agecol = "obsage",
year = "all",
pop = NA,
patch = NA,
yearcol = NA,
popcol = NA,
patchcol = NA,
indivcol = NA,
censor = FALSE,
censorcol = NA,
censorkeep = 0,
fectime = 2,
fecmod = 1,
prebreeding = TRUE
)
If all inputs are properly formatted, then this function will return
an object of class lefkoMat
, which is a list that holds the matrix
projection model and all of its metadata. Its structure is a list with the
following elements:
A list of full projection matrices in order of sorted populations,
patches, and occasions. All matrices output in the matrix
class.
A list of survival transition matrices sorted as in A
. All
matrices output in the matrix
class.
A list of fecundity matrices sorted as in A
. All matrices
output in the matrix
class.
A data frame matrix showing the pairing of ahistorical stages used to create historical stage pairs. Set to NA for ahistorical matrices.
A data frame showing age-stage pairs. In this function, it
is set to NA. Only used in output to function aflefko2
().
A data frame detailing the characteristics of associated ahistorical stages, in the form of a modified stageframe that includes status as an entry stage through reproduction.
A data frame giving the population, patch, and year of each matrix in order.
A short vector describing the number of non-zero elements
in U
and F
matrices, and the number of annual matrices.
A vector showing the numbers of individuals and rows in the vertical dataset used as input.
A vertical demographic data frame, with variables corresponding
to the naming conventions in verticalize3()
.
The age from which to start the matrix. Defaults to
NA
, age 1
is used if prebreeding = TRUE
, and age
0
is used if prebreeding = FALSE
.
The final age to use in the matrix. Defaults to NA
, in
which case the highest age in the dataset is used.
A logical value designating whether to allow continued
survival of individuals past the final age noted in the stageframe, using the
demographic characteristics of the final age. Defaults to TRUE
.
The minimum age at which reproduction is possible. Defaults
to NA
, which is interpreted to mean that fecundity should be assessed
starting in the minimum age observed in the dataset.
The maximum age at which reproduction is possible. Defaults
to NA
, which is interpreted to mean that fecundity should be assessed
until the final observed age.
A vector of names of binomial variables corresponding to status
as alive (1
) or dead (0
) in occasions t+1 ans t,
respectively.
A vector of names of variables coding reproductive status in
occasions t+1 and t, respectively. Defaults to
c("repstatus3", "repstatus2")
.
A vector of names of variables coding fecundity in occasions
t+1 and t, respectively. Defaults to c("feca3", "feca2")
.
The name or column number of the variable coding for age in
data
. Defaults to "obsage"
.
A variable corresponding to observation occasion, or a set
of such values, given in values associated with the year
term used in
vital rate model development. Can also equal "all"
, in which case
matrices will be estimated for all occasion times. Defaults to "all"
.
A variable designating which populations will have matrices
estimated. Should be set to specific population names, or to "all"
if
all populations should have matrices estimated.
A variable designating which patches or subpopulations will have
matrices estimated. Should be set to specific patch names, or to "all"
if matrices should be estimated for all patches. Defaults to "all"
.
The variable name or column number corresponding to occasion t in the dataset.
The variable name or column number corresponding to the identity of the population.
The variable name or column number corresponding to patch in the dataset.
The variable name or column number coding individual identity.
If TRUE
, then data will be removed according to the
variable set in censorcol
, such that only data with censor values
equal to censorkeep
will remain. Defaults to FALSE
.
The variable name or column number denoting the censor
status. Only needed if censor = TRUE
.
The value of the censor variable denoting data elements to
keep. Defaults to 0
.
An integer indicating whether to estimate fecundity using
the variable given for fec
in time t (2
) or time
t+1 (3
).
A scalar multiplier for fecundity. Defaults to 1.0
.
A logical value indicating whether the life history model
is a pre-breeding model. Defaults to TRUE
.
In order to accomodate survival to time t+1 in the final year of a
study, the maximum age assessed if no input last_age
is provided is
one time step past the final described age.
Users may at times wish to estimate MPMs using a dataset incorporating
multiple patches or subpopulations. Should the aim of analysis be a general
MPM that does not distinguish these patches or subpopulations, the
patchcol
variable should be left to NA
, which is the default.
Otherwise the variable identifying patch needs to be named.
Input options including multiple variable names must be entered in the order of variables in occasion t+1 and t. Rearranging the order WILL lead to erroneous calculations, and may lead to fatal errors.
flefko3()
flefko2()
aflefko2()
arlefko2()
fleslie()
rlefko3()
rlefko2()
# Cypripedium example
data(cypdata)
cypraw_v1 <- verticalize3(data = cypdata, noyears = 6, firstyear = 2004,
patchidcol = "patch", individcol = "plantid", blocksize = 4,
sizeacol = "Inf2.04", sizebcol = "Inf.04", sizeccol = "Veg.04",
repstracol = "Inf.04", repstrbcol = "Inf2.04", fecacol = "Pod.04",
NAas0 = TRUE, NRasRep = TRUE)
cyp_rl <- rleslie(data = cypraw_v1, start_age = 0, last_age = 4, continue = TRUE,
fecage_min = 3, fecage_max = 4, year = "all", pop = NA, patch = "all",
yearcol = "year2", popcol = NA, patchcol = "patchid", indivcol = "individ")
cyp_rl
Run the code above in your browser using DataLab