The site cohort keeps redundant covariates for its scenarios
This commit is contained in:
@@ -99,8 +99,11 @@ def frame(events: pd.DataFrame, as_of) -> pd.DataFrame:
|
|||||||
|
|
||||||
def prepare(rows: pd.DataFrame) -> Cohort:
|
def prepare(rows: pd.DataFrame) -> Cohort:
|
||||||
"""The site's cohort as a reference cohort is prepared: the nearly redundant covariates
|
"""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]
|
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])
|
dropped = collinear(rows, [c for c in covariates if c not in TREATMENT])
|
||||||
kept = [c for c in covariates if c not in dropped]
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user