brier: Brier score for multinomial data.

Description Usage Arguments Value References Examples

Description

Brier score for multinomial data. Requires the predicted (or fitted) probability matrix p, and one of the following: labels, indices or indicator.matrix. Preferably the latter.

Usage

1
brier(p, labels, indices, indicator.matrix, names = colnames(p), na.rm = T)

Arguments

p

An n x K matrix of probabilities, where n is the number of observations, and K the number of mutually exclusive outcome categories.

labels

Vector of length n, containing the labels (character or factor) of the observed outcome categories. If specified, must correspond with the column names of p or with names.

indices

Optional. A vector of length n, containing the indices k, k = 1,...,K, of the observed outcome categories. If specified, these indices must corresond with their respective indices in p.

indicator.matrix

Optional. An n x K matrix indicating the outcome category of each observation, where n is the number of observations, and K the number of mutually exclusive outcome categories. If specified, the order of the columns should correspond with the order of the columns of p.

names

Optional. What are the labels to which the columns of p should be matched? By default, the colnames of the outcome matrix p.

na.rm

logical. Should missing values (including NaN) be removed?

Value

brier provides the Brier score, a vector of length 1.

References

Brier GW. Verification of forecasts expressed in terms of probability. Monthly weather review. 1950 Jan;78(1):1-3.

Examples

1
2
3
4
5
6
brier(matrix(1/3, nrow = 3, ncol = 3), indices = c(1,2,3))
brier(t(matrix(c(1/2, 1/4, 1/4,
               1/8, 5/8, 2/8,
               1/8, 1/8, 3/4),
               nrow = 3, ncol = 3)),
indicator.matrix = matrix(c(1,0,0,0,1,0,0,0,1), nrow = 3, byrow = TRUE))

VMTdeJong/mPerformance documentation built on May 14, 2019, 7:42 a.m.