← 返回资讯屏轩教育 · 行业资讯

Spearman's Rank Correlation Coefficient | 斯皮尔曼等级相关系数

2026-08-03 03:34 · 本文部分内容由AI辅助创作

📚 Spearman's Rank Correlation Coefficient | 斯皮尔曼等级相关系数

Spearman's rank correlation coefficient, denoted by rs or the Greek letter ρ (rho), is a non-parametric measure of the strength and direction of the monotonic association between two ranked variables. Unlike Pearson's correlation, it does not assume a linear relationship or normally distributed data, making it a robust tool when working with ordinal data or non-linear monotonic trends. Spearman's coefficient assesses how well the relationship between two variables can be described by a monotonic function, meaning that as one variable increases, the other tends to increase (or decrease) consistently, but not necessarily at a constant rate.

斯皮尔曼等级相关系数,记作 rs 或希腊字母 ρ (rho),是衡量两个排序变量之间单调关联强度和方向的非参数指标。与皮尔逊相关系数不同,它不假设线性关系或数据呈正态分布,因此在处理有序数据或非线性单调趋势时更加稳健。斯皮尔曼系数评估的是两个变量之间的关系能被一个单调函数描述的程度,即当一个变量增加时,另一个变量倾向于一致地增加(或减少),但变化率不必恒定。

1. Understanding Monotonic Relationships | 理解单调关系

In a monotonic relationship, the variables move in the same relative direction, but the rate of change need not be constant. A positive monotonic association means that as X increases, Y tends to increase. A negative monotonic association means that as X increases, Y tends to decrease. This is a more general concept than linearity, allowing for curves that never change direction. Spearman's correlation directly measures the consistency of this directional movement by converting raw data into ranks.

在单调关系中,变量沿相同的相对方向变化,但变化率不必恒定。正单调关联意味着随着 X 增加,Y 倾向于增加。负单调关联意味着随着 X 增加,Y 倾向于减少。这是一个比线性更宽泛的概念,允许存在方向从不改变的曲线。斯皮尔曼相关系数通过将原始数据转换为秩次,直接衡量了这种方向变化的一致性。

For example, consider the relationship between hours studied and exam score. Even if the score increases rapidly at first and then levels off, the association is still positive and monotonic. Spearman's coefficient would capture this perfectly, whereas Pearson's might underestimate the strength because it looks for a straight line.

例如,考虑学习时长与考试成绩之间的关系。即使成绩起初快速上升然后趋于平缓,这种关联仍然是正向且单调的。斯皮尔曼系数能够完美捕捉这一点,而皮尔逊系数可能会因为寻找直线趋势而低估关联强度。


2. Calculation Steps | 计算步骤

The computation of Spearman's rank correlation coefficient involves ranking the data for each variable separately, then applying a formula based on the differences between paired ranks. The most common formula for rs, when there are no tied ranks, is:

斯皮尔曼等级相关系数的计算涉及分别对每个变量的数据进行排序,然后根据配对秩次之间的差异应用公式。当没有并列秩次时,最常用的 rs 公式为:

rs = 1 − (6 Σ di²) / (n(n² − 1))

where di is the difference between the ranks of each pair of observations, and n is the number of paired observations. The steps are: rank the X-values from 1 to n (smallest to largest), rank the Y-values similarly, compute the differences di = rank(Xi) − rank(Yi), square them, sum the squares, and plug into the formula.

其中 di 是每对观测值的秩次差,n 是配对观测值的数量。步骤如下:将 X 值从小到大排秩(1 到 n),同样处理 Y 值,计算差值 di = rank(Xi) − rank(Yi),求平方,求和,然后代入公式。

If there are tied ranks, each tied value is assigned the average of the ranks they would have occupied. In such cases the formula using di gives an approximation; the exact value is obtained by computing Pearson's correlation between the ranks, using the Pearson product-moment formula on the rank data.

如果存在并列秩次,每个并列值获得它们本应占用的秩次的平均值。在这种情况下,使用 di 的公式给出近似值;精确值通过计算秩次之间的皮尔逊相关系数得到,即对秩次数据使用皮尔逊积矩公式。


3. Worked Example Without Ties | 无并列秩次的示例

0→3, 15→4, 18→5. Differences d: (2-2)=0, (4-4)=0, (1-1)=0, (5-5)=0, (3-3)=0. Σd² = 0, so rs − (6×0)/(5×(25−1)) = 1. Perfect positive rank correlation, as both rankings are identical.

