scoringrules.crps_2pnormal

Contents

scoringrules.crps_2pnormal#

scoringrules.crps_2pnormal(obs: ArrayLike, scale1: ArrayLike, scale2: ArrayLike, location: ArrayLike, *, backend: Backend = None) ArrayLike#

Compute the closed form of the CRPS for the two-piece normal distribution.

It is based on the following relationship given in [1]:

\[\mathrm{CRPS}(F_{\sigma_{1}, \sigma_{2}, \mu}, y) = \sigma_{1} \mathrm{CRPS} \left( F_{-\infty,0}^{0, \sigma_{2}/(\sigma_{1} + \sigma_{2})}, \frac{\min(0, y - \mu)}{\sigma_{1}} \right) + \sigma_{2} \mathrm{CRPS} \left( F_{0, \sigma_{1}/(\sigma_{1} + \sigma_{2})}^{\infty, 0}, \frac{\min(0, y - \mu)}{\sigma_{2}} \right),\]

where \(F_{\sigma_{1}, \sigma_{2}, \mu}\) is the two-piece normal distribution with scale1 and scale2 parameters \(\sigma_{1}, \sigma_{2} > 0\) and location parameter \(\mu\), and \(F_{l, L}^{u, U}\) is the CDF of the generalised truncated and censored normal distribution.

Parameters:
obsarray_like

The observed values.

scale1array_like

Scale parameter of the lower half of the forecast two-piece normal distribution.

scale2array_like

Scale parameter of the upper half of the forecast two-piece normal distribution.

mu: array_like

Location parameter of the forecast two-piece normal distribution.

Returns:
crpsarray_like

The CRPS between 2pNormal(scale1, scale2, mu) 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_2pnormal(0.0, 0.4, 2.0, 0.1)
0.7243199144002115