# 肯德尔秩相关系数

**肯德尔τ**是一种基于秩的序数关联度量，用于衡量两个变量之间的序数关联程度。其定义为：从两个变量中随机抽取的两对观测值在两个变量上排序方向相同的概率，减去排序方向相反的概率。取值范围为−1到+1，在独立条件下等于零；与斯皮尔曼ρ一样、但与皮尔逊相关不同，肯德尔τ在任一变量的严格递增变换下保持不变。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 对来自同一分布的两对独立观测值，τ = P[(X₁−X₂)(Y₁−Y₂) > 0] − P[(X₁−X₂)(Y₁−Y₂) < 0]<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup> |
| 样本公式（无结） | τ = S / C(n,2) = 2S / (n(n−1))，其中S为同序对数减去异序对数<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup> |
| 结调整形式（tau-b） | τ = S / √(n(n−1)/2 − T) √(n(n−1)/2 − U)，其中T和U分别对X和Y中各组结求和t(t−1)/2<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup> |
| 零分布 | 在独立且无结条件下，E τ = 0，Var τ = 2(2n+5)/(9n(n−1))；小n用精确检验，n > 10用正态近似<sup>[2](https://encyclopediaofmath.org/wiki/Kendall_coefficient_of_rank_correlation)</sup> |
| 联结函数形式 | τ = 4∫∫C(u,v) dC(u,v) − 1，仅依赖于联结函数<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup> |
| 计算 | 朴素算法代价O(n²)；树状数组算法可在O(n log n)内计算tau<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup> |
| 起源 | 约1900年由G. T. 费希纳等人讨论；1938年由M. G. 肯德尔独立重新发现<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup> |

## 定义与计算

对于n对观测值，样本点对(x_j, y_j)、(x_k, y_k)在两个坐标对两点的排序方向一致时——即x_j < x_k且y_j < y_k，或x_j > x_k且y_j > y_k——称为同序对；当两个坐标的排序方向相反，即(x_j − x_k)(y_j − y_k) < 0时，称为异序对。n个观测值共有n(n−1)/2个不同的对，每个对在没有结的情况下要么是同序对，要么是异序对。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup>

样本统计量通常称为**tau-a**，是同序对数c与异序对数d之差除以对的总数：

\[ \tau_n = \frac{c - d}{\binom{n}{2}} = \frac{2S}{n(n-1)}. \]

当存在结时，调整后的公式将S除以两个结校正分母的乘积，每个变量对应一个：

\[ \tau_n = \frac{S}{\sqrt{n(n-1)/2 - T}\,\sqrt{n(n-1)/2 - U}}, \]

其中T和U分别对X和Y中每组t个结秩求和t(t−1)/2。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup>在SciPy使用的等价计数记法中，tau-b为(P − Q)/√((P + Q + T)(P + Q + U))，其中P和Q分别为同序对数和异序对数，T计算仅在x上有结而在y上无结的对数，U计算仅在y上有结而在x上无结的对数。<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup>NIST记录了相同的结校正方法，并指出无结时tau-b等于tau-a，但存在结时tau-b优于tau-a。<sup>[4](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/kendell.htm)</sup>

对于连续变量，tau还有符号表示：它等于符号函数sign(X₁−X₂)和sign(Y₁−Y₂)的皮尔逊相关，这就是它有时被称为差符号相关系数的原因。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup>

## 变体：tau-b、tau-c及相关度量

**Tau-c（斯图尔特tau-c）**在两个变量具有不同数量的不同取值时，重新缩放分子以达到完整的−1到+1范围：

\[ \tau_c = \frac{2(P - Q)}{n^2 (m-1)/m}, \]

其中m是两个变量不同取值数量的较小者。<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup><sup> • </sup><sup>[4](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/kendell.htm)</sup>斯图尔特tau-c同时校正表格大小和结，仅当两个变量均位于序数尺度上时才适用；它与tau-b、古德曼–克鲁斯卡尔gamma和斯皮尔曼秩相关一样，取值范围为−1到+1。<sup>[5](http://mrvar.fdv.uni-lj.si/pub/mz/mz8.1/goktas.pdf)</sup>SciPy实现了tau-b（默认）和tau-c，二者仅在归一化上不同，p值相同；tau-a未单独实现，因为无结时两种变体均退化为tau-a。<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup>

**萨默斯D**是tau-b的非对称修正，仅校正自变量上的结对；值为−1表示完全反转，+1表示完全一致。<sup>[5](http://mrvar.fdv.uni-lj.si/pub/mz/mz8.1/goktas.pdf)</sup>

哪种变体最能恢复潜在的关联取决于数据。在将二元正态分布分组成列联表的模拟中，艾伦·阿格雷斯蒂发现肯德尔tau-b通常比tau-c、古德曼–克鲁斯卡尔gamma和斯皮尔曼ρ的三种扩展更好地近似未分组数据的度量，并且tau-b因分组导致的效率损失与结对比例密切相关。<sup>[6](https://alanagresti.com/articles/JASA_1976.pdf)</sup>

对于非退化的离散变量，未调整的肯德尔tau无法达到±1，因为结具有正概率，而斯皮尔曼ρ可以，例如当Y = X时达到+1。古德曼–克鲁斯卡尔gamma是可达到的对应量。Tau-b将tau除以√(τ(X,X)τ(Y,Y))以校正单变量结概率，但与tau不同，在离散数据完全正相依时可以达到+1，尽管它仍是软件中广泛使用的默认值。<sup>[7](https://arxiv.org/html/2512.14609)</sup><sup> • </sup><sup>[4](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/kendell.htm)</sup>

## 统计性质与推断

在连续变量独立的零假设下，tau的期望值为0，方差为

\[ \operatorname{Var}(\tau) = \frac{2(2n+5)}{9n(n-1)}. \]

对于4 ≤ n ≤ 10的小样本，独立性检验使用专用表；当n > 10时使用正态近似，当|τ|超过u(α/2)√(2(2n+5)/(9n(n−1)))时拒绝独立性。<sup>[2](https://encyclopediaofmath.org/wiki/Kendall_coefficient_of_rank_correlation)</sup>

软件遵循类似的阈值。R在配对样本少于50个、值有限且无结时，默认计算肯德尔检验的精确p值，否则使用缩放至零均值和单位方差的正态近似。<sup>[8](https://search.r-project.org/R/refmans/stats/html/cor.test.html)</sup>R的Kendall包在无结时使用Best和Gipps（1974）算法计算精确p值，存在结时使用基于Kendall（1976）方差公式的连续性校正正态近似；对于大量结，建议使用自助法或精确枚举。<sup>[9](https://search.r-project.org/CRAN/refmans/Kendall/html/Kendall.html)</sup>StatsDirect对n ≤ 1000通过递推、对n > 1000通过埃奇沃斯级数展开来评估得分S的精确零分布。<sup>[10](https://statsdirect.com/help/nonparametric_methods/kendall_correlation.htm)</sup>SciPy仅在无结时提供精确p值，否则使用“渐近”和“自动”方法；存在结时，仍可通过x和y之间元素所有配对的置换检验形成精确零分布。<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup><sup> • </sup><sup>[11](https://docs.scipy.org/doc/scipy/tutorial/stats/hypothesis_kendalltau.html)</sup>

对于来自一般分布的大样本，tau估计量是无偏且渐近正态的：√n(τ̂ₙ − τ)收敛于方差为σ²τ = 4 Var(E[sgn(X−X′)sgn(Y−Y′)|X,Y])的正态分布，用联结函数表示为σ²τ = 16 Var[2C(U,V) − U − V]，仅依赖于联结函数C。一般上界为σ²τ ≤ 4(1 − τ²)，对于轴对称分布σ²τ ≤ 4/3。渐近置信区间形式为τ̂ₙ ± στ/√n · u(α/2)。<sup>[12](https://fam.tuwien.ac.at/~schmock/slides/AsymptoticVarianceKT.pdf)</sup>具体在正态性下，tau的渐近方差约为0.437/(n − 4)，使用该标准差的Fisher z变换置信区间在中等大样本下表现令人满意。<sup>[13](https://www.tandfonline.com/doi/pdf/10.1080/00031305.2021.2004922)</sup>这两个方差陈述描述了不同的设定——零假设下的有限样本方差和正态模型渐近方差——此处均按原文报告。StatsDirect使用Samara和Randles（1988）方法（如Hollander和Wolfe（1999）所述）为tau-b构建渐近分布无关的置信区间。<sup>[10](https://statsdirect.com/help/nonparametric_methods/kendall_correlation.htm)</sup>

## 与联结函数、椭圆分布及皮尔逊相关的关系

对于连续X和Y，tau仅通过其联结函数C依赖于联合分布，联结函数是将边缘分布与联合分布联系起来的函数：

\[ \tau = 4 \int_0^1 \int_0^1 C(u,v)\, dC(u,v) - 1. \]

等价地，对于单位正方形上的均匀(U,V)，τ = 4E[C(U,V)] − 1。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup><sup> • </sup><sup>[12](https://fam.tuwien.ac.at/~schmock/slides/AsymptoticVarianceKT.pdf)</sup>由于tau在X和Y的严格递增变换下不变，只要联结函数是正态联结函数，其均值和方差对任何连续边缘分布都保持与正态性下相同。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup><sup> • </sup><sup>[13](https://www.tandfonline.com/doi/pdf/10.1080/00031305.2021.2004922)</sup>

对于椭圆分布的(X, Y)，tau通过Lindskog、McNeil和Schmock（2003）公式与线性相关ρ相联系

\[ \tau = \frac{2}{\pi} \arcsin \rho, \]

存在结时用结校正调整。<sup>[12](https://fam.tuwien.ac.at/~schmock/slides/AsymptoticVarianceKT.pdf)</sup>这一关系正是tau矩阵可用于金融中椭圆依赖模型校准的原因。<sup>[14](https://www.degruyterbrill.com/document/doi/10.1515/demo-2025-0012/html?recommended=sidebar)</sup>

## 与斯皮尔曼ρ和皮尔逊r的比较

Tau和斯皮尔曼ρ估计不同的总体量，作为同一参数的估计量并不直接竞争。对于正态模型，一项评估认为肯德尔相关度量比斯皮尔曼秩相关更稳健且效率略高。<sup>[15](http://arxiv.org/pdf/2208.01790v1)</sup>另一项独立的理论和模拟研究发现，与某些文献中等价性的主张相反，两个系数在二元正态和污染正态模型中的偏差、方差、均方误差和渐近相对效率方面存在显著差异。<sup>[16](https://dlnext.acm.org/doi/10.1016/j.sigpro.2012.08.005)</sup>

解释上tau在两方面占优。它具有直接的概率意义，即两个变量对观测点对给出相同排序与相反排序的概率之差的重缩放，而斯皮尔曼rs没有这种简单含义。<sup>[17](https://aclanthology.org/J06-4002.pdf)</sup>在小样本中，tau的分布比rs更快接近正态性，这对大约30个或更少数据点的研究是一个优势；斯皮尔曼ρ是有偏统计量，在小样本中低估真实总体相关，而tau不提供有偏估计。<sup>[17](https://aclanthology.org/J06-4002.pdf)</sup>Kendall和Gibbons（1990）还认为斯皮尔曼统计量的置信区间不如肯德尔tau的可靠和可解释。<sup>[15](http://arxiv.org/pdf/2208.01790v1)</sup>R的Kendall包中指出的一个实际优势是，得分S在小n时近似正态分布且更易于处理。<sup>[9](https://search.r-project.org/CRAN/refmans/Kendall/html/Kendall.html)</sup>

与皮尔逊相关相比，NIST建议在数据仅可排序、关系非线性但单调、或正态性不满足时使用肯德尔tau。<sup>[4](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/kendell.htm)</sup>

## 扩展

**曼–肯德尔趋势检验**将tau框架应用于时间序列趋势检测，使用得分S，分母D = n(n−1)/2为S的最大可能值；存在结时D的公式更为复杂。<sup>[9](https://search.r-project.org/CRAN/refmans/Kendall/html/Kendall.html)</sup>对于加权情形，fastWKendall算法在O(n log n)时间和O(n)空间内计算近似加权肯德尔相关，改进了最先进的O(n²)方法。<sup>[18](http://ideas.repec.org/a/spr/compst/v33y2018i4d10.1007_s00180-017-0775-6.html)</sup>2025年的一篇论文引入了肯德尔tau和条件肯德尔tau矩阵的快速估计器，通过利用假定的块结构对部分数据取平均，在高维中降低计算成本同时保持相似的误差水平。<sup>[14](https://www.degruyterbrill.com/document/doi/10.1515/demo-2025-0012/html?recommended=sidebar)</sup>

## 关键数字

- 对数：n(n−1)/2对，无结时每对为同序或异序。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup>
- 复杂度：朴素O(n²)；树状数组实现达到O(n log n)。<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup>在n = 20,000个观测值时，朴素方法需要约4亿次成对比较，而kendallknight实现完成不到200,000次操作，基准测试减少数分钟且无精度损失。<sup>[19](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0326090)</sup>
- 零假设下的方差：2(2n+5)/(9n(n−1))。<sup>[2](https://encyclopediaofmath.org/wiki/Kendall_coefficient_of_rank_correlation)</sup>
- 正态模型渐近方差：约0.437/(n − 4)。<sup>[13](https://www.tandfonline.com/doi/pdf/10.1080/00031305.2021.2004922)</sup>
- 方差上界：一般σ²τ ≤ 4(1 − τ²)，轴对称分布σ²τ ≤ 4/3。<sup>[12](https://fam.tuwien.ac.at/~schmock/slides/AsymptoticVarianceKT.pdf)</sup>
- 精确检验阈值：R在少于50对且无结时使用精确p值；<sup>[8](https://search.r-project.org/R/refmans/stats/html/cor.test.html)</sup>StatsDirect通过递推至n ≤ 1000、超出则用埃奇沃斯展开评估精确零分布。<sup>[10](https://statsdirect.com/help/nonparametric_methods/kendall_correlation.htm)</sup>

## 应用

**趋势检测。** 曼–肯德尔检验是检测环境和其他时间序列中单调趋势的标准tau工具。<sup>[9](https://search.r-project.org/CRAN/refmans/Kendall/html/Kendall.html)</sup>

**金融与风险。** 肯德尔tau矩阵用于稳健依赖估计、联结函数拟合、椭圆图模型和组合风险价值估计；在椭圆框架中，tau估计驱动风险价值计算的线性相关矩阵。<sup>[14](https://www.degruyterbrill.com/document/doi/10.1515/demo-2025-0012/html?recommended=sidebar)</sup>2025年的一篇论文提出了由肯德尔tau和斯皮尔曼ρ构建的尾部依赖矩阵，其非参数估计量具有强相合性，渐近分布通过U过程极限理论导出，用于金融、保险和风险管理；基于肯德尔的尾部依赖矩阵优于基于斯皮尔曼的矩阵，后者存在大偏差问题。<sup>[20](https://link.springer.com/article/10.1007/s10114-025-3225-3)</sup>

**机器学习。** DiffKendall（NeurIPS 2023）通过度量成对通道对排序的一致性使肯德尔秩相关可微，用于少样本学习，τ = (N_con − N_dis)/N_total，将tau直接嵌入为训练损失。<sup>[21](https://proceedings.neurips.cc/paper_files/paper/2023/file/9b01333262789ea3a65a5fab4c22feae-Paper-Conference.pdf)</sup>2025年ICML的一篇论文引入了一个即插即用的肯德尔τ排序损失用于logits的知识蒸馏，补充而非替代KL散度，在CIFAR-100、ImageNet和COCO上跨CNN和ViT师生架构进行了验证。<sup>[22](https://dl.acm.org/doi/10.5555/3780338.3781135)</sup>在这些设定中计算效率很重要：缓慢的O(n²) tau计算在基因组学或金融等领域使用计量经济学或机器学习方法时引入瓶颈。<sup>[19](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0326090)</sup>

## 实践中的陷阱

结是主要的技术风险。SciPy内置的精确方法在存在结时不可用，因此使用渐近近似；精确零分布可以通过对元素所有配对的置换检验形成；<sup>[3](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)</sup><sup> • </sup><sup>[11](https://docs.scipy.org/doc/scipy/tutorial/stats/hypothesis_kendalltau.html)</sup>存在大量结时，建议使用自助法或精确枚举。<sup>[9](https://search.r-project.org/CRAN/refmans/Kendall/html/Kendall.html)</sup>对于离散数据，tau在完全依赖下无法达到±1，而tau-b在完全正相依下可以等于+1，因此不应将其大小解读为与连续数据相同尺度上的效应量。<sup>[7](https://arxiv.org/html/2512.14609)</sup><sup> • </sup><sup>[4](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/kendell.htm)</sup>小p值是反对独立性的证据，但不是支持零假设的证据，不表明大效应，显著性阈值应在分析前选择。<sup>[11](https://docs.scipy.org/doc/scipy/tutorial/stats/hypothesis_kendalltau.html)</sup>一项被引用的比较报告称，在小样本中tau是无偏的且比斯皮尔曼ρ更快接近正态性，并指出它通常被优先用于30个或更少数据点的研究。<sup>[17](https://aclanthology.org/J06-4002.pdf)</sup>

## 历史

后来被称为肯德尔tau的系数最早由G. T. 费希纳等人在约1900年讨论，1938年由M. G. 肯德尔独立重新发现。<sup>[1](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)</sup>肯德尔的论文《一种新的秩相关度量》发表于《生物计量学》第30卷第1-2期，1938年6月，第81–93页，是该系数的主要来源。<sup>[23](http://academic.oup.com/biomet/article-pdf/30/1-2/81/423380/30-1-2-81.pdf)</sup>

## References

1. [Kendall tau metric — Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Kendall_tau_metric)
2. [Kendall coefficient of rank correlation — Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Kendall_coefficient_of_rank_correlation)
3. [kendalltau — SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html)
4. [Kendall's Tau — NIST Dataplot reference manual](https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/kendell.htm)
5. [A Comparison of the Most Commonly Used Measures of Association for Doubly Ordered Square Contingency Tables via Simulation — Metodološki zvezki](http://mrvar.fdv.uni-lj.si/pub/mz/mz8.1/goktas.pdf)
6. [Agresti, A. (1976). The Effect of Category Choice on Some Ordinal Measures of Association. JASA](https://alanagresti.com/articles/JASA_1976.pdf)
7. [Asymptotic Inference for Rank Correlations — arXiv (2025)](https://arxiv.org/html/2512.14609)
8. [R: cor.test documentation](https://search.r-project.org/R/refmans/stats/html/cor.test.html)
9. [R Kendall package documentation](https://search.r-project.org/CRAN/refmans/Kendall/html/Kendall.html)
10. [Kendall's Rank Correlation — StatsDirect](https://statsdirect.com/help/nonparametric_methods/kendall_correlation.htm)
11. [Kendall's tau test — SciPy tutorial](https://docs.scipy.org/doc/scipy/tutorial/stats/hypothesis_kendalltau.html)
12. [Dengler, K., Schmock, U. On the Asymptotic Variance of the Estimator of Kendall's Tau — TU Wien](https://fam.tuwien.ac.at/~schmock/slides/AsymptoticVarianceKT.pdf)
13. [Myths About Linear and Monotonic Associations: Pearson's r, Spearman's ρ, and Kendall's τ — The American Statistician](https://www.tandfonline.com/doi/pdf/10.1080/00031305.2021.2004922)
14. [Fast estimation of Kendall's tau and conditional Kendall's tau matrices — Dependence Modeling (2025)](https://www.degruyterbrill.com/document/doi/10.1515/demo-2025-0012/html?recommended=sidebar)
15. [Asymptotic relative efficiency of the Kendall and Spearman correlation statistics — arXiv](http://arxiv.org/pdf/2208.01790v1)
16. [A comparative analysis of Spearman's rho and Kendall's tau in normal and contaminated normal models — Signal Processing](https://dlnext.acm.org/doi/10.1016/j.sigpro.2012.08.005)
17. [Automatic Evaluation of Information Ordering: Kendall's Tau — Computational Linguistics](https://aclanthology.org/J06-4002.pdf)
18. [fastWKendall: an efficient algorithm for weighted Kendall correlation — Computational Statistics (2018)](http://ideas.repec.org/a/spr/compst/v33y2018i4d10.1007_s00180-017-0775-6.html)
19. [Kendallknight: An R package for efficient implementation of Kendall's correlation coefficient computation — PLOS One (2025)](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0326090)
20. [Tail Dependence Matrices and Tests Based on Spearman's ρ and Kendall's τ — Acta Mathematica Sinica (2025)](https://link.springer.com/article/10.1007/s10114-025-3225-3)
21. [DiffKendall: A Novel Approach for Few-Shot Learning with Differentiable Kendall's Rank Correlation — NeurIPS 2023](https://proceedings.neurips.cc/paper_files/paper/2023/file/9b01333262789ea3a65a5fab4c22feae-Paper-Conference.pdf)
22. [Enhancing logits distillation with plug&play Kendall's τ ranking loss — ICML 2025](https://dl.acm.org/doi/10.5555/3780338.3781135)
23. [Kendall, M. G. (1938). A New Measure of Rank Correlation. Biometrika 30(1-2), 81–93](http://academic.oup.com/biomet/article-pdf/30/1-2/81/423380/30-1-2-81.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Probability distributions › Copulas and dependence structure › Concordance and rank dependence measures

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/kendall-rank-correlation-coefficient

English original: https://www.edgepedia.org/kendall-rank-correlation-coefficient
