climpred.metrics._spearman_r

climpred.metrics._spearman_r(forecast, verif, dim=None, **metric_kwargs)[source]

Spearman’s rank correlation coefficient.

corr = \mathrm{pearsonr}(ranked(f), ranked(o))

This correlation coefficient is nonparametric and assesses how well the relationship between the forecast and verification data can be described using a monotonic function. It is computed by first ranking the forecasts and verification data, and then correlating those ranks using the pearson_r correlation.

This is also known as the anomaly correlation coefficient (ACC) when comparing anomalies, although the Pearson product-moment correlation coefficient (pearson_r) is typically used when computing the ACC.

Note

Use metric spearman_r_p_value or spearman_r_eff_p_value to get the corresponding p value.

Parameters
  • forecast (xarray object) – Forecast.

  • verif (xarray object) – Verification data.

  • dim (str) – Dimension(s) to perform metric over.

  • metric_kwargs (dict) – see spearman_r()

Details:

minimum

-1.0

maximum

1.0

perfect

1.0

orientation

positive

Example

>>> HindcastEnsemble.verify(metric='spearman_r', comparison='e2o',
...     alignment='same_verifs', dim='init')
<xarray.Dataset>
Dimensions:  (lead: 10)
Coordinates:
  * lead     (lead) int32 1 2 3 4 5 6 7 8 9 10
    skill    <U11 'initialized'
Data variables:
    SST      (lead) float64 0.9336 0.9311 0.9293 0.9474 ... 0.9465 0.9346 0.9328