Title: | A Collection of Loss Functions for Assessing Point Forecasts |
---|---|
Description: | Implements multiple consistent scoring functions (Gneiting T (2011) <doi:10.1198/jasa.2011.r10138>) for assessing point forecasts and point predictions. Detailed documentation of scoring functions' properties is included for facilitating interpretation of results. |
Authors: | Hristos Tyralis [aut, cre]
|
Maintainer: | Hristos Tyralis <[email protected]> |
License: | GPL-3 |
Version: | 1.1 |
Built: | 2025-03-03 18:44:25 UTC |
Source: | https://github.com/cran/scoringfunctions |
The scoringfunctions package implements consistent scoring (loss) functions and identification functions
The package functions are categorized into the following classes:
1. Scoring functions
1.1. Consistent scoring functions for one-dimensional functionals
1.2. Consistent scoring functions for two-dimensional functionals
1.3. Consistent scoring functions for multi-dimensional functionals
2. Realised (average) score functions
2.1 Realised (average) score functions for one-dimensional functionals
3. Skill score functions
3.1 Skill score functions for one-dimensional functionals
4. Identification functions
4.1. Identification functions for one-dimensional functionals
4.2. Identification functions for two-dimensional functionals
5. Functions for sample levels
6. Supporting functions
.
bregman1_sf
: Bregman scoring function (type 1)
bregman2_sf
: Bregman scoring function (type 2, Patton scoring
function)
bregman3_sf
: Bregman scoring function (type 3, QLIKE scoring
function)
bregman4_sf
: Bregman scoring function (type 4, Patton scoring
function)
serr_sf
: Squared error scoring function
expectile_sf
: Asymmetric piecewise quadratic scoring function
(expectile scoring function, expectile loss function)
aerr_sf
: Absolute error scoring function
maelog_sf
: MAE-LOG scoring function
maesd_sf
: MAE-SD scoring function
gpl1_sf
: Generalized piecewise linear power scoring function
(type 1)
gpl2_sf
: Generalized piecewise linear power scoring function
(type 2)
quantile_sf
: Asymmetric piecewise linear scoring function
(quantile scoring function, quantile loss function)
ghuber_sf
: Generalized Huber scoring function
huber_sf
: Huber scoring function
aperr_sf
: Absolute percentage error scoring function
bmedian_sf
: -median scoring function
linex_sf
: LINEX scoring function
lqmean_sf
: -mean scoring function
lqquantile_sf
: -quantile scoring function
nmoment_sf
: -th moment scoring function
obsweighted_sf
: Observation-weighted scoring function
relerr_sf
: Relative error scoring function (MAE-PROP scoring
function)
serrexp_sf
: Squared error exp scoring function
serrlog_sf
: Squared error log scoring function
serrpower_sf
: Squared error of power transformations scoring
function
serrsq_sf
: Squared error of squares scoring function
sperr_sf
: Squared percentage error scoring function
srelerr_sf
: Squared relative error scoring function
interval_sf
: Interval scoring function (Winkler scoring
function)
mv_sf
: Mean - variance scoring function
errorspread_sf
: Error - spread scoring function
mse
: Mean squared error (MSE)
expectile_rs
: Realised expectile score
mae
: Mean absolute error (MAE)
quantile_rs
: Realised quantile score
huber_rs
: Mean Huber score
mape
: Mean absolute percentage error (MAPE)
mre
: Mean relative error (MRE)
mspe
: Mean squared percentage error (MSPE)
msre
: Mean squared relative error (MSRE)
nse
: Nash-Sutcliffe efficiency (NSE)
expectile_if
: Expectile identification function
hubermean_if
: Huber mean identification function
huberquantile_if
: Huber quantile identification function
mean_if
: Mean identification function
meanlog_if
: Log-transformed identification function
nmoment_if
: -th moment identification function
quantile_if
: Quantile identification function
mv_if
: Mean - variance identification function
quantile_level
: Sample quantile level function
capping_function
: Capping function
The function aerr_sf computes the absolute error scoring function when
materialises and
is the predictive median functional.
The absolute error scoring function is defined in Table 1 in Gneiting (2011).
aerr_sf(x, y)
aerr_sf(x, y)
x |
Predictive median functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
The absolute error scoring function is defined by:
Domain of function:
Range of function:
Vector of absolute errors.
For details on the absolute error scoring function, see Gneiting (2011).
The median functional is the median of the probability distribution of
(Gneiting 2011).
The absolute error scoring function is negatively oriented (i.e. the smaller, the better).
The absolute error scoring function is strictly -consistent for
the median functional.
is the family of probability
distributions
for which
exists and is finite
(Raiffa and Schlaifer 1961, p.196; Ferguson 1967, p.51; Thomson 1979; Saerens
2000; Gneiting 2011).
Ferguson TS (1967) Mathematical Statistics: A Decision-Theoretic Approach. Academic Press, New York.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Raiffa H,Schlaifer R (1961) Applied Statistical Decision Theory. Colonial Press, Clinton.
Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263–1271. doi:10.1109/72.883416.
Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360–380. doi:10.1016/0022-0531(79)90042-5.
# Compute the absolute error scoring function. df <- data.frame( y = rep(x = 0, times = 5), x = -2:2 ) df$absolute_error <- aerr_sf(x = df$x, y = df$y) print(df)
# Compute the absolute error scoring function. df <- data.frame( y = rep(x = 0, times = 5), x = -2:2 ) df$absolute_error <- aerr_sf(x = df$x, y = df$y) print(df)
The function aperr_sf computes the absolute percentage error scoring function
when materialises and
is the predictive
functional.
The absolute percentage error scoring function is defined in Table 1 in Gneiting (2011).
aperr_sf(x, y)
aperr_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The absolute percentage error scoring function is defined by:
Domain of function:
Range of function:
Vector of absolute percentage errors.
For details on the absolute percentage error scoring function, see Gneiting (2011).
The -median functional,
is the
median of a probability distribution whose density is proportional to
, where
is the density of the probability distribution
of
(Gneiting 2011).
The absolute percentage error scoring function is negatively oriented (i.e. the smaller, the better).
The absolute percentage error scoring function is strictly
-consistent for the
functional.
is the family of probability distributions for
which
exists and is finite.
is
the subclass of probability distributions in
, which are such
that
,
has finite integral over
, and the probability distribution
with density
proportional to
belongs to
(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. doi:10.1198/jasa.2011.r10138.
# Compute the absolute percentage error scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$absolute_percentage_error <- aperr_sf(x = df$x, y = df$y) print(df)
# Compute the absolute percentage error scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$absolute_percentage_error <- aperr_sf(x = df$x, y = df$y) print(df)
-median scoring function
The function bmedian_sf computes the -median scoring function
when
materialises and
is the predictive
functional.
The -median scoring function is defined in eq. (4) in Gneiting
(2011).
bmedian_sf(x, y, b)
bmedian_sf(x, y, b)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
b |
It can be a vector of length |
The -median scoring function is defined by:
Domain of function:
Range of function:
Vector of -median losses.
For details on the -median scoring function, see Gneiting (2011).
The -median functional,
is the
median of a probability distribution whose density is proportional to
, where
is the density of the probability distribution
of
(Gneiting 2011).
The -median scoring function is negatively oriented (i.e. the
smaller, the better).
The -median scoring function is strictly
-consistent for the
functional.
is the family of probability distributions for
which
exists and is finite.
is
the subclass of probability distributions in
, which are such
that
,
has finite integral over
, and the probability distribution
with density
proportional to
belongs to
(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. doi:10.1198/jasa.2011.r10138.
# Compute the bmedian scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, b = c(-1, 1, 2) ) df$bmedian_error <- bmedian_sf(x = df$x, y = df$y, b = df$b) print(df)
# Compute the bmedian scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, b = c(-1, 1, 2) ) df$bmedian_error <- bmedian_sf(x = df$x, y = df$y, b = df$b) print(df)
The function bregman1_sf computes the Bregman scoring function when
materialises and
is the predictive mean functional.
The Bregman scoring function is defined by eq. (18) in Gneiting (2011) and the
form implemented here for is defined by eq. (19) in
Gneiting (2011).
bregman1_sf(x, y, a)
bregman1_sf(x, y, a)
x |
Predictive mean functional (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 Bregman scoring function (type 1) is defined by:
Domain of function:
Range of function:
Vector of Bregman losses.
The implemented function is denoted as type 1 since it corresponds to a specific
type of of the general form of the Bregman scoring function
defined by eq. (18) in Gneiting (2011).
For details on the Bregman scoring function, see Savage (1971), Banerjee et al. (2005) and Gneiting (2011).
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The Bregman scoring function is negatively oriented (i.e. the smaller, the better).
The herein implemented Bregman scoring function is strictly
-consistent for the mean functional.
is the
family of probability distributions for which
and
exist and are finite (Savage 1971; Gneiting 2011).
Banerjee A, Guo X, Wang H (2005) On the optimality of conditional expectation as a Bregman predictor. IEEE Transactions on Information Theory 51(7):2664–2669. doi:10.1109/TIT.2005.850145.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Savage LJ (1971) Elicitation of personal probabilities and expectations. Journal of the American Statistical Association 66(337):783–810. doi:10.1080/01621459.1971.10482346.
# Compute the Bregman scoring function (type 1). df <- data.frame( y = rep(x = 0, times = 7), x = c(-3, -2, -1, 0, 1, 2, 3), a = rep(x = 3, times = 7) ) df$bregman1_penalty <- bregman1_sf(x = df$x, y = df$y, a = df$a) print(df) # Equivalence of Bregman scoring function (type 1) and squared error scoring # function, when a = 2. set.seed(12345) n <- 100 x <- runif(n, -20, 20) y <- runif(n, -20, 20) a <- rep(x = 2, times = n) u <- bregman1_sf(x = x, y = y, a = a) v <- serr_sf(x = x, y = y) max(abs(u - v)) # values are slightly higher than 0 due to rounding error min(abs(u - v))
# Compute the Bregman scoring function (type 1). df <- data.frame( y = rep(x = 0, times = 7), x = c(-3, -2, -1, 0, 1, 2, 3), a = rep(x = 3, times = 7) ) df$bregman1_penalty <- bregman1_sf(x = df$x, y = df$y, a = df$a) print(df) # Equivalence of Bregman scoring function (type 1) and squared error scoring # function, when a = 2. set.seed(12345) n <- 100 x <- runif(n, -20, 20) y <- runif(n, -20, 20) a <- rep(x = 2, times = n) u <- bregman1_sf(x = x, y = y, a = a) v <- serr_sf(x = x, y = y) max(abs(u - v)) # values are slightly higher than 0 due to rounding error min(abs(u - v))
The function bregman2_sf computes the Bregman scoring function when
materialises and
is the predictive mean functional.
The Bregman scoring function is defined by eq. (18) in Gneiting (2011) and the
form implemented here for ,
is defined by eq. (20) in Gneiting
(2011).
bregman2_sf(x, y, b)
bregman2_sf(x, y, b)
x |
Predictive mean functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
b |
It can be a vector of length |
The Bregman scoring function (type 2) is defined by:
Domain of function:
Range of function:
Vector of Bregman losses.
The implemented function is denoted as type 2 since it corresponds to a specific
type of of the general form of the Bregman scoring function
defined by eq. (18) in Gneiting (2011).
For details on the Bregman scoring function, see Savage (1971), Banerjee et al. (2005) and Gneiting (2011). For details on the specific form implemented here, see Patton (2011).
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The Bregman scoring function is negatively oriented (i.e. the smaller, the better).
The herein implemented Bregman scoring function is strictly
-consistent for the mean functional.
is the
family of probability distributions
for which
and
exist and are finite
(Savage 1971; Gneiting 2011).
Banerjee A, Guo X, Wang H (2005) On the optimality of conditional expectation as a Bregman predictor. IEEE Transactions on Information Theory 51(7):2664–2669. doi:10.1109/TIT.2005.850145.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. doi:10.1016/j.jeconom.2010.03.034.
Savage LJ (1971) Elicitation of personal probabilities and expectations. Journal of the American Statistical Association 66(337):783–810. doi:10.1080/01621459.1971.10482346.
# Compute the Bregman scoring function (type 2). df <- data.frame( y = rep(x = 2, times = 6), x = rep(x = 1:3, times = 2), b = rep(x = c(-3, 3), each = 3) ) df$bregman2_penalty <- bregman2_sf(x = df$x, y = df$y, b = df$b) print(df) # The Bregman scoring function (type 2) is half the squared error scoring # function, when b = 2. df <- data.frame( y = rep(x = 5.5, times = 10), x = 1:10, b = rep(x = 2, times = 10) ) df$bregman2_penalty <- bregman2_sf(x = df$x, y = df$y, b = df$b) df$squared_error <- serr_sf(x = df$x, y = df$y) df$ratio <- df$bregman2_penalty/df$squared_error print(df) # When a = b > 1 the Bregman scoring function (type 2) coincides with the # Bregman scoring function (type 1) up to a multiplicative constant. df <- data.frame( y = rep(x = 5.5, times = 10), x = 1:10, b = rep(x = c(3, 4), each = 5) ) df$bregman2_penalty <- bregman2_sf(x = df$x, y = df$y, b = df$b) df$bregman1_penalty <- bregman1_sf(x = df$x, y = df$y, a = df$b) df$ratio <- df$bregman2_penalty/df$bregman1_penalty print(df)
# Compute the Bregman scoring function (type 2). df <- data.frame( y = rep(x = 2, times = 6), x = rep(x = 1:3, times = 2), b = rep(x = c(-3, 3), each = 3) ) df$bregman2_penalty <- bregman2_sf(x = df$x, y = df$y, b = df$b) print(df) # The Bregman scoring function (type 2) is half the squared error scoring # function, when b = 2. df <- data.frame( y = rep(x = 5.5, times = 10), x = 1:10, b = rep(x = 2, times = 10) ) df$bregman2_penalty <- bregman2_sf(x = df$x, y = df$y, b = df$b) df$squared_error <- serr_sf(x = df$x, y = df$y) df$ratio <- df$bregman2_penalty/df$squared_error print(df) # When a = b > 1 the Bregman scoring function (type 2) coincides with the # Bregman scoring function (type 1) up to a multiplicative constant. df <- data.frame( y = rep(x = 5.5, times = 10), x = 1:10, b = rep(x = c(3, 4), each = 5) ) df$bregman2_penalty <- bregman2_sf(x = df$x, y = df$y, b = df$b) df$bregman1_penalty <- bregman1_sf(x = df$x, y = df$y, a = df$b) df$ratio <- df$bregman2_penalty/df$bregman1_penalty print(df)
The function bregman3_sf computes the Bregman scoring function when
materialises and
is the predictive mean functional.
The Bregman scoring function is defined by eq. (18) in Gneiting (2011) and the
form implemented here for is defined by eq. (20) in
Gneiting (2011).
bregman3_sf(x, y)
bregman3_sf(x, y)
x |
Predictive mean functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
The Bregman scoring function (type 3) is defined by:
Domain of function:
Range of function:
Vector of Bregman losses.
The implemented function is denoted as type 3 since it corresponds to a specific
type of of the general form of the Bregman scoring function
defined by eq. (18) in Gneiting (2011).
For details on the Bregman scoring function, see Savage (1971), Banerjee et al. (2005) and Gneiting (2011). For details on the specific form implemented here, see the QLIKE scoring function in Patton (2011).
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The Bregman scoring function is negatively oriented (i.e. the smaller, the better).
The herein implemented Bregman scoring function is strictly
-consistent for the mean functional.
is the
family of probability distributions
for which
and
exist and are finite (Savage 1971; Gneiting
2011).
Banerjee A, Guo X, Wang H (2005) On the optimality of conditional expectation as a Bregman predictor. IEEE Transactions on Information Theory 51(7):2664–2669. doi:10.1109/TIT.2005.850145.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. doi:10.1016/j.jeconom.2010.03.034.
Savage LJ (1971) Elicitation of personal probabilities and expectations. Journal of the American Statistical Association 66(337):783–810. doi:10.1080/01621459.1971.10482346.
# Compute the Bregman scoring function (type 3, QLIKE scoring function). df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$bregman3_penalty <- bregman3_sf(x = df$x, y = df$y) print(df)
# Compute the Bregman scoring function (type 3, QLIKE scoring function). df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$bregman3_penalty <- bregman3_sf(x = df$x, y = df$y) print(df)
The function bregman4_sf computes the Bregman scoring function when
materialises and
is the predictive mean functional.
The Bregman scoring function is defined by eq. (18) in Gneiting (2011) and the
form implemented here for is defined by eq. (20) in
Gneiting (2011).
bregman4_sf(x, y)
bregman4_sf(x, y)
x |
Predictive mean functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
The Bregman scoring function (type 4) is defined by:
Domain of function:
Range of function:
Vector of Bregman losses.
The implemented function is denoted as type 4 since it corresponds to a specific
type of of the general form of the Bregman scoring function
defined by eq. (18) in Gneiting (2011).
For details on the Bregman scoring function, see Savage (1971), Banerjee et al. (2005) and Gneiting (2011). For details on the specific form implemented here, see Patton (2011).
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The Bregman scoring function is negatively oriented (i.e. the smaller, the better).
The herein implemented Bregman scoring function is strictly
-consistent for the mean functional.
is the
family of probability distributions
for which
and
exist and are finite (Savage 1971;
Gneiting 2011).
Banerjee A, Guo X, Wang H (2005) On the optimality of conditional expectation as a Bregman predictor. IEEE Transactions on Information Theory 51(7):2664–2669. doi:10.1109/TIT.2005.850145.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. doi:10.1016/j.jeconom.2010.03.034.
Savage LJ (1971) Elicitation of personal probabilities and expectations. Journal of the American Statistical Association 66(337):783–810. doi:10.1080/01621459.1971.10482346.
# Compute the Bregman scoring function (type 4). df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$bregman4_penalty <- bregman4_sf(x = df$x, y = df$y) print(df)
# Compute the Bregman scoring function (type 4). df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$bregman4_penalty <- bregman4_sf(x = df$x, y = df$y) print(df)
The function capping_function computes the value of the capping function, defined in Taggart (2022), p.205.
It is used by the generalized Huber loss function among others (see Taggart 2022).
capping_function(t, a, b)
capping_function(t, a, b)
t |
It can be a vector of length |
a |
It can be a vector of length |
b |
It can be a vector of length |
The capping function is defined by:
or equivalently,
Domain of function:
Vector of values of the capping function.
For the definition of the capping function, see Taggart (2022), p.205.
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16:201–231. doi:10.1214/21-EJS1957.
# Compute the capping function. df <- data.frame( t = c(1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 2.5, 2.5, 3.5, 3.5), a = c(0, 0, 0, 0, Inf, Inf, Inf, Inf, 2, 3, 2, 3, 2, 3), b = c(0, 0, Inf, Inf, 0, 0, Inf, Inf, 3, 2, 3, 2, 3, 2) ) df$cf <- capping_function(t = df$t, a = df$a, b = df$b) print(df)
# Compute the capping function. df <- data.frame( t = c(1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 2.5, 2.5, 3.5, 3.5), a = c(0, 0, 0, 0, Inf, Inf, Inf, Inf, 2, 3, 2, 3, 2, 3), b = c(0, 0, Inf, Inf, 0, 0, Inf, Inf, 3, 2, 3, 2, 3, 2) ) df$cf <- capping_function(t = df$t, a = df$a, b = df$b) print(df)
The function errorspread_sf computes the error - spread scoring function, when
materialises,
is the predictive mean,
is the
predictive variance and
is the predictive skewness.
The error - spread scoring function is defined by eq. (14) in Christensen et al. (2015).
errorspread_sf(x1, x2, x3, y)
errorspread_sf(x1, x2, x3, y)
x1 |
Predictive mean (prediction). It can be a vector of length |
x2 |
Predictive variance (prediction). It can be a vector of length |
x3 |
Predictive skewness (prediction). It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The error - spread scoring function is defined by:
Domain of function:
Vector of error - spread losses.
The mean functional is the mean of the probability
distribution
of
(Christensen et al. 2015).
The variance functional is the variance
of the probability distribution
of
(Christensen et al. 2015).
The skewness functional is the skewness
(Christensen et al. 2015).
The error - spread scoring function is negatively oriented (i.e. the smaller, the better).
The error - spread scoring function is strictly consistent for the triple (mean, variance, skewness) functional (Christensen et al. 2015).
Christensen HM, Moroz IM, Palmer TN (2015) Evaluation of ensemble forecast uncertainty using a new proper score: Application to medium-range and seasonal forecasts. Quarterly Journal of the Royal Meteorological Society 141(687)(Part B):538–549. doi:10.1002/qj.2375.
# Compute the error - spread scoring function. df <- data.frame( y = rep(x = 0, times = 6), x1 = c(2, 2, -2, -2, 0, 0), x2 = c(1, 2, 1, 2, 1, 2), x3 = c(3, 3, -3, -3, 0, 0) ) df$errorspread_penalty <- errorspread_sf(x1 = df$x1, x2 = df$x2, x3 = df$x3, y = df$y) print(df)
# Compute the error - spread scoring function. df <- data.frame( y = rep(x = 0, times = 6), x1 = c(2, 2, -2, -2, 0, 0), x2 = c(1, 2, 1, 2, 1, 2), x3 = c(3, 3, -3, -3, 0, 0) ) df$errorspread_penalty <- errorspread_sf(x1 = df$x1, x2 = df$x2, x3 = df$x3, y = df$y) print(df)
The function expectile_if computes the expectile identification function at a
specific level , when
materialises and
is the predictive
expectile at level
.
The expectile identification function is defined in Table 9 in Gneiting (2011).
expectile_if(x, y, p)
expectile_if(x, y, p)
x |
Predictive expectile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The expectile identification function is defined by:
Domain of function:
Range of function:
Vector of values of the expectile identification function.
For the definition of expectiles, see Newey and Powell (1987).
The expectile identification function is a strict
-identification function for the
-expectile functional
(Gneiting 2011; Fissler and Ziegel 2016; Dimitriadis et al. 2024).
is the family of probability distributions
for which
exists and is finite (Gneiting 2011; Fissler and
Ziegel 2016; Dimitriadis et al. 2024).
Dimitriadis T, Fissler T, Ziegel JF (2024) Osband's principle for identification functions. Statistical Papers 65:1125–1132. doi:10.1007/s00362-023-01428-x.
Fissler T, Ziegel JF (2016) Higher order elicitability and Osband's principle. The Annals of Statistics 44(4):1680–1707. doi:10.1214/16-AOS1439.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Newey WK, Powell JL (1987) Asymmetric least squares estimation and testing. Econometrica 55(4):819–847. doi:10.2307/1911031.
# Compute the expectile identification function. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$expectile_if <- expectile_if(x = df$x, y = df$y, p = df$p)
# Compute the expectile identification function. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$expectile_if <- expectile_if(x = df$x, y = df$y, p = df$p)
The function expectile_rs computes the realised expectile score at a specific
level when
materialises and
is the prediction.
Realised expectile score is a realised score corresponding to the expectile scoring function expectile_sf.
expectile_rs(x, y, p)
expectile_rs(x, y, p)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The realized expectile score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised expectile score.
For details on the expectile scoring function, see expectile_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised expectile score is the realised (average) score corresponding to the expectile scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the realised expectile score. set.seed(12345) x <- 0.5 y <- rnorm(n = 100, mean = 0, sd = 1) print(expectile_rs(x = x, y = y, p = 0.7)) print(expectile_rs(x = rep(x = x, times = 100), y = y, p = 0.7))
# Compute the realised expectile score. set.seed(12345) x <- 0.5 y <- rnorm(n = 100, mean = 0, sd = 1) print(expectile_rs(x = x, y = y, p = 0.7)) print(expectile_rs(x = rep(x = x, times = 100), y = y, p = 0.7))
The function expectile_sf computes the asymmetric piecewise quadratic scoring
function (expectile scoring function) at a specific level , when
materialises and
is the predictive expectile at level
.
The asymmetric piecewise quadratic scoring function is defined by eq. (27) in Gneiting (2011).
expectile_sf(x, y, p)
expectile_sf(x, y, p)
x |
Predictive expectile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The asymmetric piecewise quadratic scoring function is defined by:
or equivalently,
Domain of function:
Range of function:
Vector of expectile losses.
For the definition of expectiles, see Newey and Powell (1987).
The asymmetric piecewise quadratic scoring function is negatively oriented (i.e. the smaller, the better).
The asymmetric piecewise quadratic scoring function is strictly
-consistent for the
-expectile functional.
is the family of probability distributions
for which
exists and is finite (Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Newey WK, Powell JL (1987) Asymmetric least squares estimation and testing. Econometrica 55(4):819–847. doi:10.2307/1911031.
# Compute the asymmetric piecewise quadratic scoring function (expectile scoring # function). df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$expectile_penalty <- expectile_sf(x = df$x, y = df$y, p = df$p) print(df) # The asymmetric piecewise quadratic scoring function (expectile scoring # function) at level p = 0.5 is half the squared error scoring function. df <- data.frame( y = rep(x = 0, times = 3), x = c(-2, 0, 2), p = rep(x = c(0.5), times = 3) ) df$expectile_penalty <- expectile_sf(x = df$x, y = df$y, p = df$p) df$squared_error <- serr_sf(x = df$x, y = df$y) print(df)
# Compute the asymmetric piecewise quadratic scoring function (expectile scoring # function). df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$expectile_penalty <- expectile_sf(x = df$x, y = df$y, p = df$p) print(df) # The asymmetric piecewise quadratic scoring function (expectile scoring # function) at level p = 0.5 is half the squared error scoring function. df <- data.frame( y = rep(x = 0, times = 3), x = c(-2, 0, 2), p = rep(x = c(0.5), times = 3) ) df$expectile_penalty <- expectile_sf(x = df$x, y = df$y, p = df$p) df$squared_error <- serr_sf(x = df$x, y = df$y) print(df)
The function ghuber_sf computes the generalized Huber scoring function at a
specific level and parameters
and
, when
materialises and
is the predictive Huber functional at level
.
The generalized Huber scoring function is defined by eq. (4.7) in Taggart (2022)
for .
ghuber_sf(x, y, p, a, b)
ghuber_sf(x, y, p, a, b)
x |
Predictive Huber functional (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
a |
It can be a vector of length |
b |
It can be a vector of length |
The generalized Huber scoring function is defined by:
or equivalently
or
where
and is the capping function defined by:
Domain of function:
Range of function:
Vector of generalized Huber losses.
For the definition of Huber functionals, see definition 3.3 in Taggart (2022). The value of eq. (4.7) is twice the value of the equation in definition 4.2 in Taggart (2002).
The generalized Huber scoring function is negatively oriented (i.e. the smaller, the better).
The generalized Huber scoring function is strictly -consistent
for the
-Huber functional.
is the family of probability
distributions
for which
and
(or equivalently
) exist and are finite (Taggart 2022).
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16:201–231. doi:10.1214/21-EJS1957.
# Compute the generalized Huber scoring function. set.seed(12345) n <- 10 df <- data.frame( x = runif(n, -2, 2), y = runif(n, -2, 2), p = runif(n, 0, 1), a = runif(n, 0, 1), b = runif(n, 0, 1) ) df$ghuber_penalty <- ghuber_sf(x = df$x, y = df$y, p = df$p, a = df$a, b = df$b) print(df) # Equivalence of the generalized Huber scoring function and the asymmetric # piecewise quadratic scoring function (expectile scoring function), when # a = Inf and b = Inf. set.seed(12345) n <- 100 x <- runif(n, -20, 20) y <- runif(n, -20, 20) p <- runif(n, 0, 1) a <- rep(x = Inf, times = n) b <- rep(x = Inf, times = n) u <- ghuber_sf(x = x, y = y, p = p, a = a, b = b) v <- expectile_sf(x = x, y = y, p = p) max(abs(u - v)) # values are slightly higher than 0 due to rounding error min(abs(u - v)) # Equivalence of the generalized Huber scoring function and the Huber scoring # function when p = 1/2 and a = b. set.seed(12345) n <- 100 x <- runif(n, -20, 20) y <- runif(n, -20, 20) p <- rep(x = 1/2, times = n) a <- runif(n, 0, 20) u <- ghuber_sf(x = x, y = y, p = p, a = a, b = a) v <- huber_sf(x = x, y = y, a = a) max(abs(u - v)) # values are slightly higher than 0 due to rounding error min(abs(u - v))
# Compute the generalized Huber scoring function. set.seed(12345) n <- 10 df <- data.frame( x = runif(n, -2, 2), y = runif(n, -2, 2), p = runif(n, 0, 1), a = runif(n, 0, 1), b = runif(n, 0, 1) ) df$ghuber_penalty <- ghuber_sf(x = df$x, y = df$y, p = df$p, a = df$a, b = df$b) print(df) # Equivalence of the generalized Huber scoring function and the asymmetric # piecewise quadratic scoring function (expectile scoring function), when # a = Inf and b = Inf. set.seed(12345) n <- 100 x <- runif(n, -20, 20) y <- runif(n, -20, 20) p <- runif(n, 0, 1) a <- rep(x = Inf, times = n) b <- rep(x = Inf, times = n) u <- ghuber_sf(x = x, y = y, p = p, a = a, b = b) v <- expectile_sf(x = x, y = y, p = p) max(abs(u - v)) # values are slightly higher than 0 due to rounding error min(abs(u - v)) # Equivalence of the generalized Huber scoring function and the Huber scoring # function when p = 1/2 and a = b. set.seed(12345) n <- 100 x <- runif(n, -20, 20) y <- runif(n, -20, 20) p <- rep(x = 1/2, times = n) a <- runif(n, 0, 20) u <- ghuber_sf(x = x, y = y, p = p, a = a, b = a) v <- huber_sf(x = x, y = y, a = a) max(abs(u - v)) # values are slightly higher than 0 due to rounding error min(abs(u - v))
The function gpl1_sf computes the generalized piecewise linear power scoring
function at a specific level for
,
, when
materialises and
is the predictive quantile at level
.
The generalized piecewise linear power scoring function is defined by eq. (25)
in Gneiting (2011) and the form implemented here for the specific is
defined by eq. (26) in Gneiting (2011).
gpl1_sf(x, y, p, b)
gpl1_sf(x, y, p, b)
x |
Predictive quantile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
b |
It can be a vector of length |
The generalized piecewise linear power scoring function (type 1) is defined by:
or equivalently
Domain of function:
Range of function:
Vector of generalized piecewise linear power losses.
The implemented function is denoted as type 1 since it corresponds to a specific
type of of the general form of the generalized piecewise linear power
scoring function defined by eq. (25) in Gneiting (2011).
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The generalized piecewise linear scoring function is negatively oriented (i.e. the smaller, the better).
The herein implemented generalized piecewise linear power scoring function is
strictly -consistent for the
-quantile functional.
is the family of probability distributions
for which
exists and is finite (Thomson 1979; Saerens 2000;
Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33–50. doi:10.2307/1913643.
Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263–1271. doi:10.1109/72.883416.
Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360–380. doi:10.1016/0022-0531(79)90042-5.
# Compute the generalized piecewise linear scoring function (type 1). df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), p = c(rep(x = 0.05, times = 3), rep(x = 0.95, times = 3)), b = rep(x = 2, times = 6) ) df$gpl1_penalty <- gpl1_sf(x = df$x, y = df$y, p = df$p, b = df$b) print(df) # Equivalence of generalized piecewise linear scoring function (type 1) and # asymmetric piecewise linear scoring function (quantile scoring function), when # b = 1. set.seed(12345) n <- 100 x <- runif(n, 0, 20) y <- runif(n, 0, 20) p <- runif(n, 0, 1) b <- rep(x = 1, times = n) u <- gpl1_sf(x = x, y = y, p = p, b = b) v <- quantile_sf(x = x, y = y, p = p) max(abs(u - v)) # Equivalence of generalized piecewise linear scoring function (type 1) and # MAE-SD scoring function, when p = 1/2 and b = 1/2. set.seed(12345) n <- 100 x <- runif(n, 0, 20) y <- runif(n, 0, 20) p <- rep(x = 0.5, times = n) b <- rep(x = 1/2, times = n) u <- gpl1_sf(x = x, y = y, p = p, b = b) v <- maesd_sf(x = x, y = y) max(abs(u - v))
# Compute the generalized piecewise linear scoring function (type 1). df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), p = c(rep(x = 0.05, times = 3), rep(x = 0.95, times = 3)), b = rep(x = 2, times = 6) ) df$gpl1_penalty <- gpl1_sf(x = df$x, y = df$y, p = df$p, b = df$b) print(df) # Equivalence of generalized piecewise linear scoring function (type 1) and # asymmetric piecewise linear scoring function (quantile scoring function), when # b = 1. set.seed(12345) n <- 100 x <- runif(n, 0, 20) y <- runif(n, 0, 20) p <- runif(n, 0, 1) b <- rep(x = 1, times = n) u <- gpl1_sf(x = x, y = y, p = p, b = b) v <- quantile_sf(x = x, y = y, p = p) max(abs(u - v)) # Equivalence of generalized piecewise linear scoring function (type 1) and # MAE-SD scoring function, when p = 1/2 and b = 1/2. set.seed(12345) n <- 100 x <- runif(n, 0, 20) y <- runif(n, 0, 20) p <- rep(x = 0.5, times = n) b <- rep(x = 1/2, times = n) u <- gpl1_sf(x = x, y = y, p = p, b = b) v <- maesd_sf(x = x, y = y) max(abs(u - v))
The function gpl2_sf computes the generalized piecewise linea power scoring
function at a specific level for
, when
materialises and
is the predictive quantile at level
.
The generalized piecewise linear power scoring function is negatively oriented (i.e. the smaller, the better).
The generalized piecewise linear scoring function is defined by eq. (25) in
Gneiting (2011) and the form implemented here for the specific is
defined by eq. (26) in Gneiting (2011) for
.
gpl2_sf(x, y, p)
gpl2_sf(x, y, p)
x |
Predictive quantile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The generalized piecewise linear power scoring function (type 2) is defined by:
or equivalently
Domain of function:
Range of function:
Vector of generalized piecewise linear losses.
The implemented function is denoted as type 2 since it corresponds to a specific
type of of the general form of the generalized piecewise linear power
scoring function defined by eq. (25) in Gneiting (2011).
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The herein implemented generalized piecewise linear power scoring function is
strictly -consistent for the
-quantile functional.
is the family of probability distributions
for which
exists and is finite (Thomson 1979; Saerens
2000; Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33–50. doi:10.2307/1913643.
Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263–1271. doi:10.1109/72.883416.
Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360–380. doi:10.1016/0022-0531(79)90042-5.
# Compute the generalized piecewise linear scoring function (type 2). df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), p = c(rep(x = 0.05, times = 3), rep(x = 0.95, times = 3)) ) df$gpl2_penalty <- gpl2_sf(x = df$x, y = df$y, p = df$p) print(df) # The generalized piecewise linear scoring function (type 2) is half the MAE-LOG # scoring function. df <- data.frame( y = rep(x = 5.5, times = 10), x = 1:10, p = rep(x = 0.5, times = 10) ) df$gpl2_penalty <- gpl2_sf(x = df$x, y = df$y, p = df$p) df$mae_log_penalty <- maelog_sf(x = df$x, y = df$y) df$ratio <- df$gpl2_penalty/df$mae_log_penalty print(df)
# Compute the generalized piecewise linear scoring function (type 2). df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), p = c(rep(x = 0.05, times = 3), rep(x = 0.95, times = 3)) ) df$gpl2_penalty <- gpl2_sf(x = df$x, y = df$y, p = df$p) print(df) # The generalized piecewise linear scoring function (type 2) is half the MAE-LOG # scoring function. df <- data.frame( y = rep(x = 5.5, times = 10), x = 1:10, p = rep(x = 0.5, times = 10) ) df$gpl2_penalty <- gpl2_sf(x = df$x, y = df$y, p = df$p) df$mae_log_penalty <- maelog_sf(x = df$x, y = df$y) df$ratio <- df$gpl2_penalty/df$mae_log_penalty print(df)
The function huber_rs computes the mean Huber score with parameter
, when
materialises and
is the prediction.
Mean Huber score is a realised score corresponding to the Huber scoring function huber_sf.
huber_rs(x, y, a)
huber_rs(x, y, a)
x |
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 mean Huber score is defined by:
where
and
Domain of function:
Range of function:
Value of the mean Huber score.
For details on the Huber scoring function, see huber_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean Huber score is the realised (average) score corresponding to the Huber scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the Huber mean score. set.seed(12345) a <- 0.5 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(huber_rs(x = x, y = y, a = a)) print(huber_rs(x = rep(x = x, times = 100), y = y, a = a))
# Compute the Huber mean score. set.seed(12345) a <- 0.5 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(huber_rs(x = x, y = y, a = a)) print(huber_rs(x = rep(x = x, times = 100), y = y, a = a))
The function huber_sf computes the Huber scoring function with parameter
, when
materialises and
is the predictive Huber mean.
The Huber scoring function is defined in Huber (1964).
huber_sf(x, y, a)
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:
or equivalently
where is the capping function defined by:
Domain of function:
Range of function:
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 -consistent for the Huber
mean.
is the family of probability distributions
for
which
and
(or equivalently
) exist and are finite (Taggart 2022).
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.
# 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)
# 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)
The function hubermean_if computes the Huber mean identification function with
parameter , when
materialises and
is the predictive Huber
mean.
The Huber mean identification function is defined by eq. (3.5) in Taggart (2022).
hubermean_if(x, y, a)
hubermean_if(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 mean identification function is defined by:
where is the capping function defined by:
Domain of function:
Vector of values of the Huber mean identification function.
For the definition of Huber mean, see Taggart (2022).
The Huber mean identification function is a strict
-identification function for the Huber mean functional (Taggart
2022).
is the family of probability distributions
for which
for which
exists and is finite (Taggart 2022).
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16:201–231. doi:10.1214/21-EJS1957.
# 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)
# 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)
The function huberquantile_if computes the Huber quantile identification
function at a specific level and parameters
and
, when
materialises and
is the predictive Huber functional at level
.
The Huber quantile identification function is defined by eq. (3.5) in Taggart (2022).
huberquantile_if(x, y, p, a, b)
huberquantile_if(x, y, p, a, b)
x |
Predictive Huber functional (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
a |
It can be a vector of length |
b |
It can be a vector of length |
The Huber quantile identification function is defined by:
where is the capping function defined by:
Domain of function:
Vector of values of the Huber quantile identification function.
For the definition of Huber quantile, see Taggart (2022).
The Huber quantile identification function is a strict
-identification function for the Huber quantile functional
(Taggart 2022).
is the family of probability distributions
for which
for which
exists and is finite (Taggart 2022).
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16:201–231. doi:10.1214/21-EJS1957.
# Compute the Huber quantile identification function. set.seed(12345) n <- 10 df <- data.frame( x = runif(n, -2, 2), y = runif(n, -2, 2), p = runif(n, 0, 1), a = runif(n, 0, 1), b = runif(n, 0, 1) ) df$huberquantile_if <- huberquantile_if(x = df$x, y = df$y, p = df$p, a = df$a, b = df$b) print(df)
# Compute the Huber quantile identification function. set.seed(12345) n <- 10 df <- data.frame( x = runif(n, -2, 2), y = runif(n, -2, 2), p = runif(n, 0, 1), a = runif(n, 0, 1), b = runif(n, 0, 1) ) df$huberquantile_if <- huberquantile_if(x = df$x, y = df$y, p = df$p, a = df$a, b = df$b) print(df)
The function interval_sf computes the interval scoring function (Winkler scoring
function) when materialises and
is the central
prediction interval.
The interval scoring function is defined by eq. (43) in Gneiting and Raftery (2007).
interval_sf(x1, x2, y, p)
interval_sf(x1, x2, y, p)
x1 |
Predictive quantile (prediction) at level |
x2 |
Predictive quantile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The interval scoring function is defined by:
Domain of function:
Range of function:
Vector of interval losses.
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The interval scoring function is negatively oriented (i.e. the smaller, the better).
The interval scoring function is strictly -consistent for the
central
prediction interval
.
and
are quantile functionals at levels
and
respectively.
is the family of probability distributions
for which
exists and is finite (Dunsmore 1968; Winkler 1972;
Gneiting and Raftery 2007; Winkler and Murphy 1979; Fissler and Ziegel 2016;
Brehmer and Gneiting 2021).
Brehmer JR, Gneiting T (2021) Scoring interval forecasts: Equal-tailed, shortest, and modal interval. Bernoulli 27(3):1993–2010. doi:10.3150/20-BEJ1298.
Dunsmore IR (1968) A Bayesian approach to calibration. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 30(2):396–405. doi:10.1111/j.2517-6161.1968.tb00740.x.
Fissler T, Ziegel JF (2016) Higher order elicitability and Osband's principle. The Annals of Statistics 44(4):1680–1707. doi:10.1214/16-AOS1439.
Gneiting T, Raftery AE (2007) Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association 102(477):359–378. doi:10.1198/016214506000001437.
Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33–50. doi:10.2307/1913643.
Winkler RL (1972) A decision-theoretic approach to interval estimation. Journal of the American Statistical Association 67(337):187–191. doi:10.1080/01621459.1972.10481224.
Winkler RL, Murphy AH (1979) The use of probabilities in forecasts of maximum and minimum temperatures.Meteorological Magazine 108(1288):317–329.
# Compute the interval scoring function (Winkler scoring function). df <- data.frame( y = rep(x = 0, times = 6), x1 = c(-3, -2, -1, 0, 1, 2), x2 = c(1, 2, 3, 4, 5, 6), p = rep(x = c(0.05, 0.95), times = 3) ) df$interval_penalty <- interval_sf(x1 = df$x1, x2 = df$x2, y = df$y, p = df$p) print(df)
# Compute the interval scoring function (Winkler scoring function). df <- data.frame( y = rep(x = 0, times = 6), x1 = c(-3, -2, -1, 0, 1, 2), x2 = c(1, 2, 3, 4, 5, 6), p = rep(x = c(0.05, 0.95), times = 3) ) df$interval_penalty <- interval_sf(x1 = df$x1, x2 = df$x2, y = df$y, p = df$p) print(df)
The function linex_sf computes the LINEX scoring function with parameter
when
materialises and
is the predictive
moment generating
functional.
The LINEX scoring function is defined by Varian (1975).
linex_sf(x, y, a)
linex_sf(x, y, a)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
a |
It can be a vector of length |
The LINEX scoring function is defined by:
Domain of function:
Range of function:
Vector of LINEX losses.
For details on the LINEX scoring function, see Varian (1975) and Zellner (1986).
The LINEX scoring function is negatively oriented (i.e. the smaller, the better).
The LINEX scoring function is strictly -consistent for
the
moment generating
functional.
is the family of probability distributions
for which
and
exist and are finite (Varian 1975; Zellner 1986;
Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Varian HR (1975) A Bayesian approach to real estate assessment. In: Fienberg SE, Zellner A(eds) Studies in Bayesian Econometrics and Statistics in Honor of Leonard J. Savage. Amsterdam: North-Holland, pp 195–208.
Zellner A (1986) Bayesian estimation and prediction using asymmetric loss functions. Journal of the American Statistical Association 81(394):446–451. doi:10.1080/01621459.1986.10478289.
# Compute the LINEX scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = c(-1, 1, 2) ) df$linex_loss <- linex_sf(x = df$x, y = df$y, a = df$a) print(df)
# Compute the LINEX scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = c(-1, 1, 2) ) df$linex_loss <- linex_sf(x = df$x, y = df$y, a = df$a) print(df)
-mean scoring function
The function lqmean_sf computes the -mean scoring function, when
materialises and
is the predictive
-mean.
The -mean scoring function is defined by Chen (1996). It is equivalent
to the
-quantile scoring function at level
, up to a
multiplicative constant.
lqmean_sf(x, y, q)
lqmean_sf(x, y, q)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
q |
It can be a vector of length |
The -mean scoring function is defined by:
Domain of function:
Range of function:
Vector of -mean losses.
For the definition of -means, see Chen (1996). In particular,
-means are the solution of the equation
, where
-means are
-quantiles at level
.
The -mean scoring function is negatively oriented (i.e. the smaller,
the better).
The -mean scoring function is strictly
-consistent
for the
-mean functional.
is the family of probability
distributions
for which
exists and is finite
(Chen 2016; Bellini 2014).
Bellini F, Klar B, Muller A, Gianin ER (2014) Generalized quantiles as risk measures. Insurance: Mathematics and Economics 54:41–48. doi:10.1016/j.insmatheco.2013.10.015.
Chen Z (1996) Conditional -quantiles and their application to the
testing of symmetry in non-parametric regression.
Statistics and Probability Letters 29(2):107–115.
doi:10.1016/0167-7152(95)00163-8.
# Compute the Lq-mean scoring function. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), q = c(2, 3, 2, 3, 2, 3) ) df$lqmean_penalty <- lqmean_sf(x = df$x, y = df$y, q = df$q) print(df)
# Compute the Lq-mean scoring function. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), q = c(2, 3, 2, 3, 2, 3) ) df$lqmean_penalty <- lqmean_sf(x = df$x, y = df$y, q = df$q) print(df)
-quantile scoring function
The function lqquantile_sf computes the -quantile scoring function at a
specific level
, when
materialises and
is the predictive
-quantile at level
.
The -quantile scoring function is defined by Chen (1996).
lqquantile_sf(x, y, p, q)
lqquantile_sf(x, y, p, q)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
q |
It can be a vector of length |
The -quantile scoring function is defined by:
or equivalently,
Domain of function:
Range of function:
Vector of -quantile losses.
For the definition of -quantiles, see Chen (1996). In particular,
-quantiles at level
are the solution of the equation
, where
The -quantile scoring function is negatively oriented (i.e. the
smaller, the better).
The -quantile scoring function is strictly
-consistent
for the
-quantile functional at level
.
is the
family of probability distributions
for which
exists and is finite (Chen 2016; Bellini 2014).
Bellini F, Klar B, Muller A, Gianin ER (2014) Generalized quantiles as risk measures. Insurance: Mathematics and Economics 54:41–48. doi:10.1016/j.insmatheco.2013.10.015.
Chen Z (1996) Conditional -quantiles and their application to the
testing of symmetry in non-parametric regression.
Statistics and Probability Letters 29(2):107–115.
doi:10.1016/0167-7152(95)00163-8.
# Compute the Lq-quantile scoring function at level p. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3), q = c(2, 3, 2, 3, 2, 3) ) df$lqquantile_penalty <- lqquantile_sf(x = df$x, y = df$y, p = df$p, q = df$q) print(df)
# Compute the Lq-quantile scoring function at level p. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3), q = c(2, 3, 2, 3, 2, 3) ) df$lqquantile_penalty <- lqquantile_sf(x = df$x, y = df$y, p = df$p, q = df$q) print(df)
The function mae computes the mean absolute error when
materialises and
is the prediction.
Mean absolute error is a realised score corresponding to the absolute error scoring function aerr_sf.
mae(x, y)
mae(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean absolute error is defined by:
where
and
Domain of function:
Range of function:
Value of the mean absolute error.
For details on the absolute error scoring function, see aerr_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean absolute error is the realised (average) score corresponding to the absolute error scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean absolute error. set.seed(12345) x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(mae(x = x, y = y)) print(mae(x = rep(x = x, times = 100), y = y))
# Compute the mean absolute error. set.seed(12345) x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(mae(x = x, y = y)) print(mae(x = rep(x = x, times = 100), y = y))
The function maelog_sf computes the MAE-LOG scoring function when
materialises and
is the predictive median functional.
The MAE-LOG scoring function is defined by eq. (11) in Patton (2011).
maelog_sf(x, y)
maelog_sf(x, y)
x |
Predictive median functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
The MAE-LOG scoring function is defined by:
Domain of function:
Range of function:
Vector of MAE-LOG losses.
For details on the MAE-LOG scoring function, see Gneiting (2011) and Patton (2011).
The median functional is the median of the probability distribution of
(Gneiting 2011).
The MAE-LOG scoring function is negatively oriented (i.e. the smaller, the better).
The MAE-LOG scoring function is strictly -consistent for the
median functional.
is the family of probability distributions
for which
exists and is finite (Thomson
1979; Saerens 2000; Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. doi:10.1016/j.jeconom.2010.03.034.
Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263–1271. doi:10.1109/72.883416.
Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360–380. doi:10.1016/0022-0531(79)90042-5.
# Compute the MAE-LOG scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$mae_log_penalty <- maelog_sf(x = df$x, y = df$y) print(df)
# Compute the MAE-LOG scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$mae_log_penalty <- maelog_sf(x = df$x, y = df$y) print(df)
The function maesd_sf computes the MAE-SD scoring function when
materialises and
is the predictive median functional.
The MAE-SD scoring function is defined by eq. (12) in Patton (2011).
maesd_sf(x, y)
maesd_sf(x, y)
x |
Predictive median functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
The MAE-SD scoring function is defined by:
Domain of function:
Range of function:
Vector of MAE-SD losses.
For details on the MAE-SD scoring function, see Gneiting (2011) and Patton (2011).
The median functional is the median of the probability distribution of
(Gneiting 2011).
The MAE-SD scoring function is negatively oriented (i.e. the smaller, the better).
The MAE-SD scoring function is strictly -consistent for the
median functional.
is the family of probability distributions
for which
exists and is finite (Thomson
1979; Saerens 2000; Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. doi:10.1016/j.jeconom.2010.03.034.
Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263–1271. doi:10.1109/72.883416.
Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360–380. doi:10.1016/0022-0531(79)90042-5.
# Compute the MAE-SD scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$mae_sd_penalty <- maesd_sf(x = df$x, y = df$y) print(df)
# Compute the MAE-SD scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$mae_sd_penalty <- maesd_sf(x = df$x, y = df$y) print(df)
The function mape computes the mean absolute percentage error when
materialises and
is the
prediction.
Mean absolute percentage error is a realised score corresponding to the absolute percentage error scoring function aperr_sf.
mape(x, y)
mape(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean absolute pecentage error is defined by:
where
and
Domain of function:
where
is the zero vector of length and the symbol
indicates pairwise
inequality.
Range of function:
Value of the mean absolute percentage error.
For details on the absolute percentage error scoring function, see aperr_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean absolute percentage error is the realised (average) score corresponding to the absolute percentage error scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean absolute percentage error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(mape(x = x, y = y)) print(mape(x = rep(x = x, times = 100), y = y))
# Compute the mean absolute percentage error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(mape(x = x, y = y)) print(mape(x = rep(x = x, times = 100), y = y))
The function mean_if computes the mean identification function , when
materialises and
is the predictive mean.
The mean identification function is defined in Table 9 in Gneiting (2011).
mean_if(x, y)
mean_if(x, y)
x |
Predictive mean (prediction). It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean identification function is defined by:
Domain of function:
Range of function:
Vector of values of the mean identification function.
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The mean identification function is a strict -identification
function for the mean functional. (Gneiting 2011; Fissler and Ziegel 2016;
Dimitriadis et al. 2024).
is the family of probability distributions
for which
exists and is finite (Gneiting 2011; Fissler and
Ziegel 2016; Dimitriadis et al. 2024).
Dimitriadis T, Fissler T, Ziegel JF (2024) Osband's principle for identification functions. Statistical Papers 65:1125–1132. doi:10.1007/s00362-023-01428-x.
Fissler T, Ziegel JF (2016) Higher order elicitability and Osband's principle. The Annals of Statistics 44(4):1680–1707. doi:10.1214/16-AOS1439.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Newey WK, Powell JL (1987) Asymmetric least squares estimation and testing. Econometrica 55(4):819–847. doi:10.2307/1911031.
# Compute the mean identification function. df <- data.frame( y = rep(x = 0, times = 3), x = c(-2, 0, 2) ) df$mean_if <- mean_if(x = df$x, y = df$y)
# Compute the mean identification function. df <- data.frame( y = rep(x = 0, times = 3), x = c(-2, 0, 2) ) df$mean_if <- mean_if(x = df$x, y = df$y)
The function meanlog_if computes the log-transformed identification function,
when materialises and
is the
predictive functional.
The log-transformed identification function is defined in Tyralis and Papacharalampous (2025).
meanlog_if(x, y)
meanlog_if(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean identification function is defined by:
Domain of function:
Range of function:
Vector of values of the log-transformed identification function.
The log-transformed identification function is a strict
-identification function for the log-transformed expectation
(Tyralis and Papacharalampous 2025).
is the family of probability distributions
for which
exists and is finite (Tyralis and
Papacharalampous 2025).
Tyralis H, Papacharalampous G (2025) Transformations of predictions and realizations in consistent scoring functions. doi:10.48550/arXiv.2502.16542.
# Compute the log-transformed identification function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$meanlog_if <- meanlog_if(x = df$x, y = df$y)
# Compute the log-transformed identification function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$meanlog_if <- meanlog_if(x = df$x, y = df$y)
The function mre computes the mean relative error when
materialises and
is the prediction.
Mean relative error is a realised score corresponding to the relative error scoring function relerr_sf.
mre(x, y)
mre(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean relative error is defined by:
where
and
Domain of function:
where
is the zero vector of length and the symbol
indicates pairwise
inequality.
Range of function:
Value of the mean relative error.
For details on the relative error scoring function, see relerr_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean relative error is the realised (average) score corresponding to the relative error scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean relative error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(mre(x = x, y = y)) print(mre(x = rep(x = x, times = 100), y = y))
# Compute the mean relative error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(mre(x = x, y = y)) print(mre(x = rep(x = x, times = 100), y = y))
The function mse computes the mean squared error when
materialises and
is the prediction.
Mean squared error is a realised score corresponding to the squared error scoring function serr_sf.
mse(x, y)
mse(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean squared error is defined by:
where
and
Domain of function:
Range of function:
Value of the mean squared error.
For details on the squared error scoring function, see serr_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean squared error is the realised (average) score corresponding to the squared error scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean squared error. set.seed(12345) x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(mse(x = x, y = y)) print(mse(x = rep(x = x, times = 100), y = y))
# Compute the mean squared error. set.seed(12345) x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(mse(x = x, y = y)) print(mse(x = rep(x = x, times = 100), y = y))
The function mspe computes the mean squared percentage error when
materialises and
is the
prediction.
Mean squared percentage error is a realised score corresponding to the squared percentage error scoring function sperr_sf.
mspe(x, y)
mspe(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean squared percentage error is defined by:
where
and
Domain of function:
where
is the zero vector of length and the symbol
indicates pairwise
inequality.
Range of function:
Value of the mean squared percentage error.
For details on the squared percentage error scoring function, see sperr_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean squared percentage error is the realised (average) score corresponding to the squared percentage error scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean squared percentage error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(mspe(x = x, y = y)) print(mspe(x = rep(x = x, times = 100), y = y))
# Compute the mean squared percentage error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(mspe(x = x, y = y)) print(mspe(x = rep(x = x, times = 100), y = y))
The function msre computes the mean squared relative error when
materialises and
is the
prediction.
Mean squared relative error is a realised score corresponding to the squared relative error scoring function srelerr_sf.
msre(x, y)
msre(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean squared relative error is defined by:
where
and
Domain of function:
where
is the zero vector of length and the symbol
indicates pairwise
inequality.
Range of function:
Value of the mean squared relative error.
For details on the squared relative error scoring function, see srelerr_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The mean squared relative error is the realised (average) score corresponding to the squared relative error scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean squared relative error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(msre(x = x, y = y)) print(msre(x = rep(x = x, times = 100), y = y))
# Compute the mean squared relative error. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, mean = 0, sdlog = 1) print(msre(x = x, y = y)) print(msre(x = rep(x = x, times = 100), y = y))
The function mv_if computes the mean - variance identification function, when
materialises,
is the predictive mean and
is the
predictive variance.
The mean - variance identification function is defined in proposition (3.11) in Fissler and Ziegel (2019).
mv_if(x1, x2, y)
mv_if(x1, x2, y)
x1 |
Predictive mean (prediction). It can be a vector of length |
x2 |
Predictive variance (prediction). It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean - variance identification function is defined by:
Domain of function:
Matrix of mean - variance values of the identification function.
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The variance functional is the variance
of the probability distribution
of
(Gneiting 2011)
The mean - variance identification function is a strict
-identification function for the pair (mean, variance)
functional (Gneiting 2011; Fissler and Ziegel 2019; Dimitriadis et al. 2024).
is the family of probability distributions
for which
and
exist and are finite
(Gneiting 2011; Fissler and Ziegel 2019; Dimitriadis et al. 2024).
Dimitriadis T, Fissler T, Ziegel JF (2024) Osband's principle for identification functions. Statistical Papers 65:1125–1132. doi:10.1007/s00362-023-01428-x.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the mean - variance identification function. df <- data.frame( y = rep(x = 0, times = 6), x1 = c(2, 2, -2, -2, 0, 0), x2 = c(1, 2, 1, 2, 1, 2) ) v <- as.data.frame(mv_if(x1 = df$x1, x2 = df$x2, y = df$y)) print(cbind(df, v))
# Compute the mean - variance identification function. df <- data.frame( y = rep(x = 0, times = 6), x1 = c(2, 2, -2, -2, 0, 0), x2 = c(1, 2, 1, 2, 1, 2) ) v <- as.data.frame(mv_if(x1 = df$x1, x2 = df$x2, y = df$y)) print(cbind(df, v))
The function mv_sf computes the mean - variance scoring function, when
materialises,
is the predictive mean and
is the predictive
variance.
The mean - variance scoring function is defined by eq. (3.11) in Fissler and Ziegel (2019).
mv_sf(x1, x2, y)
mv_sf(x1, x2, y)
x1 |
Predictive mean (prediction). It can be a vector of length |
x2 |
Predictive variance (prediction). It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The mean - variance scoring function is defined by:
Domain of function:
Vector of mean - variance losses.
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The variance functional is the variance
of the probability distribution
of
(Gneiting 2011)
The mean - variance scoring function is negatively oriented (i.e. the smaller, the better).
The mean - variance scoring function is strictly consistent for the pair (mean, variance) functional (Osband 1985, p.9; Gneiting 2011; Fissler and Ziegel 2019).
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Osband KH (1985) Providing Incentives for Better Cost Forecasting. PhD thesis, University of California, Berkeley. doi:10.5281/zenodo.4355667.
# Compute the mean - variance scoring function. df <- data.frame( y = rep(x = 0, times = 6), x1 = c(2, 2, -2, -2, 0, 0), x2 = c(1, 2, 1, 2, 1, 2) ) df$mv_penalty <- mv_sf(x1 = df$x1, x2 = df$x2, y = df$y) print(df)
# Compute the mean - variance scoring function. df <- data.frame( y = rep(x = 0, times = 6), x1 = c(2, 2, -2, -2, 0, 0), x2 = c(1, 2, 1, 2, 1, 2) ) df$mv_penalty <- mv_sf(x1 = df$x1, x2 = df$x2, y = df$y) print(df)
-th moment identification function
The function nmoment_if computes the -th moment identification function,
when
materialises and
is the predictive
-th moment.
The expectile identification function is defined in Table 9 in Gneiting (2011)
by setting and
.
nmoment_if(x, y, n)
nmoment_if(x, y, n)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
n |
|
The -th moment identification function is defined by:
Domain of function:
Vector of values of the -th moment identification function.
The -th moment functional is the expectation
of the probability distribution
of
.
The -th moment identification function is a strict
-identification function for the
-th moment functional
(Gneiting 2011; Fissler and Ziegel 2016).
is the family of probability distributions
for which
exists and is finite (Gneiting 2011; Fissler and
Ziegel 2016).
Fissler T, Ziegel JF (2016) Higher order elicitability and Osband's principle. The Annals of Statistics 44(4):1680–1707. doi:10.1214/16-AOS1439.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# 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_if <- nmoment_if(x = df$x, y = df$y, n = df$n) print(df)
# 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_if <- nmoment_if(x = df$x, y = df$y, n = df$n) print(df)
-th moment scoring function
The function nmoment_sf computes the -th moment scoring function, when
materialises, and
is the predictive
-th moment.
The -th moment scoring function is defined by eq. (22) in Gneiting (2011)
by setting
,
,
and removing
all terms that are not functions of
.
nmoment_sf(x, y, n)
nmoment_sf(x, y, n)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
n |
|
The -th moment scoring function is defined by:
Domain of function:
Vector of -th moment losses.
The -th moment functional is the expectation
of the probability distribution
of
.
The -th moment scoring function is negatively oriented (i.e. the smaller,
the better).
The -th moment scoring function is strictly
-consistent
for the
-th moment functional
(Theorem 8 in Gneiting 2011).
is the family of probability
distributions
for which
,
,
and
exist and are finite (Theorem 8 in Gneiting
2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# 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)
# 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)
The function nse computes the Nash-Sutcliffe efficiency when
materialises and
is the
prediction.
Nash-Sutcliffe efficiency is a skill score corresponding to the squared error scoring function serr_sf. It is defined in eq. (3) in Nash and Sutcliffe (1970).
nse(x, y)
nse(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
The Nash-Sutcliffe efficiency is defined by:
where
and the predictions of the method of interest as well as the reference method are evaluated respectively by:
Domain of function:
Range of function:
Value of the Nash-Sutcliffe efficiency.
For details on the squared error scoring function, see serr_sf.
The concept of skill scores is defined by Gneiting (2011).
The Nash-Sutcclife efficiency is defined in eq. (3) in Nash and Sutcliffe (1970).
The Nash-Sutcclife efficiency is positevely oriented (i.e. the larger, the better).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Nash JE, Sutcliffe JV (1970) River flow forecasting through conceptual models part I - A discussion of principles. Journal of Hydrology 10(3):282–290. doi:10.1016/0022-1694(70)90255-6.
# Compute the Nash-Sutcliffe efficiency. set.seed(12345) x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(nse(x = x, y = y)) print(nse(x = rep(x = x, times = 100), y = y)) print(nse(x = mean(y), y = y)) print(nse(x = y, y = y))
# Compute the Nash-Sutcliffe efficiency. set.seed(12345) x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(nse(x = x, y = y)) print(nse(x = rep(x = x, times = 100), y = y)) print(nse(x = mean(y), y = y)) print(nse(x = y, y = y))
The function obsweighted_sf computes the observation-weighted scoring function
when materialises and
is the predictive
functional.
The observation-weighted scoring function is defined in p. 752 in Gneiting (2011).
obsweighted_sf(x, y)
obsweighted_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The observation-weighted scoring function is defined by:
Domain of function:
Range of function:
Vector of observation-weighted errors.
For details on the observation-weighted scoring function, see Gneiting (2011).
The observation-weighted scoring function is negatively oriented (i.e. the smaller, the better).
The observation-weighted scoring function is strictly consistent for the
functional.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the observation-weighted scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squared_relative_error <- obsweighted_sf(x = df$x, y = df$y) print(df)
# Compute the observation-weighted scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squared_relative_error <- obsweighted_sf(x = df$x, y = df$y) print(df)
The function quantile_if computes the quantile identification function at a
specific level , when
materialises and
is the predictive
quantile at level
.
The quantile identification function is defined in Table 9 in Gneiting (2011).
quantile_if(x, y, p)
quantile_if(x, y, p)
x |
Predictive quantile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The quantile identification function is defined by:
Domain of function:
Range of function:
Vector of values of the quantile identification function.
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The quantile identification function is a strict
-identification function for the
-quantile functional
(Gneiting 2011; Fissler and Ziegel 2016; Dimitriadis et al. 2024).
is the family of probability distributions
for which
there exists an
with
(Gneiting 2011; Fissler and Ziegel
2016; Dimitriadis et al. 2024).
Dimitriadis T, Fissler T, Ziegel JF (2024) Osband's principle for identification functions. Statistical Papers 65:1125–1132. doi:10.1007/s00362-023-01428-x.
Fissler T, Ziegel JF (2016) Higher order elicitability and Osband's principle. The Annals of Statistics 44(4):1680–1707. doi:10.1214/16-AOS1439.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33–50. doi:10.2307/1913643.
# Compute the quantile identification function. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$quantile_if <- quantile_if(x = df$x, y = df$y, p = df$p)
# Compute the quantile identification function. df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$quantile_if <- quantile_if(x = df$x, y = df$y, p = df$p)
The function quantile_level computes the sample quantile level, when
materialises and
is the
predictive quantile at level
.
quantile_level(x, y)
quantile_level(x, y)
x |
Predictive quantile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
The sample quantile level function is defined by:
where
and
Domain of function:
Value of the sample quantile level.
The sample quantile level is directly related to the quantile identification function quantile_if.
If materialises and
is the
predictive quantile at level
, then ideally, the sample quantile level
should be equal to the nominal quantile level
.
# Compute the sample quantile level. set.seed(12345) x <- qnorm(p = 0.75, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) y <- rnorm(n = 1000, mean = 0, sd = 1) print(quantile_level(x = x, y = y))
# Compute the sample quantile level. set.seed(12345) x <- qnorm(p = 0.75, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) y <- rnorm(n = 1000, mean = 0, sd = 1) print(quantile_level(x = x, y = y))
The function quantile_rs computes the realised quantile score at a specific
level when
materialises and
is the prediction.
Realised quantile score is a realised score corresponding to the quantile scoring function quantile_sf.
quantile_rs(x, y, p)
quantile_rs(x, y, p)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The realized quantile score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised quantile score.
For details on the quantile scoring function, see quantile_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised quantile score is the realised (average) score corresponding to the quantile scoring function.
Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166–1211. doi:10.1214/19-EJS1552.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the realised quantile score. set.seed(12345) x <- qnorm(p = 0.7, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) y <- rnorm(n = 1000, mean = 0, sd = 1) print(quantile_rs(x = x, y = y, p = 0.7)) print(quantile_rs(x = rep(x = x, times = 1000), y = y, p = 0.7)) print(quantile_rs(x = rep(x = x, times = 1000) - 0.1, y = y, p = 0.7))
# Compute the realised quantile score. set.seed(12345) x <- qnorm(p = 0.7, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) y <- rnorm(n = 1000, mean = 0, sd = 1) print(quantile_rs(x = x, y = y, p = 0.7)) print(quantile_rs(x = rep(x = x, times = 1000), y = y, p = 0.7)) print(quantile_rs(x = rep(x = x, times = 1000) - 0.1, y = y, p = 0.7))
The function quantile_sf computes the asymmetric piecewise linear scoring
function (quantile scoring function) at a specific level , when
materialises and
is the predictive quantile at level
.
The asymmetric piecewise linear scoring function is defined by eq. (24) in Gneiting (2011).
quantile_sf(x, y, p)
quantile_sf(x, y, p)
x |
Predictive quantile (prediction) at level |
y |
Realisation (true value) of process. It can be a vector of length
|
p |
It can be a vector of length |
The assymetric piecewise linear scoring function is defined by:
or equivalently,
Domain of function:
Range of function:
Vector of quantile losses.
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The asymmetric piecewise linear scoring function is negatively oriented (i.e. the smaller, the better).
The asymmetric piecewise linear scoring function is strictly
-consistent for the
-quantile functional.
is the family of probability distributions
for which
exists and is finite (Schlaifer 1961, p.196; Ferguson
1967, p.51; Thomson 1979; Saerens 2000; Gneiting 2011).
Ferguson TS (1967) Mathematical Statistics: A Decision-Theoretic Approach. Academic Press, New York.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33–50. doi:10.2307/1913643.
Raiffa H,Schlaifer R (1961) Applied Statistical Decision Theory. Colonial Press, Clinton.
Saerens M (2000) Building cost functions minimizing to some summary statistics. IEEE Transactions on Neural Networks 11(6):1263–1271. doi:10.1109/72.883416.
Thomson W (1979) Eliciting production possibilities from a well-informed manager. Journal of Economic Theory 20(3):360–380. doi:10.1016/0022-0531(79)90042-5.
# Compute the asymmetric piecewise linear scoring function (quantile scoring # function). df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$quantile_penalty <- quantile_sf(x = df$x, y = df$y, p = df$p) print(df) # The absolute error scoring function is twice the asymmetric piecewise linear # scoring function (quantile scoring function) at level p = 0.5. df <- data.frame( y = rep(x = 0, times = 3), x = c(-2, 0, 2), p = rep(x = c(0.5), times = 3) ) df$quantile_penalty <- quantile_sf(x = df$x, y = df$y, p = df$p) df$absolute_error <- aerr_sf(x = df$x, y = df$y) print(df)
# Compute the asymmetric piecewise linear scoring function (quantile scoring # function). df <- data.frame( y = rep(x = 0, times = 6), x = c(2, 2, -2, -2, 0, 0), p = rep(x = c(0.05, 0.95), times = 3) ) df$quantile_penalty <- quantile_sf(x = df$x, y = df$y, p = df$p) print(df) # The absolute error scoring function is twice the asymmetric piecewise linear # scoring function (quantile scoring function) at level p = 0.5. df <- data.frame( y = rep(x = 0, times = 3), x = c(-2, 0, 2), p = rep(x = c(0.5), times = 3) ) df$quantile_penalty <- quantile_sf(x = df$x, y = df$y, p = df$p) df$absolute_error <- aerr_sf(x = df$x, y = df$y) print(df)
The function relerr_sf computes the relative error scoring function when
materialises and
is the predictive
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)
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:
Domain of function:
Range of function:
Vector of relative errors.
For details on the relative error scoring function, see Gneiting (2011).
The -median functional,
is the
median of a probability distribution whose density is proportional to
, where
is the density of the probability distribution
of
(Gneiting 2011).
The relative error scoring function is negatively oriented (i.e. the smaller, the better).
The relative error scoring function is strictly -consistent for the
functional.
is the family of
probability distributions for which
exists and is
finite.
is the subclass of probability distributions in
, which are such that
,
has finite
integral over
, and the probability distribution
with density proportional to
belongs to
(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. doi:10.1198/jasa.2011.r10138.
Patton AJ (2011) Volatility forecast comparison using imperfect volatility proxies. Journal of Econometrics 160(1):246–256. doi:10.1016/j.jeconom.2010.03.034.
# 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)
# 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)
The function serr_sf computes the squared error scoring function when
materialises and
is the predictive mean functional.
The squared error scoring function is defined in Table 1 in Gneiting (2011).
serr_sf(x, y)
serr_sf(x, y)
x |
Predictive mean functional (prediction). It can be a vector of length
|
y |
Realisation (true value) of process. It can be a vector of length
|
The squared error scoring function is defined by:
Domain of function:
Range of function:
Vector of squared errors.
For details on the squared error scoring function, see Savage (1971), Gneiting (2011).
The mean functional is the mean of the probability
distribution
of
(Gneiting 2011).
The squared error scoring function is negatively oriented (i.e. the smaller, the better).
The squared error scoring function is strictly -consistent for
the mean functional.
is the family of probability distributions
for which the second moment exists and is finite (Savage 1971;
Gneiting 2011).
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Savage LJ (1971) Elicitation of personal probabilities and expectations. Journal of the American Statistical Association 66(337):783–810. doi:10.1080/01621459.1971.10482346.
# Compute the squarer error scoring function. df <- data.frame( y = rep(x = 0, times = 5), x = -2:2 ) df$squared_error <- serr_sf(x = df$x, y = df$y) print(df)
# Compute the squarer error scoring function. df <- data.frame( y = rep(x = 0, times = 5), x = -2:2 ) df$squared_error <- serr_sf(x = df$x, y = df$y) print(df)
The function serrexp_sf computes the squared error exp scoring function when
materialises and
is the
predictive entropic risk measure (Gerber 1974).
The squared error exp scoring function is defined in Fissler and Pesenti (2023).
serrexp_sf(x, y, a)
serrexp_sf(x, y, a)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
a |
It can be a vector of length |
The squared error exp scoring function is defined by:
Domain of function:
Range of function:
Vector of squared errors of exp-transformed variables.
For details on the squared error exp scoring function, see Fissler and Pesenti (2023).
The squared error exp scoring function is negatively oriented (i.e. the smaller, the better).
The squared error exp scoring function is strictly -consistent
for the
entropic risk measure
functional.
is the family of probability distributions
for which
exists and is finite (Fissler and
Pesenti 2023; Tyralis and Papacharalampous 2025).
Fissler T, Pesenti SM (2023) Sensitivity measures based on scoring functions. European Journal of Operational Research 307(3):1408–1423. doi:10.1016/j.ejor.2022.10.002.
Gerber HU (1974) On additive premium calculation principles. ASTIN Bulletin: The Journal of the IAA 7(3):215–222. doi:10.1017/S0515036100006061.
Tyralis H, Papacharalampous G (2025) Transformations of predictions and realizations in consistent scoring functions. doi:10.48550/arXiv.2502.16542.
# Compute the squarer error exp scoring function. df <- data.frame( y = rep(x = 0, times = 5), x = -2:2, a = c(-2, -1, 1, 2, 3) ) df$squaredexp_error <- serrexp_sf(x = df$x, y = df$y, a = df$a) print(df)
# Compute the squarer error exp scoring function. df <- data.frame( y = rep(x = 0, times = 5), x = -2:2, a = c(-2, -1, 1, 2, 3) ) df$squaredexp_error <- serrexp_sf(x = df$x, y = df$y, a = df$a) print(df)
The function serrlog_sf computes the squared error log scoring function when
materialises and
is the
predictive functional.
The squared error log scoring function is defined in Houghton-Carr (1999).
serrlog_sf(x, y)
serrlog_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The squared error scoring function is defined by:
Domain of function:
Range of function:
Vector of squared errors of log-transformed variables.
For details on the squared error log scoring function, see Houghton-Carr (1999).
The squared error log scoring function is negatively oriented (i.e. the smaller, the better).
The squared error log scoring function is strictly -consistent
for the
functional.
is
the family of probability distributions
for which
exists and is finite (Tyralis and
Papacharalampous 2025).
Houghton-Carr HA (1999) Assessment criteria for simple conceptual daily rainfall-runoff models. Hydrological Sciences Journal 44(2):237–261. doi:10.1080/02626669909492220.
Tyralis H, Papacharalampous G (2025) Transformations of predictions and realizations in consistent scoring functions. doi:10.48550/arXiv.2502.16542.
# Compute the squarer error log scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squaredlog_error <- serrlog_sf(x = df$x, y = df$y) print(df)
# Compute the squarer error log scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squaredlog_error <- serrlog_sf(x = df$x, y = df$y) print(df)
The function serrpower_sf computes the squared error of power transformations
scoring function when materialises and
is the
predictive functional.
The squared error of power transformations scoring function is defined in Tyralis and Papacharalampous (2025).
serrpower_sf(x, y, a)
serrpower_sf(x, y, a)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
a |
It can be a vector of length |
The squared error of power transformations scoring function is defined by:
Domain of function:
Case #1
Case #2
Range of function:
Vector of squared errors of power-transformed variables.
For details on the squared error of power tranformations scoring function, see Tyralis and Papacharalampous (2025).
The squared error of power tranformations scoring function is negatively oriented (i.e. the smaller, the better).
The squared error of power transformations scoring function is strictly
-consistent for the
functional.
is the family of probability distributions
for which
exists and is finite (Tyralis and
Papacharalampous 2025).
Tyralis H, Papacharalampous G (2025) Transformations of predictions and realizations in consistent scoring functions. doi:10.48550/arXiv.2502.16542.
# Compute the squarer error of power tranformations scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = 1:3 ) df$squaredpower_error <- serrpower_sf(x = df$x, y = df$y, a = df$a) print(df)
# Compute the squarer error of power tranformations scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = 1:3 ) df$squaredpower_error <- serrpower_sf(x = df$x, y = df$y, a = df$a) print(df)
The function serrsq_sf computes the squared error of squares scoring function
when materialises and
is the
predictive functional.
The squared error of squares scoring function is defined in Thirel et al. (2024).
serrsq_sf(x, y)
serrsq_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The squared error of squares scoring function is defined by:
Domain of function:
Range of function:
Vector of squared errors of squared-transformed variables.
For details on the squared error of squares scoring function, see Thirel et al. (2024).
The squared error of squares scoring function is negatively oriented (i.e. the smaller, the better).
The squared error of squares scoring function is strictly
-consistent for the
functional.
is the family of probability distributions
for which
exists and is finite (Tyralis and
Papacharalampous 2025).
Thirel G, Santos L, Delaigue O, Perrin C (2024) On the use of streamflow transformations for hydrological model calibration. Hydrology and Earth System Sciences 28(21):4837–4860. doi:10.5194/hess-28-4837-2024.
Tyralis H, Papacharalampous G (2025) Transformations of predictions and realizations in consistent scoring functions. doi:10.48550/arXiv.2502.16542.
# Compute the squarer error of squares scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squaredsq_error <- serrsq_sf(x = df$x, y = df$y) print(df)
# Compute the squarer error of squares scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squaredsq_error <- serrsq_sf(x = df$x, y = df$y) print(df)
The function sperr_sf computes the squared percentage error scoring function
when materialises and
is the predictive
functional.
The squared percentage error scoring function is defined in p. 752 in Gneiting (2011).
sperr_sf(x, y)
sperr_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The squared percentage error scoring function is defined by:
Domain of function:
Range of function:
Vector of squared percentage errors.
For details on the squared percentage error scoring function, see Park and Stefanski (1998) and Gneiting (2011).
The squared percentage error scoring function is negatively oriented (i.e. the smaller, the better).
The squared percentage error scoring function is strictly consistent for the
functional.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
Park H, Stefanski LA (1998) Relative-error prediction. Statistics and Probability Letters 40(3):227–236. doi:10.1016/S0167-7152(98)00088-1.
# Compute the squared percentage error scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squared_percentage_error <- sperr_sf(x = df$x, y = df$y) print(df)
# Compute the squared percentage error scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squared_percentage_error <- sperr_sf(x = df$x, y = df$y) print(df)
The function srelerr_sf computes the squared relative error scoring function
when materialises and
is the predictive
functional.
The squared relative error scoring function is defined in p. 752 in Gneiting (2011).
srelerr_sf(x, y)
srelerr_sf(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The squared relative error scoring function is defined by:
Domain of function:
Range of function:
Vector of squared relative errors.
For details on the squared relative error scoring function, see Gneiting (2011).
The squared relative error scoring function is negatively oriented (i.e. the smaller, the better).
The squared relative error scoring function is strictly consistent for the
functional.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
# Compute the squared percentage error scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squared_relative_error <- srelerr_sf(x = df$x, y = df$y) print(df)
# Compute the squared percentage error scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$squared_relative_error <- srelerr_sf(x = df$x, y = df$y) print(df)