Skip to contents

Each run is a data frame with a patient id, a predicted probability and (in at least one of them) the 0/1 outcome. Patients are matched on id_col; those in only one run are counted and left out. A 0.004 AUROC gap whose interval spans zero is not a difference. No patient-level rows are returned.

Usage

compare_model_runs(
  run_a,
  run_b,
  id_col = "person_id",
  pred_col = "pred",
  outcome_col = "outcome",
  run_names = c("A", "B"),
  n_boot = 500L,
  ci_level = 0.95,
  top_fraction = 0.1,
  seed = 0
)

Arguments

run_a, run_b

Data frames, one row per patient.

id_col, pred_col, outcome_col

Column names.

run_names

Labels of the two runs.

n_boot

Bootstrap resamples.

ci_level

Interval level.

top_fraction

Share of patients flagged as highest risk for the overlap measure.

seed

Random seed (the caller's RNG state is restored).

Value

A list: n (patients in both runs, in only one, events); metrics (AUROC, AUPRC, Brier, mean predicted and observed risk of each run); difference (B - A of each metric with a paired bootstrap interval and p_boot); agreement (Spearman correlation, mean absolute difference in predicted risk, share of the top top_fraction that both runs flag).