This function takes a vector of observed binary outcomes, and a
corresponding vector of predicted risks (e.g. from a logistic regression
CPM), and calculates measures of predictive performance. The function is
intended as a standalone way of validating predicted risks against binary
outcomes outside of the usual pred_input_info() -> pred_validate() package
workflow. See pred_validate
for the main validation function
of this package.
Various metrics of calibration (agreement between the observed risk and the
predicted risks, across the full risk range) and discrimination (ability
of the model to distinguish between those who develop the outcome and
those who do not) are calculated. For calibration, the observed-to-expected
ratio, calibration intercept and calibration slopes are estimated. The
calibration intercept is estimated by fitting a logistic regression model
to the observed binary outcomes, with the linear predictor of the model as
an offset. For calibration slope, a logistic regression model is fit to the
observed binary outcome with the linear predictor from the model as the
only covariate. For discrimination, the function estimates the area under
the receiver operating characteristic curve (AUC). Various other metrics
are also calculated to assess overall accuracy (Brier score, Cox-Snell R2).
A flexible calibration plot is produced. Specify parameter
cal_plot
to indicate whether a calibration plot should be produced
(TRUE), or not (FALSE). See pred_validate
for details on
this plot, and details of optional plotting arguments.