Implementation of age-stage kin estimates (multi-state) by Caswell (2020). Stages are implied in length of input lists.

kin_multi_stage(
  U = NULL,
  f = NULL,
  D = NULL,
  H = NULL,
  birth_female = 1/2.04,
  output_kin = NULL,
  parity = FALSE,
  list_output = FALSE,
  fast = FALSE
)

Arguments

U

list. age elements with column-stochastic transition matrix with dimension for the state space, conditional on survival.

f

matrix. state-specific fertility (age in rows and states in columns). Is accepted also a list with for each age-class.

D

matrix. survival probabilities by state (age in rows and states in columns). Is accepted also a list for each state with survival matrices.

H

matrix. assigns the offspring of individuals in some stage to the appropriate age class (age in rows and states in columns). Is accepted also a list with a matrix for each state.

birth_female

numeric. Female portion at birth.

output_kin

character. kin to return. For example "m" for mother, "d" for daughter. See the vignette for all kin types.

parity

logical. parity states imply age distribution of mothers re-scaled to not have parity 0 when Focal born. Default TRUE.

list_output

logical. Results as a list. Default FALSE.

fast

logical. If FALSE (the default) the model runs with the original R implementation (dense matrix products in R, output tables assembled with dplyr, tidyr and data.table). If TRUE, the same projections run in compiled C++ code and the output tables are built directly, which is typically 5 to 200 times faster on large inputs (long time series, two-sex, cause-of-death or multistate models). The returned object is identical in both cases: same values, same columns, same row order, same classes. Use fast = TRUE for production runs and fast = FALSE to read or step through the model equations in R.

Value

A data frame with focal´s age, related ages and type of kin (for example d is daughter, oa is older aunts, etc.), living and death kin counts, and specific stage. If list_output = TRUE then this is a list with elements as kin types.