score_binary | R Documentation |
Calculate scores summarizing discrimination/calibration of predictions
against observed binary events. If score_fun is not defined when calling
validate
this function is used.
score_binary(y, p, ...)
y |
vector containing a binary outcome |
p |
vector of predictions |
... |
additional arguments. This function only supports calib_args as
an optional argument. calib_args should contain arguments for pmcalibration::pmcalibration.
If a calibration plot (apparent vs bias corrected calibration curves via |
The following measures are returned in a named vector.
the c-statistic (aka area under the ROC curve). Probability that randomly selected observation with y = 1 with have higher p compared to randomly selected y = 0.
mean squared error - mean((y - p)^2)
Intercept from a logistic calibration model: glm(y ~ 1 + offset(qlogis(p)), family="binomial")
Slope from a logistic calibration model: glm(y ~ 1 + qlogis(p), family="binomial")
average absolute difference between p and calibration curve (aka integrated calibration index or ICI).
median absolute difference between p and calibration curve
90th percentile absolute difference between p and calibration curve
maximum absolute difference between p and calibration curve
average squared difference between p and calibration curve. Estimated calibration index (Van Hoorde et al. 2015)
if eval is specified (via calib_args), values for
plotting apparent and bias-corrected calibration curves are returned (see cal_plot
).
By default these are omitted from the summary printed (see summary.internal_validate
).
Logistic calibration and other calibration metrics from non-linear calibration curves
assessing 'moderate-calibration' (Eavg, E50, E90, Emax, ECI; see references) are calculated
via the pmcalibration
package. The default settings can be modified by passing
calib_args to validate
call. calib_args should be a named list corresponding to
arguments to pmcalibration::pmcalibration
.
a named vector of scores (see Details)
Austin PC, Steyerberg EW. (2019) The Integrated Calibration Index (ICI) and related metrics for quantifying the calibration of logistic regression models. Statistics in Medicine. 38, pp. 1–15. https://doi.org/10.1002/sim.8281
Van Hoorde, K., Van Huffel, S., Timmerman, D., Bourne, T., Van Calster, B. (2015). A spline-based tool to assess and visualize the calibration of multiclass risk predictions. Journal of Biomedical Informatics, 54, pp. 283-93
Van Calster, B., Nieboer, D., Vergouwe, Y., De Cock, B., Pencina M., Steyerberg E.W. (2016). A calibration hierarchy for risk models was defined: from utopia to empirical data. Journal of Clinical Epidemiology, 74, pp. 167-176
p <- runif(100)
y <- rbinom(length(p), 1, p)
score_binary(y = y, p = p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.