Skip to contents

Splits the Brier score into reliability (calibration loss: how far the predictions are from the observed frequencies), resolution (how much the observed frequencies of the bins differ from the overall frequency: the information in the predictions) and uncertainty (the variance of the observations, the same for every model): Brier = reliability - resolution + uncertainty (Murphy 1973). With predictions grouped into bins this holds only approximately, so two within-bin terms are added (Stephenson et al. 2008), and Brier = reliability - resolution + uncertainty + within_bin_variance - within_bin_covariance exactly. Lower reliability and higher resolution are better. See calibration_curve() for the presence-background caveat.

Usage

brier_decompose(obs, pred, bins = 10, binning = c("width", "count"))

Arguments

obs

Observations (1 = presence, 0 = absence/background), or a table from extract_predictions() (a data.frame with obs and one column per model): then pred is not needed and every model gets its curve.

pred

Predicted probabilities (between 0 and 1).

bins

Number of bins.

binning

"width" (equal-width bins over the range of the predictions) or "count" (equal numbers of points).

Value

A named numeric vector: brier, reliability, resolution, uncertainty, within_bin_variance, within_bin_covariance.

References

Murphy, A.H. (1973) A new vector partition of the probability score. Journal of Applied Meteorology 12, 595-600.

Stephenson, D.B., Coelho, C.A.S., Jolliffe, I.T. (2008) Two extra components in the Brier score decomposition. Weather and Forecasting 23, 752-757.

Silva Filho, T., Song, H., Perello-Nieto, M., Santos-Rodriguez, R., Kull, M., Flach, P. (2023) Classifier calibration: a survey on how to assess and improve predicted class probabilities. Machine Learning 112, 3211-3260. doi:10.1007/s10994-023-06336-7

Examples

set.seed(1)
p <- runif(1000)
y <- rbinom(1000, 1, p)
bd <- brier_decompose(y, p)
bd
#>                 brier           reliability            resolution 
#>          0.1706229159          0.0004827122          0.0794052916 
#>           uncertainty   within_bin_variance within_bin_covariance 
#>          0.2498040000          0.0007806420          0.0010391467 
sum(bd[c("reliability", "uncertainty", "within_bin_variance")]) -
  sum(bd[c("resolution", "within_bin_covariance")])   # = Brier
#> [1] 0.1706229