errorspread_sf: Error - spread scoring function

View source: R/errorspread_sf.R

errorspread_sfR Documentation

Error - spread scoring function

Description

The function errorspread_sf computes the error - spread scoring function, when y materialises, x_1 is the predictive mean, x_2 is the predictive variance and x_3 is the predictive skewness.

The error - spread scoring function is defined by eq. (14) in Christensen et al. (2015).

Usage

errorspread_sf(x1, x2, x3, y)

Arguments

x1

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

x2

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

x3

Predictive skewness (prediction). 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, x_2 and x_3).

Details

The error - spread scoring function is defined by:

S(x_1, x_2, x_3, y) := (x_2 - (x_1 - y)^2 - (x_1 - y) x_2^{1/2} x_3)^2

Domain of function:

x_1 \in \mathbb{R}

x_2 > 0

x_3 \in \mathbb{R}

y \in \mathbb{R}

Range of function:

S(x_1, x_2, x_3, y) \geq 0, \forall x_1, x_3, y \in \mathbb{R}, x_2 > 0

Value

Vector of error - spread losses.

Note

The mean functional is the mean \textnormal{E}_F[Y] of the probability distribution F of Y (Christensen et al. 2015).

The variance functional is the variance \textnormal{Var}_F[Y] := \textnormal{E}_F[Y^2] - (\textnormal{E}_F[Y])^{2} of the probability distribution F of Y (Christensen et al. 2015).

The skewness functional is the skewness \textnormal{Sk}_F[Y] := \textnormal{E}_F[((Y - \textnormal{E}_F[Y])/(\textnormal{Var}_F[Y])^{1/2})^3] (Christensen et al. 2015).

The error - spread scoring function is negatively oriented (i.e. the smaller, the better).

The error - spread scoring function is consistent for the triple (mean, variance, skewness) functional. \mathbb{F} is the family of probability distributions F for which \textnormal{E}_F[Y^4] exists and is finite (Christensen et al. 2015).

References

Christensen HM, Moroz IM, Palmer TN (2015) Evaluation of ensemble forecast uncertainty using a new proper score: Application to medium-range and seasonal forecasts. Quarterly Journal of the Royal Meteorological Society 141(687)(Part B):538–549. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/qj.2375")}.

Examples

# Compute the error - spread scoring function.

df <- data.frame(
    y = rep(x = 0, times = 6),
    x1 = c(2, 2, -2, -2, 0, 0),
    x2 = c(1, 2, 1, 2, 1, 2),
    x3 = c(3, 3, -3, -3, 0, 0)
)

df$errorspread_penalty <- errorspread_sf(x1 = df$x1, x2 = df$x2, x3 = df$x3,
    y = df$y)

print(df)

scoringfunctions documentation built on Aug. 30, 2026, 5:07 p.m.