Wrapper around the crps_sample()
function from the
scoringRules package. Can be used for continuous as well as integer
valued forecasts
Arguments
- true_values
A vector with the true observed values of size n
- predictions
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, predictions can just be a vector of size n.
References
Alexander Jordan, Fabian Krüger, Sebastian Lerch, Evaluating Probabilistic Forecasts with scoringRules, https://www.jstatsoft.org/article/view/v090i12
Examples
true_values <- rpois(30, lambda = 1:30)
predictions <- replicate(200, rpois(n = 30, lambda = 1:30))
crps_sample(true_values, predictions)
#> [1] 0.704300 0.631825 0.569025 1.138250 1.105850 4.640850 1.203950 2.443400
#> [9] 3.588550 0.755750 4.013150 2.206725 1.653500 3.399650 1.611975 3.600775
#> [17] 1.347150 1.612325 2.965800 4.939350 1.346200 2.350075 1.913825 1.515675
#> [25] 6.219325 1.238925 1.628900 3.613250 2.224925 1.843975