Learn R Programming

scoringfunctions (version 1.1)

gpl2_sf: Generalized piecewise linear power scoring function (type 2)

Description

The function gpl2_sf computes the generalized piecewise linea power scoring function at a specific level \(p\) for \(g(x) = \log(x)\), when \(y\) materialises and \(x\) is the predictive quantile at level \(p\).

The generalized piecewise linear power scoring function is negatively oriented (i.e. the smaller, the better).

The generalized piecewise linear scoring function is defined by eq. (25) in Gneiting (2011) and the form implemented here for the specific \(g(x)\) is defined by eq. (26) in Gneiting (2011) for \(b = 0\).

Usage

gpl2_sf(x, y, p)

Value

Vector of generalized piecewise linear losses.

Arguments

x

Predictive quantile (prediction) at level \(p\). 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\)).

p

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

Details

The generalized piecewise linear power scoring function (type 2) is defined by:

$$ S(x, y, p) := (\textbf{1} \lbrace x \geq y \rbrace - p) \log(x/y) $$

or equivalently

$$ S(x, y, p) := p | \max \lbrace -(\log(x) - \log(y)), 0 \rbrace | + (1 - p) | \max \lbrace \log(x) - \log(y), 0 \rbrace | $$

Domain of function:

$$x > 0$$

$$y > 0$$

$$0 < p < 1$$

Range of function:

$$S(x, y, p) \geq 0, \forall x, y > 0, p \in (0, 1)$$

References

Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746--762. tools:::Rd_expr_doi("10.1198/jasa.2011.r10138").

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

Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263--1271. tools:::Rd_expr_doi("10.1109/72.883416").

Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360--380. tools:::Rd_expr_doi("10.1016/0022-0531(79)90042-5").

Examples

Run this code
# Compute the generalized piecewise linear scoring function (type 2).

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

df$gpl2_penalty <- gpl2_sf(x = df$x, y = df$y, p = df$p)

print(df)

# The generalized piecewise linear scoring function (type 2) is half the MAE-LOG
# scoring function.

df <- data.frame(
    y = rep(x = 5.5, times = 10),
    x = 1:10,
    p = rep(x = 0.5, times = 10)
)

df$gpl2_penalty <- gpl2_sf(x = df$x, y = df$y, p = df$p)

df$mae_log_penalty <- maelog_sf(x = df$x, y = df$y)

df$ratio <- df$gpl2_penalty/df$mae_log_penalty

print(df)

Run the code above in your browser using DataLab