Correlation

Definition

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

  • If two variables move together (increase or decrease together), they have a positive correlation.
  • If one increases while the other decreases, they have a negative correlation.
  • If they don’t move in a systematic way, correlation is close to zero.

Formula (Pearson Correlation Coefficient)

For variables $X$ and $Y$ with $n$ data points:

$r = \frac{\sum_{i=1}^{n} (x_i – \bar{x})(y_i – \bar{y})}{\sqrt{\sum_{i=1}^{n} (x_i – \bar{x})^2} \sqrt{\sum_{i=1}^{n} (y_i – \bar{y})^2}}$

  • $r$ = correlation coefficient (ranges from –1 to +1)
  • $\bar{x}, \bar{y}$ = means of $X$ and $Y$

Interpretation of $r$

  • $r = +1$: Perfect positive correlation (as $X$ increases, $Y$ increases).
  • $r = -1$: Perfect negative correlation (as $X$ increases, $Y$ decreases).
  • $r = 0$: No linear correlation.

Important: Correlation only measures linear association, not causation.


Types of Correlation

  1. Positive Correlation – height and weight (generally both go up).
  2. Negative Correlation – price and demand (usually, as price rises, demand falls).
  3. Zero Correlation – shoe size and intelligence (no relationship).

Example

Suppose:

  • Hours studied = [2, 4, 6, 8]
  • Exam scores = [50, 65, 80, 95]

As hours studied increase, scores increase. rrr will be close to +1 (strong positive correlation).


Correlation vs Causation

  • Correlation: Just a statistical relationship — variables move together.
  • Causation: One variable actually produces a change in the other.

Example of misleading correlation:

  • Ice cream sales and drowning accidents are positively correlated.
  • But ice cream doesn’t cause drowning — both are caused by hot weather (a confounder).

Other Correlation Measures

  • Spearman’s rank correlation: Measures monotonic (not necessarily linear) relationships.
  • Kendall’s tau: Rank-based correlation, useful for ordinal data.

In short:
Correlation = “Do two variables move together?”
But it does not mean “Does one cause the other?”


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

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