The site cohort keeps redundant covariates for its scenarios

This commit is contained in:
Roberto Treviño
2026-11-29 00:41:24 -06:00
parent 53e6f77c9e
commit 8e9da2c73a
+5 -2
View File
@@ -99,8 +99,11 @@ def frame(events: pd.DataFrame, as_of) -> pd.DataFrame:
def prepare(rows: pd.DataFrame) -> Cohort:
"""The site's cohort as a reference cohort is prepared: the nearly redundant covariates
dropped (cohorts.collinear)."""
dropped (cohorts.collinear) from the model, though kept in the table, since the clinical
scenarios name patients by them (the subtype, built from the receptors and Ki-67, is
redundant by construction)."""
covariates = [c for c in rows.columns if c not in FIXED]
dropped = collinear(rows, [c for c in covariates if c not in TREATMENT])
kept = [c for c in covariates if c not in dropped]
return Cohort("site", rows[FIXED + kept], kept, [c for c in TREATMENT if c in kept], dropped)
treatment = [c for c in TREATMENT if c in kept]
return Cohort("site", rows[FIXED + kept + dropped], kept, treatment, dropped)