Correlation Measures | 相关性度量方法

📚 Correlation Measures | 相关性度量方法

In statistics, correlation measures the strength and direction of a linear relationship between two quantitative variables. It is a fundamental tool in data analysis, helping us understand how changes in one variable are associated with changes in another.

在统计学中,相关性用于衡量两个定量变量之间线性关系的强度和方向。它是数据分析中的基本工具,帮助我们理解一个变量的变化如何与另一个变量的变化相关联。


1. What is Correlation? | 什么是相关性?

Correlation is a statistical technique that tells us whether two variables move together. If one variable tends to increase when the other increases, the correlation is positive. If one tends to decrease when the other increases, the correlation is negative.

相关性是一种统计技术,用于判断两个变量是否共同变动。如果一个变量随着另一个变量的增大而增大,则相关性为正;如果一个变量随着另一个变量的增大而减小,则相关性为负。

It is important to distinguish correlation from association. Correlation specifically refers to linear association, whereas association is a broader term that includes any type of relationship.

需要注意的是,相关性与关联性是有区别的。相关性特指线性关联,而关联性是一个更宽泛的概念,包括任何类型的关系。

The most common correlation coefficients range from -1 to +1. A value of +1 indicates a perfect positive linear relationship, -1 indicates a perfect negative linear relationship, and 0 indicates no linear relationship.

最常见的相关系数取值范围在 -1 到 +1 之间。+1 表示完全正线性关系,-1 表示完全负线性关系,0 表示不存在线性关系。


2. Scatter Diagrams | 散点图

Before calculating any correlation coefficient, it is essential to plot the data on a scatter diagram. A scatter diagram is a graph in which each point represents a pair of values (x, y). The pattern of points reveals the direction, form, and strength of the relationship.

在计算任何相关系数之前,必须先绘制散点图。散点图是一种图中每个点代表一对数值 (x, y) 的图形。点的分布模式揭示了关系的方向、形式和强度。

If the points cluster closely around a straight line, the relationship is strong. If they are widely scattered, the relationship is weak. The slope of the line indicates the direction: upward for positive, downward for negative.

如果点紧密聚集在一条直线周围,则关系较强。如果点分散较广,则关系较弱。直线的斜率指示方向:向上为正,向下为负。

Scatter diagrams also help identify outliers and non-linear patterns that numerical measures might miss. Always start with a scatter plot before computing correlation coefficients.

散点图还有助于识别可能被数值指标遗漏的异常值和非线性模式。在计算相关系数之前,务必先绘制散点图。


3. Pearson Correlation Coefficient | 皮尔逊相关系数

The Pearson correlation coefficient, denoted by r, measures the strength and direction of a linear relationship between two continuous variables. It is defined as the covariance of the two variables divided by the product of their standard deviations.

皮尔逊相关系数(记作 r)衡量两个连续变量之间线性关系的强度和方向。其定义为两个变量的协方差除以它们标准差的乘积。

r = Σ(xᵢ – x̄)(yᵢ – ȳ) / √[Σ(xᵢ – x̄)² Σ(yᵢ – ȳ)²]

Here x̄ and ȳ are the sample means of x and y. The numerator is the sum of products of deviations, and the denominator normalizes the result to lie between -1 and +1.

其中 x̄ 和 ȳ 分别是 x 和 y 的样本均值。分子是离差乘积之和,分母将结果归一化,使其落在 -1 到 +1 之间。

An equivalent formula more suitable for calculation is:

一个更适合计算的等价公式为:

r = (nΣxy – ΣxΣy) / √[(nΣx² – (Σx)²)(nΣy² – (Σy)²)]

where n is the number of data pairs. This formula avoids computing means first and is often used in calculators and spreadsheets.

其中 n 是数据对的数量。该公式避免了先计算均值,常用于计算器和电子表格中。


4. Properties of Pearson’s r | 皮尔逊相关系数的性质

Pearson’s r is symmetric: r(x, y) = r(y, x). It is also invariant under linear transformations of the variables. If you add a constant or multiply by a positive constant, r remains unchanged.

皮尔逊相关系数具有对称性:r(x, y) = r(y, x)。它在线性变换下保持不变。如果对变量加上一个常数或乘以一个正常数,r 的值不变。

However, r is sensitive to outliers. A single extreme point can dramatically change the value of r, making it unreliable if outliers are present in the data.

然而,r 对异常值非常敏感。一个极端点就可能导致 r 值发生巨大变化,因此当数据中存在异常值时,r 不可靠。

Moreover, r only measures linear relationships. Two variables may have a strong non-linear relationship (e.g., a U-shape) yet have r close to zero. Therefore, a low r does not imply no relationship; it implies no linear relationship.

此外,r 只能衡量线性关系。两个变量可能存在很强的非线性关系(例如 U 形),但 r 却接近于零。因此,r 值低并不意味着没有关系,只意味着没有线性关系。

To test significance of r, we often use a hypothesis test with the null hypothesis that the population correlation coefficient equals zero. The test statistic follows a t-distribution with n-2 degrees of freedom.

为了检验 r 的显著性,我们通常使用假设检验,零假设为总体相关系数等于零。检验统计量服从自由度为 n-2 的 t 分布。


5. Spearman’s Rank Correlation | 斯皮尔曼秩相关

Spearman’s rank correlation coefficient, denoted by rₛ or ρ, is a non-parametric measure of monotonic association. It is based on the ranks of the data rather than the raw values, making it robust to outliers and applicable to ordinal data.

斯皮尔曼秩相关系数(记作 rₛ 或 ρ)是一种基于数据秩而非原始值的非参数单调关联度量。它不受异常值影响,也适用于有序数据。

To calculate rₛ, assign ranks to each variable separately. If no ties exist, the formula simplifies to:

计算 rₛ 时,分别对每个变量进行秩排序。如果不存在并列秩,公式可简化为:

rₛ = 1 – (6Σdᵢ²) / (n(n² – 1))

where dᵢ is the difference between the ranks of each pair, and n is the number of pairs. If ties exist, use the Pearson formula applied to the ranks.

其中 dᵢ 是每对秩的差值,n 是数据对的数量。如果存在并列秩,则对秩使用皮尔逊公式计算。

Spearman’s rₛ detects monotonic relationships, not just linear ones. A monotonic relationship is one where the variables tend to move in the same direction without necessarily forming a straight line.

斯皮尔曼 rₛ 检测的是单调关系,而不仅仅是线性关系。单调关系是指变量倾向于沿同一方向变化,但不一定形成直线。


6. Kendall’s Tau | 肯德尔τ系数

Kendall’s tau (τ) is another non-parametric measure of association. It compares the number of concordant and discordant pairs of observations. A concordant pair has pairs (xᵢ, yᵢ) and (xⱼ, yⱼ) that move in the same direction; a discordant pair moves in opposite directions.

肯德尔τ(τ)是另一种非参数关联度量。它比较观测值中的一致对和不一致对的数量。如果两对数据 (xᵢ, yᵢ) 和 (xⱼ, yⱼ) 同向变化,则称为一致对;反向变化则称为不一致对。

τ = (C – D) / [n(n – 1)/2]

where C is the number of concordant pairs, D is the number of discordant pairs, and n is the sample size. Kendall’s tau also ranges from -1 to +1.

其中 C 是一致对的数量,D 是不一致对的数量,n 是样本量。肯德尔τ的取值范围也是从 -1 到 +1。

Compared with Spearman’s rₛ, Kendall’s tau has a more intuitive interpretation in terms of probabilities. The expected value of tau relates to the probability that a randomly selected pair of observations moves in the same direction.

与斯皮尔曼 rₛ 相比,肯德尔τ在概率意义上更直观。τ的期望值与随机选取的一对观测值同向变化的概率有关。

Kendall’s tau is often preferred for smaller samples because its distribution under the null hypothesis is better approximated by a normal distribution even with small n.

在样本较小的情况下,肯德尔τ往往更受青睐,因为在零假设下其分布甚至在 n 较小时也能很好地近似正态分布。


7. Coefficient of Determination | 决定系数

The coefficient of determination, denoted R², is the square of the Pearson correlation coefficient in simple linear regression. It represents the proportion of variance in one variable that is explained by the other variable.

决定系数(记作 R²)在简单线性回归中是皮尔逊相关系数的平方。它表示一个变量的方差中能被另一个变量解释的比例。

For example, if r = 0.8, then R² = 0.64. This means 64% of the variation in y can be explained by its linear relationship with x. The remaining 36% is due to other factors or random error.

例如,如果 r = 0.8,则 R² = 0.64。这意味着 y 的变异的 64% 可以通过与 x 的线性关系来解释,其余 36% 源于其他因素或随机误差。

R² always lies between 0 and 1. A higher R² indicates a better fit of the linear model. However, a high R² does not guarantee that the relationship is causal.

R² 始终介于 0 和 1 之间。R² 越高,说明线性模型拟合越好。但高 R² 并不能保证这种关系是因果关系。

Note that R² is only meaningful for linear regression models. For non-linear models, the definition of R² may differ and is not simply the square of a correlation coefficient.

注意,R² 仅对线性回归模型有意义。对于非线性模型,R² 的定义可能不同,并且并不仅仅是相关系数的平方。


8. Correlation vs Causation | 相关性与因果性

A common mistake is to interpret a strong correlation as evidence of causation. Correlation does not imply causation. Two variables may be correlated because of a third confounder, a reverse cause, or pure coincidence.

一个常见错误是将强相关性解释为因果关系的证据。相关不等于因果。两个变量可能因为第三个混杂因素、反向因果或纯属巧合而相关。

For example, ice cream sales and drowning deaths are positively correlated. However, ice cream does not cause drowning; the confounding variable is hot weather, which increases both ice cream consumption and swimming activity.

例如,冰淇淋销量与溺水死亡人数呈正相关。但冰淇淋并不会导致溺水;混杂变量是炎热天气,它同时增加了冰淇淋消费和游泳活动。

To establish causation, one needs rigorous experimental design, randomized controlled trials, or advanced causal inference methods. Mere observational data cannot prove causation.

要确定因果关系,需要严谨的实验设计、随机对照试验或高级因果推断方法。仅凭观测数据不能证明因果关系。

This principle is crucial in science, economics, and medicine. Always remember the phrase: “Correlation does not imply causation.”

这一原则在科学、经济学和医学中至关重要。请务必记住:相关不等于因果。


9. Choosing the Right Measure | 选择合适的方法

The choice of correlation measure depends on the type of data and the research question. For continuous data with approximately linear relationships and no outliers, Pearson’s r is appropriate.

相关性方法的选择取决于数据类型和研究问题。对于近似线性关系且无异常值的连续数据,适合使用皮尔逊 r。

If the data are ordinal, or if the relationship is monotonic but not linear, or if outliers are present, Spearman’s rₛ is a better choice.

如果数据是有序的,或者关系是单调的但不是线性的,或者存在异常值,则更适合使用斯皮尔曼 rₛ。

Kendall’s tau is useful when the sample size is small and you want to control for ties. It is also preferred in some fields because its interpretation in terms of concordance probability is straightforward.

当样本量较小且需要处理并列秩时,肯德尔τ很有用。在某些领域中它也受到青睐,因为其一致概率的解释直截了当。

For categorical variables, correlation coefficients like Cramér’s V or the phi coefficient may be used instead. The methods described above are for quantitative or ranked data.

对于分类变量,可以使用克莱默V系数或 phi 系数等。上述方法适用于定量数据或秩数据。


10. Worked Example | 计算示例

Consider five students with scores in mathematics (x) and physics (y):

