crps.numeric {scoringRules} | R Documentation |
Continuous Ranked Probability Score for Parametric Forecast Distributions
Description
Calculate the Continuous Ranked Probability Score (CRPS) given observations and parameters of a family of distributions.
Usage
## S3 method for class 'numeric'
crps(y, family, ...)
Arguments
y |
vector of realized values. |
family |
string which specifies the parametric family; current options:
|
... |
vectors of parameter values; expected input depends on the chosen
|
Details
Mathematical details are available in Appendix A of the vignette Evaluating probabilistic forecasts with scoringRules that accompanies the package.
The parameters supplied to each of the functions are numeric vectors:
Distributions defined on the real line:
-
"laplace"
or"lapl"
:location
(real-valued location parameter),scale
(positive scale parameter); seecrps_lapl
-
"logistic"
or"logis"
:location
(real-valued location parameter),scale
(positive scale parameter); seecrps_logis
-
"normal"
or"norm"
:mean
,sd
(mean and standard deviation); seecrps_norm
-
"normal-mixture"
or"mixture-normal"
or"mixnorm"
:m
(mean parameters),s
(standard deviations),w
(weights); seecrps_mixnorm
; note: matrix-input for parameters -
"t"
:df
(degrees of freedom),location
(real-valued location parameter),scale
(positive scale parameter); seecrps_t
-
"two-piece-exponential"
or"2pexp"
:location
(real-valued location parameter),scale1
,scale2
(positive scale parameters); seecrps_2pexp
-
"two-piece-normal"
or"2pnorm"
:location
(real-valued location parameter),scale1
,scale2
(positive scale parameters); seecrps_2pnorm
-
Distributions for non-negative random variables:
-
"exponential"
or"exp"
:rate
(positive rate parameter); seecrps_exp
-
"gamma"
:shape
(positive shape parameter),rate
(positive rate parameter),scale
(alternative torate
); seecrps_gamma
-
"log-laplace"
or"llapl"
:locationlog
(real-valued location parameter),scalelog
(positive scale parameter); seecrps_llapl
-
"log-logistic"
or"llogis"
:locationlog
(real-valued location parameter),scalelog
(positive scale parameter); seecrps_llogis
-
"log-normal"
or"lnorm"
:locationlog
(real-valued location parameter),scalelog
(positive scale parameter); seecrps_lnorm
-
Distributions with flexible support and/or point masses:
-
"beta"
:shape1
,shape2
(positive shape parameters),lower
,upper
(lower and upper limits); seecrps_beta
-
"uniform"
or"unif"
:min
,max
(lower and upper limits),lmass
,umass
(point mass in lower or upper limit); seecrps_unif
-
"expM"
:location
(real-valued location parameter),scale
(positive scale parameter),mass
(point mass inlocation
); seecrps_expM
-
"gev"
:location
(real-valued location parameter),scale
(positive scale parameter),shape
(real-valued shape parameter); seecrps_gev
-
"gpd"
:location
(real-valued location parameter),scale
(positive scale parameter),shape
(real-valued shape parameter),mass
(point mass inlocation
); seecrps_gpd
-
"tlogis"
:location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits); seecrps_tlogis
-
"clogis"
:location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits); seecrps_clogis
-
"gtclogis"
:location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits);lmass
,umass
(point mass in lower or upper limit); seecrps_gtclogis
-
"tnorm"
:location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits); seecrps_tnorm
-
"cnorm"
:location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits); seecrps_cnorm
-
"gtcnorm"
:location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits);lmass
,umass
(point mass in lower or upper limit); seecrps_gtcnorm
-
"tt"
:df
(degrees of freedom),location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits); seecrps_tt
-
"ct"
:df
(degrees of freedom),location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits); seecrps_ct
-
"gtct"
:df
(degrees of freedom),location
(location parameter),scale
(scale parameter),lower
,upper
(lower and upper limits);lmass
,umass
(point mass in lower or upper limit); seecrps_gtct
-
Distributions of discrete variables:
-
"binom"
:size
(number of trials (zero or more)),prob
(probability of success on each trial); seecrps_binom
-
"hyper"
:m
(the number of white balls in the urn),n
(the number of black balls in the urn),k
(the number of balls drawn from the urn); seecrps_hyper
-
"negative-binomial"
or"nbinom"
:size
(positive dispersion parameter),prob
(success probability),mu
(mean, alternative toprob
); seecrps_nbinom
-
"poisson"
or"pois"
:lambda
(positive mean); seecrps_pois
-
All numerical arguments should be of the same length. An exception are scalars of length 1, which will be recycled.
Value
Vector of score values. A lower score indicates a better forecast.
Author(s)
Alexander Jordan, Fabian Krueger, Sebastian Lerch
References
Closed form expressions of the CRPS for specific distributions:
Baran, S. and S. Lerch (2015): 'Log-normal distribution based Ensemble Model Output Statistics models for probabilistic wind-speed forecasting', Quarterly Journal of the Royal Meteorological Society 141, 2289-2299. doi:10.1002/qj.2521 (Log-normal)
Friederichs, P. and T.L. Thorarinsdottir (2012): 'Forecast verification for extreme value distributions with an application to probabilistic peak wind prediction', Environmetrics 23, 579-594. doi:10.1002/env.2176 (Generalized Extreme Value, Generalized Pareto)
Gneiting, T., Larson, K., Westvelt III, A.H. and T. Goldman (2005): 'Calibrated probabilistic forecasting using ensemble model output statistics and minimum CRPS estimation', Monthly Weather Review 133, 1098-1118. doi:10.1175/mwr2904.1 (Normal)
Gneiting, T., Larson, K., Westrick, K., Genton, M.G. and E. Aldrich (2006): 'Calibrated probabilistic forecasting at the stateline wind energy center: The regime-switching space-time method', Journal of the American Statistical Association 101, 968-979. doi:10.1198/016214506000000456 (Censored normal)
Gneiting, T. and T.L. Thorarinsdottir (2010): ‘Predicting inflation: Professional experts versus no-change forecasts’, arXiv preprint arXiv:1010.2318. (Two-piece normal)
Grimit, E.P., Gneiting, T., Berrocal, V.J. and N.A. Johnson (2006): 'The continuous ranked probability score for circular variables and its application to mesoscale forecast ensemble verification', Quarterly Journal of the Royal Meteorological Society 132, 2925-2942. doi:10.1256/qj.05.235 (Mixture of normals)
Scheuerer, M. and D. Moeller (2015): 'Probabilistic wind speed forecasting on a grid based on ensemble model output statistics', Annals of Applied Statistics 9, 1328-1349. doi:10.1214/15-aoas843 (Gamma)
Thorarinsdottir, T.L. and T. Gneiting (2010): 'Probabilistic forecasts of wind speed: ensemble model output statistics by using heteroscedastic censored regression', Journal of the Royal Statistical Society (Series A) 173, 371-388. doi:10.1111/j.1467-985x.2009.00616.x (Truncated normal)
Wei, W. and L. Held (2014): ‘Calibration tests for count data’, TEST 23, 787-205. doi:10.1007/s11749-014-0380-8 (Poisson, Negative Binomial)
Independent listing of closed-form solutions for the CRPS:
Taillardat, M., Mestre, O., Zamo, M. and P. Naveau (2016): 'Calibrated ensemble forecasts using quantile regression forests and ensemble model output statistics', Monthly Weather Review 144, 2375-2393. doi:10.1175/mwr-d-15-0260.1
See Also
Examples
crps(y = 1, family = "normal", mean = 0, sd = 2)
crps(y = rnorm(20), family = "normal", mean = 1:20, sd = sqrt(1:20))
## Arguments can have different lengths:
crps(y = rnorm(20), family = "normal", mean = 0, sd = 2)
crps(y = 1, family = "normal", mean = 1:20, sd = sqrt(1:20))
## Mixture of normal distributions requires matrix input for parameters:
mval <- matrix(rnorm(20*50), nrow = 20)
sdval <- matrix(runif(20*50, min = 0, max = 2), nrow = 20)
weights <- matrix(rep(1/50, 20*50), nrow = 20)
crps(y = rnorm(20), family = "mixnorm", m = mval, s = sdval, w = weights)