Proper Scoring Rule to score quantile predictions. Smaller values are better.
The quantile score is closely related to the interval score (see wis()) and
is the quantile equivalent that works with single quantiles instead of
central prediction intervals.
The quantile score, also called pinball loss, for a single quantile
level \(\tau\) is defined as
$$
\text{QS}_\tau(F, y) = 2 \cdot \{ \mathbf{1}(y \leq q_\tau) - \tau\} \cdot (q_\tau - y) =
\begin{cases}
2 \cdot (1 - \tau) * q_\tau - y, & \text{if } y \leq q_\tau\\
2 \cdot \tau * |q_\tau - y|, & \text{if } y > q_\tau,
\end{cases}
$$
with \(q_\tau\) being the \(\tau\)-quantile of the predictive
distribution \(F\), and \(\mathbf{1}(\cdot)\) the indicator function.
The weighted interval score for a single prediction interval can be obtained
as the average of the quantile scores for the lower and upper quantile of
that prediction interval:
$$
\text{WIS}_\alpha(F, y) = \frac{\text{QS}_{\alpha/2}(F, y)
+ \text{QS}_{1 - \alpha/2}(F, y)}{2}.
$$
See the SI of Bracher et al. (2021) for more details.
quantile_score() returns the average quantile score across the quantile
levels provided. For a set of quantile levels that form pairwise central
prediction intervals, the quantile score is equivalent to the interval score
for the default weighting (weigh = TRUE). With weigh = FALSE, the two
can differ when the quantile levels 0 and 1 are present (see wis() for
details).