crps | R Documentation |
This function calculates the Continuous Ranked Probability Score (CRPS) given observations of a univariate variable and samples of a predictive distribution.
crps(y, x, method = "ens", na.action = na.omit, aggregate = FALSE, ...)
y |
vector of observations |
x |
matrix of samples of a predictive distribution (depending on |
method |
character; " |
na.action |
function to handle the NA's. Default: |
aggregate |
logical or function for aggregating the single scores, e.g. |
... |
further arguments passed to the |
For a vector y
of length n, x
should be given as matrix
with n rows, where the i-th entry of y
belongs to the i-th row
of x
. The columns of x
represent the samples of a predictive distribution.
If method "ens
" is specified, the CRPS values are calculated for
given ensemble forecasts in x
(Grimit et al., 2006).
If method "sml
" is specified, the CRPS values are calculated for a "small" number of
given ensemble forecasts in x
(Ferro et al., 2008).
A lower CRPS indicates a better forecast.
Vector of score value(s).
David Jobst
Matheson, J. Winkler, R. (1976). Scoring Rules for Continuous Probability Distributions. 22(10), 1087-1096.
Ferro, C., Richardson, D. and Weigel, A. (2008). On the effect of ensemble size on the discrete and continuous ranked probability scores. Meteorological Applications, 15, 19-24.
Grimit, E., Gneiting, T., Berrocal, V. and Johnson, N. (2006). The continuous ranked probability score for circular variables and its applications to mesoscale forecast ensemble verification. Quarterly Journal of the Royal Meteorological Society, 132, 2925-2942.
# simulated data
n <- 30
m1 <- 50
m2 <- 3
m3 <- 10000
y <- rnorm(n)
x1 <- matrix(rnorm(n*m1), ncol = m1)
x2 <- matrix(rnorm(n*m2), ncol = m2)
x3 <- matrix(rnorm(n*m3), ncol = m3)
# crps calculation
crps(y = y, x = x1, method = "ens")
crps(y = y, x = x1, method = "ens", aggregate = mean)
crps(y = y, x = x2, method = "sml")
crps(y = y, x = x2, method = "sml", aggregate = mean)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.