Learn R Programming

scoringfunctions (version 1.1)

interval_sf: Interval scoring function (Winkler scoring function)

Description

The function interval_sf computes the interval scoring function (Winkler scoring function) when \(y\) materialises and \([x_1, x_2]\) is the central \(1 - p\) prediction interval.

The interval scoring function is defined by eq. (43) in Gneiting and Raftery (2007).

Usage

interval_sf(x1, x2, y, p)

Value

Vector of interval losses.

Arguments

x1

Predictive quantile (prediction) at level \(p/2\). It can be a vector of length \(n\) (must have the same length as \(y\)).

x2

Predictive quantile (prediction) at level \(1 - p/2\). It can be a vector of length \(n\) (must have the same length as \(y\)).

y

Realisation (true value) of process. It can be a vector of length \(n\) (must have the same length as \(x_1\)).

p

It can be a vector of length \(n\) (must have the same length as \(y\)).

Details

The interval scoring function is defined by:

$$ S(x_1, x_2, y, p) := (x_2 - x_1) + (2/p) (x_1 - y) \textbf{1} \lbrace y < x_1 \rbrace + (2/p) (y - x_2) \textbf{1} \lbrace y > x_2 \rbrace $$

Domain of function:

$$x_1 \in \mathbb{R}$$

$$x_2 \in \mathbb{R}$$

$$x_1 < x_2$$

$$y \in \mathbb{R}$$

$$0 < p < 1$$

Range of function:

$$S(x_1, x_2, y, p) \geq 0, \forall x_1, x_2, y \in \mathbb{R}, x_1 < x_2, p \in (0, 1)$$

References

Brehmer JR, Gneiting T (2021) Scoring interval forecasts: Equal-tailed, shortest, and modal interval. Bernoulli 27(3):1993--2010. tools:::Rd_expr_doi("10.3150/20-BEJ1298").

Dunsmore IR (1968) A Bayesian approach to calibration. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 30(2):396--405. tools:::Rd_expr_doi("10.1111/j.2517-6161.1968.tb00740.x").

Fissler T, Ziegel JF (2016) Higher order elicitability and Osband's principle. The Annals of Statistics 44(4):1680--1707. tools:::Rd_expr_doi("10.1214/16-AOS1439").

Gneiting T, Raftery AE (2007) Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association 102(477):359--378. tools:::Rd_expr_doi("10.1198/016214506000001437").

Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33--50. tools:::Rd_expr_doi("10.2307/1913643").

Winkler RL (1972) A decision-theoretic approach to interval estimation. Journal of the American Statistical Association 67(337):187--191. tools:::Rd_expr_doi("10.1080/01621459.1972.10481224").

Winkler RL, Murphy AH (1979) The use of probabilities in forecasts of maximum and minimum temperatures.Meteorological Magazine 108(1288):317--329.

Examples

Run this code
# Compute the interval scoring function (Winkler scoring function).

df <- data.frame(
    y = rep(x = 0, times = 6),
    x1 = c(-3, -2, -1, 0, 1, 2),
    x2 = c(1, 2, 3, 4, 5, 6),
    p = rep(x = c(0.05, 0.95), times = 3)
)

df$interval_penalty <- interval_sf(x1 = df$x1, x2 = df$x2, y = df$y, p = df$p)

print(df)

Run the code above in your browser using DataLab