Correlation

Statistics & Probability

Correlation measures the strength and direction of the linear relationship between two quantitative variables.

Definition

Correlation describes how two things are related. If they tend to increase together, the correlation is positive. If one increases while the other decreases, the correlation is negative. If there is no pattern, the correlation is close to zero.

Example

Temperature and ice cream sales are positively correlated: hotter days tend to have higher sales. Temperature and hot chocolate sales are negatively correlated: colder days have higher sales.

Key Insight

Correlation only measures the relationship, not what causes what. Two things can be correlated by accident or because they are both caused by a third factor.

Definition

Correlation is a statistical measure of the strength and direction of the linear relationship between two quantitative variables. It ranges from -1 (perfect negative linear relationship) to +1 (perfect positive linear relationship), with 0 indicating no linear relationship. It does not measure nonlinear associations.

Example

Study hours and GPA have a moderate positive correlation ($r \approx 0.5$-$0.7$). Shoe size and intelligence have approximately zero correlation. These are assessed from scatter plots and the correlation coefficient.

Key Insight

Correlation does not imply causation. Ice cream sales and drowning rates are positively correlated because both increase in summer, not because ice cream causes drowning.

Definition

The Pearson correlation $\rho = \text{Cov}(X,Y)/(\sigma_X\sigma_Y) = E[(X-\mu_X)(Y-\mu_Y)]/(\sigma_X\sigma_Y)$ is the population correlation. The sample Pearson $r$ estimates $\rho$. Spearman's rank correlation and Kendall's tau are nonparametric alternatives that measure monotone (not just linear) associations.

Example

Testing $H_0: \rho = 0$ uses the test statistic $t = r\sqrt{n-2}/\sqrt{1-r^2}$, which follows a t-distribution with $n-2$ degrees of freedom under the null. For $n=30$ and $r=0.4$, $t = 0.4\sqrt{28}/\sqrt{0.84} = 2.31$, which is significant at $\alpha=0.05$.

Key Insight

Correlation is invariant under linear transformations of $X$ and $Y$ but not under nonlinear transformations. Two variables with identical Pearson $r$ can have very different scatter plot shapes (see Anscombe's quartet), reinforcing the need for visual inspection alongside numerical summaries.