假设一名 IB 学生收集了 5 名同学的复习时数 (X) 和一次小测验的 20 分制成绩 (Y) 的数据。数据对为:(2, 8), (5, 15), (1, 5), (8, 18), (3, 10)。X 的排序:1→秩次 1, 2→2, 3→3, 5→4, 8→5。Y 的排序:5→1, 8→2, 10→3, 15→4, 18→5。差值 d:(2-2)=0, (4-4)=0, (1-1)=0, (5-5)=0, (3-3)=0。Σd² = 0,所以 rs = 1 − (6×0)/(5×(25−1)) = 1。完美的正等级相关,因为两个排序完全一致。

,3,4,5. Ranks of Y: 5,4,3,2,1. d = (−4, −2, 0, 2, 4), squared sum = 16+4+0+4+16=40. n=5. rs = 1 − 240/(120) = 1 − 2 = −1. Perfect negative correlation.

现在看一个负趋势的例子:X (2, 4, 6, 8, 10) 和 Y (18, 14, 10, 6, 2)。X 的秩次:1,2,3,4,5。Y 的秩次:5,4,3,2,1。d = (−4, −2, 0, 2, 4),平方和 = 16+4+0+4+16=40。n=5。rs = 1 − 240/(120) = 1 − 2 = −1。完美负相关。


4. Dealing with Tied Ranks | 处理并列秩次

2 = 2.5 each. The next value 30 gets rank 4. For Y, repeat the same process independently.

当两个或更多数值相同时,它们获得如果略有不同时本应占有的秩次的平均值。例如,如果 X 的数据为 10, 20, 20, 30,排序后的值及其初始秩次为:10 (1), 20 (2), 20 (3), 30 (4)。并列的 20 分别获得秩次 (2+3)/2 = 2.5。下一个值 30 获得秩次 4。对 Y 独立地重复相同过程。

The formula rs ed, but it will give a slightly biased estimate when ties are present. A correction factor can be applied or, more reliably, you can compute the Pearson correlation coefficient between the two sets of ranks directly. Many statistical software packages and calculators do this automatically.

仍然可以使用公式 rs = 1 − (6 Σd²)/(n(n²−1)),但当存在并列秩次时会给出略微有偏的估计。可以应用一个校正因子,或者更可靠的做法是直接计算两组秩次之间的皮尔逊相关系数。许多统计软件和计算器会自动完成此操作。

In IB assessment, you are often asked to calculate Spearman's coefficient given a table with ties, using the d² formula. Always state that you are assuming the effect of ties is negligible, or use the average ranks and the d² formula, and comment on its approximate nature.

在 IB 评估中,你经常需要根据给定含有并列秩次的表格计算斯皮尔曼系数,使用 d² 公式。务必说明假设并列秩次影响可忽略,或使用平均秩次和 d² 公式,并对其近似性质加以评论。


5. Interpreting the Coefficient | 解读系数

The Spearman rank correlation coefficient always lies between -1 and +1. A value of +1 indicates a perfect positive monotonic relationship: as one variable increases, the other increases in a perfectly consistent rank order. A value of -1 indicates a perfect negative monotonic relationship. A value of 0 suggests no monotonic association; the ranks are independent.

斯皮尔曼等级相关系数的取值范围始终在 -1 到 +1 之间。值为 +1 表示完美的正单调关系:一个变量增加时,另一个变量的秩次完全一致地增加。值为 -1 表示完美的负单调关系。值为 0 表示没有单调关联;秩次是独立的。

Interpreting intermediate values follows similar guidelines to Pearson's r but with caution. Typically, |rs| below 0.3 is considered weak, 0.3 to 0.7 moderate, and above 0.7 strong. However, the context and the number of observations heavily influence the interpretation. A strong Spearman coefficient may exist even when the scatter plot shows a curved pattern, as long as the direction never reverses.

对中间值的解读遵循与皮尔逊 r 类似的指导原则,但需谨慎。通常,|rs| 低于 0.3 被认为是弱的,0.3 至 0.7 为中等,0.7 以上为强。然而,情境和观测数量极大地影响解读。即使散点图呈现弯曲模式,只要方向从未反转,斯皮尔曼系数也可能很高。

For example, a coefficient of 0.85 indicates a strong positive monotonic association, meaning the rank order of the two variables is very similar. You can state that "there is strong evidence of a positive association between the ranked variables." Always accompany the numerical value with a descriptive statement in context.

例如,系数 0.85 表明强烈的正单调关联,意味着两个变量的秩次非常相似。你可以说“有强有力的证据表明排序变量之间存在正相关。”始终将数值与情境下的描述性陈述相结合。


广告 / Sponsored

6. Hypothesis Testing for Spearman's ρ | 斯皮尔曼 ρ 的假设检验

In IB Mathematics: applications and interpretation, you are expected to perform a hypothesis test for Spearman's rank correlation using a p-value or critical value approach. The null hypothesis H0 relation between the two variables in the population (ρ = 0). The alternative hypothesis H1 can be two-tailed (ρ ≠ 0) or one-tailed (ρ > 0 or ρ < 0), depending on the research question.

