scoringrules.crps_gtclogistic

scoringrules.crps_gtclogistic#

scoringrules.crps_gtclogistic(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 logistic distribution.

\[\begin{split}\begin{aligned} \mathrm{CRPS}(F_{l, L}^{u, U}, y) = & \, |y - z| + uU^{2} - lL^{2} \\ & - \left( \frac{1 - L - U}{F(u) - F(l)} \right) z \left( \frac{(1 - 2L) F(u) + (1 - 2U) F(l)}{1 - L - U} \right) \\ & - \left( \frac{1 - L - U}{F(u) - F(l)} \right) \left( 2 \log F(-z) - 2G(u)U - 2 G(l)L \right) \\ & - \left( \frac{1 - L - U}{F(u) - F(l)} \right)^{2} \left( H(u) - H(l) \right), \end{aligned}\end{split}\]
\[\begin{aligned} \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}), \end{aligned}\]
\[G(x) = xF(x) + \log F(-x),\]
..math::

H(x) = F(x) - xF(x)^{2} + (1 - 2F(x))log F(-x),

where \(F\) is the CDF of the standard logistic distribution, \(F_{l, L, \mu, \sigma}^{u, U}\) is the CDF of the logistic 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\).

Parameters:
obsarray_like

The observed values.

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 gtcLogistic(location, scale, lower, upper, lmass, umass) and obs.

Examples

>>> import scoringrules as sr
>>> sr.crps_gtclogistic(0.0, 0.1, 0.4, -1.0, 1.0, 0.1, 0.1)
0.1658713056903939