Compute per-cohort performance metrics for a fitted panel on validation data.
Unlike evaluate_panel() which returns aggregate metrics, this function
returns a data frame with one row per cohort, enabling comparison of panel
transferability across independent datasets.
evaluate_panel_by_cohort(
panel,
x,
y,
metrics = c("sensitivity", "specificity", "auc"),
cutoff_prob = 0.5,
positive = NULL,
feature_transform = NULL,
assay = NULL
)A BiomarkerPanelResult.
Validation feature matrix, or a list of matrices for multi-cohort evaluation. Names of the list become cohort identifiers.
Validation binary response factor, or a list of factors when x is
a list.
Character vector of registered metric names to compute (any
name in metric_registry(), e.g. "pauc" or
"specificity_at_sensitivity"). Defaults to
c("sensitivity", "specificity", "auc").
Classification probability threshold. Defaults to 0.5.
Label treated as the positive class. Defaults to the value
stored in the panel, or "Yes".
Optional feature transform name. Defaults to the transform stored in the fitted panel.
For SummarizedExperiment inputs, assay name or index.
A data.frame with columns:
Character; cohort identifier
Integer; number of samples in cohort
Integer; number of positive samples
Integer; number of negative samples
One column per metric in metrics argument
Attributes: cutoff_prob, positive, features.
evaluate_panel() for aggregate evaluation,
plot_cohort_comparison() for visualization.
# With a fitted panel and multi-cohort validation data:
# cohort_metrics <- evaluate_panel_by_cohort(panel, x_list, y_list)
# plot_cohort_comparison(cohort_metrics)