Statistics & probability · AI SL & HL
Correlation and regression
Describe association, fit the correct prediction line and explain the limits of a regression model.
Course focus: AI SL & HL: use technology to support calculation, show the mathematical setup and interpret the result in its context. Additional HL methods are labelled below.
Before you start: Scatter plots, means and straight-line equations.
Build it from the beginning
Correlation describes the direction and strength of a linear association; it does not explain its cause. Regression fits a prediction rule in a specified direction. Read which variable is being predicted before substituting.
A first walkthrough
A fitted model is \(y=2+3x\). Predict y when x=4.
- The model predicts y from x.
- Substitute the input: \(y=2+3(4)=14\).
- This is a model prediction, not a guarantee that every observation equals 14.
The foundations behind the method
Understand what the symbols mean
A scatter plot pairs two measurements on each observational unit. Correlation describes linear association, not causation. A strong relationship can arise through a third variable or selection effects. Identify explanatory and response variables before interpreting a regression equation.
How the ideas connect
Least-squares regression of y on x minimizes squared vertical residuals in y. Its line predicts y from x, not the reverse. A residual is observed minus predicted. Extrapolation uses the fitted rule beyond observed inputs and is more vulnerable to a changed relationship.
Start with the idea
Build your understanding
A scatter plot shows paired observations. Correlation describes a linear association; regression builds a directional prediction rule. Neither establishes a cause, and a good numerical fit can still be unsuitable outside the observed range.
Direction of prediction
Regressing y on x minimises vertical residuals for predicting y. Reversing the variables is a different calculation.
Residual
A residual is observed output minus predicted output. Patterns among residuals can reveal a poor model even when correlation is strong.
Compare the approaches
Choose by the information in the question, rather than the formula you recognise first.
Correlation
When it helpsSummarise the direction and strength of linear association.
Check before using itA value near zero does not rule out a nonlinear relationship.
Regression
When it helpsPredict one variable from another under a chosen model.
Check before using itExtrapolation and causal claims need independent justification.
Your method plan
- Inspect the scatter plot and unusual points.
- Choose the prediction direction and fit the appropriate model.
- Interpret predictions within the data range and inspect residuals.
Learn the methods
Learn step by step
1. Start with the scatter plot
Look for direction, strength, approximate linearity and unusual points. Pearson’s r measures linear association, not every kind of relationship. A curved relationship can be strong even when r is small. Outliers may materially change both r and the regression line.
2. Correlation is not causation
An association may result from another variable or chance; it does not prove one variable causes the other. State the context and direction: as x increases, y tends to increase or decrease. Avoid saying that every point follows the trend exactly.
Correlation
Why this formula works
Dividing the paired-deviation sum by the square-root product of each variable’s squared-deviation sum removes units and scale. The resulting r lies between −1 and 1 and describes linear association rather than causation.
\(r=S_{xy}/\sqrt{S_{xx}S_{yy}}\), when both variables have nonzero spread; −\(1\le r\le 1\).
Quick example
If \(Sxy=6\), \(Sxx=4\) and \(Syy=9\), then \(r=6/\sqrt{36}=1\). All nonconstant data pairs are perfectly aligned on an increasing line.
3. Regression direction
The regression of y on x predicts y from x and minimises vertical squared deviations. It passes through (mean x, mean y). To predict x from y, use the regression of x on y; simply rearranging the y-on-x line generally gives a different result.
A residual is a vertical difference
- Fitted line: y = x + 1
Regression line
Why this formula works
The y-on-x regression minimises the sum of squared vertical prediction errors. Solving its two minimisation equations gives slope \(Sxy/Sxx\) and an intercept that makes the line pass through the data’s mean point.
\(\hat y=a+bx\) \(b=S_{xy}/S_{xx}\) \(a=\bar y-b\bar x\).
Quick example
If mean \(x=2\), mean \(y=5\) and the slope is 3, the intercept is \(5-3(2)=-1\), giving predicted \(y=3x-1\).
Worked example: A perfect line
For pairs \((1,2)\), \((2,4)\), \((3,6)\), find the regression of y on x.
- The means are \((2,4)\). Centred sums are \(Sxx=2\) and \(Sxy=4\).
- Slope \(b=2\) and intercept \(a=4-2(2)=0\), so predicted \(y=2x\).
- All points lie on this line, so \(r=1\). This still does not establish causation.
4. Calculation and precision
Enter paired data in the same order and verify a few pairs. Record the slope and intercept with enough digits. Substitute using full calculator precision and round the final prediction, not the displayed coefficients first. State the predicted variable’s units.
Centred sums
Why this formula works
Subtracting each variable’s mean measures deviations from its centre. Sxx sums squared x-deviations; Sxy sums products of paired deviations, so it records whether x and y tend to depart from their means together.
\(S_{xy}=\sum(x_i-\bar x)(y_i-\bar y)\) \(S_{xx}=\sum(x_i-\bar x)^2\).
Quick example
For points \((1,2)\) and \((3,6)\), the means are \((2,4)\), \(Sxx=1+1=2\) and \(Sxy=2+2=4\), giving slope 2.
Worked example: Keep unrounded coefficients
A fitted line has intercept 2.973333… and slope 0.853333…. Predict y when \(x=7\).
- Calculate using full precision: 2.973333…+0.853333…×\(7=8.946666\)….
- Round the prediction to 8.95 at two decimal places.
- Using rounded coefficients 2.97 and 0.853 gives 8.941, which can change the final rounded answer.
5. Interpolation and extrapolation
Predictions inside the observed x-range are interpolation. Outside it they are extrapolation and require stronger assumptions about the continuing pattern. Even inside the range, weak correlation or a poor linear fit limits reliability. Predictions are estimates, not guaranteed outcomes.
Quick formula reference
For revision once you understand the methods above. Check the conditions before using a formula.
Regression line
\(\hat y=a+bx\), \(b=S_{xy}/S_{xx}\), \(a=\bar y-b\bar x\).
Return to the explanation →Centred sums
\(S_{xy}=\sum(x_i-\bar x)(y_i-\bar y)\), \(S_{xx}=\sum(x_i-\bar x)^2\).
Return to the explanation →Correlation
\(r=S_{xy}/\sqrt{S_{xx}S_{yy}}\), when both variables have nonzero spread; −\(1\le r\le 1\).
Return to the explanation →Learn to diagnose an error
Spot the mistake
The statement below is incorrect. Identify the missing condition or reasoning before opening the explanation.
From regression \(y=2x+1\), the fitted regression of x on y must be \(x=(y-1)/2\).
Explain and repair the mistake
Algebraically rearranging a fitted line does not refit the reverse regression, which minimizes different residuals. They coincide in the perfectly linear case, but not generally.
Connect and apply
Put the ideas together
A more demanding application of this guide’s methods. This is a learning stage; any additional HL content is labelled separately.
Read a residual in context
A model predicts score \(y=12+4x\) from weekly practice hours x. A student practises 3 hours and scores 20.
- The predicted score is \(12+4(3)=24\). The residual is \(20-24=-4\).
- A negative residual means the observation lies below the fitted line, not that the score itself is negative.
- The gradient describes an estimated increase of four score units per extra hour in this fitted dataset. It does not prove practice alone caused that difference.
- Predicting for 30 hours would be questionable if the original observations ranged from zero to five; the straight-line model may not remain realistic.
Is solving the fitted equation for x equivalent to fitting the regression of x on y?
Check your reasoning
No. Inverting a fitted prediction line does not change the residual criterion used to fit it. The reverse regression generally gives a different line.
Common mistakes and how to avoid them
- Correlation alone cannot establish cause.
- Do not reverse the regression direction by algebra alone.
- Keep full precision until the final result.
- Extrapolation needs an explicit reliability comment.
Practise independently
Build confidence, then apply it
Try each question before opening its hint or solution. If a method is new, return to the walkthrough, then try again. These learning stages describe the practice sequence; additional HL content is labelled separately.
- 1
Build confidence
What does a gradient of 3 mean in this model?
Need a starting point?
Describe a change in predicted output per input unit.
Show the worked solution
- Increasing x by 1 increases predicted y by 3.
- The statement needs the original variable units to be meaningful.
- 2
Apply and explain
The data used x values from 1 to 6. Why be cautious at x=20?
Need a starting point?
Compare the new input with the observed range.
Show the worked solution
- Twenty lies well outside the data, so this is extrapolation.
- The linear pattern may not continue there; the fitted line alone cannot justify reliability.
- 3
Check your understanding
Observed y is 9 and predicted y is 7. Find the residual.
Show the worked solution
The residual is \(9-7=2\). It is positive because the point is above the fitted line.
- 4
Use the method
Observed x-values are between 2 and 9. Is a prediction at \(x=20\) interpolation or extrapolation?
Show the worked solution
Extrapolation. It is far beyond the observed range, so the linear trend may not continue there.
Finished? Use the linked question bank below to practise selecting the method without a guide telling you which rule to use.
Using these methods in exam questions
AI Paper 1
GDC requiredShort-response questions still need mathematical setup and interpretation. Choose the correct tool, enter the model or data carefully, and check units and rounding.
AI Paper 2
GDC requiredExtended-response questions connect several steps. Keep intermediate values at full precision and explain how each result answers the context.
For this topic: Define the variable or events, write the probability statement or hypotheses, then calculate. Name the distribution and its parameters; interpret the result using the original population or context.
Paper 3: build a connected argument
Both AA HL and AI HL Paper 3 contain two extended problem-solving questions. A question develops a theme, so keep useful earlier results, test small cases and explain any proposed general rule. A calculator pattern can suggest a result; your mathematical reasoning must support it.
- Identify what the first part establishes and record the conditions under which it holds.
- When a later part introduces a new definition or model, connect it to methods you already know rather than assuming a new formula must have been memorised.
- Check the conclusion against an earlier numerical case and explain its meaning or limitation.
For the first-assessment-2021 courses. IB assessment reference ↗
Find a specific method or formula
Now practise the method
If you opened this guide from a question, return to that tab and try the method without looking at the example. Your answer stays in the question tab.
Practise this subtopic →Want a broader practice session? Explore IB Maths AI SL practice questions →Explore IB Maths AI HL practice questions →Try free IB Maths exam-style questions and worked solutions →
Original Arc Practice teaching notes for Maths AI. Core and HL sections are distinguished above. These notes follow the first-assessment-2021 course and are not an official IB publication or a complete syllabus checklist. IB course reference. Report a correction.