huber_sf {scoringfunctions}R Documentation

Huber scoring function

Description

The function huber_sf computes the Huber scoring function with parameter aa, when yy materializes and xx is the predictive Huber mean.

The Huber scoring function is defined in Huber (1964).

Usage

huber_sf(x, y, a)

Arguments

x

Predictive Huber mean (prediction). It can be a vector of length nn (must have the same length as yy).

y

Realization (true value) of process. It can be a vector of length nn (must have the same length as xx).

a

It can be a vector of length nn (must have the same length as yy).

Details

The Huber scoring function is defined by:

S(x,y,a):={12(xy)2,xyaaxy12a2,xy>a S(x, y, a) := \left\{ \begin{array}{ll} \dfrac{1}{2} (x - y)^2, & |x - y| \leq a\\ a |x - y| - \dfrac{1}{2} a^2, & |x - y| > a \end{array} \right.

Domain of function:

xRx \in \R

yRy \in \R

a>0a > 0

Range of function:

S(x,y,a)0,x,yR,a>0S(x, y, a) \geq 0, \forall x, y \in \R, a > 0

Value

Vector of Huber losses.

Note

For the definition of Huber mean, see Taggart (2022).

The Huber scoring function is negatively oriented (i.e. the smaller, the better).

The Huber scoring function is strictly consistent for the Huber mean relative to the family F\mathbb{F} of potential probability distributions FF for the future yy for which EF[Y2(Ya)2]E_F[Y^2 - (Y - a)^2] and EF[Y2(Y+a)2]E_F[Y^2 - (Y + a)^2] exist and are finite (Taggart 2022).

References

Huber PJ (1964) Robust Estimation of a Location Parameter. Annals of Mathematical Statistics 35(1):73–101. doi:10.1214/aoms/1177703732.

Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16:201–231. doi:10.1214/21-EJS1957.

Examples

# Compute the Huber scoring function.

df <- data.frame(
    x = c(-3, -2, -1, 0, 1, 2, 3),
    y = c(0, 0, 0, 0, 0, 0, 0),
    a = c(2.7, 2.5, 0.6, 0.7, 0.9, 1.2, 5)
)

df$huber_penalty <- huber_sf(x = df$x, y = df$y, a = df$a)

print(df)

[Package scoringfunctions version 0.0.6 Index]