plusmin {elect} | R Documentation |
Compute an additive function of a series of estimated life expectancies
plusmin(x, index = NA, func = "plus", probs = c(0.025, 0.5, 0.975), digits = 3)
x |
Life expectancies estimated by |
index |
Selection of the life expectancies in the function (following the order in |
func |
Required series of "plus" and "minus". Example: |
probs |
Probabilities for the quantiles |
digits |
Number of digits in the output |
This function requires that uncertainty of LEs is estimated; that is, S
is not 0.
Ardo van den Hout
# 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 function of life expectancies:
sddata <- electData[electData$bsline == 1,]
LEs <- elect(x = model, b.covariates = list(age = 0, x = 1),
statedistdata = sddata, h = 0.5, age.max = 50, S = 25)
plusmin(LEs, index = c(2,4), func = "plus")