AA SL · Statistics and probability · course

Correlation and regression.

AA SL resourcesPDF

Two measurements on each member of a sample: do they move together? The correlation coefficient $r$ says how closely the points follow a line; the regression line is that line, and it predicts one variable from the other, as long as we stay inside the data.

IScatter diagrams and correlationSL 4.4 · bivariate data, Pearson's $r$, correlation and causation

I.1 Describing a correlation from $r$

Definition 1

Pearson's correlation coefficient

For bivariate data $(x,\,y)$, Pearson's correlation coefficient $r$ (GDC) measures how close the points are to a straight line: $-1\le r\le1$. Close to $1$: strong positive linear correlation; close to $-1$: strong negative; close to $0$: none.
Example 1

Describe the correlation when $r=-0.81$, when $r=0.35$ and when $r=0.02$.

What you do
What you write
Step 1 The sign gives the direction
negative; positive; positive
Step 2 The size gives the strength
$0.81$ strong; $0.35$ weak; $0.02$ none
Step 3 Say it in words
strong negative; weak positive; no linear correlation
Figure 1 — The more the points scatter, the closer $r$ gets to $0$.

Apply

  1. Describe $r=0.96$.
    Answerstrong positive
  2. Describe $r=-0.47$.
    Answerweak (to moderate) negative

I.2 $r$ on the GDC

Example 2

Find $r$ for $x$: $1,\,2,\,3,\,4,\,5,\,6$ and $y$: $2,\,5,\,4,\,8,\,9,\,11$, and describe the correlation.

What you do
What you write
Step 1 Enter $x$ and $y$ in two lists
Statistics: lists $X1$, $Y1$
Step 2 Linear regression gives $r$
$r=0.961$
Step 3 Describe it
strong positive linear correlation

Apply

  1. Find $r$ for $x$: $2,\,4,\,6,\,8$ and $y$: $9,\,7,\,6,\,2$.
    Answer$-0.965$

I.3 Correlation is not causation

Watch out 1
Correlation is not causation: both variables may depend on a third. And $r$ measures a linear link only: points on a parabola can have $r\approx0$.
Example 3

Across many towns, the number of doctors and the number of deaths each year are strongly positively correlated. Do doctors cause deaths?

What you do
What you write
Step 1 Look for a third variable
the population of the town
Step 2 Conclude in words
no: larger towns have more of both; the correlation shows no cause

Apply

  1. In children, shoe size and reading score are positively correlated. Why?
    Answerboth grow with age

IIRegression linesSL 4.4 · 4.10 · $y$ on $x$, $x$ on $y$, interpolation and extrapolation

II.1 The regression line of $y$ on $x$

Definition 2

regression line of y on x

The regression line of $y$ on $x$, $y=ax+b$ from the GDC, makes the sum of the squared vertical distances to the points as small as possible. It passes through the mean point $(\bar x,\,\bar y)$.
Example 4

For the data of Example 2, find the regression line of $y$ on $x$ and check that it passes through the mean point.

What you do
What you write
Step 1 Linear regression on the GDC
$y=1.74x+0.4$ ($a=1.742857\ldots$)
Step 2 The mean point
$\bar x=3.5$, $\bar y=6.5$
Step 3 Check
$1.742857\times3.5+0.4=6.5$
Figure 2 — Exam-style question 3. The regression line makes the squares as small as possible.

Apply

  1. The regression line of $y$ on $x$ for $x$: $2,\,4,\,6,\,8$ and $y$: $9,\,7,\,6,\,2$.
    Answer$y=-1.1x+11.5$

II.2 Predicting: interpolation and extrapolation

Property 1

predicting

Estimate $y$ from $x$ with the line of $y$ on $x$; estimate $x$ from $y$ with the line of $x$ on $y$ (SL 4.10). Reliable when $|r|$ is close to $1$ and the value lies inside the data (interpolation); outside (extrapolation) it is not.
Example 5

The line $y=0.9x+12$ was found from data with $20\le x\le60$ and $r=0.95$. Estimate $y$ when $x=45$ and when $x=90$, and comment.

What you do
What you write
Step 1 Substitute $x=45$
$y=0.9\times45+12=52.5$
Step 2 Inside the data, $|r|$ close to $1$
reliable (interpolation)
Step 3 $x=90$ is outside the data
$93$, but not reliable (extrapolation)

Apply

  1. Example 4's line: estimate $y$ when $x=4.5$.
    Answer$8.24$
  2. A line with $r=0.12$: is an estimate inside the data reliable?
    Answerno: the correlation is very weak

II.3 The mean point

Example 6

The regression line of $y$ on $x$ is $y=2.4x+7$ and $\bar x=5$. Find $\bar y$.

What you do
What you write
Step 1 The line passes through $(\bar x,\,\bar y)$
substitute $x=\bar x$
Step 2 Compute
$\bar y=2.4\times5+7=19$

Apply

  1. $y=ax+2$, $\bar x=8$, $\bar y=26$: find $a$.
    Answer$a=3$

II.4 The line of $x$ on $y$

Watch out 2
Do not rearrange $y=ax+b$ to find $x$: the line of $x$ on $y$ is a different line, unless $r=\pm1$.
Example 7

For the data of Example 2, estimate $x$ when $y=7$.

