Correlation
Study guides: Exam MAS-I, Exam 9, Exam ACIA-CAPSTONE, Exam F2PC, Exam F3PC, Exam F1ILA, Exam F3ILA, Exam F3FIE, Exam F3BNK
Correlation is a measure of the strength and direction of the linear relationship between two random variables X and Y. The correlation coefficient is
\rho(X, Y) = \frac{\text{Cov}(X, Y)}{\sqrt{\text{Var}(X)\,\text{Var}(Y)}}
\text{Cov}(X, Y) = E[XY] - E[X]E[Y]is the covariance ofXandY.
The correlation lies between -1 and 1. It is 1 or -1 only when Y is an exact linear function of X with positive or negative slope, and 0 when there is no linear association. Unlike the covariance, it has no units, so it can be compared across variables measured on different scales.
Random variables
XandYhave\text(X) = 25,\text(Y) = 36and\text(X, Y) = -18. What is their correlation?
- The product of the standard deviations is
\sqrt{25 \times 36} = 30.- The correlation is
\rho(X, Y) = -18/30 = -0.6, a moderate negative linear relationship.
Sample correlation coefficient
From n pairs of observations (x_i, y_i), the sample (Pearson) correlation coefficient is
r = \frac{\sum_{i=1}^{n} (x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n} (x_i - \bar{x})^2 \sum_{i=1}^{n} (y_i - \bar{y})^2}}
\bar{x}and\bar{y}are the sample means.
Dividing the top and the bottom by n gives the same value as (\overline{xy} - \bar{x}\,\bar{y})/(s_x s_y), where \overline{xy} is the mean of the products and s_x and s_y are the standard deviations computed with divisor n. In simple linear regression, the R^2 of the fitted line is r^2.
What is the sample correlation of the pairs
(1, 2),(2, 4),(3, 5),(4, 4)and(5, 5)?
- The means are
\bar{x} = 3and\bar{y} = 4.- The sum of products of deviations is
(-2)(-2) + (-1)(0) + 0 + (1)(0) + (2)(1) = 6.- The sums of squared deviations are
10forxand4 + 0 + 1 + 0 + 1 = 6fory.r = 6/\sqrt{10 \times 6} = 0.7746, and a regression line through these points hasR^2 = 0.7746^2 = 0.60.
Correlation and independence
If X and Y are independent, their covariance is zero, so their correlation is zero. The converse does not hold: two variables can be strongly dependent, one even a function of the other, and still have zero correlation, because correlation measures only linear association.
Xis uniform on[-1, 1]andY = X^2. What is their correlation?
E[X] = 0, andE[XY] = E[X^3] = 0becauseX^3is symmetric about zero.\text{Cov}(X, Y) = E[XY] - E[X]E[Y] = 0, so\rho(X, Y) = 0.Yis completely determined byX, so the two are dependent even though they are uncorrelated.
Limitations of the Pearson correlation coefficient
- It measures only linear association. A tight curved pattern can have
rnear zero, and|r|is near 1 only when the points lie close to a straight line. - It summarizes the dependence over the whole data set in one number, so it hides how the dependence differs between the tails and the middle of the distribution.
- It uses the values of the observations, not their ranks, so a single outlier or high-leverage point can drive it. Rank correlations such as Spearman's are less affected.
- It is not unchanged by a nonlinear increasing transformation of a variable, such as taking logs.
- A strong correlation does not show that one variable causes the other.
The pairs
(1, 3),(2, 1),(3, 4)and(4, 2)are joined by(10, 10). What is the sample correlation with and without the last pair?
- With all five pairs,
r = 0.90.- Without
(10, 10),r = 0.- The single point far from the others creates the whole correlation, so
rshould be read together with a scatter plot of the data.
Practice questions
- CAS Exam 5 Spring 2015, Question 13
- CAS Exam 7 Spring 2012, Question 15
- CAS Exam 7 Spring 2012, Question 16
- CAS Exam 7 Spring 2012, Question 17
- CAS Exam 7 Spring 2012, Question 23
- CAS Exam 7 Spring 2013, Question 8
- CAS Exam 7 Spring 2013, Question 16
- CAS Exam 7 Spring 2013, Question 17
- CAS Exam 7 Spring 2013, Question 18
- CAS Exam 7 Spring 2013, Question 22
- CAS Exam 7 Spring 2014, Question 20
- CAS Exam 7 Spring 2014, Question 21
- CAS Exam 7 Spring 2015, Question 8
- CAS Exam 7 Spring 2015, Question 18
- CAS Exam 7 Spring 2015, Question 19
- CAS Exam 7 Spring 2015, Question 21
- CAS Exam 7 Spring 2015, Question 23
- CAS Exam 7 Spring 2016, Question 25
- CAS Exam 7 Spring 2017, Question 8
- CAS Exam 7 Spring 2017, Question 23
- CAS Exam 7 Spring 2018, Question 23
- CAS Exam 7 Spring 2019, Question 20
- CAS Exam 8 Fall 2015, Question 4
- CAS Exam 8 Fall 2016, Question 1
- CAS Exam 8 Fall 2019, Question 1
- CAS Exam 9 Spring 2013, Question 12
- CAS Exam 9 Spring 2014, Question 15
- CAS Exam 9 Spring 2014, Question 16
- CAS Exam 9 Spring 2015, Question 5
- CAS Exam 9 Spring 2016, Question 16
- CAS Exam 9 Spring 2016, Question 18
- CAS Exam 9 Spring 2017, Question 3
- CAS Exam 9 Spring 2017, Question 4
- CAS Exam 9 Spring 2017, Question 14
- CAS Exam 9 Spring 2018, Question 12
- Exam 9 Practice Question 10
- Exam DISC-RM Practice Question 34
- Exam DISC-RM Practice Question 466
- CAS Exam MAS-I Fall 2018, Question 41
- CAS Exam MAS-I Fall 2018, Question 44
- CAS Exam MAS-I Fall 2018, Question 45
- CAS Exam MAS-I Spring 2018, Question 41
- CAS Exam MAS-I Spring 2018, Question 42
- Exam MAS-I Practice Question 129
- Exam MAS-I Practice Question 137
- Exam MAS-I Practice Question 139
- Exam MAS-I Practice Question 140
- CAS Exam MAS-II Fall 2018, Question 23
- CAS Exam MAS-II Spring 2019, Question 40
- Exam PA Practice Question 14