Learn R Programming

scoringfunctions (version 1.1)

quantile_rs: Realised quantile score

Description

The function quantile_rs computes the realised quantile score at a specific level \(p\) when \(\textbf{\textit{y}}\) materialises and \(\textbf{\textit{x}}\) is the prediction.

Realised quantile score is a realised score corresponding to the quantile scoring function quantile_sf.

Usage

quantile_rs(x, y, p)

Value

Value of the realised quantile score.

Arguments

x

Prediction. It can be a vector of length \(n\) (must have the same length as \(\textbf{\textit{y}}\)).

y

Realisation (true value) of process. It can be a vector of length \(n\) (must have the same length as \(\textbf{\textit{x}}\)).

p

It can be a vector of length \(n\) (must have the same length as \(\textbf{\textit{y}}\)) or a scalar value.

Details

The realized quantile score is defined by:

$$S(\textbf{\textit{x}}, \textbf{\textit{y}}, p) := (1/n) \sum_{i = 1}^{n} L(x_i, y_i, p)$$

where

$$\textbf{\textit{x}} = (x_1, ..., x_n)^\mathsf{T}$$

$$\textbf{\textit{y}} = (y_1, ..., y_n)^\mathsf{T}$$

and

$$L(x, y, p) := (\textbf{1} \lbrace x \geq y \rbrace - p) (x - y)$$

Domain of function:

$$\textbf{\textit{x}} \in \mathbb{R}^n$$

$$\textbf{\textit{y}} \in \mathbb{R}^n$$

$$0 < p < 1$$

Range of function:

$$S(\textbf{\textit{x}}, \textbf{\textit{y}}, p) \geq 0, \forall \textbf{\textit{x}}, \textbf{\textit{y}} \in \mathbb{R}^n, p \in (0, 1)$$

References

Fissler T, Ziegel JF (2019) Order-sensitivity and equivariance of scoring functions. Electronic Journal of Statistics 13(1):1166--1211. tools:::Rd_expr_doi("10.1214/19-EJS1552").

Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746--762. tools:::Rd_expr_doi("10.1198/jasa.2011.r10138").

Examples

Run this code
# 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))

Run the code above in your browser using DataLab