Calculation and Interpretation of Correlation Coefficients (Pearson Correlation Coefficient, Spearman Rank Correlation)

Introduction

Correlation coefficients are fundamental tools in statistics used to quantify the strength and direction of a linear relationship between two variables. These coefficients provide a numerical measure of how closely data points are clustered around a straight line, enabling researchers to assess the degree of association without assuming a specific functional form. The Pearson correlation coefficient, often denoted as $ r $, measures linear correlation, while the Spearman rank correlation coefficient, denoted as $ \rho $, assesses monotonic correlation, which refers to a relationship that may not be linear but preserves the direction of increase or decrease in one variable relative to the other. This article explores the mathematical foundations, calculation methods, and practical applications of these two coefficients, emphasizing their distinct characteristics and appropriate use cases.

Core Content

Pearson Correlation Coefficient

The Pearson correlation coefficient is a measure of linear association between two continuous variables $ x $ and $ y $. It is calculated using the formula:
$$ r = \frac{n\sum xy - (\sum x)(\sum y)}{\sqrt{[n\sum x^2 - (\sum x)^2][n\sum y^2 - (\sum y)^2]}} $$
where $ n $ is the number of data points, $ x $ and $ y $ are the variables, and $ \sum $ denotes summation. The coefficient ranges from $ -1 $ to $ 1 $, with $ 1 $ indicating a perfect positive linear relationship, $ -1 $ a perfect negative linear relationship, and $ 0 $ indicating no linear correlation.

The derivation of this formula relies on the covariance of the variables divided by the product of their standard deviations. The numerator captures the covariance, while the denominator normalizes the result to ensure the coefficient lies within the $ -1 $ to $ 1 $ range. The Pearson coefficient assumes that the relationship between the variables is linear and that the data follows a normal distribution.

To illustrate, consider two datasets:
$$ x = [1, 2, 3, 4], \quad y = [3, 5, 7, 9] $$
Calculating the Pearson coefficient:
$$ r = \frac{4(1\cdot3 + 2\cdot5 + 3\cdot7 + 4\cdot9) - (1+2+3+4)(3+5+7+9)}{\sqrt{[4(1^2 + 2^2 + 3^2 + 4^2) - (1+2+3+4)^2][