scoringrules.crps_poisson

Contents

scoringrules.crps_poisson#

scoringrules.crps_poisson(obs: ArrayLike, mean: ArrayLike, *, backend: Backend = None) ArrayLike#

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

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

\[\mathrm{CRPS}(F_{\lambda}, y) = (y - \lambda) (2F_{\lambda}(y) - 1) + 2 \lambda f_{\lambda}(\lfloor y \rfloor ) - \lambda \exp (-2 \lambda) (I_{0} (2 \lambda) + I_{1} (2 \lambda)),\]

where \(F_{\lambda}\) is Poisson distribution function with mean parameter \(\lambda > 0\), and \(I_{0}\) and \(I_{1}\) are modified Bessel functions of the first kind.

Parameters:
obsarray_like

The observed values.

meanarray_like

Mean parameter of the forecast poisson distribution.

Returns:
crpsarray_like

The CRPS between Pois(mean) and obs.

References

[1]

Wei, W., Held, L. (2014), Calibration tests for count data. TEST 23, 787-805. https://doi.org/10.1007/s11749-014-0380-8

Examples

>>> import scoringrules as sr
>>> sr.crps_poisson(1, 2)
0.4991650450203817