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 overpredictoin 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()
.
crps_sample(observed, predicted, separate_results = FALSE, ...)dispersion_sample(observed, predicted, ...)
overprediction_sample(observed, predicted, ...)
underprediction_sample(observed, predicted, ...)
Vector with scores.
dispersion_sample()
: a numeric vector with dispersion values (one per
observation).
overprediction_quantile()
: a numeric vector with overprediction values
(one per observation).
underprediction_quantile()
: a numeric vector with underprediction values (one per
observation).
A vector with observed values of size n
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, predicted
can just be a vector of size n.
Logical. If TRUE
(default is FALSE
), then the
separate parts of the CRPS (dispersion penalty, penalties for
over- and under-prediction) get returned as separate elements of a list.
If you want a data.frame
instead, simply call as.data.frame()
on the
output.
Additional arguments passed on to crps_sample()
from functions
overprediction_sample()
, underprediction_sample()
and
dispersion_sample()
.
Overview of required input format for sample-based forecasts
Alexander Jordan, Fabian Krüger, Sebastian Lerch, Evaluating Probabilistic Forecasts with scoringRules, https://www.jstatsoft.org/article/view/v090i12
observed <- rpois(30, lambda = 1:30)
predicted <- replicate(200, rpois(n = 30, lambda = 1:30))
crps_sample(observed, predicted)
Run the code above in your browser using DataLab