Evaluates model transportability across multi-hospital network studies by fitting models on Site i and evaluating on Site j for all (i, j) pairs in K x K consortium matrix.
Usage
consortium_cross_site_validation(
site_data,
feature_cols,
target_col,
site_col = "site",
regularize = TRUE,
alpha = 1,
group_col = NULL,
n_splits = 5,
random_state = 42
)Arguments
- site_data
Data frame containing predictive features, target, and
site_col, or named list of data frames per site.- feature_cols
Character vector of feature column names.
- target_col
Name of the binary target outcome column.
- site_col
Name of the site identifier column (default
"site").- regularize
Logical; whether to apply L2 ridge regularization (default
TRUE).- alpha
Numeric; L2 penalty parameter (default
1.0).- group_col
Optional patient identifier column (e.g.
subject_id) for data with several stays per patient. The diagonal (internal) cell is then the AUROC / Brier of out-of-fold predictions from a patient-grouped, outcome-stratifiedn_splits-fold cross-validation, instead of the apparent in-sample performance. Off-diagonal cells are unchanged (patients are assumed distinct across sites).- n_splits
Folds of the grouped cross-validation (default 5, at most the number of patients).
- random_state
Seed of the deterministic group shuffle (default 42).
