solarforecastarbiter.metrics.deterministic.coeff_determination

solarforecastarbiter.metrics.deterministic.coeff_determination(obs, fx)[source]

Coefficient of determination (R^2).

\[R^2 = 1 - (A / B)\]

where:

\[A = \sum_{i=1}^n (\text{obs}_i - \text{fx}_i)^2\]
\[B = \sum_{i=1}^n (\text{obs}_i - \text{obs}_\text{avg})^2\]
\[\text{obs}_\text{avg} = 1/n \sum_{i=1} \text{obs}_i\]
Parameters:
  • obs ((n,) array-like) – Observed values.
  • fx ((n,) array-like) – Forecasted values.
Returns:

r2 (float) – The coefficient of determination (R^2 [-]) of the observations and forecasts.