Draws the event time from the all-cause conditional hazard within \((L, R]\) (as in impute_ic_times) and assigns a cause. If the cause is observed it is retained (the time is then drawn by a rejection step so that it follows the cause-specific conditional density); if the cause is unknown it is sampled with probability \(h_k(T)/h_\bullet(T)\) at the imputed time, mirroring the cause-assignment in sim_pexp and the CIF increment in get_cif.

impute_ic_cr(object, ic, cut, beta = NULL, cache = NULL, cause_known = NULL)

Arguments

object

A fitted pamm model used as imputation model.

ic

A data frame as returned by parse_ic_surv (subject- level, with covariates and ic_L/ic_R/ic_kind).

cut

The fixed vector of interval cut-points (shared across imputations).

beta

Coefficient vector to evaluate the hazard at. Defaults to coef(object); pass a posterior draw for proper multiple imputation.

cache

Optional pre-built cache from ic_pred_cache; avoids recomputing the (expensive) design matrix across imputations.

cause_known

Optional vector (length nrow(ic)) of observed causes (as levels of cache$cause_levels); NA marks unknown cause. Censored and exact rows are ignored.

Value

A list with numeric time and character cause (both length nrow(ic); cause is NA for censored rows).