scoringrules.crps_beta

Contents

scoringrules.crps_beta#

scoringrules.crps_beta(obs: ArrayLike, a: ArrayLike, b: ArrayLike, lower: ArrayLike = 0.0, upper: ArrayLike = 1.0, *, backend: Backend = None) ArrayLike#

Compute the closed form of the CRPS for the beta distribution.

It is based on the following formulation from [1]:

\[\begin{split}\begin{split} \mathrm{CRPS}(F_{\alpha, \beta}, y) = & (u - l)\left\{ \frac{y - l}{u - l} \left( 2F_{\alpha, \beta} \left( \frac{y - l}{u - l} \right) - 1 \right) \right. \\ & \left. + \frac{\alpha}{\alpha + \beta} \left( 1 - 2F_{\alpha + 1, \beta} \left( \frac{y - l}{u - l} \right) - \frac{2B(2\alpha, 2\beta)}{\alpha B(\alpha, \beta)^{2}} \right) \right\} \end{split}\end{split}\]

where \(F_{\alpha, \beta}\) is the beta distribution function with shape parameters \(\alpha, \beta > 0\), and lower and upper bounds \(l, u \in \mathbb{R}\), \(l < u\).

Parameters:
obsarray_like

The observed values.

a: array_like

First shape parameter of the forecast beta distribution.

b: array_like

Second shape parameter of the forecast beta distribution.

lowerarray_like

Lower bound of the forecast beta distribution.

upperarray_like

Upper bound of the forecast beta distribution.

backendstr, optional

The name of the backend used for computations. Defaults to numba if available, else numpy.

Returns:
crpsarray_like

The CRPS between Beta(a, b) 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_beta(0.3, 0.7, 1.1)
0.08501024366637236