06 Correlation
06 Correlation
Correlation
Eleni-Rosalina Andrinopoulou
Department of Biostatistics, Erasmus Medical Center
7@erandrinopoulou
In this Section
▶ Correlation coefficients
▶ Examples
1
Correlation
2
2
1
1
1
Variable 2
Variable 2
Variable 2
0
0
0
−1
−1
−1
−2
−2
−2
−2 −1 0 1 2 −2 −1 0 1 2 −2 −1 0 1 2
2
Pearson Correlation
▶ magnitude of association
▶ linear association
▶ direction of the relationship
3
Spearman Correlation
▶ direction of the relationship
▶ monotonic relationship
What is rank?
Ranks are integers indicating the rank of some values. E.g. the rank of 3,
10, 16, 6, 2 is 2, 4, 5, 3, 1:
[1] 2 4 5 3 1
4
Difference between Pearson and Spearman
Weak positive correlation: Strong positive correlation:
Pearson = 0.5 Spearman = 0.51 Pearson = 0.9 Spearman = 0.8
2
2
1
1
Variable 2
Variable 2
0
0
−1
−1
−2
−2
−2 −1 0 1 2 −2 −1 0 1 2
Variable 1 Variable 1
5
Difference between Pearson and Spearman
What if there is a correlation but
Linear VS monotonic relationship:
this is not linear?
Pearson = −0.85 Spearman = −0.99
Pearson = 0.06 Spearman = 0.04
50
50
45
40
40
Variable 2
30
Variable 2
35
20
30
10
25
0
20
5 10 15 20
0 5 10 15 20 25 30
Variable 1
Variable 1
6
Other Correlation Measures
Note
▶ Correlation must not be confused with causality
▶ If two variables are correlated, it does not imply that one variable
causes the changes in another variable