nmoment_sf: n-th moment scoring function

View source: R/nmoment_sf.R

nmoment_sfR Documentation

n-th moment scoring function

Description

The function nmoment_sf computes the n-th moment scoring function, when y materialises, and \textnormal{E}_F[Y^n] is the predictive n-th moment.

The n-th moment scoring function is defined by eq. (22) in Gneiting (2011) by setting r(t) = t^n, s(t) = 1, \phi(t) = t^2 and removing all terms that are not functions of x.

Usage

nmoment_sf(x, y, n)

Arguments

x

Predictive n-th moment. It can be a vector of length m (must have the same length as y).

y

Realisation (true value) of process. It can be a vector of length m (must have the same length as x).

n

n) is the moment order. It can be a vector of length m (must have the same length as x).

Details

The n-th moment scoring function is defined by:

S(x, y, n) := -x^2 - 2 x (y^n - x)

Domain of function:

x \in \mathbb{R}

y \in \mathbb{R}

n \in \mathbb{N}

Value

Vector of n-th moment losses.

Note

The n-th moment functional is the expectation \textnormal{E}_F[Y^n] of the probability distribution F of y.

The n-th moment scoring function is negatively oriented (i.e. the smaller, the better).

The n-th moment scoring function is strictly \mathbb{F}-consistent for the n-th moment functional \textnormal{E}_F[Y^n] (Theorem 8 in Gneiting 2011). \mathbb{F} is the family of probability distributions F for which \textnormal{E}_F[Y^], \textnormal{E}_F[Y^2], \textnormal{E}_F[Y^n] and \textnormal{E}_F[Y^{n + 1}] exist and are finite (Theorem 8 in Gneiting 2011).

References

Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1198/jasa.2011.r10138")}.

Examples

# Compute the n-th moment scoring function.

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

df$nmoment_penalty <- nmoment_sf(x = df$x, y = df$y, n = df$n)

print(df)

scoringfunctions documentation built on April 4, 2025, 12:28 a.m.