scoringrules.crps_uniform#
- scoringrules.crps_uniform(obs: ArrayLike, min: ArrayLike, max: ArrayLike, lmass: ArrayLike = 0.0, umass: ArrayLike = 0.0, *, backend: Backend = None) ArrayLike#
Compute the closed form of the CRPS for the uniform distribution.
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(\mathcal{U}_{L}^{U}(l, u), y) = (u - l) \left\{ | \frac{y - l}{u - l} - F \left( \frac{y - l}{u - l} \right) | + F \left( \frac{y - l}{u - l} \right)^{2} (1 - L - U) - F \left( \frac{y - l}{u - l} \right) (1 - 2L) + \frac{(1 - L - U)^{2}}{3} + (1 - L)U \right\}\]where \(\mathcal{U}_{L}^{U}(l, u)\) is the uniform distribution with lower bound \(l\), upper bound \(u > l\), point mass \(L\) on the lower bound, and point mass \(U\) on the upper bound. We must have that \(L, U \ge 0, L + U < 1\).
- Parameters:
- obsarray_like
The observed values.
- min: array_like
Lower bound of the forecast uniform distribution.
- max: array_like
Upper bound of the forecast uniform distribution.
- lmassarray_like
Point mass on the lower bound of the forecast uniform distribution.
- umassarray_like
Point mass on the upper bound of the forecast uniform distribution.
- Returns:
- crpsarray_like
The CRPS between U(min, max, lmass, umass) and obs.
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_uniform(0.4, 0.0, 1.0, 0.0, 0.0) 0.09333333333333332