From 8e9da2c73a02f3b51cd7bb3ed9f174b99a61b1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o?= Date: Sun, 29 Nov 2026 00:41:24 -0600 Subject: [PATCH] The site cohort keeps redundant covariates for its scenarios --- models/cama/recurrence/site.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/cama/recurrence/site.py b/models/cama/recurrence/site.py index a648c60..eb61d52 100644 --- a/models/cama/recurrence/site.py +++ b/models/cama/recurrence/site.py @@ -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)