scoringrules.crps_gtcnormal#
- scoringrules.crps_gtcnormal(obs: ArrayLike, location: ArrayLike, scale: ArrayLike, lower: ArrayLike = -inf, upper: ArrayLike = inf, lmass: ArrayLike = 0.0, umass: ArrayLike = 0.0, *, backend: Backend = None) ArrayLike#
Compute the closed form of the CRPS for the generalised truncated and censored normal distribution.
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(F_{l, L}^{u, U}, y) = |y - z| + uU^{2} - lL^{2} + \left( \frac{1 - L - U}{\Phi(u) - \Phi(l)} \right) z \left( 2 \Phi(z) - \frac{(1 - 2L) \Phi(u) + (1 - 2U) \Phi(l)}{1 - L - U} \right) + \left( \frac{1 - L - U}{\Phi(u) - \Phi(l)} \right) \left( 2 \phi(z) - 2 \phi(u)U - 2 \phi(l)L \right) - \left( \frac{1 - L - U}{\Phi(u) - \Phi(l)} \right)^{2} \left( \frac{1}{\sqrt{\pi}} \right) \left( \Phi(u \sqrt{2}) - \Phi(l \sqrt{2}) \right),\]\[\mathrm{CRPS}(F_{l, L, \mu, \sigma}^{u, U}, y) = \sigma \mathrm{CRPS}(F_{(l - \mu)/\sigma, L}^{(u - \mu)/\sigma, U}, \frac{y - \mu}{\sigma}),\]where \(\Phi:math:\) and \(\phi\) are respectively the CDF and PDF of the standard normal distribution, \(F_{l, L, \mu, \sigma}^{u, U}\) is the CDF of the normal distribution truncated below at \(l\) and above at \(u\), with point masses \(L, U > 0\) at the lower and upper boundaries, respectively, and location and scale parameters \(\mu\) and \(\sigma > 0\). \(F_{l, L}^{u, U} = F_{l, L, 0, 1}^{u, U}\).
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_gtcnormal(0.0, 0.1, 0.4, -1.0, 1.0, 0.1, 0.1) 0.1351100832878575