scoringrules.crps_loglaplace

scoringrules.crps_loglaplace#

scoringrules.crps_loglaplace(obs: ArrayLike, locationlog: ArrayLike, scalelog: ArrayLike, *, backend: Backend = None) ArrayLike#

Compute the closed form of the CRPS for the log-Laplace distribution.

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

\[\mathrm{CRPS}(F_{\mu, \sigma}, y) = y (2 F_{\mu, \sigma}(y) - 1) + \exp(\mu) \left( \frac{\sigma}{4 - \sigma^{2}} + A(y) \right),\]

where \(F_{\mu, \sigma}\) is the CDF of the log-laplace distribution with location parameter \(\mu\) and scale parameter \(\sigma \in (0, 1)\), and

\[A(y) = \frac{1}{1 + \sigma} \left( 1 - (2 F_{\mu, \sigma}(y) - 1)^{1 + \sigma} \right),\]

if \(y < \exp{\mu}\), and

\[A(y) = \frac{-1}{1 - \sigma} \left( 1 - (2 (1 - F_{\mu, \sigma}(y)))^{1 - \sigma} \right),\]

if \(y \ge \exp{\mu}\).

Parameters:
obsarray_like

Observed values.

locationlogarray_like

Location parameter of the forecast log-laplace distribution.

scalelogarray_like

Scale parameter of the forecast log-laplace distribution.

backendstr, optional

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

Returns:
crpsarray_like

The CRPS between obs and Loglaplace(locationlog, scalelog).

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_loglaplace(3.0, 0.1, 0.9)
1.162020513653791