scoringrules.crps_2pexponential#
- scoringrules.crps_2pexponential(obs: ArrayLike, scale1: ArrayLike, scale2: ArrayLike, location: ArrayLike, *, backend: Backend = None) ArrayLike#
Compute the closed form of the CRPS for the two-piece exponential distribution.
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(F_{\sigma_{1}, \sigma_{2}, \mu}, y) = |y - \mu| + \frac{2\sigma_{\pm}^{2}}{\sigma_{1} + \sigma_{2}} \exp \left( - \frac{|y - \mu|}{\sigma_{\pm}} \right) - \frac{2\sigma_{\pm}^{2}}{\sigma_{1} + \sigma_{2}} + \frac{\sigma_{1}^{3} + \sigma_{2}^{3}}{2(\sigma_{1} + \sigma_{2})^2},\]where \(F_{\sigma_{1}, \sigma_{2}, \mu}\) is the two-piece exponential distribution function with scale parameters \(\sigma_{1}, \sigma_{2} > 0\) and location parameter \(\mu\). The parameter \(\sigma_{\pm}\) is equal to \(\sigma_{1}\) if \(y < 0\) and \(\sigma_{2}\) if \(y \geq 0\).
- Parameters:
- obsarray_like
The observed values.
- scale1array_like
First scale parameter of the forecast two-piece exponential distribution.
- scale2array_like
Second scale parameter of the forecast two-piece exponential distribution.
- locationarray_like
Location parameter of the forecast two-piece exponential distribution.
- backendstr, optional
The name of the backend used for computations. Defaults to
numbaif available, elsenumpy.
- Returns:
- crpsarray_like
The CRPS between 2pExp(sigma1, sigma2, location) 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_2pexponential(0.8, 3.0, 1.4, 0.0) array(1.18038524)