.claude/skills/illness-death/SKILL.md
Guide users through simulating clinical trials using the illness-death model with response. Use this skill when the user asks about: multi-state models for oncology trials, simulating correlated OS/PFS/ORR endpoints, transition rates between disease states, illness-death model calibration, building ADTTE datasets from simulation, analysis cut date determination, or theoretical survival curves from transition rates.
npx skillsauth add keaven/gsDesignSkills illness-deathInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill covers the illness-death model implementation in gMCPLite/inst/simulation/,
which simulates correlated OS, PFS, and ORR endpoints for oncology trial design.
The model lives in inst/simulation/ within the gMCPLite package:
sim_illness_death.R — build_transition_rates(), sim_illness_death(), and internal CDF helpers (.pfs_cdf(), .os_cdf())cut_illness_death.R — get_analysis_dates(), cut_illness_death()Load via source():
source(file.path(rprojroot::find_root("DESCRIPTION"), "inst", "simulation", "sim_illness_death.R"))
source(file.path(rprojroot::find_root("DESCRIPTION"), "inst", "simulation", "cut_illness_death.R"))
The illness-death model has four states with piecewise exponential transition times:
State 0 ─── response ───> State 1 (responded)
(alive, prog_0 ────> State 2 (progressed)
no resp) death_0 ───> State 3 (dead)
State 1 ─── prog_1 ────> State 2
(responded) death_1 ───> State 3
State 2 ─── death_2 ───> State 3
(progressed)
Because PFS and OS share the same underlying state transitions, they are automatically correlated — a patient who progresses early tends to die earlier. This makes the model more realistic than independently simulating PFS and OS.
build_transition_rates()Calibrates transition rates from clinically interpretable inputs (median PFS/OS, ORR, hazard ratios). Uses numerical root-finding so that control arm marginal PFS and OS medians match the inputs exactly.
sim_illness_death()Simulates enrollment, randomization, and multi-state outcomes. Uses
simtrial::rpwexp() for piecewise exponential transition times and
simtrial::rpwexp_enroll() for enrollment.
get_analysis_dates()Computes calendar cut dates from timing rules: minimum follow-up after FPE, event-driven triggers with caps, and maximum extensions.
cut_illness_death()Applies administrative censoring at a cut date and produces ADTTE-format datasets with OS, PFS, TTR, and ORR endpoints.
.pfs_cdf(t, ...) — Marginal PFS CDF from transition rates.os_cdf(t, ...) — Marginal OS CDF from transition rates.conv2_cdf(t, a, b) — CDF of sum of two independent exponentials.conv3_cdf(t, a, b, c) — CDF of sum of three independent exponentialsThese allow computing theoretical survival curves without simulation.
For detailed code templates, read references/code_patterns.md.
Topics covered:
Piecewise rates: build_transition_rates() produces constant rates. To model piecewise PFS or response, modify the output by splitting rows into multiple time periods with different rates and durations.
Design vs simulation effects: Build separate transition rate tables with different HRs for design (sample size) and simulation (operating characteristics). Weaker simulation HRs reveal realistic power under conservative assumptions.
Response rate timing: Multiply the base response rate for early periods (e.g., 2.25× for $t < 6$ months) and reduce it later (e.g., 10% of base) to model response windows.
Calibration: build_transition_rates() numerically calibrates control arm rates to match specified median PFS and OS. Experimental arm rates are derived by scaling with HRs, then re-calibrating response rate for the target ORR.
death_wo_prog_rate: Baseline rate of death without prior progression (default 0.02/month). This controls the fraction of patients who die without progressing.
responder_prog_ratio: Ratio of progression rate for responders vs non-responders (default 0.5). Lower values mean responders have longer PFS.
Piecewise rates: transition_rate supports multiple rows per (stratum, treatment, transition) with different durations, enabling time-varying hazards.
Enrollment: Uses simtrial::rpwexp_enroll() — specify ramp-up as increasing rates over duration periods.
FPE-relative timing: Analysis cut dates are computed relative to the final patient enrolled (FPE), not study start.
Event-driven timing with caps: get_analysis_dates() supports both calendar-based and event-driven triggers with maximum extension caps.
Stratified analyses: For overall population p-values, use strata() in survdiff() (logrank) or sample-size-weighted stratum-specific risk differences (ORR). Beware that survdiff() with strata() returns obs/exp as matrices — sum across strata columns.
testing
Guide users through weighted parametric group sequential design using the wpgsd R package. Use this skill when the user asks about: correlated test statistics across hypotheses, generate_bounds, closed_test, correlation matrices for nested populations, or parametric multiplicity adjustment with group sequential designs.
tools
Guide users through clinical trial simulation using the simtrial R package. Use this skill when the user asks about: simulating survival trials, simfix, sim_pw_surv, cutting data at calendar or event times, weighted logrank tests, MaxCombo tests, or simulation-based power.
tools
Guide users through confirmatory adaptive clinical trial design and analysis using the rpact R package. Use this skill when the user asks about: adaptive designs, sample size reassessment, conditional power, inverse normal combination test, Fisher combination test, multi-stage designs, or rpact design objects.
tools
Guide users through multi-endpoint group sequential trial simulation with multiplicity-controlled testing. Use this skill when the user asks about: simulating trials with OS, PFS, and ORR endpoints, illness-death model simulation with gsDesign bounds, sequential p-values in simulation loops, combining graphicalMCP with gsDesign for simulation-based operating characteristics, cumulative rejection probabilities, or building a full pipeline from design through simulation to multiplicity-adjusted testing.