civic_calibrate: Assess probability calibration (binary classification)

View source: R/civic_scorecard.R

civic_calibrateR Documentation

Assess probability calibration (binary classification)

Description

Evaluates whether predicted probabilities are well-calibrated: a model predicting 0.7 should be correct ~70 Returns Brier score and Expected Calibration Error (ECE).

Usage

civic_calibrate(object, data, outcome, positive = NULL, n_bins = 10L)

Arguments

object

A 'civic_model' (binary classification only).

data

A data frame for evaluation.

outcome

Character. Outcome column name.

positive

Character. Positive class level.

n_bins

Integer. Number of probability bins (default '10').

Value

An object of class 'civic_calibration' (a list) with: 'bins' (tibble), 'brier_score', 'ece', 'positive', 'outcome', 'model'.

Examples

m   <- civic_fit(voted ~ age + education, civic_voting)
cal <- civic_calibrate(m, civic_voting, "voted", "yes")
print(cal)
civic_plot_calibration(cal)

civic.icarm documentation built on June 18, 2026, 1:06 a.m.