solarforecastarbiter.metrics.deterministic.pearson_correlation_coeff¶
-
solarforecastarbiter.metrics.deterministic.
pearson_correlation_coeff
(obs, fx)[source]¶ Pearson correlation coefficient (r).
\[r = A / (B * C)\]where:
\[A = \sum_{i=1}^n (\text{fx}_i - \text{fx}_\text{avg}) * (\text{obs}_i - \text{obs}_\text{avg})\]\[B = \sqrt{ \sum_{i=1}^n (\text{fx}_i - \text{fx}_\text{avg})^2 }\]\[C = \sqrt{ \sum_{i=1}^n (\text{obs}_i - \text{obs}_\text{avg})^2 }\]\[\text{fx}_\text{avg} = 1/n \sum_{i=1} \text{fx}_i\]\[\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: r (float) – The correlation coefficient (r [-]) of the observations and forecasts.