Calculating Correlation & Regression (AA HL)
When two variables might be linked, a scatter diagram shows the pattern and Pearson's correlation coefficient puts a number on how strong and in which direction that linear pattern runs. This topic covers finding and on your GDC, fitting the regression lines of on and of on , and using those lines carefully to predict one variable from the other - without falling into the traps of extrapolation or mistaking correlation for causation.
What the syllabus says
This topic maps onto two points in the official IB Analysis & Approaches syllabus.
| Code | Syllabus content |
|---|---|
| SL4.4 | Linear correlation of bivariate data - technology should be used to calculate Pearson's product-moment correlation coefficient , although hand calculation may enhance understanding. Scatter diagrams; lines of best fit passing through the mean point. Distinction between correlation and causation - correlation does not imply causation. Equation of the regression line of on , found using technology, used for prediction, interpreting the parameters and in , and awareness of the dangers of extrapolation. |
| SL4.10 | Equation of the regression line of on , and its use for prediction - with awareness that this line cannot always reliably be used to predict from a given value. |
Official IB source: Mathematics: analysis and approaches subject brief (PDF, ibo.org).
These are core AA SL syllabus points that are also examinable at AA HL.
Key terms
Five words worth knowing cold before you touch the formulas below - each with a worked example showing exactly what it means.
What is Pearson's correlation coefficient ?
is a number between and that measures how closely a set of bivariate data follows a straight line. A value near means a strong positive linear relationship, near means a strong negative one, and near means little or no linear relationship. It says nothing about non-linear patterns.
e.g. For every point lies exactly on , so .
What is the regression line of on ?
The regression line of on is the straight line that best fits the data by minimising the vertical distances from each point to the line. It always passes through the mean point , and is the line used when predicting from a given value of .
e.g. If , and the gradient is , then , giving .
What is the regression line of on ?
The regression line of on is a different straight line, found by minimising the horizontal distances instead of the vertical ones. It's used only for predicting from a given value of - swapping the on line around algebraically does not give the same line.
e.g. If the on gradient is and , the on gradient is , not .
What is ?
, the coefficient of determination, is the square of the correlation coefficient. It gives the proportion of the variation in one variable that can be explained by a linear relationship with the other, usually expressed as a percentage.
e.g. If , then , so of the variation in is explained by .
What's the difference between interpolation and extrapolation?
Interpolation is using a regression line to predict a value that falls within the range of the original data, which is generally reliable. Extrapolation is predicting outside that range, which is risky because there's no evidence the linear pattern continues beyond the data collected.
e.g. If ranges from to in the data, predicting at is interpolation; predicting at is extrapolation.
Key formulas
A handful of formulas cover this topic, and every one of them is normally evaluated on your GDC rather than substituted into by hand. The tables below summarise them - the explanations underneath go into more depth.
Formula reference
Pearson's and both regression line equations are given in the formula booklet - the coefficient of determination is not listed separately since it's simply squared.
| Formula | Used for | Booklet? |
|---|---|---|
| Pearson's product-moment correlation coefficient | Yes | |
| Regression line of on | Yes | |
| Regression line of on | Yes | |
| Coefficient of determination | Not in booklet - square the value of r |
Regression line of y on x vs x on y
These are two genuinely different lines, and mixing them up is one of the most common ways marks are lost on this topic.
| Feature | Line of y on x | Line of x on y |
|---|---|---|
| Minimises | vertical distances to the line | horizontal distances to the line |
| Form | ||
| Use it to predict | from a given | from a given |
| Passes through | ||
| Gradient relationship | product of the two gradients | |
Correlation and its strength
Sign of r
Positive : as increases, tends to increase. Negative : as increases, tends to decrease.
In the formula bookletStrength of r
close to means a strong linear relationship; close to means a weak or absent one.
Not in the formula booklet - interpretation onlyCorrelation vs causation
A strong shows association, not that one variable causes the other - a third, confounding variable could explain both.
Not in the formula booklet - conceptual pointUsing the regression line for prediction
Interpolation
Predicting within the range of the collected data - generally reliable, since the line is supported by nearby data.
Not in the formula booklet - definitionExtrapolation
Predicting outside the data range - the linear pattern is not guaranteed to continue, so the prediction may be unreliable.
Not in the formula booklet - definitionInterpreting the gradient
In context, is the change in per unit increase in , and is the value of predicted when (if that makes sense in context).
Not in the formula booklet - interpretationWorked examples
Two full exam-style questions, marked exactly like the real thing. Try each one yourself before checking the worked solution.
A farmer records fertiliser applied (kg/hectare) and crop yield (tonnes/hectare) for 6 plots:
| 20 | 35 | 50 | 65 | 80 | 95 | |
| 3.1 | 3.9 | 4.6 | 5.4 | 6.0 | 6.7 |
(a) Calculate the Pearson's product-moment correlation coefficient and interpret its strength and direction.
(b) Find the equation of the regression line of on
(c) Predict the yield for kg/hectare of fertiliser.
Worked solution
(a) a very strong positive linear correlation. M1
A1
R1
(b) M1 A1
(c) M1
tonnes/hectare. A1
Data on and gives the regression line with .
New variables are defined: and .
(a) Express the regression line of on in the form .
(b) State the value of the correlation coefficient between and .
(c) State the gradient of the regression line of on .
Worked solution
(a) M1 Substituting into to express in terms of . Since , M1 Substitute in terms of . A1 Correct simplified equation .
(b) Linear transformations do not change , so . A1 Correct value , stated directly from the fact that linear transformations preserve .
(c) (3 significant figures) A1 Correct value for the gradient of on , using .
Common mistakes
The four slip-ups that account for most of the marks lost on this topic - worth reading before you start practising, not just after you get one wrong.
- Confusing the sign of with its strength. is a stronger relationship than - the sign only tells you the direction, the magnitude tells you the strength.
- Using the on line to predict from . Rearranging algebraically does not give the true on regression line - you need to run the regression the other way on your GDC.
- Extrapolating with confidence. A prediction far outside the range of -values in the data is unreliable, even with a strong - always check whether you're interpolating or extrapolating before trusting the answer.
- Treating a strong as proof of causation. A high correlation shows association, not that one variable causes the other - a confounding factor could be driving both.
Using your GDC
Every step below is a real button sequence, not a vague "use your calculator" hint - covering the TI-84 Plus, TI-Nspire, and Casio fx-9860/fx-CG50. Pick your model to filter down to just the steps that apply to you.
Core AA skill - gives the regression line and the correlation coefficient in one step.
- Enter x-values in one list and y-values in another.
- Turn on DiagnosticOn once (2nd → CATALOG) so r appears; then STAT → CALC → 4:LinReg(ax+b), set Xlist and Ylist, Calculate.TI-84
- Calculator page → menu → Statistics → Stat Calculations → Linear Regression (mx+b).Nspire
- Statistics menu → CALC (F2) → REG (F3) → X (linear); r shows automatically.Casio
- Read a (gradient), b (intercept), r (correlation) and r² (coefficient of determination).
- Use the equation to predict - but only within the data range (interpolation).
Tip: r near ±1 means a strong linear fit; near 0 means weak. r² is the proportion of variation explained.
Instant summary statistics from a list - no formulas to compute by hand. Useful for finding and before working with the regression line.
- Enter the data into a list.
- STAT → Edit → type values into L1. Then STAT → CALC → 1:1-Var Stats, choose L1, Calculate.TI-84
- Add a Lists & Spreadsheet page, name a column and enter data; then a Calculator page → menu → Statistics → Stat Calculations → One-Variable Statistics.Nspire
- Statistics menu → enter data in List 1 → CALC (F2) → 1-VAR.Casio
- Read x̄ (mean), Sx (sample sd) or σx (population sd), and the five-number summary (min, Q1, median, Q3, max).
- For frequency data, put values in one list and frequencies in another and set the frequency list.
Tip: Sx vs σx: use σx (population) for a complete data set, Sx (sample) for a sample. IB usually wants σx.
See the full GDC guide for more calculator models and topics.
Quick questions
The questions students on this topic ask most often.
What does a correlation coefficient close to 1 or -1 mean?
A value of close to or means the points lie close to a straight line - close to is a strong positive relationship (as increases, increases), close to is a strong negative relationship (as increases, decreases). A value near means little or no linear relationship.
What's the difference between the regression line of y on x and the line of x on y?
The line of on minimises the vertical distances from the points to the line, and is used to predict from a given . The line of on minimises the horizontal distances instead, and is used to predict from a given . They are two different lines unless the correlation is perfect.
Why can't I use the y on x line to predict x from a y value?
The on line was built to minimise vertical errors when predicting , not horizontal errors when predicting - rearranging it algebraically gives a different, less accurate line than the true on regression. Use the on line whenever you're predicting from .
Is Pearson's r formula given in the exam formula booklet?
Yes - the formula for , and the equations of both regression lines, are in the topic 4 section of the AA formula booklet. In practice you'll almost always find and the regression line directly from your GDC rather than substituting into the formula by hand.
Related topics
More Statistics & Probability topics from the same AA HL syllabus unit, in case you want to keep going.
Ready to practise properly?
Correlation & regression questions, marked instantly like the real exam.