import greenwood as gw
sim = gw.simulate_competing_risks(
n=500, n_causes=2, n_covariates=3, seed=42
)
sim.survSurv(type=mright, n=500, events=296, states=('cause1', 'cause2'))
Result of simulate_competing_risks().
Usage
Bundles the simulated survival response, covariate matrix, and latent ground-truth times into a single object. This makes it easy to pass synthetic data directly to competing-risks estimators and metrics.
surv: SurvA multi-state Surv response ready for use with AalenJohansen, FineGray, or any competing-risks metric.
covariates: Array | NoneCovariate matrix of shape (n, n_covariates), or None when n_covariates=0.
latent_times: ArrayPer-cause latent event times of shape (n, n_causes) before the competing-risks minimum is taken. Useful for constructing oracle predictions in tests and benchmarks.
censoring_time: Array(n,). The observed time is min(min(latent_times, axis=1), censoring_time).
Generate synthetic competing-risks data with two causes and three covariates. The result holds a ready-to-use Surv response and covariate matrix:
import greenwood as gw
sim = gw.simulate_competing_risks(
n=500, n_causes=2, n_covariates=3, seed=42
)
sim.survSurv(type=mright, n=500, events=296, states=('cause1', 'cause2'))
The covariates and latent times are available for oracle comparisons: