CleverSphere

Linear regression and correlation

The regression line describes the linear relation between two variables; the correlation coefficient shows its strength and direction.

Formulas

  • b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)²
  • a = ȳ − b · x̄
  • r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √(Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)²), −1 ≤ r ≤ 1

Your turn

Three problems on this topic. Comma or point, fractions like 1/6 work too.

Task 1 of 3Regression & correlation

Task

Work out Pearson's correlation coefficient for these pairs.

xy
15
33
40
51
7-6

r (2 decimal places)

Comma or point; fractions like 1/6 work too.

Worked example

Study hours x and points y were measured. Find the regression line y = a + b·x.

Worked solution

  1. 1.x̄ = 3.40, ȳ = 25.20
  2. 2.b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)² = 75.60 / 17.20 = 4.40
  3. 3.a = ȳ − b · x̄ = 25.20 − 4.40 · 3.40 = 10.26

Typical mistake: Dividing by Σ(yᵢ − ȳ)² instead of Σ(xᵢ − x̄)² for b.

Work out Pearson's correlation coefficient for these pairs.

Worked solution

  1. 1.r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √(Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)²)
  2. 2.= 52.80 / √(22.80 · 134.80) = 0.95
  3. 3.|r| close to 1 means a strong linear relation; the sign shows the direction.

Typical mistake: Reading correlation as causation.

Frequently asked questions

Does high correlation mean causation?

No. A relation can come from a third variable or chance.

Problems on this topic

Related topics

More topics