在 IB 数学“应用与解释”课程中,你需要使用 p 值或临界值方法对斯皮尔曼等级相关进行假设检验。零假设 H0 通常为总体中两个变量之间不存在相关(ρ = 0)。备择假设 H1 可以是双侧(ρ ≠ 0)或单侧(ρ > 0 或 ρ < 0),取决于研究问题。

The test statistic is the calculated rs. Under the null hypothesis and for small sample sizes, the sampling distribution of rs arger samples (n > 10 or n > 30, depending on the approximation), the test statistic t = rs √((n-2)/(1−rs²)) approximately follows a t-distribution with n-2 degrees of freedom. The p-value can then be found or compared to the significance level α (often 0.05).

检验统计量为计算得到的 rs。在零假设下且样本量较小时,rs 的抽样分布并不简单,但临界值可以查表获得。对于较大样本(n > 10 或 n > 30,取决于近似程度),检验统计量 t = rs √((n-2)/(1−rs²)) 近似服从自由度为 n-2 的 t 分布。然后可以求得 p 值或与显著性水平 α(通常为 0.05)比较。


7. Hypothesis Testing Example | 假设检验示例

a positive correlation between rankings of two judges on a performance. n=10, calculated rs=0.73. H0: ρ = 0, H1: ρ > 0. Significance level α=0.05. Using t-test: t = 0.73 × √(8/(1−0.73²)) ≈ 0.73 × √8/0.4671 freedom, the one-tailed critical t-value at 0.05 is about 1.86. Since 3.02 > 1.86, reject H0. There is sufficient evidence of positive correlation.

一名学生想检验两位评委对一场表演的排序之间是否存在正相关。n=10,计算所得 rs=0.73。H0:ρ = 0,H1:ρ > 0。显著性水平 α=0.05。使用 t 检验:t = 0.73 × √(8/(1−0.73²)) ≈ 0.73 × √8/0.4671 ≈ 0.73 × 4.139 ≈ 3.02。自由度为 8,单侧临界 t 值在 0.05 水平下约为 1.86。由于 3.02 > 1.86,拒绝 H0。有充分证据表明存在正相关。

Alternatively, using a critical value table for Spearman' =10 and one-tailed α=0.05, the critical value is 0.564. Since 0.73 > 0.564, again reject H0. Always specify which method you are using and ensure the table matches the test type.

或者,使用斯皮尔曼等级相关系数临界值表(非 t 近似),对于 n=10 和单侧 α=0.05,临界值为 0.564。由于 0.73 > 0.564,同样拒绝 H0。务必明确说明你使用的方法,并确保表格与检验类型相符。


8. Assumptions and Limitations | 假设与局限

Spearman's rank correlation relies on fewer assumptions than Pearson's. The key assumptions are: the data must be at least ordinal (can be ranked), the observations are independent, and a monotonic relationship is being tested. There is no requirement for normality or homoscedasticity. However, it is sensitive to outliers only insofar as they affect ranks; extreme values may still alter the rank order significantly if they are far from the cluster.

斯皮尔曼等级相关依赖的假设少于皮尔逊相关。关键假设为:数据至少是有序的(可排序),观测值相互独立,并且所检验的是单调关系。不要求正态性或方差齐性。然而,它对异常值敏感的程度仅限于它们对秩次的影响;极端值如果远离数据簇,仍可能显著改变秩次顺序。

A major limitation is that Spearman's coefficient measures only monotonic association. If the true relationship is non-monotonic, such as a U-shaped curve, the coefficient might be close to zero even though a strong relationship exists. Always plot the data first to visually inspect the pattern. Also, with tied ranks, the test statistic's distribution may be distorted for very small samples.

一个主要局限是斯皮尔曼系数只衡量单调关联。如果真实关系是非单调的,例如 U 形曲线,即使存在强关系,系数也可能接近零。始终先绘制数据图以目视检查模式。此外,对于非常小的样本,存在并列秩次时检验统计量的分布可能会失真。


9. Comparing Spearman and Pearson | 斯皮尔曼与皮尔逊的比较

While Pearson's r measures linear correlation, Spearman's rs measures monotonic rank correlation. Pearson is parametric and more powerful if the assumptions of bivariate normality and linearity hold. Spearman is non-parametric, distribution-free, and more robust to outliers and skewed distributions. If the relationship is strictly linear, both coefficients will be similar in magnitude, but Spearman may be slightly less efficient.

皮尔逊 r 衡量线性相关,而斯皮尔曼 rs 衡量单调等级相关。皮尔逊是参数方法,如果满足双变量正态性和线性假设,则更强大。斯皮尔曼是非参数方法,不依赖于分布,对异常值和偏态分布更稳健。如果关系严格线性,两者的大小将相似,但斯皮尔曼可能稍有效率损失。

