solarforecastarbiter.metrics.deterministic.kolmogorov_smirnov_integral

solarforecastarbiter.metrics.deterministic.kolmogorov_smirnov_integral(obs, fx, normed=False)[source]

Kolmogorov-Smirnov Test Integral (KSI).

\[\text{KSI} = \int_{p_\min}^{p_\max} D_n(p) dp\]

where:

\[D_n(p) = \max(|\text{CDF}_\text{obs}(p) - \text{CDF}_\text{fx}(p)|)\]

and CDF_obs and CDF_fx are the empirical CDFs of the observations and forecasts, respectively. KSI can be normalized as:

\[\text{KSI [%]} = \text{KSI} / a_\text{critical} * 100%\]

where:

\[a_\text{critical} = V_c * (p_\max - p_\min)\]
\[V_c = 1.63 / \sqrt{n}\]
Parameters:
  • obs ((n,) array-like) – Observed values.
  • fx ((n,) array-like) – Forecasted values.
  • normed (bool, optional) – If True, return the normalized KSI [%].
Returns:

ksi (float) – The KSI of the forecast.

Notes

The calculation of the empirical CDF uses a right endpoint rule (the default of the statsmodels ECDF function). For example, if the data is [1.0, 2.0], then ECDF output is 0.5 for any input less than 1.0.