qscore {isodistrreg} | R Documentation |
Quantile scores for IDR or raw forecasts
Description
Computes quantile scores of IDR quantile predictions or of quantile
predictions from raw forecasts in a data.frame
.
Usage
qscore(predictions, quantiles, y)
Arguments
predictions |
either an object of class |
quantiles |
numeric vector of desired quantiles. |
y |
a numeric vector of obervations of the same length as the number of
predictions, or of length 1. In the latter case, |
Details
The quantile score of a forecast x for the u-quantile is defined as
2(1{x > y} - u)(x - y),
where y is the observation. For u = 1/2, this equals the mean absolute error of the median forecast.
Value
A matrix of the quantile scores for the desired quantiles, one column per quantile.
References
Gneiting, T. and Raftery, A. E. (2007), 'Strictly proper scoring rules, prediction, and estimation', Journal of the American Statistical Association 102(477), 359-378
See Also
Examples
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 mean absolute error of the median postprocessed forecast using
## data of the next 2 years (out-of-sample predictions) and compare to raw
## HRES forecast
data <- rain[(3 * 365 + 1):(5 * 365), "HRES", drop = FALSE]
obs <- rain[(3 * 365 + 1):(5 * 365), "obs"]
predictions <- predict(fit, data = data)
idrMAE <- mean(qscore(predictions, 0.5, obs))
rawMAE <- mean(qscore(data, 0.5, obs))
c("idr" = idrMAE, "raw" = rawMAE)