scoringrules.crps_gpd#
- scoringrules.crps_gpd(obs: ArrayLike, shape: ArrayLike, location: ArrayLike = 0.0, scale: ArrayLike = 1.0, mass: ArrayLike = 0.0, *, backend: Backend = None) ArrayLike#
Compute the closed form of the CRPS for the generalised pareto distribution (GPD).
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(F_{M, \xi}, y) = |y| - \frac{2 (1 - M)}{1 - \xi} \left( 1 - (1 - F_{\xi}(y))^{1 - \xi} \right) + \frac{(1 - M)^{2}}{2 - \xi},\]\[\mathrm{CRPS}(F_{M, \xi, \mu, \sigma}, y) = \sigma \mathrm{CRPS} \left( F_{M, \xi}, \frac{y - \mu}{\sigma} \right),\]where \(F_{M, \xi, \mu, \sigma}\) is the GPD distribution function with shape parameter \(\xi < 1\), location parameter \(\mu\), scale parameter \(\sigma > 0\), and point mass \(M \in [0, 1]\) at the lower boundary. \(F_{M, \xi} = F_{M, \xi, 0, 1}\).
- Parameters:
- obsarray_like
The observed values.
- shapearray_like
Shape parameter of the forecast GPD distribution.
- locationarray_like
Location parameter of the forecast GPD distribution.
- scalearray_like
Scale parameter of the forecast GPD distribution.
- massarray_like
Mass parameter at the lower boundary of the forecast GPD distribution.
- backendstr, optional
The name of the backend used for computations. Defaults to
numbaif available, elsenumpy.
- Returns:
- crpsarray_like
The CRPS between obs and GPD(shape, location, scale, mass).
References
[1]Jordan, A., Krüger, F., & Lerch, S. (2019). Evaluating Probabilistic Forecasts with scoringRules. Journal of Statistical Software, 90(12), 1-37. https://doi.org/10.18637/jss.v090.i12
Examples
>>> import scoringrules as sr >>> sr.crps_gpd(0.3, 0.9) 0.6849331901197213