Add interval-censored survival support via multiple imputation#291
Closed
fabian-s wants to merge 3 commits into
Closed
Add interval-censored survival support via multiple imputation#291fabian-s wants to merge 3 commits into
fabian-s wants to merge 3 commits into
Conversation
Interval-censored Surv(L, R, type = "interval2") responses are detected and handled by a proper-MI workflow: exact event times are repeatedly drawn from the model-based conditional hazard (coefficients drawn from the imputation model's posterior), each completed data set is re-fit as a PAMM on one shared cut grid, and inference is Rubin-pooled (print/summary with median-p and FMI diagnostics; pooled add_hazard / add_cumu_hazard / add_surv_prob / add_cif). - pamm_ic() (single event) and pamm_ic_cr() (competing risks, incl. imputation of unknown causes) - iter argument: chained refit-and-reimpute per imputation chain; removes the one-step early-time survival bias under sparse inspection (validated in a 39-cell x 500-rep Monte Carlo benchmark; recommended iter = 3 for sparse panels, default 1) - warn_unstable_chains(): flags numerically degenerate imputation chains (silent mgcv failure mode under flexible TV terms + small n) - add_inspections() simulation helper with a coherent end-of-study-exam censoring convention (terminal_exam; avoids an informative-censoring trap) for IC examples and validation - sim_pexp() made factor-safe (errors loudly on bare factor arithmetic instead of silently coercing to NA) - vignette (interval-censored.Rmd) with worked examples, guidance on m and iter, comparison against midpoint imputation and Turnbull - comprehensive test suite (test-interval-censored.R); full package suite passes (688 assertions) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> (cherry picked from commit e20bb60)
Collaborator
Author
|
simulation study for this: especially with iterated MI, this seems to work quite well for both point and interval estimates... |
Collaborator
Author
|
suggested vignette for this: |
Collaborator
Author
|
see #292 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for interval-censored time-to-event data via a multiple-imputation (MI) workflow.
Surv(L, R, type = "interval2")responses are detected automatically byas_ped(); the new fitters repeatedly draw exact event times from the model-based conditional hazard on(L, R], re-fit the standard right-censored PAMM pipeline on each completed data set (one shared cut grid, so fits are poolable), and pool inference with Rubin's rules.The workflow was validated in a 39-cell × 500-replication Monte Carlo benchmark (ADEMP design; oracle / midpoint-imputation / icenReg
ic_par+ic_sp/ Turnbull comparators). The benchmark materials are deliberately not part of this PR; they live in the fork underattic/ic-benchmark/(design, decision log, and full report) if you want to inspect them.What's included
Fitters
pamm_ic()(single event) andpamm_ic_cr()(competing risks; retains observed causes, imputes unknown ones from the fitted cause-specific hazards). Imputation is always proper: coefficients are drawn from the imputation model's asymptotic posterior before each draw.iterargument (default 1): chained refit-and-reimpute within each imputation chain. One-step MI is biased for early-time survival when inspection intervals are wide (benchmark: coverage falls with n);iter = 3removes most of that bias at ~linear fit cost. Documented recommendation: default for densely inspected data,iter = 3for sparse panels.warn_unstable_chains(): flags numerically degenerate imputation chains (a silent mgcv failure mode that can occur when iterating flexible time-varying models on small samples) via a warning and$unstable_chains.Pooled inference
print()/summary()report the pooled fit: Rubin-combined coefficients/covariances, median-p term tests, fraction-of-missing-information diagnostics.add_hazard(),add_cumu_hazard(),add_surv_prob(),add_cif()gainpamm_icmethods that combine per-imputation posterior draws (each fit evaluated with its own design matrix, since mgcv bases are data-dependent), so intervals carry within- plus between-imputation uncertainty.add_cumu_hazard()/add_surv_prob()are converted to S3 generics with default methods (backward compatible).strip_pamm_fit()), so memory does not scale withm.Supporting changes
R/as-ped-ic.R/R/impute-ic.R: IC detection/parsing/transformation and the conditional-hazard imputation sampler (calibration unit-tested: PIT uniformity, draws respect(L, R]).add_inspections()(R/sim-ic.R): manufactures IC panel data from exact simulated times for examples/testing. Uses a coherent end-of-study-examination censoring convention (terminal_exam) — mixing exact exit times for survivors with open intervals for undetected events would make right-censoring informative and bias every IC likelihood (regression-tested).sim_pexp(): now factor-safe — bare factor arithmetic in the formula errors loudly instead of silently coercing toNA.resolve_rhs_vars()helper inR/formula-utils.R(dot-formula resolution, used by the IC pipeline).interval-censored.Rmd: worked single-event and competing-risks examples, guidance on choosingm(via FMI) anditer, comparison against midpoint imputation and the Turnbull NPMLE.test-interval-censored.R(+ asim_pexpfactor-safety test); full package suite passes (688 assertions).Notes for review
gg_smooth/get_termsrefactor etc.); only IC-related changes are included.🤖 Generated with Claude Code