R/kin_time_invariant.R
kin_time_invariant.RdMtrix implementation of Goodman-Keyfitz-Pullum equations adapted by Caswell (2019).
kin_time_invariant(
p = NULL,
f = NULL,
birth_female = 1/2.04,
pi = NULL,
output_kin = NULL,
list_output = FALSE,
fast = FALSE
)numeric. A vector of survival probabilities with same length as ages.
numeric. A vector of age-specific fertility rates with same length as ages.
numeric. Female portion at birth.
numeric. For using some specific non-stable age distribution of childbearing (same length as ages). Default NULL.
character. kin to return. For example "m" for mother, "d" for daughter. See vignette for all kin types.
logical. Results as a list with output_kin elements, with focal´s age in columns and kin ages in rows (2 * ages, last chunk of ages for death experience). Default FALSE
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.
A data frame with focal´s age, related ages and type of kin
(for example d is daughter, oa is older aunts, etc.), alive and death. If list_output = TRUE then this is a list.