Learn R Programming

scoringfunctions (version 1.1)

errorspread_sf: 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)

Value

Vector of error - spread losses.

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\)).

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}$$

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. tools:::Rd_expr_doi("10.1002/qj.2375").

Examples

Run this code
# 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)

Run the code above in your browser using DataLab