crps_sample {scoringutils} | R Documentation |
(Continuous) ranked probability score
Description
Wrapper around the crps_sample()
function from the
scoringRules package. Can be used for continuous as well as integer
valued forecasts
The Continuous ranked probability score (CRPS) can be interpreted as the sum of three components: overprediction, underprediction and dispersion. "Dispersion" is defined as the CRPS of the median forecast $m$. If an observation $y$ is greater than $m$ then overprediction is defined as the CRPS of the forecast for $y$ minus the dispersion component, and underprediction is zero. If, on the other hand, $y<m$ then underprediction is defined as the CRPS of the forecast for $y$ minus the dispersion component, and overprediction is zero.
The overprediction, underprediction and dispersion components correspond to
those of the wis()
.
Usage
crps_sample(observed, predicted, separate_results = FALSE, ...)
dispersion_sample(observed, predicted, ...)
overprediction_sample(observed, predicted, ...)
underprediction_sample(observed, predicted, ...)
Arguments
observed |
A vector with observed values of size n |
predicted |
nxN matrix of predictive samples, n (number of rows) being
the number of data points and N (number of columns) the number of Monte
Carlo samples. Alternatively, |
separate_results |
Logical. If |
... |
Additional arguments passed on to |
Value
Vector with scores.
dispersion_sample()
: a numeric vector with dispersion values (one per
observation).
overprediction_sample()
: a numeric vector with overprediction values
(one per observation).
underprediction_sample()
: a numeric vector with underprediction values (one per
observation).
Input format
Overview of required input format for sample-based forecasts
References
Alexander Jordan, Fabian Krüger, Sebastian Lerch, Evaluating Probabilistic Forecasts with scoringRules, https://www.jstatsoft.org/article/view/v090i12
Examples
observed <- rpois(30, lambda = 1:30)
predicted <- replicate(200, rpois(n = 30, lambda = 1:30))
crps_sample(observed, predicted)