Multi-state life table based on multi-state markov model from msm package
Usage
msm.table(model, ages, start, covs)
Arguments
- model
msm
model. See details.
- ages
Numeric vector of ages.
- start
Start values of lx for each group presented as numeric vector.
- covs
List of (age-invariant) covariates as for msm
models.
Value
Table with age (x), mx (transition rates to death), lx (root of the table = 1), Lx, Tx and ex for all groups and the whole population.
Details
msm
is a Multi-state Markov model in continuous time, where age is both time and covariate.
For example, model = msm::msm(state~age, subject = id, covariates = ~ age + sex, data = data, ...)
Examples
# model <- msm::msm(state~age, subject = id, covariates = ~ age + sex, data = data, ...)
# table <- msm.table(model = model, ages = 20:80, start = c(1,0,0), covs = list(sex = 1))