crps | R Documentation |
Computes the CRPS of IDR or raw forecasts.
crps(predictions, y)
## S3 method for class 'idr'
crps(predictions, y)
## S3 method for class 'data.frame'
crps(predictions, y)
predictions |
either an object of class |
y |
a numeric vector of obervations of the same length as the number of
predictions, or of length 1. In the latter case, |
This function uses adapted code taken from the function crps_edf
of
the scoringRules package.
A vector of CRPS values.
Jordan A., Krueger F., Lerch S. (2018). "Evaluating Probabilistic Forecasts with scoringRules." Journal of Statistical Software. Forthcoming.
Gneiting, T. and Raftery, A. E. (2007), 'Strictly proper scoring rules, prediction, and estimation', Journal of the American Statistical Association 102(477), 359-378
predict.idrfit
data("rain")
## Postprocess HRES forecast using data of 3 years
X <- rain[1:(3 * 365), "HRES", drop = FALSE]
y <- rain[1:(3 * 365), "obs"]
fit <- idr(y = y, X = X)
## Compute CRPS of postprocessed HRES forecast using data of the next 2 years
## (out-of-sample predictions)
data <- rain[(3 * 365 + 1):(5 * 365), "HRES", drop = FALSE]
obs <- rain[(3 * 365 + 1):(5 * 365), "obs"]
predictions <- predict(fit, data = data)
idrCrps <- crps(predictions, y = obs)
## Compare this to CRPS of the raw ensemble of all forecasts (high resolution,
## control and 50 perturbed ensemble forecasts)
rawData <- rain[(3 * 365 + 1):(5 * 365), c("HRES", "CTR", paste0("P", 1:50))]
rawCrps <- crps(rawData, y = obs)
c("idr_HRES" = mean(idrCrps), "raw_all" = mean(rawCrps))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.