📚 Pearson's Correlation Coefficient | 皮尔逊相关系数
Pearson's correlation coefficient, often denoted by r, is the most widely used measure of linear association between two quantitative variables. In the IB Mathematics curriculum, understanding how to calculate, interpret and test r is essential for analysing bivariate data, evaluating the strength of relationships and making predictions within the linear regression framework.
皮尔逊相关系数,通常记作 r,是衡量两个定量变量之间线性关联最广泛的指标。在 IB 数学课程中,理解如何计算、解释和检验 r 对于分析双变量数据、评价关系强度以及在线性回归框架中进行预测至关重要。
1. What is Correlation? | 什么是相关性?
Correlation describes the direction and strength of a linear relationship between two variables. Positive correlation means that as one variable increases, the other tends to increase; negative correlation means that as one variable increases, the other tends to decrease. A scatter plot showing points tightly clustered around a straight line indicates strong correlation, while a widely scattered cloud suggests weak or no linear correlation.
相关性描述了两个变量之间线性关系的方向和强度。正相关意味着一个变量增加时,另一个变量也趋向增加;负相关意味着一个变量增加时,另一个变量趋向减少。散点图上的点紧密围绕一条直线聚集表示强相关,而发散的点云则暗示线性相关较弱或不存在。
It is crucial to remember that correlation does not imply causation, and Pearson's r is designed to measure only linear relationships. A perfectly quadratic or sinusoidal pattern can yield an r close to zero even if the variables are perfectly related in a non-linear way.
关键要记住,相关并不意味着因果,并且皮尔逊 r 仅用于测量线性关系。一个完美的二次或正弦模式可能会产生接近于零的 r,即使变量之间存在完美的非线性关系。
2. The Pearson Correlation Coefficient Formula | 皮尔逊相关系数公式
For a sample of n paired observations (x₁, y₁), (x₂, y₂), …, (xₙ, yₙ), the sample correlation coefficient r is given by the covariance of x and y divided by the product of their standard deviations. The algebraic form used in IB examinations is typically:
对于样本 n 对观测值 (x₁, y₁), (x₂, y₂), …, (xₙ, yₙ),样本相关系数 r 由 x 和 y 的协方差除以它们标准差的乘积得到。IB 考试中常用的代数形式通常为:
r = Σ(xᵢ - x̄)(yᵢ - ȳ) / √[Σ(xᵢ - x̄)² × Σ(yᵢ - ȳ)²]
Here, x̄ and ȳ are the sample means of the x-values and y-values respectively. The numerator is the sum of the products of deviations, while the denominator contains the square roots of the sums of squared deviations. An equivalent computing formula using sums of squares and cross-products is also frequently used when calculations are done by hand.
这里 x̄ 和 ȳ 分别是 x 值和 y 值的样本均值。分子是离差乘积之和,分母包含离差平方和的平方根。当手工计算时,也常使用基于平方和与交叉乘积的等价计算公式。
3. Understanding the Range: –1 to +1 | 理解取值范围:-1 到 +1
The correlation coefficient always lies between –1 and 1 inclusive. An r of +1 indicates a perfect positive linear correlation (all points lie exactly on an upward sloping straight line). An r of –1 indicates a perfect negative linear correlation (all points on a downward sloping line). An r of 0 indicates no linear correlation, though a non-linear relationship may still exist.
相关系数始终在 –1 到 1 之间(含端点)。r = +1 表示完全正线性相关(所有点刚好位于一条向上的直线上)。r = –1 表示完全负线性相关(所有点在向下的直线上)。r = 0 表示无线型相关,但非线性关系可能仍然存在。
In practice, we interpret the magnitude of r using rough descriptors. While cut-offs can vary, the following table gives a common classification:
在实践中,我们使用粗略的描述词来解释 r 的大小。虽然划分标准可能有所不同,下表给出了一种常见分类:
| |r| range | Strength of linear correlation | 线性相关强度 |
|---|---|
| 0.0 – 0.3 | Weak | 弱 |
| 0.3 – 0.7 | Moderate | 中等 |
| 0.7 – 1.0 | Strong | 强 |
4. Calculating r: A Worked Example | 计算 r:实例演示
Consider the following paired data set of five observations: (1, 2), (2, 3), (3, 5), (4, 4), (5, 8). We will compute the correlation coefficient step by step.
考虑以下五个观测值的配对数据集:(1, 2), (2, 3), (3, 5), (4, 4), (5, 8)。我们将逐步计算相关系数。
First, find the means: x̄ = (1+2+3+4+5)/5 = 3, ȳ = (2+3+5+4+8)/5 = 4.4.
首先求均值:x̄ = (1+2+3+4+5)/5 = 3,ȳ = (2+3+5+4+8)/5 = 4.4。
Next, compute the deviations and their products. The working can be organised in a table:
接着计算离差及其乘积。计算过程可以用表格整理:
| xᵢ | yᵢ | xᵢ - x̄ | yᵢ - ȳ | (xᵢ - x̄)(yᵢ - ȳ) | (xᵢ - x̄)² | (yᵢ - ȳ)² |
|---|---|---|---|---|---|---|
| 1 | 2 | -2 | -2.4 | 4.8 | 4 | 5.76 |
| 2 | 3 | -1 | -1.4 | 1.4 | 1 | 1.96 |
| 3 | 5 | 0 | 0.6 | 0 | 0 | 0.36 |
| 4 | 4 | 1 | -0.4 | -0.4 | 1 | 0.16 |
| 5 | 8 | 2 | 3.6 | 7.2 | 4 | 12.96 |
| Sum | 13.0 | 10 | 21.2 |
Then, substitute the sums into the formula:
然后,将总和代入公式:
r = 13.0 / √10 × 21.2 = 13.0 / √212 ≈ 13.0 / 14.56 ≈ 0.893
The result r ≈ 0.893 suggests a strong positive linear correlation between x and y.
结果 r ≈ 0.893 表明 x 和 y 之间存在强正线性相关。
5. Interpreting the Value of r | 解释 r 值
An r of 0.893 alone tells us that the linear association is strong and positive. However, interpretation should be made cautiously. The context of the data matters; in some fields an r of 0.6 might be considered strong, while in controlled laboratory settings an r of 0.9 could be weak. Always check the scatter plot for a visual insight.
仅有 r = 0.893 只能告诉我们线性关联是正向且强烈的。但解读时应谨慎。数据的背景很重要;在某些领域中 r = 0.6 可能被认为是强的,而在受控的实验室环境中 r = 0.9 可能显得较弱。务必通过散点图获取视觉上的洞察。
Remember that r measures only the strength of the linear component. If the true relationship is curved, a high r may not capture the full pattern, and a low r does not prove independence.
请记住,r 只测量线性部分的强度。如果真实关系是弯曲的,高 r 值可能并不能捕捉到完整的模式,而低 r 值也并不证明变量独立。
6. Coefficient of Determination (r²) | 决定系数 (r²)
p with the x-variable. For our example, r² = 0.893² ≈ 0.797. This means approximately 79.7% of the variability in y is accounted for by the variation in x, while the remaining 20.3% is due to other factors or random variation.
一个非常有用的相关度量是决定系数 r²。它表示 y 变量的变异中可以由与 x 变量的线性关系解释的比例。在我们的例子中,r² = 0.893² ≈ 0.797,这意味着 y 的变异性中大约 79.7% 可以由 x 的变化解释,其余 20.3% 则归因于其他因素或随机变异。
IB exam questions often ask you to interpret r² in the context of the problem. Be sure to use phrases like "percentage of variation explained" rather than just stating the number.
IB 考试题目经常要求你在问题背景下解释 r²。务必使用诸如“解释的变异百分比”这样的表述,而不仅仅是陈述数值。
7. Hypothesis Testing for the Population Correlation ρ | 对总体相关系数 ρ 的假设检验
and the alternative is H₁: ρ ≠ 0 (two-tailed) or H₁: ρ > 0 or ρ < 0 for one-tailed tests.
我们可以检验样本相关是否为总体中存在线性关系提供了显著证据。原假设通常为 H₀: ρ = 0(无线性相关),备择假设 H₁: ρ ≠ 0(双尾检验),或单尾检验时用 H₁: ρ > 0 或 ρ < 0。
The test statistic follows a t-distribution with n-2 degrees of freedom:
Published by TutorHao | IB Mathematics Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图