Uses the estimated state occupation probabilities from a fitted multi-state model using nhm to calculate the expected time of entry into a given state, conditional on reaching that state.
expected_hitting_time(model, state, covvalue=NULL, tstart=0, tmax=NULL,
initp = NULL, npt = 500, ltrunc = NULL, rtol = 1e-06, atol = 1e-06, ci = TRUE,
sim = FALSE, mode = "main", B = 1000, coverage = 0.95)Returns a list with the following components:
Estimated expected hitting time.
Variance of the expected hitting time estimate.
Variance of the log of the expected hitting time.
Lower limit of symmetric confidence interval
Upper limit of symmetric confidence interval
Lower limit of confidence interval based on a log-transformation.
Upper limit of confidence interval based on a log-transformation.
Estimated unconditional probability of reaching the state.
Variance of the estimate of the unconditional probability of reaching the state.
Value of the initial probability vector at time tstart calculated from the model.
Fitted model object produced using nhm.
The state of interest for the hitting time.
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.
Initial time from which to measure the hitting time and calculate initial state probabilities. Defaults to 0 if omitted.
Maximum time to integrate over to estimate the mean hitting time. The expected hitting time is effectively conditional on reaching the state before tmax. Defaults to the maximum observed follow-up time in the data.
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 t0 supplied. If model does not include misclassification, will assume entry in state 1.
Number of points over which to evaluate state occupation probabilities in order to numerically approximate the integrals via a trapezium rule.
Optional list containing ltruncation_time and ltruncation_states. If supplied will replace the values in the original model fit object.
Relative tolerance parameter to be used by lsoda when solving the differential equations
Absolute tolerance parameter to be used by lsoda when solving the differential equations
Logical for whether confidence intervals should be calculated for the quantities.
Logical for whether simulation-based (parametric bootstrap) confidence intervals should be used (TRUE) or delta method-based intervals (FALSE).
Argument for internal use to faciliate parametric bootstrapping: default "main" ensures standard errors and calculated, if mode="boot" then standard errors are not calculated.
Integer specifying the number of bootstrap replicates to perform if sim=TRUE. Defaults to 1000.
Nominal coverage proportion required for confidence intervals. Defaults to 0.95 implying two-sided 95% confidence intervals.
Andrew Titman a.titman@lancaster.ac.uk
Uses the estimated state occupation probabilities and transition intensities from a fitted multi-state model using nhm to calculate the expected time of entry into a particular state, conditional on entry.
The method assumes the state of interest can only be entered once and will give incorrect results otherwise.
The state occupation probabilities are calculated in the same way as in state_occupation_probability.nhm. If the estimated initp has a non-zero probability of being in the hitting state (or states only reachable via that state), then the function computes the expected hitting time from tstart conditional on not having not yet reached that state.
state_occupation_probability.nhm, expected_hitting_time