elect: State-specific and marginal life expectancies

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Estimation of state-specific and marginal life expectancies given a multi-state survival model fitted using the msm-package

Usage

1
2
3
elect(x, b.covariates, statedistdata, time.scale.msm = "years",
        h, age.max, S = 0, setseed = NULL, RestrAndConst = NULL,
        statedist.covariates = "age", method = "step")

Arguments

x

Fitted msm model

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 multi-state model: "years", "months","weeks", or a value in (0,1]

h

Grid parameter for integration where scale is time.scale.msm

age.max

Assumed maximum age in same time scale as in fitted model

S

Number of replications for estimation of uncertainty (S=0 for no estimation)

setseed

Seed for the random number generation in the simulation

RestrAndConst

Vector which indexes the independent model parameters. Only needed when constraint is used in msm call

statedist.covariates

Names of covariates for model for prevalence distribution of living states

method

Approximation of integral: "step" for simple step function, "MiddleRiemann" or "Simpson"

Details

The elect-package is an add-on 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.

Value

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 elect call

covars

Covariates as specified in elect call

S

S as specified in elect call

sd.model

Fitted model for the prevalence distribution of living states

Author(s)

Ardo van den Hout and Mei Sum Chan

References

Jackson, C.H. (2011). Multi-State Models for Panel Data: The msm Package for R., Journal of Statistical Software, 38(8), 1-29.

Van den Hout, A. (2017). Multi-State Survival Models for Interval-Censored Data. Boca Raton: CRC/Chapman & Hall.

See Also

summary.elect, plot.elect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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

elect documentation built on May 2, 2019, 2:09 p.m.

Related to elect in elect...