squared: Square distances from the outcome.

View source: R/extraction.R

squaredR Documentation

Square distances from the outcome.

Description

Calculates square distances from the true outcome, i.e. squared differences between the outcome and fitted class probability as defined in the formula of the Brier score.

Usage

squared(x, ...)

## S3 method for class 'predx'
squared(x, ...)

## S3 method for class 'caretx'
squared(x, newdata = NULL, ...)

Arguments

x

caretx model or predx prediction object.

...

extra arguments passed to methods, currently none.

newdata

test data set (optional).

Details

The sum of squared distances between fitted and outcome over all observations is the Brier score, which ranges from 0 to 1 for binary classification models and from 0 to 2 for multi-class classifiers. In each case, 0 indicates a perfect concordance, while 1 or 2 (binary or multi level) hallmarks a completely false prediction. For regression, squared working residuals are returned. squared() is a S3 generic function.

Value

For predx objects, a data frame with the columns .outcome and .fitted representing the true outcome and predicted class assignment, respectively, and square_dist with the squared distance from the outcome.

References

Brier GW. VERIFICATION OF FORECASTS EXPRESSED IN TERMS OF PROBABILITY. Mon Weather Rev (1950) 78:1–3. doi:10.1175/1520-0493(1950)078<0001:vofeit>2.0.co;2

Goldstein-Greenwood J. A Brief on Brier Scores | UVA Library. (2021) Available at: https://library.virginia.edu/data/articles/a-brief-on-brier-scores


PiotrTymoszuk/caretExtra documentation built on Oct. 15, 2023, 10:03 p.m.