| Title: | Loss Functions for Assessing Point Forecasts |
|---|---|
| Description: | Implements consistent loss functions and the corresponding identification functions for point forecasts, including those of the mean, the median, quantiles, expectiles, moments and Huber functionals (Gneiting T (2011) <doi:10.1198/jasa.2011.r10138>; Fissler T, Ziegel JF (2016) <doi:10.1214/16-AOS1439>). Pointwise losses and realised average scores are both available. Detailed documentation of the functions' properties is included for facilitating the interpretation of results. |
| Authors: | Hristos Tyralis [aut, cre] (ORCID: <https://orcid.org/0000-0002-8932-4997>), Georgia Papacharalampous [aut] (ORCID: <https://orcid.org/0000-0001-5446-954X>) |
| Maintainer: | Hristos Tyralis <[email protected]> |
| License: | GPL-3 |
| Version: | 1.2 |
| Built: | 2026-09-29 12:54:42 UTC |
| Source: | https://github.com/cran/scoringfunctions |
The scoringfunctions package implements consistent scoring (loss) functions and identification functions.
The table below lists a selection of predictive functionals alongside their
pointwise scoring functions (_sf) / realised average scores
(_rs), and identification functions (_if). The complete listing
of the package functions is given in the numbered sections below the table:
| Target Functional | Loss Functions (_sf / _rs)
|
Identification (_if) |
| Mean | serr_sf / mse,
bregman1_sf / bregman1_rs
|
mean_if |
bregman2_sf / bregman2_rs,
bregman3_sf / qlike
|
||
bregman4_sf / bregman4_rs |
||
Expectile ()
|
expectile_sf / expectile_rs
|
expectile_if |
| Median | aerr_sf / mae,
maelog_sf / maelog_rs
|
quantile_if () |
maesd_sf / maesd_rs |
||
-Median |
bmedian_sf / bmedian_rs
|
--- |
Quantile ()
|
quantile_sf / quantile_rs,
gpl1_sf / gpl1_rs
|
quantile_if |
gpl2_sf / gpl2_rs |
||
| Huber Mean | huber_sf / huber_rs
|
hubermean_if |
| Huber Quantile | ghuber_sf / ghuber_rs
|
huberquantile_if |
-Mean |
lqmean_sf / lqmean_rs
|
--- |
-Quantile
|
lqquantile_sf / lqquantile_rs
|
--- |
Interval () |
interval_sf |
--- |
| Mean - Variance | mv_sf |
mv_if |
| Error - Spread | errorspread_sf |
--- |
| Relative Error | relerr_sf / mre |
--- |
| Percentage Error | aperr_sf / mape |
--- |
The package functions are categorised into six classes, each of which has its own section below:
Scoring functions
Realised (average) score functions
Skill score functions
Identification functions
Functions for sample levels
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
powerweighted_sf: Power-weighted squared error 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
bregman1_rs: Realised Bregman score (type 1)
bregman2_rs: Realised Bregman score (type 2, Patton score)
bregman4_rs: Realised Bregman score (type 4, Patton score)
mse: Mean squared error (MSE)
qlike: QLIKE
expectile_rs: Realised expectile score
mae: Mean absolute error (MAE)
maelog_rs: Realised MAE-LOG score
maesd_rs: Realised MAE-SD score
gpl1_rs: Realised generalized piecewise linear power score
(type 1)
gpl2_rs: Realised generalized piecewise linear power score
(type 2)
quantile_rs: Realised quantile score
ghuber_rs: Realised generalized Huber score
huber_rs: Realised Huber score
bmedian_rs: Realised -median score
linex_rs: Realised LINEX score
lqmean_rs: Realised -mean score
lqquantile_rs: Realised -quantile score
mape: Mean absolute percentage error (MAPE)
mre: Mean relative error (MRE)
mspe: Mean squared percentage error (MSPE)
msre: Mean squared relative error (MSRE)
nmoment_rs: Realised -th moment score
obsweighted_rs: Realised observation-weighted score
serrexp_rs: Realised squared error exp score
serrlog_rs: Realised squared error log score
serrpower_rs: Realised squared error of power
transformations score
serrsq_rs: Realised squared error of squares score
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
meanexp_if: Exp-transformed identification function
meanlog_if: Log-transformed identification function
meanpower_if: Power-transformed identification function
nmoment_if: -th moment identification function
powerweighted_if: Power-weighted identification function
quantile_if: Quantile identification function
mv_if: Mean - variance identification function
quantile_level: Sample quantile level function
capping_function: Capping function
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.
Bellini F, Klar B, Muller A, Rosazza Gianin E (2014) Generalized quantiles as risk measures. Insurance: Mathematics and Economics 54:41–48. doi:10.1016/j.insmatheco.2013.10.015.
Brehmer JR, Gneiting T (2021) Scoring interval forecasts: Equal-tailed, shortest, and modal interval. Bernoulli 27(3):1993–2010. doi:10.3150/20-BEJ1298.
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.
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.
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.
Dunsmore IR (1968) A Bayesian approach to calibration. Journal of the Royal Statistical Society, Series B (Methodological) 30(2):396–405. doi:10.1111/j.2517-6161.1968.tb00740.x.
Ferguson TS (1967) Mathematical Statistics: A Decision-Theoretic Approach. Academic Press, New York.
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.
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.
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.
Gerber HU (1974) On additive premium calculation principles. ASTIN Bulletin: The Journal of the IAA 7(3):215–222. doi:10.1017/S0515036100006061.
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746–762. doi:10.1198/jasa.2011.r10138.
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.
Houghton-Carr HA (1999) Assessment criteria for simple conceptual daily rainfall-runoff models. Hydrological Sciences Journal 44(2):237–261. doi:10.1080/02626669909492220.
Huber PJ (1964) Robust estimation of a location parameter. Annals of Mathematical Statistics 35(1):73–101. doi:10.1214/aoms/1177703732.
Koenker R, Bassett Jr G (1978) Regression quantiles. Econometrica 46(1):33–50. doi:10.2307/1913643.
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.
Newey WK, Powell JL (1987) Asymmetric least squares estimation and testing. Econometrica 55(4):819–847. doi:10.2307/1911031.
Park H, Stefanski LA (1998) Relative-error prediction. Statistics and Probability Letters 40(3):227–236. doi:10.1016/S0167-7152(98)00088-1.
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.
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.
Savage LJ (1971) Elicitation of personal probabilities and expectations. Journal of the American Statistical Association 66(336):783–801. doi:10.1080/01621459.1971.10482346.
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16(1):201–231. doi:10.1214/21-EJS1957.
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.
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.
Tyralis H, Papacharalampous G (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
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.
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.
Yeh C-C, Yeh H-W, Chan W (2008) Some equivalent forms of the arithematic-geometric mean inequality in probability: A survey. Journal of Inequalities and Applications 2008:386715. doi:10.1155/2008/386715.
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.
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 functional elicited by the absolute
percentage error scoring function is the -median at
, whose density is proportional to
(p. 752 in Gneiting 2011). The -median functional at general
is elicited by bmedian_sf.
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 score
The function bmedian_rs computes the realised -median score with
parameter , when materialises and
is the prediction.
Realised -median score is a realised score corresponding to the
-median scoring function bmedian_sf.
bmedian_rs(x, y, b)bmedian_rs(x, y, b)
x |
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 scalar. |
The realised -median score 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 realised -median score.
For details on the -median scoring function, see bmedian_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised -median score is the realised (average) score
corresponding to the -median 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 beta-median score. set.seed(12345) b <- 2 x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(bmedian_rs(x = x, y = y, b = b)) print(bmedian_rs(x = rep(x = x, times = 100), y = y, b = b))# Compute the realised beta-median score. set.seed(12345) b <- 2 x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(bmedian_rs(x = x, y = y, b = b)) print(bmedian_rs(x = rep(x = x, times = 100), y = y, b = b))
-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 |
The parameter |
The -median scoring function is defined by, with :
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_rs computes the realised Bregman score (type 1) with
parameter , when materialises and
is the prediction.
Realised Bregman score (type 1) is a realised score corresponding to the Bregman scoring function (type 1) bregman1_sf.
bregman1_rs(x, y, a)bregman1_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 scalar. |
The realised Bregman score (type 1) is defined by:
where
and
Domain of function:
Range of function:
Value of the realised Bregman score (type 1).
For details on the Bregman scoring function (type 1), see bregman1_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised Bregman score (type 1) is the realised (average) score corresponding to the Bregman scoring function (type 1).
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 Bregman score (type 1). set.seed(12345) a <- 3 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(bregman1_rs(x = x, y = y, a = a)) print(bregman1_rs(x = rep(x = x, times = 100), y = y, a = a))# Compute the realised Bregman score (type 1). set.seed(12345) a <- 3 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(bregman1_rs(x = x, y = y, a = a)) print(bregman1_rs(x = rep(x = x, times = 100), y = y, a = a))
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 named type 1 because 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(336):783–801. 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[1]) 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 = n, min = -20, max = 20) y <- runif(n = n, min = -20, max = 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[1]) 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 = n, min = -20, max = 20) y <- runif(n = n, min = -20, max = 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_rs computes the realised Bregman score (type 2, Patton
score) with parameter , when materialises and
is the prediction.
Realised Bregman score (type 2) is a realised score corresponding to the Bregman scoring function (type 2, Patton scoring function) bregman2_sf.
bregman2_rs(x, y, b)bregman2_rs(x, y, b)
x |
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 scalar. |
The realised Bregman score (type 2) 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 realised Bregman score (type 2).
For details on the Bregman scoring function (type 2), see bregman2_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised Bregman score (type 2) is the realised (average) score corresponding to the Bregman scoring function (type 2).
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 Bregman score (type 2). set.seed(12345) b <- 3 x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(bregman2_rs(x = x, y = y, b = b)) print(bregman2_rs(x = rep(x = x, times = 100), y = y, b = b))# Compute the realised Bregman score (type 2). set.seed(12345) b <- 3 x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(bregman2_rs(x = x, y = y, b = b)) print(bregman2_rs(x = rep(x = x, times = 100), y = y, b = b))
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 named type 2 because 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(336):783–801. 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) equals 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) equals 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 named type 3 because 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(336):783–801. 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_rs computes the realised Bregman score (type 4, Patton
score) when materialises and
is the prediction.
Realised Bregman score (type 4) is a realised score corresponding to the Bregman scoring function (type 4, Patton scoring function) bregman4_sf.
bregman4_rs(x, y)bregman4_rs(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 realised Bregman score (type 4) 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 realised Bregman score (type 4).
For details on the Bregman scoring function (type 4), see bregman4_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised Bregman score (type 4) is the realised (average) score corresponding to the Bregman scoring function (type 4).
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 Bregman score (type 4). set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(bregman4_rs(x = x, y = y)) print(bregman4_rs(x = rep(x = x, times = 100), y = y))# Compute the realised Bregman score (type 4). set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(bregman4_rs(x = x, y = y)) print(bregman4_rs(x = rep(x = x, times = 100), y = y))
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 named type 4 because 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(336):783–801. 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:
Range of function:
Vector of values of the capping function.
For the definition of the capping function, see Taggart (2022), p.205.
Taggart (2022), p.205 admits the endpoints and
, at which the corresponding cap is removed; the examples below
include those cases.
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16(1):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:
Range 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 consistent for the triple (mean,
variance, skewness) functional. is the family of probability
distributions for which exists and is
finite (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) print(df)# 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) print(df)
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 scalar. |
The realised 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
and exist and are 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_rs computes the realised generalized Huber score at a
specific level and parameters and , when
materialises and is the
prediction.
Realised generalized Huber score is a realised score corresponding to the generalized Huber scoring function ghuber_sf.
ghuber_rs(x, y, p, a, b)ghuber_rs(x, y, p, a, b)
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 scalar. |
a |
It can be a value. |
b |
It can be a value. |
The realised generalized Huber score is defined by:
where
and
where
and is the capping function defined by:
Domain of function:
Range of function:
Value of the realised generalized Huber score.
For details on the generalized Huber scoring function, see ghuber_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised generalized Huber score is the realised (average) score corresponding to the generalized 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 realised generalized Huber score. set.seed(12345) p <- 0.7 a <- 0.5 b <- 0.5 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(ghuber_rs(x = x, y = y, p = p, a = a, b = b)) print(ghuber_rs(x = rep(x = x, times = 100), y = y, p = p, a = a, b = b))# Compute the realised generalized Huber score. set.seed(12345) p <- 0.7 a <- 0.5 b <- 0.5 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(ghuber_rs(x = x, y = y, p = p, a = a, b = b)) print(ghuber_rs(x = rep(x = x, times = 100), y = y, p = p, a = a, b = b))
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 (2022).
Definition 3.3 in Taggart (2022) is given for finite and
. The endpoints and are admitted
here through the capping function, which is defined on at
p.205 in Taggart (2022); at the function equals
expectile_sf, the limit of part 5 of proposition 3.4
in Taggart (2022).
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(1):201–231. doi:10.1214/21-EJS1957.
# Compute the generalized Huber scoring function. set.seed(12345) n <- 10 df <- data.frame( x = runif(n = n, min = -2, max = 2), y = runif(n = n, min = -2, max = 2), p = runif(n = n, min = 0, max = 1), a = runif(n = n, min = 0, max = 1), b = runif(n = n, min = 0, max = 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 = n, min = -20, max = 20) y <- runif(n = n, min = -20, max = 20) p <- runif(n = n, min = 0, max = 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 = n, min = -20, max = 20) y <- runif(n = n, min = -20, max = 20) p <- rep(x = 1/2, times = n) a <- runif(n = n, min = 0, max = 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 = n, min = -2, max = 2), y = runif(n = n, min = -2, max = 2), p = runif(n = n, min = 0, max = 1), a = runif(n = n, min = 0, max = 1), b = runif(n = n, min = 0, max = 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 = n, min = -20, max = 20) y <- runif(n = n, min = -20, max = 20) p <- runif(n = n, min = 0, max = 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 = n, min = -20, max = 20) y <- runif(n = n, min = -20, max = 20) p <- rep(x = 1/2, times = n) a <- runif(n = n, min = 0, max = 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_rs computes the realised generalized piecewise linear power
score (type 1) at a specific level and parameter , when
materialises and is the
prediction.
Realised generalized piecewise linear power score (type 1) is a realised score corresponding to the generalized piecewise linear power scoring function (type 1) gpl1_sf.
gpl1_rs(x, y, p, b)gpl1_rs(x, y, p, b)
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 scalar. |
b |
It can be a scalar. |
The realised generalized piecewise linear power score (type 1) 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 realised generalized piecewise linear power score (type 1).
For details on the generalized piecewise linear power scoring function (type 1), see gpl1_sf.
The parameter is restricted to , where , because
is strictly increasing only for , as required by
Theorem 9(b) in Gneiting (2011). See gpl1_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised generalized piecewise linear power score (type 1) is the realised (average) score corresponding to the generalized piecewise linear power scoring function (type 1).
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 generalized piecewise linear power score (type 1). set.seed(12345) p <- 0.7 b <- 2 x <- qlnorm(p = p, meanlog = 0, sdlog = 1) y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(gpl1_rs(x = x, y = y, p = p, b = b)) print(gpl1_rs(x = rep(x = x, times = 100), y = y, p = p, b = b))# Compute the realised generalized piecewise linear power score (type 1). set.seed(12345) p <- 0.7 b <- 2 x <- qlnorm(p = p, meanlog = 0, sdlog = 1) y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(gpl1_rs(x = x, y = y, p = p, b = b)) print(gpl1_rs(x = rep(x = x, times = 100), y = y, p = p, b = b))
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 named type 1 because 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).
Eq. (26) in Gneiting (2011) is given for . The implementation herein deliberately restricts the domain
to , where , because is strictly
increasing only for , as required by Theorem 9(b) in Gneiting (2011).
The two forms given above are equivalent on only; they disagree in
sign for , which is outside the domain of the function. Because no
argument validation is performed, a call with returns a value rather
than an error.
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The generalized piecewise linear power 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 = n, min = 0, max = 20) y <- runif(n = n, min = 0, max = 20) p <- runif(n = n, min = 0, max = 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 = n, min = 0, max = 20) y <- runif(n = n, min = 0, max = 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 = n, min = 0, max = 20) y <- runif(n = n, min = 0, max = 20) p <- runif(n = n, min = 0, max = 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 = n, min = 0, max = 20) y <- runif(n = n, min = 0, max = 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_rs computes the realised generalized piecewise linear power
score (type 2) at a specific level , when
materialises and is the prediction.
Realised generalized piecewise linear power score (type 2) is a realised score corresponding to the generalized piecewise linear power scoring function (type 2) gpl2_sf.
gpl2_rs(x, y, p)gpl2_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 scalar. |
The realised generalized piecewise linear power score (type 2) 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 realised generalized piecewise linear power score (type 2).
For details on the generalized piecewise linear power scoring function (type 2), see gpl2_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised generalized piecewise linear power score (type 2) is the realised (average) score corresponding to the generalized piecewise linear power scoring function (type 2).
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 generalized piecewise linear power score (type 2). set.seed(12345) p <- 0.7 x <- qlnorm(p = p, meanlog = 0, sdlog = 1) y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(gpl2_rs(x = x, y = y, p = p)) print(gpl2_rs(x = rep(x = x, times = 100), y = y, p = p))# Compute the realised generalized piecewise linear power score (type 2). set.seed(12345) p <- 0.7 x <- qlnorm(p = p, meanlog = 0, sdlog = 1) y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(gpl2_rs(x = x, y = y, p = p)) print(gpl2_rs(x = rep(x = x, times = 100), y = y, p = p))
The function gpl2_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) 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 power losses.
The implemented function is named type 2 because 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 power 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 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, when p = 1/2. 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, when p = 1/2. 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 realised Huber score with parameter
, when materialises and
is the prediction.
Realised 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 scalar. |
The realised Huber score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised 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 realised 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 realised Huber 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 realised Huber 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(1):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), for and .
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:
Range of function:
Vector of values of the Huber mean identification function.
For the definition of Huber mean, see Taggart (2022).
Eq. (3.5) in Taggart (2022) defines the general Huber quantile identification
function , implemented in huberquantile_if. The Huber
mean identification function is its specialisation to and
, so that huberquantile_if(x, y, 1/2, a, a) and
hubermean_if(x, y, a) agree.
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
exists and is finite (Taggart 2022).
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16(1):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), in its general form.
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:
Range of function:
Vector of values of the Huber quantile identification function.
For the definition of Huber quantile, see Taggart (2022).
At and the Huber quantile identification function
reduces to the Huber mean identification function hubermean_if.
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
exists and is finite (Taggart 2022).
Taggart RJ (2022) Point forecasting and forecast evaluation with generalized Huber loss. Electronic Journal of Statistics 16(1):201–231. doi:10.1214/21-EJS1957.
# Compute the Huber quantile identification function. set.seed(12345) n <- 10 df <- data.frame( x = runif(n = n, min = -2, max = 2), y = runif(n = n, min = -2, max = 2), p = runif(n = n, min = 0, max = 1), a = runif(n = n, min = 0, max = 1), b = runif(n = n, min = 0, max = 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 = n, min = -2, max = 2), y = runif(n = n, min = -2, max = 2), p = runif(n = n, min = 0, max = 1), a = runif(n = n, min = 0, max = 1), b = runif(n = n, min = 0, max = 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 (Methodological) 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_rs computes the realised LINEX score with parameter ,
when materialises and is the
prediction.
Realised LINEX score is a realised score corresponding to the LINEX scoring function linex_sf.
linex_rs(x, y, a)linex_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 scalar. |
The realised LINEX score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised LINEX score.
For details on the LINEX scoring function, see linex_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised LINEX score is the realised (average) score corresponding to the LINEX 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 LINEX score. set.seed(12345) a <- 1 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(linex_rs(x = x, y = y, a = a)) print(linex_rs(x = rep(x = x, times = 100), y = y, a = a))# Compute the realised LINEX score. set.seed(12345) a <- 1 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(linex_rs(x = x, y = y, a = a)) print(linex_rs(x = rep(x = x, times = 100), y = y, a = a))
The function linex_sf computes the LINEX scoring function with parameter
when materialises and is the predictive
entropic risk
measure (Gerber 1974).
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 entropic risk
measure. is the family of probability distributions
for which and
exist and are finite (Varian 1975; Zellner 1986;
Gneiting 2011).
The functional elicited here is the entropic risk measure of serrexp_sf
at the opposite sign of the parameter: serrexp_sf elicits
, whereas the LINEX
scoring function with parameter elicits
, which is the same
one-parameter family evaluated at .
Gerber HU (1974) On additive premium calculation principles. ASTIN Bulletin: The Journal of the IAA 7(3):215–222. doi:10.1017/S0515036100006061.
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 score
The function lqmean_rs computes the realised -mean score with
parameter , when materialises and
is the prediction.
Realised -mean score is a realised score corresponding to the
-mean scoring function lqmean_sf.
lqmean_rs(x, y, q)lqmean_rs(x, y, q)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
q |
It can be a scalar. |
The realised -mean score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised -mean score.
For details on the -mean scoring function, see lqmean_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised -mean score is the realised (average) score corresponding
to the -mean 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 Lq-mean score. set.seed(12345) q <- 2 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(lqmean_rs(x = x, y = y, q = q)) print(lqmean_rs(x = rep(x = x, times = 100), y = y, q = q))# Compute the realised Lq-mean score. set.seed(12345) q <- 2 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(lqmean_rs(x = x, y = y, q = q)) print(lqmean_rs(x = rep(x = x, times = 100), y = y, q = q))
-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 parameter is restricted to . At the scoring function
is the absolute error scoring function aerr_sf, which elicits the median.
The restriction to makes the expected score strictly convex, so its
minimiser is unique; at the minimiser is in general set-valued
(Section 2, p. 108 in Chen 1996).
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 1996; Bellini et al. 2014).
Bellini F, Klar B, Muller A, Rosazza Gianin E (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 score
The function lqquantile_rs computes the realised -quantile score at a
specific level and parameter , when
materialises and is the prediction.
Realised -quantile score is a realised score corresponding to the
-quantile scoring function lqquantile_sf.
lqquantile_rs(x, y, p, q)lqquantile_rs(x, y, p, q)
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 scalar. |
q |
It can be a scalar. |
The realised -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
lqquantile_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 Lq-quantile score. set.seed(12345) p <- 0.7 q <- 2 x <- qnorm(p = p, mean = 0, sd = 1) y <- rnorm(n = 100, mean = 0, sd = 1) print(lqquantile_rs(x = x, y = y, p = p, q = q)) print(lqquantile_rs(x = rep(x = x, times = 100), y = y, p = p, q = q))# Compute the realised Lq-quantile score. set.seed(12345) p <- 0.7 q <- 2 x <- qnorm(p = p, mean = 0, sd = 1) y <- rnorm(n = 100, mean = 0, sd = 1) print(lqquantile_rs(x = x, y = y, p = p, q = q)) print(lqquantile_rs(x = rep(x = x, times = 100), y = y, p = p, q = q))
-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 parameter is restricted to . At the scoring function
is the quantile scoring function quantile_sf, which elicits the
-quantile. The restriction to makes the expected score
strictly convex, so its minimiser is unique; at the minimiser is in
general set-valued (Section 2, p. 108 in Chen 1996).
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 1996; Bellini et al.
2014).
Bellini F, Klar B, Muller A, Rosazza Gianin E (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_rs computes the realised MAE-LOG score when
materialises and is the
prediction.
Realised MAE-LOG score is a realised score corresponding to the MAE-LOG scoring function maelog_sf.
maelog_rs(x, y)maelog_rs(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 realised MAE-LOG score 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 realised MAE-LOG score.
For details on the MAE-LOG scoring function, see maelog_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised MAE-LOG score is the realised (average) score corresponding to the MAE-LOG 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 MAE-LOG score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(maelog_rs(x = x, y = y)) print(maelog_rs(x = rep(x = x, times = 100), y = y))# Compute the realised MAE-LOG score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(maelog_rs(x = x, y = y)) print(maelog_rs(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_rs computes the realised MAE-SD score when
materialises and is the
prediction.
Realised MAE-SD score is a realised score corresponding to the MAE-SD scoring function maesd_sf.
maesd_rs(x, y)maesd_rs(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 realised MAE-SD score 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 realised MAE-SD score.
For details on the MAE-SD scoring function, see maesd_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised MAE-SD score is the realised (average) score corresponding to the MAE-SD 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 MAE-SD score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(maesd_rs(x = x, y = y)) print(maesd_rs(x = rep(x = x, times = 100), y = y))# Compute the realised MAE-SD score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(maesd_rs(x = x, y = y)) print(maesd_rs(x = rep(x = x, times = 100), y = y))
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 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 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, meanlog = 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, meanlog = 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 functional is the expectile at level (Newey and
Powell 1987), and the mean identification function equals the expectile
identification function expectile_if at .
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) print(df)# 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) print(df)
The function meanexp_if computes the exp-transformed identification function
with parameter , when materialises and
is the predictive functional.
The exp-transformed identification function is defined by Remark 1 in Tyralis
and Papacharalampous (2026), applied to .
meanexp_if(x, y, a)meanexp_if(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 exp-transformed identification function is defined by:
Domain of function:
Range of function:
Vector of values of the exp-transformed identification function.
For details on the entropic risk measure functional
, see Gerber (1974) and
serrexp_sf.
The exp-transformed identification function is a strict
-identification function for the entropic risk measure
functional (Tyralis and
Papacharalampous 2026).
is the family of probability distributions for which
exists and is finite (Tyralis and
Papacharalampous 2026).
linex_sf parameterises the same one-parameter family of entropic risk
measures at the opposite sign: it elicits its functional as
, which equals the functional
documented here evaluated at .
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 (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
# Compute the exp-transformed identification function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = c(-1, 1, 2) ) df$meanexp_if <- meanexp_if(x = df$x, y = df$y, a = df$a) print(df)# Compute the exp-transformed identification function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = c(-1, 1, 2) ) df$meanexp_if <- meanexp_if(x = df$x, y = df$y, a = df$a) print(df)
The function meanlog_if computes the log-transformed identification function,
when materialises and , the
geometric mean of (Yeh et al. 2008), is the predictive functional.
The log-transformed identification function is defined in Tyralis and Papacharalampous (2026).
meanlog_if(x, y)meanlog_if(x, y)
x |
Predictive |
y |
Realisation (true value) of process. It can be a vector of length
|
The log-transformed identification function is defined by:
Domain of function:
Range of function:
Vector of values of the log-transformed identification function.
The functional is the geometric mean of
the probability distribution of , i.e. the case of
the generalized (power) mean of order defined by eq. (2.1) in Yeh et
al. (2008).
The log-transformed identification function is a strict
-identification function for the log-transformed expectation
(Tyralis and Papacharalampous 2026).
is the family of probability distributions for which
exists and is finite (Tyralis and
Papacharalampous 2026).
Tyralis H, Papacharalampous G (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
Yeh C-C, Yeh H-W, Chan W (2008) Some equivalent forms of the arithematic-geometric mean inequality in probability: A survey. Journal of Inequalities and Applications 2008:386715. doi:10.1155/2008/386715.
# 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) print(df)# 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) print(df)
The function meanpower_if computes the power-transformed identification
function with parameter , when materialises and
is the predictive functional.
The power-transformed identification function is defined by Remark 1 in
Tyralis and Papacharalampous (2026), applied to .
meanpower_if(x, y, a)meanpower_if(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 power-transformed identification function is defined by:
Domain of function:
Case #1
Case #2
Range of function:
Vector of values of the power-transformed identification function.
For details on the functional, see
serrpower_sf.
The power-transformed identification function is a strict
-identification function for the
functional (Tyralis and Papacharalampous
2026).
is the family of probability distributions for which
exists and is finite (Tyralis and Papacharalampous
2026).
At , this is the identification function counterpart of
serrsq_sf, which has no dedicated identification function of its own in
this package.
Tyralis H, Papacharalampous G (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
# Compute the power-transformed identification function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = c(1, 2, 3) ) df$meanpower_if <- meanpower_if(x = df$x, y = df$y, a = df$a) print(df)# Compute the power-transformed identification function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3, a = c(1, 2, 3) ) df$meanpower_if <- meanpower_if(x = df$x, y = df$y, a = df$a) print(df)
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, meanlog = 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, meanlog = 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, meanlog = 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, meanlog = 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, meanlog = 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, meanlog = 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.18 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:
Range 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:
Range 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 (eq. (3.11)
and Example 3.19 in Fissler and Ziegel (2019); Proposition 4.4 in Fissler and
Ziegel (2016)). is the family of probability distributions
for which and
exist and are finite (eq. (3.11) and Example 3.19 in Fissler and Ziegel (2019);
Proposition 4.4 in 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.
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.
# 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 -th moment 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:
Range 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).
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.
# Compute the n-th moment identification 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 identification 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 score
The function nmoment_rs computes the realised -th moment score, when
materialises and is the
prediction.
Realised -th moment score is a realised score corresponding to the
-th moment scoring function nmoment_sf.
nmoment_rs(x, y, n)nmoment_rs(x, y, n)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
n |
Moment order. It can be a scalar. |
The realised -th moment score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised -th moment score.
For details on the -th moment scoring function, see nmoment_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised -th moment score is the realised (average) score
corresponding to the -th moment 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 n-th moment score. # x = 1 is the predictive 2nd moment E[Y^2] of a standard normal distribution. set.seed(12345) n <- 2 x <- 1 y <- rnorm(n = 100, mean = 0, sd = 1) print(nmoment_rs(x = x, y = y, n = n)) print(nmoment_rs(x = rep(x = x, times = 100), y = y, n = n))# Compute the realised n-th moment score. # x = 1 is the predictive 2nd moment E[Y^2] of a standard normal distribution. set.seed(12345) n <- 2 x <- 1 y <- rnorm(n = 100, mean = 0, sd = 1) print(nmoment_rs(x = x, y = y, n = n)) print(nmoment_rs(x = rep(x = x, times = 100), y = y, n = n))
-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:
Range 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.
nmoment_rs, nmoment_if,
serr_sf, lqmean_sf
# 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:
The reference score is the score of the constant
prediction and therefore depends on
only.
is the vector of ones.
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-Sutcliffe efficiency is defined in eq. (3) in Nash and Sutcliffe (1970).
The Nash-Sutcliffe efficiency is positively oriented (i.e. the larger, the better).
The Nash-Sutcliffe efficiency is undefined when the reference score
is zero, which happens if and
only if is constant. In that degenerate case the
function returns NaN or -Inf.
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_rs computes the realised observation-weighted score
when materialises and is the
prediction.
Realised observation-weighted score is a realised score corresponding to the observation-weighted scoring function obsweighted_sf.
obsweighted_rs(x, y)obsweighted_rs(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 realised observation-weighted score 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 realised observation-weighted score.
For details on the observation-weighted scoring function, see obsweighted_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised observation-weighted score is the realised (average) score corresponding to the observation-weighted 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 observation-weighted score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(obsweighted_rs(x = x, y = y)) print(obsweighted_rs(x = rep(x = x, times = 100), y = y))# Compute the realised observation-weighted score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(obsweighted_rs(x = x, y = y)) print(obsweighted_rs(x = rep(x = x, times = 100), 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 on 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
(Theorem 5 and eq. (12) in Gneiting 2011). is the family of
probability distributions concentrated on for which
, and
exist and are finite (Theorem 5 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 observation-weighted scoring function. df <- data.frame( y = rep(x = 2, times = 3), x = 1:3 ) df$obsweighted_penalty <- 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$obsweighted_penalty <- obsweighted_sf(x = df$x, y = df$y) print(df)
The function powerweighted_if computes the power-weighted identification
function with parameter , when materialises and
is the
predictive functional.
The power-weighted identification function is defined by Table 9 in
Gneiting (2011), applied to and .
powerweighted_if(x, y, a)powerweighted_if(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 power-weighted identification function is defined by:
or equivalently,
Domain of function:
Range of function:
Vector of values of the power-weighted identification function.
The
functional is the ratio of expectations formed by weighting the probability
distribution of with (eq. (11) in
Gneiting 2011). For details on this functional, see powerweighted_sf.
The power-weighted identification function is a strict
-identification function for the
functional
(Table 9 and Theorem 8 in Gneiting 2011). is the family of
probability distributions for which and
exist and are finite (Theorem 8 in
Gneiting 2011).
At the power-weighted identification function reduces to
mean_if and the functional to the mean .
This is the identification function counterpart of powerweighted_sf, and
thereby also of obsweighted_sf and srelerr_sf at and
of sperr_sf at .
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 power-weighted identification function. df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), a = rep(x = c(1, -2), each = 3) ) df$powerweighted_if <- powerweighted_if(x = df$x, y = df$y, a = df$a) print(df) # The power-weighted identification function reduces to the mean identification # function at a = 0. set.seed(12345) n <- 10 x <- runif(n = n, min = 0, max = 2) y <- runif(n = n, min = 0, max = 2) max(abs(powerweighted_if(x = x, y = y, a = 0) - mean_if(x = x, y = y))) # values are slightly higher than 0 due to rounding error# Compute the power-weighted identification function. df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), a = rep(x = c(1, -2), each = 3) ) df$powerweighted_if <- powerweighted_if(x = df$x, y = df$y, a = df$a) print(df) # The power-weighted identification function reduces to the mean identification # function at a = 0. set.seed(12345) n <- 10 x <- runif(n = n, min = 0, max = 2) y <- runif(n = n, min = 0, max = 2) max(abs(powerweighted_if(x = x, y = y, a = 0) - mean_if(x = x, y = y))) # values are slightly higher than 0 due to rounding error
The function powerweighted_sf computes the power-weighted squared error scoring
function with parameter , when materialises and is the
predictive
functional.
The power-weighted squared error scoring function is defined by eqs. (10) and
(11) in Gneiting (2011), applied to the weight function and to
the squared error scoring function.
powerweighted_sf(x, y, a)powerweighted_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 power-weighted squared error scoring function is defined by:
Domain of function:
Range of function:
Vector of power-weighted squared errors.
The
functional is the ratio of expectations formed by weighting the probability
distribution of with (eq. (11) in
Gneiting 2011).
The power-weighted squared error scoring function is negatively oriented (i.e. the smaller, the better).
The power-weighted squared error scoring function is strictly
-consistent for the
functional
(Theorem 5 in Gneiting 2011). is the family of probability
distributions for which ,
and exist
and are finite (Theorem 5 in Gneiting 2011).
At the power-weighted squared error scoring function reduces to
serr_sf and the functional to the mean , at
it reduces to obsweighted_sf, and at it reduces
to sperr_sf.
srelerr_sf targets the same functional as the case , but is
not a member of this family, because it weights with the prediction
rather than with the realisation (p. 752 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 power-weighted squared error scoring function. df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), a = rep(x = c(1, -2), each = 3) ) df$powerweighted_penalty <- powerweighted_sf(x = df$x, y = df$y, a = df$a) print(df) # The power-weighted squared error scoring function reduces to the squared # error scoring function at a = 0, to the observation-weighted scoring function # at a = 1 and to the squared percentage error scoring function at a = -2. set.seed(12345) n <- 10 x <- runif(n = n, min = 0, max = 2) y <- runif(n = n, min = 0, max = 2) max(abs(powerweighted_sf(x = x, y = y, a = 0) - serr_sf(x = x, y = y))) max(abs(powerweighted_sf(x = x, y = y, a = 1) - obsweighted_sf(x = x, y = y))) max(abs(powerweighted_sf(x = x, y = y, a = -2) - sperr_sf(x = x, y = y))) # values are slightly higher than 0 due to rounding error# Compute the power-weighted squared error scoring function. df <- data.frame( y = rep(x = 2, times = 6), x = c(1, 2, 3, 1, 2, 3), a = rep(x = c(1, -2), each = 3) ) df$powerweighted_penalty <- powerweighted_sf(x = df$x, y = df$y, a = df$a) print(df) # The power-weighted squared error scoring function reduces to the squared # error scoring function at a = 0, to the observation-weighted scoring function # at a = 1 and to the squared percentage error scoring function at a = -2. set.seed(12345) n <- 10 x <- runif(n = n, min = 0, max = 2) y <- runif(n = n, min = 0, max = 2) max(abs(powerweighted_sf(x = x, y = y, a = 0) - serr_sf(x = x, y = y))) max(abs(powerweighted_sf(x = x, y = y, a = 1) - obsweighted_sf(x = x, y = y))) max(abs(powerweighted_sf(x = x, y = y, a = -2) - sperr_sf(x = x, y = y))) # values are slightly higher than 0 due to rounding error
The function qlike computes the QLIKE score when
materialises and is the prediction.
QLIKE is a realised score corresponding to the Bregman scoring function (type 3, QLIKE scoring function) bregman3_sf.
qlike(x, y)qlike(x, y)
x |
Prediction. It can be a vector of length |
y |
Realisation (true value) of process. It can be a vector of length
|
QLIKE 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 QLIKE.
For details on the Bregman scoring function (type 3, QLIKE scoring function), see bregman3_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
QLIKE is the realised (average) score corresponding to the Bregman scoring function (type 3, QLIKE 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 QLIKE. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(qlike(x = x, y = y)) print(qlike(x = rep(x = x, times = 100), y = y))# Compute QLIKE. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(qlike(x = x, y = y)) print(qlike(x = rep(x = x, times = 100), y = y))
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; Dimitriadis et al. 2024).
is the family of probability distributions for which
there exists an with (Gneiting 2011; 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.
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) print(df)# 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) print(df)
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
Domain of function:
Range of function:
Value of the sample quantile level.
For the definition of quantiles, see Koenker and Bassett Jr (1978).
The sample quantile level is directly related to the quantile identification
function quantile_if, which is defined in Table 9 in Gneiting (2011).
The sample quantile level equals the sample mean of ,
where is the quantile identification function at level .
If materialises and is the
predictive quantile at level , then ideally, the sample quantile level
should be equal to the nominal quantile level .
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.
quantile_sf, quantile_rs,
quantile_if
# 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 scalar. |
The realised 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 asymmetric 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 (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.
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 functional elicited by the relative error
scoring function is the -median at , whose density is
proportional to (p. 748 and p. 749 in Gneiting 2011). The
-median functional at general is elicited by
bmedian_sf.
Patton (2011) adds that the MAE-PROP scoring function is also known as the mean
absolute percentage error (MAPE). That name is used differently here: the
package follows Gneiting (2011), where the absolute percentage error is
, elicited by aperr_sf and averaged by mape,
whose elicited functional is . A reader
arriving from Patton (2011) should use relerr_sf, not mape.
The relative error scoring function is negatively oriented (i.e. the smaller, the better).
The relative error scoring function is strictly
-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(336):783–801. doi:10.1080/01621459.1971.10482346.
# Compute the squared 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 squared 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_rs computes the realised squared error exp score with
parameter , when materialises and
is the prediction.
Realised squared error exp score is a realised score corresponding to the squared error exp scoring function serrexp_sf.
serrexp_rs(x, y, a)serrexp_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 scalar. |
The realised squared error exp score is defined by:
where
and
Domain of function:
Range of function:
Value of the realised squared error exp score.
For details on the squared error exp scoring function, see serrexp_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised squared error exp score is the realised (average) score corresponding to the squared error exp 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 squared error exp score. set.seed(12345) a <- 1 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(serrexp_rs(x = x, y = y, a = a)) print(serrexp_rs(x = rep(x = x, times = 100), y = y, a = a))# Compute the realised squared error exp score. set.seed(12345) a <- 1 x <- 0 y <- rnorm(n = 100, mean = 0, sd = 1) print(serrexp_rs(x = x, y = y, a = a)) print(serrexp_rs(x = rep(x = x, times = 100), y = y, a = a))
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).
Appendix A1 in Fissler and Pesenti (2023) is given for . The domain
used here is the one given for in Table 1
in Tyralis and Papacharalampous (2026), where the transformation is a bijection
for every .
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 2026). The squared transform doubles
the moment requirement: alone makes
the functional well defined, but the expected score is finite only under
.
linex_sf parameterises the same one-parameter family of entropic risk
measures at the opposite sign: it elicits its functional as
, which equals the functional
documented here evaluated at .
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 (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
# Compute the squared 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 squared 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_rs computes the realised squared error log score when
materialises and is the
prediction.
Realised squared error log score is a realised score corresponding to the squared error log scoring function serrlog_sf.
serrlog_rs(x, y)serrlog_rs(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 realised squared error log score 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 realised squared error log score.
For details on the squared error log scoring function, see serrlog_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised squared error log score is the realised (average) score corresponding to the squared error log 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 squared error log score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(serrlog_rs(x = x, y = y)) print(serrlog_rs(x = rep(x = x, times = 100), y = y))# Compute the realised squared error log score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(serrlog_rs(x = x, y = y)) print(serrlog_rs(x = rep(x = x, times = 100), y = y))
The function serrlog_sf computes the squared error log scoring function when
materialises and is the
predictive functional, i.e. the geometric mean of (Yeh et al. 2008).
The squared error log scoring function is described by eq. (2) 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 log 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 functional is the geometric mean of
the probability distribution of , i.e. the case of
the generalized (power) mean of order defined by eq. (2.1) in Yeh et
al. (2008).
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 2026).
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 (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
Yeh C-C, Yeh H-W, Chan W (2008) Some equivalent forms of the arithematic-geometric mean inequality in probability: A survey. Journal of Inequalities and Applications 2008:386715. doi:10.1155/2008/386715.
# Compute the squared 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 squared 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_rs computes the realised squared error of power
transformations score with parameter , when
materialises and is the prediction.
Realised squared error of power transformations score is a realised score corresponding to the squared error of power transformations scoring function serrpower_sf.
serrpower_rs(x, y, a)serrpower_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 scalar. |
The realised squared error of power transformations score is defined by:
where
and
Domain of function:
Case #1
Case #2
where
is the zero vector of length and the symbols and
indicate pairwise inequality.
Range of function:
Value of the realised squared error of power transformations score.
For details on the squared error of power transformations scoring function, see serrpower_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised squared error of power transformations score is the realised (average) score corresponding to the squared error of power transformations 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 squared error of power transformations score. set.seed(12345) a <- 2 x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(serrpower_rs(x = x, y = y, a = a)) print(serrpower_rs(x = rep(x = x, times = 100), y = y, a = a))# Compute the realised squared error of power transformations score. set.seed(12345) a <- 2 x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(serrpower_rs(x = x, y = y, a = a)) print(serrpower_rs(x = rep(x = x, times = 100), y = y, a = a))
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 (2026).
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:
Case #1
Case #2
Vector of squared errors of power-transformed variables.
For details on the squared error of power transformations scoring function, see Tyralis and Papacharalampous (2026).
The squared error of power transformations 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 2026).
Tyralis H, Papacharalampous G (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
# Compute the squared error of power transformations 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 squared error of power transformations 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_rs computes the realised squared error of squares score
when materialises and is the
prediction.
Realised squared error of squares score is a realised score corresponding to the squared error of squares scoring function serrsq_sf.
serrsq_rs(x, y)serrsq_rs(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 realised squared error of squares score 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 realised squared error of squares score.
For details on the squared error of squares scoring function, see serrsq_sf.
The concept of realised (average) scores is defined by Gneiting (2011) and Fissler and Ziegel (2019).
The realised squared error of squares score is the realised (average) score corresponding to the squared error of squares 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 squared error of squares score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(serrsq_rs(x = x, y = y)) print(serrsq_rs(x = rep(x = x, times = 100), y = y))# Compute the realised squared error of squares score. set.seed(12345) x <- 0.5 y <- rlnorm(n = 100, meanlog = 0, sdlog = 1) print(serrsq_rs(x = x, y = y)) print(serrsq_rs(x = rep(x = x, times = 100), y = y))
The function serrsq_sf computes the squared error of squares scoring function
when materialises and is the
predictive functional.
The squared transformation used by the squared error of squares scoring function is described 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 transformation, 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 2026).
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 (2026) Variable transformations in consistent loss functions. Knowledge-Based Systems 336:115202. doi:10.1016/j.knosys.2025.115202.
# Compute the squared 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 squared 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 on 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
(Park and Stefanski 1998; Theorem 5 and eq. (11) on p. 752 in Gneiting 2011).
is the family of probability distributions for which
and exist and are
finite (Theorem 5 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.
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 on 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
(eq. (12) on p. 752 in Gneiting 2011). is the family of
probability distributions concentrated on for which
exists and is finite (Gneiting 2011).
The squared relative error scoring function weights with the prediction
rather than with the realisation , so it is not a member of the weighted
family of Theorem 5 in Gneiting (2011); it targets the same functional as
obsweighted_sf, which is
(eq. (12) on p. 752 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 squared relative 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 relative 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)