scoringrules.crps_gtct#
- scoringrules.crps_gtct(obs: ArrayLike, df: ArrayLike, location: ArrayLike = 0.0, scale: ArrayLike = 1.0, 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 t distribution.
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(F_{l, L, \nu}^{u, U}, y) = |y - z| + uU^{2} - lL^{2} + \left( \frac{1 - L - U}{F_{\nu}(u) - F_{\nu}(l)} \right) z \left( 2 F_{\nu}(z) - \frac{(1 - 2L) F_{\nu}(u) + (1 - 2U) F_{\nu}(l)}{1 - L - U} \right) - \left( \frac{1 - L - U}{F_{\nu}(u) - F_{\nu}(l)} \right) \left( 2 G_{\nu}(z) - 2 G_{\nu}(u)U - 2 G_{\nu}(l)L \right) - \left( \frac{1 - L - U}{F_{\nu}(u) - F_{\nu}(l)} \right)^{2} \bar{B}_{\nu} \left( H_{\nu}(u) - H_{\nu}(l) \right),\]\[\mathrm{CRPS}(F_{l, L, \nu, \mu, \sigma}^{u, U}, y) = \sigma \mathrm{CRPS}(F_{(l - \mu)/\sigma, L, \nu}^{(u - \mu)/\sigma, U}, \frac{y - \mu}{\sigma}),\]\[G_{\nu}(x) = - \left( \frac{\nu + x^{2}}{\nu - 1} \right) f_{\nu}(x),\]\[H_{\nu}(x) = \frac{1}{2} + \frac{1}{2} \mathrm{sgn}(x) I \left( \frac{1}{2}, \nu - \frac{1}{2}, \frac{x^{2}}{\nu + x^{2}} \right),\]\[\bar{B}_{\nu} = \left( \frac{2 \sqrt{\nu}}{\nu - 1} \right) \frac{B(\frac{1}{2}, \nu - \frac{1}{2})}{B(\frac{1}{2}, \frac{\nu}{2})^{2}},\]where \(F_{\nu}\) is the CDF of the standard t distribution with \(\nu > 1\) degrees of freedom, distribution, \(F_{l, L, \nu, \mu, \sigma}^{u, U}\) is the CDF of the t distribution truncated below at \(l\) and above at \(u\), with point masses \(L, U > 0\) at the lower and upper boundaries, respectively, and degrees of freedom, location and scale parameters \(\nu > 1\), \(\mu\) and \(\sigma > 0\). \(F_{l, L, \nu}^{u, U} = F_{l, L, \nu, 0, 1}^{u, U}\).
- Parameters:
- obsarray_like
The observed values.
- dfarray_like
Degrees of freedom parameter of the forecast distribution.
- locationarray_like
Location parameter of the forecast distribution.
- scalearray_like
Scale parameter of the forecast distribution.
- lowerarray_like
Lower boundary of the truncated forecast distribution.
- upperarray_like
Upper boundary of the truncated forecast distribution.
- lmassarray_like
Point mass assigned to the lower boundary of the forecast distribution.
- umassarray_like
Point mass assigned to the upper boundary of the forecast distribution.
- Returns:
- crpsarray_like
The CRPS between gtct(df, location, scale, lower, upper, lmass, umass) 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_gtct(0.0, 2.0, 0.1, 0.4, -1.0, 1.0, 0.1, 0.1) 0.13997789333289662