| relerr_sf | R Documentation |
The function relerr_sf computes the relative error scoring function when y
materialises and x is the predictive \textnormal{med}^{(1)}(F)
functional.
The relative error scoring function is defined in Table 1 in Gneiting (2011).
The relative error scoring function is referred to as MAE-PROP scoring function in eq. (13) in Patton (2011).
relerr_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The relative error scoring function is defined by:
S(x, y) := |(x - y)/x|
Domain of function:
x > 0
y > 0
Range of function:
S(x, y) \geq 0, \forall x, y > 0
Vector of relative errors.
For details on the relative error scoring function, see Gneiting (2011).
The \beta-median functional, \textnormal{med}^{(\beta)}(F) is the
median of a probability distribution whose density is proportional to
y^\beta f(y), where f is the density of the probability distribution
F of Y (Gneiting 2011).
The functional \textnormal{med}^{(1)}(F) elicited by the relative error
scoring function is the \beta-median at \beta = 1, whose density is
proportional to y f(y) (p. 748 and p. 749 in Gneiting 2011). The
\beta-median functional at general \beta is elicited by
bmedian_sf.
Patton (2011) adds that the MAE-PROP scoring function is also known as the mean
absolute percentage error (MAPE). That name is used differently here: the
package follows Gneiting (2011), where the absolute percentage error is
|(x - y)/y|, elicited by aperr_sf and averaged by mape,
whose elicited functional is \textnormal{med}^{(-1)}(F). A reader
arriving from Patton (2011) should use relerr_sf, not mape.
The relative error scoring function is negatively oriented (i.e. the smaller, the better).
The relative error scoring function is strictly
\mathbb{F}^{(w)}-consistent for the \textnormal{med}^{(1)}(F)
functional. \mathbb{F} is the family of probability distributions for
which \textnormal{E}_F[Y] exists and is finite. \mathbb{F}^{(w)} is
the subclass of probability distributions in \mathbb{F}, which are such
that w(y) f(y), w(y) = y has finite integral over
(0, \infty), and the probability distribution F^{(w)} with density
proportional to w(y) f(y) belongs to \mathbb{F} (see Theorems 5 and
9 in Gneiting 2011).
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")}.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jeconom.2010.03.034")}.
mre
# Compute the relative error scoring function.
df <- data.frame(
y = rep(x = 2, times = 3),
x = 1:3
)
df$relative_error <- relerr_sf(x = df$x, y = df$y)
print(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.