state_life_expectancy: State-specific life expectancies and quality-adjusted life...

View source: R/state_occupancy_routines.R

state_life_expectancyR Documentation

State-specific life expectancies and quality-adjusted life years

Description

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.

Usage

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)

Arguments

model

Fitted model object produced using nhm.

covvalue

Vector of covariate vectors (should be given in the order specified in the covariate option in nhm). If omitted the function will use the mean values of the covariates.

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 tstart correspond to those implied by the left-truncation model. If ltrunc supplied will similarly calculate based on left-truncation from the value of ltruncation_time supplied. If model does not include misclassification, will assume entry in state 1.

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 nstate length vector of state-specific utilities in order to produce a single quality-adjusted life years estimate, or an nstate x m matrix of utilities. See details below.

ltrunc

Optional list containing ltruncation_time and ltruncation_states. If supplied will replace the values in the original model fit object.

rtol

Relative tolerance parameter to be used by lsoda when solving the differential equations

atol

Absolute tolerance parameter to be used by lsoda when solving the differential equations

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 (TRUE) or delta method-based intervals (FALSE).

mode

Argument for internal use to faciliate parametric bootstrapping: default "main" ensures standard errors and calculated, if mode="boot" then standard errors are not calculated.

B

Integer specifying the number of bootstrap replicates to perform if sim=TRUE. Defaults to 1000.

coverage

Nominal coverage proportion required for confidence intervals. Defaults to 0.95 implying two-sided 95% confidence intervals.

Details

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.

Value

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.

est_high

Upper limits of the individual confidence intervals corresponding to the entries in est.

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 tstart calculated from the model.

ders

First derivative of the state-wise life expectancy estimates with respect to each of the parameter values, evaluated at the fitted MLE.

Author(s)

Andrew Titman a.titman@lancaster.ac.uk

See Also

state_occupation_probability.nhm, expected_hitting_time


nhm documentation built on Sept. 1, 2025, 1:08 a.m.