Greenwood v0.5.0 adds first-class support for time-varying covariates. The new split_episodes() utility handles the data-wrangling step that has historically been a barrier to TVC analysis: it takes a subject-level baseline table and a long-format visits table and merges them into the counting-process (interval-per-row) format that Surv.counting() and CoxPH already accept.
New Features
- Time-varying covariate support via
split_episodes()— Converts repeated-measurement data into counting-process (episode-split) format. Accepts a baseline table (one row per subject with follow-up time, event indicator, and time-fixed covariates) and a visits table (one row per subject/visit with time-varying covariate values), and produces a(tstart, tstop, event, …)dataset ready to pass directly toSurv.counting()andCoxPH.fit(). Supports last-observation-carried-forward (LOCF) viacarry_forward=Trueand returns output in Pandas, Polars, or PyArrow depending on theformat=argument. (#21)