huber_sf | R Documentation |
The function huber_sf computes the Huber scoring function with parameter
a
, when y
materialises and x
is the predictive Huber mean.
The Huber scoring function is defined in Huber (1964).
huber_sf(x, y, a)
x |
Predictive Huber mean (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
a |
It can be a vector of length |
The Huber scoring function is defined by:
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.
or equivalently
S(x, y, a) := (1/2) \kappa_{a,a}(x - y) (2 (x - y) - \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
Range of function:
S(x, y, a) \geq 0, \forall x, y \in \mathbb{R}, a > 0
Vector of Huber losses.
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 \mathbb{F}
-consistent for the Huber
mean. \mathbb{F}
is the family of probability distributions F
for
which \textnormal{E}_F[Y^2 - (Y - a)^2]
and
\textnormal{E}_F[Y^2 - (Y + a)^2]
(or equivalently
\textnormal{E}_F[Y]
) exist and are finite (Taggart 2022).
Huber PJ (1964) Robust estimation of a location parameter. Annals of Mathematical Statistics 35(1):73–101. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/aoms/1177703732")}.
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16:201–231. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/21-EJS1957")}.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.