Choose Spearman when variables are ordinal, when the relationship appears curved but monotonic, or when the data contain influential outliers that would distort Pearson's r. In IB internal assessments, justifying the choice of Spearman over Pearson is an important aspect of the statistical analysis section.

当变量为有序数据、关系呈弯曲但单调、或数据含有会扭曲皮尔逊 r 的强影响异常值时,选择斯皮尔曼。在 IB 内部评估中,论证为何选择斯皮尔曼而非皮尔逊是统计分析部分的一个重要方面。


10. Spearman's Coefficient in Technology | 斯皮尔曼系数在技术工具中的应用

In IB exams and IA, you are allowed to use a graphing calculator (such as TI-84 or TI-Nspire) to compute Spearman's rank correlation coefficient. Typically, you enter the two data lists, then use the statistics menu to select the Spearman rank correlation test. The calculator outputs rs and often the p-value for a hypothesis test. You must still show the steps of hypothesis testing and interpret the output correctly.

在 IB 考试和内部评估中,你可以使用图形计算器(如 TI-84 或 TI-Nspire)来计算斯皮尔曼等级相关系数。通常,输入两个数据列表,然后使用统计菜单选择斯皮尔曼等级相关检验。计算器输出 rs 以及通常的假设检验 p 值。你仍需展示假设检验的步骤并正确解读输出。

Additionally, software like Excel can compute Spearman's coefficient by first ranking the data (using RANK.AVG function) and then applying the CORREL function to the ranks. Always verify the method and document it clearly. Manual calculation using the d² formula is still tested to ensure conceptual understanding.

此外,Excel 等软件可以通过先对数据排序(使用 RANK.AVG 函数),然后对秩次应用 CORREL 函数来计算斯皮尔曼系数。务必验证方法并清楚记录。为确保概念理解,仍会考查使用 d² 公式进行手动计算。


11. Real-World Applications in IB IA | IB 内部评估中的实际应用

Many IB Mathematical Studies or Applications and Interpretations students use Spearman's rank correlation in their Internal Assessment to explore relationships between variables that may not be linear. Examples include: the relationship between the ranking of countries in happiness and GDP per capita, judges' scores in a competition, or Likert-scale survey responses about attitudes. Spearman's method respects the ordinal nature of such data.

许多 IB 数学学习或应用与解释课程的学生在内部评估中使用斯皮尔曼等级相关系数来探索可能非线性的变量关系。例如:国家幸福指数排名与人均 GDP 之间的关系、比赛中评委的评分、或关于态度的李克特量表调查回答。斯皮尔曼方法尊重这类数据的有序性质。

When writing the IA, students should discuss why Spearman's correlation was chosen, check for monotonicity via a scatter plot of ranks, perform the test, interpret the rs value and p-value, and mention any limitations such as ties or small sample size. A thoughtful evaluation of the statistical technique will earn higher marks in the reflection criterion.

在撰写 IA 时,学生应讨论为何选择斯皮尔曼相关,通过秩次散点图检查单调性,执行检验,解读 rs 值和 p 值,并提到任何局限,如并列秩次或小样本量。对统计技术进行深思熟虑的评估将在反思标准中获得更高分数。


12. Common Mistakes and Tips | 常见错误与建议

Students often confuse the formula for Spearman's rs with Pearson's r, or forget to rank the data before applying the d² formula. Another common error is using the Spearman test for non-monotonic relationships, leading to a coefficient near zero and a wrong conclusion that there is no association. Always visually inspect the data with a scatter diagram before choosing a correlation method.

学生常常将斯皮尔曼 rs 的公式与皮尔逊 r 混淆,或在应用 d² 公式前忘记对数据进行排序。另一个常见错误是对非单调关系使用斯皮尔曼检验,导致系数接近零,并错误推断不存在关联。在选择相关方法之前,务必通过散点图目视检查数据。

When calculating, ensure that differences d are computed as rank(X) minus rank(Y) consistently, and that squaring is done correctly. In hypothesis testing, clearly state H0 and H1 using proper notation, define the significance level, calculate the test statistic or find the p-value, make a comparison, and write a conclusion in the context of the problem. Omitting the context will lose marks.

在计算时,确保差值 d 统一按照秩(X) 减去秩(Y) 的方式计算,并正确平方。在假设检验中,用适当的符号清楚陈述 H0 和 H1,定义显著性水平,计算检验统计量或求得 p 值,进行比较,并根据问题情境写出结论。忽略情境会丢分。


Published by TutorHao | Mathematics Revision Series | aleveler.com

广告 / Sponsored
IBDP国际文凭计算机科学学生用书 高级及标准水平 Computer Science for the IB Diplo…
计算机 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥524.0

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao