elect {elect}  R Documentation 
Estimation of statespecific and marginal life expectancies given
a multistate survival model fitted using the msm
package
elect(x, b.covariates, statedistdata, time.scale.msm = "years", h, age.max, S = 0, setseed = NULL, RestrAndConst = NULL, statedist.covariates = "age", method = "step")
x 
Fitted 
b.covariates 
List with specified covariates values (ignore intercept) 
statedistdata 
Data used to estimate prevalence distribution of living states 
time.scale.msm 
Time scale in multistate model: 
h 
Grid parameter for integration where scale is 
age.max 
Assumed maximum age in same time scale as in fitted model 
S 
Number of replications for estimation of uncertainty ( 
setseed 
Seed for the random number generation in the simulation 
RestrAndConst 
Vector which indexes the independent model parameters. Only
needed when 
statedist.covariates 
Names of covariates for model for prevalence distribution of living states 
method 
Approximation of integral: 
The elect
package is an addon to the msm
package for models with one death state. In the msm
call for fitting the model use center=FALSE
, and names state
and age
. Do not use variables encoded as factor by R
. Covariate age
should be the first entry in b.covariates
. The other covariates in b.covariates
should follow the order
in the msm
call. The life expectancies are computed by approximating the
integral numerically with a grid defined by h
. The specification of statedist.covariates
should
be a subset of b.covariates
.
A list containing the following components:
pnt 
Life expectancies derived from MLE of model parameters 
sim 
Simulated life expectancies using the MLE of model parameters 
h 
As specified in 
covars 
Covariates as specified in 
S 

sd.model 
Fitted model for the prevalence distribution of living states 
Ardo van den Hout and Mei Sum Chan
Jackson, C.H. (2011). MultiState Models for Panel Data: The msm Package for R., Journal of Statistical Software, 38(8), 129.
Van den Hout, A. (2017). MultiState Survival Models for IntervalCensored Data. Boca Raton: CRC/Chapman & Hall.
# Fit msm model: Q < rbind(c(0,0.01,0.01), c(0,0,0.01), c(0,0,0)) model < msm(state~age, subject = id, data = electData, center = FALSE, qmatrix = Q, deathexact = TRUE, covariates = ~age+x) # Estimate life expectancies: sddata < electData[electData$bsline == 1,] LEs < elect(x = model, b.covariates = list(age = 0, x = 0), statedistdata = sddata, h = 0.5, age.max = 50, S = 25) summary(LEs) plot(LEs) # For smoother graphs, increase S