View source: R/quantile_level.R
quantile_level | R Documentation |
The function quantile_level computes the sample quantile level, when
\textbf{\textit{y}}
materialises and \textbf{\textit{x}}
is the
predictive quantile at level p
.
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:
P(x, y) := (1/n) \sum_{i = 1}^{n} V(x_i, y_i)
where
\textbf{\textit{x}} = (x_1, ..., x_n)^\mathsf{T}
\textbf{\textit{y}} = (y_1, ..., y_n)^\mathsf{T}
and
V(x, y) := \textbf{1} \lbrace x \geq y \rbrace
Domain of function:
\textbf{\textit{x}} \in \mathbb{R}^n
\textbf{\textit{y}} \in \mathbb{R}^n
Value of the sample quantile level.
The sample quantile level is directly related to the quantile identification function quantile_if.
If \textbf{\textit{y}}
materialises and \textbf{\textit{x}}
is the
predictive quantile at level p
, then ideally, the sample quantile level
should be equal to the nominal quantile level p
.
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.