Skip to main content
Planned maintenance impacting Stack Overflow and all Stack Exchange sites is scheduled for Monday, September 16, 2024, 5:00 PM-10:00 PM EDT (Monday, September 16, 21:00 UTC- Tuesday, September 17, 2:00 UTC). The email/password authentication method will be unavailable for logging in and registering. Read more here

A measure of the degree of association among a pair of variables.

The Pearson correlation between two random variables $X$ and $Y$ is defined as

$$ {\rm cor}(X,Y) = \frac{ E(XY) - E(X)E(Y) }{ \sqrt{ {\rm var}(X) {\rm var}(Y) } }$$

and is bounded between $-1$ (perfect negative linear relationship) and $1$ (perfect positive linear relationship). The numerator of ${\rm cor}(X,Y)$ is known as the covariance between $X$ and $Y$.

If the Pearson correlation is $0$, we say the two variables are linearly independent.

Other definitions of correlations exist and can detect non-linear relationships. For example, Spearman's Rank Correlation' and Kendall's Rank Correlation