View source: R/state_occupancy_routines.R
state_life_expectancy | R Documentation |
Uses the estimated state occupation probabilities from a fitted multi-state model using nhm
to calculate estimated life years spent in each state, or weighted sums of the state-wise life expectancies.
state_life_expectancy(model, covvalue=NULL, tstart=0, tmax=NULL, initp = NULL,
npt = 500, discount = NULL, utilities = NULL, ltrunc = NULL, rtol = 1e-06,
atol = 1e-06, ci = TRUE, sim = FALSE, mode = "main", B = 1000, coverage = 0.95)
model |
Fitted model object produced using |
covvalue |
Vector of covariate vectors (should be given in the order specified in the |
tstart |
Initial time from which to integrate over state occupancy probabilities. Defaults to 0. |
tmax |
Maximum time to integrate over state occupancy probabilities. |
initp |
optional vector of initial state occupation probabilities. If NULL then will use the estimates from the model. If original model was left-truncated will assume probabilities at |
npt |
Number of points over which to evaluate state occupation probabilities in order to numerically approximate the integral via a trapezium rule. |
discount |
Optional discounting function (e.g. if discounted LYs are required). See details below. |
utilities |
Either an |
ltrunc |
Optional list containing |
rtol |
Relative tolerance parameter to be used by |
atol |
Absolute tolerance parameter to be used by |
ci |
Logical for whether confidence intervals should be calculated for the quantities. |
sim |
Logical for whether simulation-based (parametric bootstrap) confidence intervals should be used ( |
mode |
Argument for internal use to faciliate parametric bootstrapping: default |
B |
Integer specifying the number of bootstrap replicates to perform if |
coverage |
Nominal coverage proportion required for confidence intervals. Defaults to 0.95 implying two-sided 95% confidence intervals. |
The function uses the same methods as state_occupation_probability.nhm
to obtain state occupation probability estimates at a grid of times and then uses the trapezium rule to get estimates of the expected time spent in each state.
The utilties
argument can be used to either create utility weights for quality-adjusted life years estimates, assuming time-constant state-specific health utilities. Alternatively, multiple summaries of the state-specific life expectancies can be obtained by specifying an nstate
x m
matrix.
The discount
option can be used to estimate discounted life years. discount
should be a function that takes a vector of times and converts it to a vector of corresponding discounting factors, or instead returns a matrix with nstate
columns of state-wise discounting factors. If utilities
is also specified then the discounting will be applied to the utility-weighted quantities. Note that, if the state-specific utilities are time-dependent, this can be accommodated by jointly specifying the discounting and utility within the discount function.
If the fitted model
involved left-truncation and a tstart
value is chosen that is greater than the origin time (ltruncation_time
) in the original model then by default the function will calculate state occupation probabilities assuming a random sample of patients who are sampled conditional on being in one of the ltruncation_states
at tstart
. This can be overridden by either providing an initial state vector for initp
or supplying a different ltrunc
object.
Returns a list containing
est |
Estimates of state-wise life expectancy for each of the states |
est_cov |
Covariance matrix associated with the state-wise life expectancy estimates |
est_low |
Lower limits of the individual confidence intervals corresponding to the entries in |
est_high |
Upper limits of the individual confidence intervals corresponding to the entries in |
qaly_est |
If utilities are specified, provides the weighted summaries. |
qaly_var |
Variance or covariance matrix associated with the weighted summaries. |
qaly_low |
Lower limits of the individual confidence interval(s) of the weighted summaries. |
qaly_high |
Upper limits of the individual confidence interval(s) of the weighted summaries. |
initp |
Value of the initial probability vector at time |
ders |
First derivative of the state-wise life expectancy estimates with respect to each of the parameter values, evaluated at the fitted MLE. |
Andrew Titman a.titman@lancaster.ac.uk
state_occupation_probability.nhm
, expected_hitting_time
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.