scoringrules.crps_normal

Contents

scoringrules.crps_normal#

scoringrules.crps_normal(obs: ArrayLike, mu: ArrayLike, sigma: ArrayLike, *, backend: Backend = None) ArrayLike#

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

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

\[\mathrm{CRPS}(\mathcal{N}(\mu, \sigma), y) = \sigma \Bigl\{ \omega [\Phi(ω) - 1] + 2 \phi(\omega) - \frac{1}{\sqrt{\pi}} \Bigl\}\]

where \(\Phi(ω)\) and \(\phi(ω)\) are respectively the CDF and PDF of the standard normal distribution at the normalized prediction error \(\omega = \frac{y - \mu}{\sigma}\).

Parameters:
obsarray_like

The observed values.

mu: array_like

Mean of the forecast normal distribution.

sigma: array_like

Standard deviation of the forecast normal distribution.

Returns:
crpsarray_like

The CRPS between Normal(mu, sigma) and obs.

References

[1]

Gneiting, T., A. E. Raftery, A. H. Westveld, and T. Goldman (2005), Calibrated Probabilistic Forecasting Using Ensemble Model Output Statistics and Minimum CRPS Estimation. Mon. Wea. Rev., 133, 1098-1118, https://doi.org/10.1175/MWR2904.1.

Examples

>>> import scoringrules as sr
>>> sr.crps_normal(0.0, 0.1, 0.4)
0.10339992515976162