SciPy 中的 spearmanr 使用了什么显着性检验?

What significance test is used for spearmanr in SciPy?

在 scipy.stats.spearmanr 中使用什么类型的显着性检验来产生它吐出的 p 值?该文档只是说它是一个两侧的 p 值,但相对于什么分布?是 t 分布吗?

根据 documentation,

the p-value roughly indicates the probability of an uncorrelated system producing datasets that have a Spearman correlation at least as extreme as the one computed from these datasets. The p-values are not entirely reliable but are probably reasonable for datasets larger than 500 or so.

当您查看 source code 时,您可以看到他们计算了一个 t 值:

% rs is rho
t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs)))

然后计算 p 值,假定具有两个自由度的 t 分布:

prob = distributions.t.sf(np.abs(t),n-2)*2

这也在 Wikipedia 上作为计算统计显着性的一个选项进行了解释。