Correlation Math Example 1

Follow the full solution, then compare it with the other examples linked below.

Example 1

medium
Given five data points (1,2),(2,4),(3,5),(4,4),(5,5)(1,2), (2,4), (3,5), (4,4), (5,5), compute the Pearson correlation coefficient rr.

Solution

  1. 1
    Compute means: xห‰=3\bar{x} = 3, yห‰=4\bar{y} = 4.
  2. 2
    Compute โˆ‘(xiโˆ’xห‰)(yiโˆ’yห‰)\sum(x_i - \bar{x})(y_i - \bar{y}): (โˆ’2)(โˆ’2)+(โˆ’1)(0)+(0)(1)+(1)(0)+(2)(1)=4+0+0+0+2=6(-2)(-2) + (-1)(0) + (0)(1) + (1)(0) + (2)(1) = 4 + 0 + 0 + 0 + 2 = 6.
  3. 3
    Compute โˆ‘(xiโˆ’xห‰)2=4+1+0+1+4=10\sum(x_i - \bar{x})^2 = 4 + 1 + 0 + 1 + 4 = 10 and โˆ‘(yiโˆ’yห‰)2=4+0+1+0+1=6\sum(y_i - \bar{y})^2 = 4 + 0 + 1 + 0 + 1 = 6.
  4. 4
    r=610ร—6=660=67.746โ‰ˆ0.775r = \frac{6}{\sqrt{10 \times 6}} = \frac{6}{\sqrt{60}} = \frac{6}{7.746} \approx 0.775.

Answer

rโ‰ˆ0.775r \approx 0.775
The Pearson correlation coefficient rr ranges from โˆ’1-1 to 11. A value of 0.7750.775 indicates a strong positive linear relationship between xx and yy.

About Correlation

Correlation measures the strength and direction of the linear relationship between two quantitative variables, ranging from โˆ’1-1 to +1+1.

Learn more about Correlation โ†’

More Correlation Examples