Correlation and linear regression
IB Mathematics Applications and Interpretation HLΒ· 20 min read
1. Bivariate Data and Correlationβ β ββββ± 15 min
Bivariate data describes pairs of values for two different variables collected from the same sample. We use scatter graphs to visualize relationships between variables, and Pearson's correlation coefficient to quantify the strength of linear relationships.
Pearson's Correlation Coefficient
A numerical measure of the strength and direction of the linear relationship between two continuous variables, ranging from to .
Example:
= perfect positive linear correlation, = perfect negative linear correlation, = no linear correlation.
General interpretation guidelines: = strong correlation, = moderate correlation, = weak/no linear correlation.
For the data , , calculate and interpret the result.
- 1
- Calculate sample means:
- 2
- 3
- Calculate sample standard deviations:
- 4
- 5
- Calculate covariance:
- 6
- Use the formula :
- 7
- 8
Interpretation: There is a very strong positive linear relationship between and .
Exam tip:
Always use your GDC to calculate in exams, manual calculation is rarely required.
2. Least Squares Regression Lineβ β β βββ± 20 min
A regression line models the linear relationship between two variables. The least squares method fits the line by minimizing the sum of squared vertical distances (residuals) between observed and predicted values.
y on x Regression Line
A line used to predict the value of the response variable from the explanatory variable . It always passes through the point (ar{x}, ar{y}).
Example:
The gradient and the intercept .
We use different lines for different prediction goals: on predicts from , and on predicts from . The two lines are not the same.
Using the previous data (, ar{x}=3, ar{y}=5.4, , ), find the on regression line and interpret the gradient.
- 1
- Calculate the gradient :
- 2
- 3
- Calculate the intercept :
- 4
- 5
- Final equation:
- 6
- 7
Interpretation: For every 1 unit increase in , is predicted to increase by 1.68 units on average.
Exam tip:
Use the fact that the line passes through (ar{x}, ar{y}) to check your answer in exams.
3. Prediction: Interpolation vs Extrapolationβ β β βββ± 15 min
Regression lines are used to predict unknown values of the response variable. The reliability of a prediction depends on whether the input value falls inside or outside the range of the original collected data.
Interpolation is generally reliable because we know the linear relationship holds for this range. Extrapolation is unreliable because we have no evidence the linear relationship continues outside the observed range.
Using the regression line (original ranges from 1 to 5), predict for and , and comment on reliability.
- 1
For :
- 2
- 3
Comment: is inside the original range of 1 to 5, so this is interpolation. The prediction is reliable.
- 4
For :
- 5
- 6
Comment: is outside the original range, so this is extrapolation. The prediction is unreliable, as we do not know if the linear relationship continues to .
4. Correlation vs Causationβ β ββββ± 10 min
A common misconception is that a strong correlation between two variables proves that one causes the other. This is not true, and correlation can arise from multiple non-causal scenarios.
A study finds a strong positive correlation between monthly ice cream sales and monthly drowning deaths. Does ice cream sales cause drowning?
- 1
- Observe that there is a strong positive correlation, but no obvious direct link.
- 2
- Identify the lurking variable: temperature. Higher temperatures increase both ice cream sales and the number of people swimming, leading to more drownings.
- 3
- Conclusion: There is no causal relationship between ice cream sales and drowning deaths. The correlation is explained by the lurking variable.
Exam tip:
Always explicitly state that correlation does not imply causation when asked to interpret results in exams.
5. Common Pitfalls
Wrong move:
Claiming a strong correlation proves causation
Why:
Correlation only measures association, not a directional causal link, and can be explained by lurking variables
Correct move:
Always explicitly state that correlation does not imply causation unless experimental evidence confirms a causal link
Wrong move:
Treating extrapolated predictions as equally reliable as interpolated predictions
Why:
The linear relationship is only validated for the range of observed data
Correct move:
Always flag extrapolated predictions as unreliable when discussing results
Wrong move:
Using an x on y regression line to predict y from x
Why:
Regression lines are fitted to minimize error for a specific response variable, so the wrong line gives biased predictions
Correct move:
Use the y on x line to predict y from x, and the x on y line to predict x from y
Wrong move:
Assuming a near-zero correlation means no relationship exists
Why:
Pearson's r only measures linear correlation, and strong non-linear relationships can give a near-zero r
Correct move:
Always plot a scatter graph to check for non-linear patterns before concluding no relationship exists
Wrong move:
Rounding regression coefficients to 2 decimal places early in calculations
Why:
Early rounding introduces significant error into final predictions
Correct move:
Keep full unrounded coefficients stored in your GDC until the final step of your calculation
6. Quick Reference Cheatsheet
Concept | Key Value/Formula | Note |
|---|---|---|
Pearson's | Measures strength of linear correlation | |
Strong correlation | Clear linear trend | |
Weak correlation | No clear linear trend | |
y on x line | Predict from | |
Gradient | Change in per unit | |
Intercept | Predicted when | |
Interpolation | Predict within data range | Generally reliable |
Extrapolation | Predict outside data range | Usually unreliable |
Core rule | Correlation Causation | Always mention lurking variables |
When this came up on past exams
AI-estimated based on syllabus patterns β cross-check with official past papers for accuracy. Use only as revision-focus signals.
- 2021 Β· 1
Calculate r and regression line
- 2022 Β· 2
Interpolation vs extrapolation
- 2023 Β· 1
Correlation vs causation discussion
Going deeper
What's Next
Correlation and linear regression form the foundation of all statistical modeling for IB AI HL. These skills are directly applicable to your internal assessment, where you will be expected to analyze relationships between variables in your own dataset. Next, you will extend these ideas to non-linear regression, where you transform non-linear relationships to fit a linear model, and learn how to test if an observed correlation is statistically significant. Mastery of this subtopic is critical for all further statistical work in the course.
