ENH: `stats.spearmanrho`: array API compatible substitute for `spearmanr`

Hi team,

In June, RFC: stats.spearmanr: interface adjustment to enable array API support proposed the creation of a new stats.spearmanrho function so SciPy could provide a Spearman correlation test that worked with non-NumPy arrays without breaking backward compatibility in stats.spearmanr.

ENH: stats.spearmanrho: array API compatible substitute for spearmanr implements this idea. Besides supporting non-NumPy arrays, the proposed function:

  • provides support for N-d arrays,
  • adheres to the standard scipy.stats broadcasting conventions, permitting the calculation of only desired correlation coefficients rather than always calculating all pairwise correlations,
  • has the ability to compute exact p-values, even in the case of ties, and
  • does not appear to suffer from the issues that are currently open against spearmanror those that have been closed but were only partially resolved (see details in PR).

The name spearmanrho also more closely follows the common practice of concatenating author name and associated symbol (using “rho”, which is traditionally reserved to refer to Spearman’s correlation coefficient, instead of “r”, which is also used to refer to Pearson’s).

Please join the discussion about this proposed addition in gh-23851.

Matt