考虑五名学生的数学成绩 (x) 和物理成绩 (y):

x 2 4 6 8 10
y 1 3 5 7 9

First compute the following sums: Σx = 30, Σy = 25, Σxy = 2*1 + 4*3 + 6*5 + 8*7 + 10*9 = 2 + 12 + 30 + 56 + 90 = 190, Σx² = 4 + 16 + 36 + 64 + 100 = 220, Σy² = 1 + 9 + 25 + 49 + 81 = 165.

首先计算以下和:Σx = 30,Σy = 25,Σxy = 2*1 + 4*3 + 6*5 + 8*7 + 10*9 = 2 + 12 + 30 + 56 + 90 = 190,Σx² = 4 + 16 + 36 + 64 + 100 = 220,Σy² = 1 + 9 + 25 + 49 + 81 = 165。

Using the computational formula with n = 5:

使用 n = 5 的计算公式:

r = (5*190 – 30*25) / √[(5*220 – 30²)(5*165 – 25²)]

The numerator is 950 – 750 = 200. The denominator is √[(1100 – 900)(825 – 625)] = √(200 * 200) = 200. Therefore r = 200 / 200 = 1.

分子为 950 – 750 = 200。分母为 √[(1100 – 900)(825 – 625)] = √(200 * 200) = 200。因此 r = 200 / 200 = 1。

A perfect positive correlation of 1 is obtained because y is exactly a linear function of x (y = x – 1). This example illustrates the formula and the meaning of perfect correlation.

由于 y 恰好是 x 的线性函数 (y = x – 1),因此得到完全正相关 1。该示例说明了公式的使用以及完全相关的含义。


11. Common Mistakes | 常见错误

One common mistake is using Pearson’s r for non-linear relationships. Always examine a scatter plot first. Another is ignoring outliers, which can drastically affect r.

一个常见错误是对非线性关系使用皮尔逊 r。务必先检查散点图。另一个错误是忽略异常值,异常值会极大影响 r 值。

Another mistake is interpreting r as a percentage. r = 0.5 does not mean a 50% relationship. The coefficient of determination R² gives that interpretation (0.25 or 25%).

另一个错误是将 r 解释为百分比。r = 0.5 并不意味着 50% 的关系。决定系数 R² 才能这样解释(0.25 即 25%)。

Confusing correlation with causation is also a serious error. Even strong, statistically significant correlations may be spurious.

混淆相关与因果也是严重错误。即使相关性很强且具有统计显著性,也可能是虚假相关。

Finally, be careful with ranks when ties exist in Spearman’s formula. If ties are numerous, use the general formula based on Pearson’s r applied to ranks or use Kendall’s tau.

最后,在斯皮尔曼公式中,如果存在并列秩,要特别小心。如果并列秩很多,应使用基于皮尔逊 r 的通用公式应用于秩,或改用肯德尔τ。


12. Summary | 总结

Correlation measures quantify the strength and direction of association between two variables. Pearson’s r is for linear relationships with continuous data; Spearman’s rₛ is for monotonic relationships on ranks; Kendall’s tau is an alternative rank-based measure.

相关性度量用于量化两个变量之间关联的强度和方向。皮尔逊 r 适用于连续数据的线性关系;斯皮尔曼 rₛ 适用于基于秩的单调关系;肯德尔τ是另一种基于秩的度量。

Always visualize data with scatter plots before computing coefficients, check for outliers and non-linearity, and never treat correlation as causation. The coefficient of determination R² supplements r by explaining variance.

在计算系数之前,务必先用散点图可视化数据,检查异常值和非线性,切勿将相关性视为因果。决定系数 R² 通过解释方差补充了 r 的信息。

By mastering these methods, you can interpret relationships in data accurately and avoid common statistical pitfalls.

通过掌握这些方法,你可以准确解释数据中的关系,并避免常见的统计陷阱。

Published by TutorHao | Mathematics Revision Series | aleveler.com

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

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version