scoringrules.crps_laplace#
- scoringrules.crps_laplace(obs: ArrayLike, location: ArrayLike = 0.0, scale: ArrayLike = 1.0, *, backend: Backend = None) ArrayLike#
Compute the closed form of the CRPS for the laplace distribution.
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(F, y) = |y - \mu| + \sigma \exp ( -| y - \mu| / \sigma) - \frac{3\sigma}{4},\]where \(\mu\) and \(\sigma > 0\) are the location and scale parameters of the Laplace distribution.
- Parameters:
- obsarray_like
Observed values.
- locationarray_like
Location parameter of the forecast laplace distribution.
- scalearray_like
Scale parameter of the forecast laplace distribution.
- backendstr, optional
The name of the backend used for computations. Defaults to
numbaif available, elsenumpy.
- Returns:
- crps:
The CRPS between obs and Laplace(location, scale).
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_laplace(0.3, 0.1, 0.2) 0.12357588823428847