Learn R Programming

scoringfunctions (version 1.1)

hubermean_if: Huber mean identification function

Description

The function hubermean_if computes the Huber mean identification function with parameter \(a\), when \(y\) materialises and \(x\) is the predictive Huber mean.

The Huber mean identification function is defined by eq. (3.5) in Taggart (2022).

Usage

hubermean_if(x, y, a)

Value

Vector of values of the Huber mean identification function.

Arguments

x

Predictive Huber mean (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\)).

a

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

Details

The Huber mean identification function is defined by:

$$V(x, y, a) := (1/2) \kappa_{a,a}(x - y)$$

where \(\kappa_{a,b}(t)\) is the capping function defined by:

$$\kappa_{a,b}(t) := \max \lbrace \min \lbrace t,b \rbrace, -a \rbrace$$

Domain of function:

$$x \in \mathbb{R}$$

$$y \in \mathbb{R}$$

$$a > 0$$

References

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

Examples

Run this code
# Compute the Huber mean identification 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$hubermean_if <- hubermean_if(x = df$x, y = df$y, a = df$a)

print(df)

Run the code above in your browser using DataLab