What you do
What you write
Step 1 $x$ from $y$: the line of $x$ on $y$ (GDC)
$x=0.530y+0.0522$
Step 2 Substitute $y=7$
$x=3.77$
Step 3 Inside the data, $r=0.961$
a reliable estimate

Apply

  1. For $x$: $2,\,4,\,6,\,8$ and $y$: $9,\,7,\,6,\,2$, estimate $x$ when $y=5$.
    Answer$x=-0.846y+10.1$: $5.85$

IIIExam-style questionsfrom the shortest to the longest · every one in steps, with its marks

A Reading r and a regression line

Exam-style question 1Paper 1 · no calculator · [Maximum mark: 4]

For $12$ cars, the age $x$ years and the value $y$ thousand euros give $r=-0.92$ and the regression line of $y$ on $x$, $y=-2.5x+80$. The ages range from $2$ to $15$ years, and the mean age is $10$ years.

(a)Describe the correlation between age and value.[1]
(b)Use the regression line to estimate the value of a car aged $12$ years.[1]
(c)Explain why the line should not be used to estimate the value of a car aged $40$ years.[1]
(d)Find the mean value of the $12$ cars.[1]
More questions like this

Working (a)

What you do
What you write
Step 1 Sign and size of $r$, in words
strong negative (linear) correlation

Working (b)

What you do
What you write
Step 1 Substitute $x=12$
$-2.5\times12+80=50$: $50\,000$ euros

Working (c)

What you do
What you write
Step 1 Outside the data: say why
$40$ is far outside the data: extrapolation
The line also gives a negative value.

Working (d)

What you do
What you write
Step 1 The mean point: substitute $\bar x$
$-2.5\times10+80=55$: $55\,000$ euros
The regression line passes through $(\bar x,\,\bar y)$.

Play this question in Mark it: find each mark yourself →

Exam-style question 2Paper 1 · no calculator · [Maximum mark: 4]

For a set of bivariate data, the regression line of $y$ on $x$ is $y=0.8x+4$ and $\bar x=15$.

(a)Find $\bar y$.[2]
(b)Explain why this line should not be used to estimate $x$ when $y=20$.[2]
More questions like this

Working (a)

What you do
What you write
Step 1 The line passes through $(\bar x,\,\bar y)$
the line passes through $(\bar x,\,\bar y)$
Step 2 Substitute
$\bar y=0.8\times15+4=16$

Working (b)

What you do
What you write
Step 1 Estimating $x$, not $y$
to estimate $x$ from $y$
Step 2 Name the right line
use the regression line of $x$ on $y$
Not the line of $y$ on $x$ rearranged.

Play this question in Mark it: find each mark yourself →

B Data on the GDC (Paper 2)

Exam-style question 3Paper 2 · calculator · [Maximum mark: 7]

Eight students recorded the hours $x$ they studied for a test and their score $y$. $\displaystyle \begin{array}{c|cccccccc}x\&2\&3\&5\&6\&8\&9\&11\&12\\\hline y\&47\&55\&58\&63\&66\&75\&76\&85\end{array}$

(a)Find the value of Pearson's correlation coefficient $r$.[1]
(b)Find the equation of the regression line of $y$ on $x$.[2]
(c)Estimate the score of a student who studied for $10$ hours.[2]
(d)Estimate the number of hours studied by a student who scored $70$.[2]
More questions like this

Working (a)

What you do
What you write
Step 1 $r$ on the GDC
$r=0.979$ ($0.979458\ldots$)

Working (b)

What you do
What you write
Step 1 Regression line of $y$ on $x$
$y=3.38x+42.0$ ($3.38043\ldots$, $41.9619\ldots$)
A1 for each coefficient.

Working (c)

What you do
What you write
Step 1 Substitute $x=10$
$3.38043\times10+41.9619$
Step 2 Compute
$75.8$ ($75.7663\ldots$)

Working (d)

What you do
What you write
Step 1 The line of $x$ on $y$
line of $x$ on $y$: $x=0.284y-11.6$
Not the line of (b) rearranged, which gives $8.29$.
Step 2 Substitute $y=70$
$8.24$ hours ($8.24158\ldots$)

Play this question in Mark it: find each mark yourself →

IVWhich method? Read the questionthe whole topic on one page

The question says
You write
A scatter diagram or a value of $r$ is given and you must “describe the correlation”: use the sign and the size of $r$.
strong / moderate / weak, positive / negative D1
You must “find $r$” or “find the regression line” from a table of data: use the GDC.
$r$ to $3$ s.f.; $y=ax+b$ with $a$, $b$ to $3$ s.f. D2
You must “estimate $y$ when $x=\ldots$”: use the line of $y$ on $x$.
substitute; check it is interpolation P1
You must “estimate $x$ when $y=\ldots$”: use the line of $x$ on $y$.
the other line, from the GDC P1
You must say whether “the estimate is reliable”: look at $|r|$ and the range of the data.
yes if $|r|\approx1$ and inside; no if outside or $r$ weak P1
The regression line is given and a mean is unknown: the mean point $(\bar x,\,\bar y)$ is on the line.
substitute $\bar x$ to get $\bar y$ D2
The question asks whether $x$ causes $y$: a value of $r$ shows correlation only.
no conclusion about cause from $r$ W1
In the exam 1

command terms

Describe the correlation: strength and direction. Interpret the gradient: “for each extra unit of $x$, $y$ increases by $a$ on average”. Justify: interpolation or extrapolation, and the value of $r$.