IB MATHEMATICS: ANALYSIS AND APPROACHES • STATISTICS AND PROBABILITY

Correlation & Regression — SL 4.2 Correlation and regression (intro; linear regression)

Learn how to measure the strength of relationships between variables and predict outcomes using the line of best fit.

Historical Context & Motivation

Humans have always tried to spot patterns in data — farmers tracked rainfall and crop yields, astronomers logged star positions over centuries. But for most of history, these observations remained informal. The question "How strong is the link between two measurements?" had no precise mathematical answer. It wasn't until the 19th century that statisticians developed the tools we now call correlation and regression, giving us a way to quantify relationships and make predictions from data.

1805
Legendre's Method of Least Squares
French mathematician Adrien-Marie Legendre published the method of least squares, a technique for fitting a line to data points by minimizing the sum of squared errors. This became the backbone of regression analysis.
1886
Galton Coins 'Regression'
Sir Francis Galton studied the heights of parents and children. He noticed that children of very tall parents tended to be shorter than their parents — a phenomenon he called regression to the mean. This gave linear regression its name.
1896
Pearson's Correlation Coefficient
Karl Pearson formalized the product-moment correlation coefficient (r), providing a single number between −1 and 1 that measures the strength and direction of a linear relationship.
1900s–Today
Modern Applications
Regression and correlation are now everywhere — from predicting stock prices to modelling climate change, from sports analytics to machine learning. The same core ideas Galton and Pearson developed power billions of predictions daily.

The central question this topic addresses is: when you collect two measurements for each individual (for example, hours studied and exam score), how can you describe the relationship mathematically, measure how strong it is, and use it to make predictions? That is the purpose of correlation and linear regression.

Core Principles & Definitions

Before diving into calculations, you need to understand several foundational ideas. In any bivariate data set you have pairs of values — one for the independent variable (x) and one for the dependent variable (y). We want to know whether these variables move together and, if so, how closely.

1

Bivariate Data

Data consisting of paired observations (x, y) for each individual or case. Each pair belongs to the same subject — for example, a student's study time and their test mark.
2

Scatter Diagram

A graph where each (x, y) pair is plotted as a point. The pattern of the cloud of points reveals the type and strength of the relationship between the two variables.
3

Correlation

A measure of the strength and direction of a linear relationship between two variables. It is quantified by the Pearson product-moment correlation coefficient, r, which ranges from −1 to 1.
4

Linear Regression

The process of finding the equation of the straight line (y = ax + b) that best fits the data. This 'line of best fit' is found by minimizing the sum of the squared vertical distances from each point to the line.
5

Interpolation vs. Extrapolation

Using the regression line to predict within the range of your data is called interpolation — generally reliable. Predicting outside that range is called extrapolation — often unreliable because the relationship may not hold.
KEY TAKEAWAY
Think of correlation like a GPS signal strength bar. When r is close to 1 or −1, the signal is strong — you can predict one variable from the other with confidence. When r is near 0, the signal is weak — there's too much static (scatter) for the line to be useful. The regression line is the best route your GPS can plot through the noisy data points.

Scatter Diagrams & Correlation Patterns

The most important first step in any correlation/regression problem is to draw (or inspect) a scatter diagram. The visual shape of the point cloud tells you immediately whether a linear model is appropriate, what direction the relationship goes, and roughly how strong it is. The diagram below shows three classic patterns side by side.

Three scatter diagrams illustrating strong positive correlation (points rise together, r near 1), strong negative correlation (one rises as the other falls, r near −1), and no correlation (scattered randomly, r near 0). Dashed lines show the approximate regression line for each case.

Notice how the tightness of the point cloud around the dashed line varies. In the strong positive case (left), points hug the line closely, meaning the value of r is near 1. In the strong negative case (centre), the points also hug the line closely, but it slopes downward, giving r near −1. In the no-correlation case (right), the points form a shapeless cloud, so r is near 0 and the line is essentially flat and useless for prediction.

Mathematical Framework

The IB syllabus requires you to know and use several formulas. Your GDC (graphing calculator) will do the heavy computation, but understanding what each formula means is essential for interpreting results and answering exam questions.

Pearson's Correlation Coefficient (r)

PEARSON'S r (GIVEN IN FORMULA BOOKLET)
r = Sxy / √(Sxx × Syy)
where Sxy = Σxᵢyᵢ − (Σxᵢ)(Σyᵢ)/n , Sxx = Σxᵢ² − (Σxᵢ)²/n , Syy = Σyᵢ² − (Σyᵢ)²/n , and n is the number of data pairs.

The value of r always satisfies −1 ≤ r ≤ 1. When r = 1, all points lie perfectly on a line with positive slope; when r = −1, they lie on a line with negative slope. In practice, you will enter your data lists into your GDC and read off r directly.

Equation of the Regression Line (y on x)

REGRESSION LINE (y ON x)
ŷ = ax + b
where a (gradient) = Sxy / Sxx and b (y-intercept) = ȳ − a·x̄ . The line always passes through the mean point (x̄, ȳ).
COEFFICIENT OF DETERMINATION
r² = (proportion of variation in y explained by x)
If r = 0.9, then r² = 0.81, meaning 81% of the variation in y can be explained by its linear relationship with x. The remaining 19% is due to other factors.
📝 IB Exam Tip
In the IB, the regression line of y on x is written as ŷ = ax + b (not y = mx + c). Use this form when predicting y from x. The IB formula booklet provides the formulas for a and b, but on most questions you will use your GDC to find them. Always state the equation with at least 3 significant figures.

Interpreting the Correlation Coefficient

Knowing the value of r is only useful if you can interpret it in context. The IB expects you to describe correlation using specific language: strong, moderate, or weak combined with positive or negative. The table below gives commonly accepted thresholds, though in the IB exam, the boundary values may be slightly flexible.

Strength of Linear Correlation (|r| values)
Strong Negative
Moderate Negative
Weak / None
Moderate Positive
Strong Positive
r = −1
−0.75
−0.25
0.25
0.75
r = 1
Perfect NegativePerfect Positive
A detailed scatter diagram showing study hours versus exam score. The regression line (purple) passes through the mean point (x̄, ȳ) marked with a yellow circle. The short red dashed segments show residuals — the vertical distances from data points to the line. Least squares regression minimizes the sum of these squared residuals.

The diagram above illustrates a key fact: the regression line of y on x always passes through (x̄, ȳ), the point formed by the means of both variables. The residuals (the vertical red dashes) show the errors — the differences between the actual y-values and the predicted ŷ-values. The least squares method finds the line that makes the sum of the squares of these residuals as small as possible.

⚠️ Correlation ≠ Causation
A strong correlation between x and y does NOT prove that x causes y. For example, ice cream sales and drowning rates are strongly positively correlated — but ice cream doesn't cause drowning. Both are driven by a lurking variable: hot weather. Always be cautious about claiming causation from correlation alone.

Worked Example

A teacher records the number of hours 8 students spent on revision (x) and their percentage marks on a test (y). The data is shown below.

Revision hours and test marks for 8 students
StudentHours (x)Mark (y)
A240
B350
C555
D452
E665
F768
G872
H980
Find the regression line y on x and the correlation coefficient
1
Step 1 — Calculate the summary statisticsFirst, find the necessary sums. With n = 8: Σx = 2 + 3 + 5 + 4 + 6 + 7 + 8 + 9 = 44, so x̄ = 44/8 = 5.5. Σy = 40 + 50 + 55 + 52 + 65 + 68 + 72 + 80 = 482, so ȳ = 482/8 = 60.25.
x̄ = 5.5, ȳ = 60.25
2
Step 2 — Calculate Sxx, Syy, and SxyΣx² = 4 + 9 + 25 + 16 + 36 + 49 + 64 + 81 = 284. So Sxx = 284 − (44)²/8 = 284 − 242 = 42. Σy² = 1600 + 2500 + 3025 + 2704 + 4225 + 4624 + 5184 + 6400 = 30262. So Syy = 30262 − (482)²/8 = 30262 − 29040.5 = 1221.5. Σxy = 80 + 150 + 275 + 208 + 390 + 476 + 576 + 720 = 2875. So Sxy = 2875 − (44)(482)/8 = 2875 − 2651 = 224.
Sxx = 42, Syy = 1221.5, Sxy = 224
3
Step 3 — Find the gradient a and intercept ba = Sxy / Sxx = 224 / 42 ≈ 5.333 (to 4 s.f.: 5.333). b = ȳ − a × x̄ = 60.25 − 5.333 × 5.5 = 60.25 − 29.33 ≈ 30.92.
ŷ = 5.33x + 30.9 (3 s.f.)
4
Step 4 — Calculate rr = Sxy / √(Sxx × Syy) = 224 / √(42 × 1221.5) = 224 / √51303 = 224 / 226.5 ≈ 0.989.
r ≈ 0.989 — strong positive correlation
5
Step 5 — Make a prediction (interpolation)Predict the mark for a student who studied for 6.5 hours: ŷ = 5.33(6.5) + 30.9 = 34.65 + 30.9 = 65.6. Since 6.5 is within the data range (2 to 9), this is interpolation and the prediction is reliable.
Predicted mark ≈ 65.6%

Strengths, Limitations & Common Pitfalls

Linear regression is a powerful tool, but it has important limitations. Understanding these will help you avoid common mistakes in IB exams and in real-world data analysis.

Strengths and limitations of linear regression
StrengthsLimitations
Provides a clear, objective measure of linear association (r)Only detects linear relationships — a perfect curve would give r ≈ 0
The regression line allows quantitative predictionsExtrapolation beyond the data range is unreliable
Easy to compute with a GDC — entering lists gives a, b, r instantlyOutliers can drastically skew the regression line and the r-value
r² gives the percentage of variation explained — easy to interpretCorrelation does not imply causation — a lurking variable may be the true cause
The regression line always passes through (x̄, ȳ) — useful for checkingSmall sample sizes make r unreliable — a few points can show a strong r by chance
⚠️ COMMON IB EXAM MISTAKES
Three mistakes cost students the most marks: (1) Confusing the y on x line with the x on y line — the IB will specify which one to use. (2) Extrapolating and claiming the prediction is reliable. (3) Stating that a strong r value proves causation. Remember: correlation describes the strength of association, not the reason for it.

Connection to Advanced Topics

The linear regression you learn in SL 4.2 is the starting point for a family of far more powerful techniques used across science, economics, and machine learning. Here is how the SL content connects to what comes next.

How SL 4.2 connects to advanced regression topics
SL 4.2 (This Topic)HL / Further Study
One independent variable (x), one dependent variable (y)Multiple regression: many independent variables predict y (e.g., y = a₁x₁ + a₂x₂ + ... + b)
Pearson's r measures linear correlationSpearman's rank correlation (rs) handles non-linear monotonic relationships and ranked data
Fit a straight line onlyNon-linear regression fits curves (quadratic, exponential, logarithmic models)
Coefficient of determination r² interpreted informallyHypothesis testing on r — is the correlation statistically significant?
Use GDC for computationsMatrix algebra and software (Python, R, SPSS) for large data sets

If you continue to HL, you will encounter Spearman's rank correlation and formal hypothesis testing for correlation. In university statistics or data science courses, you will use multiple regression models that extend the same least-squares principle to handle dozens of variables simultaneously. The logic you build now — scatter diagrams, residuals, r-values — forms the foundation for all of it.

Practice Problems

PROBLEM 1CONCEPTUAL
A researcher finds a Pearson correlation coefficient of r = −0.82 between the number of hours spent watching TV per day and a student's GPA. Describe the correlation in words and explain what this value tells you. Does this prove that watching TV causes lower grades?
PROBLEM 2BASIC CALCULATION
The regression line of y on x is ŷ = 3.5x + 12. The mean of x is x̄ = 4. Find ȳ, the mean of y.
PROBLEM 3INTERMEDIATE
For a data set of 10 pairs, you are given: Σx = 50, Σy = 120, Σx² = 310, Σy² = 1580, Σxy = 680. Calculate the equation of the regression line of y on x and the value of r.
PROBLEM 4APPLIED
A sports scientist measures the weekly training distance (km) and resting heart rate (bpm) for 12 athletes. The GDC gives: ŷ = −0.45x + 82, r = −0.91. (a) Interpret the gradient in context. (b) Predict the resting heart rate for an athlete who trains 60 km per week. (c) Would it be appropriate to predict the heart rate for an athlete training 200 km per week? Explain.
PROBLEM 5CRITICAL THINKING
Two students analyse the same data set. Student A reports r = 0.65 and concludes 'there is a moderate positive linear relationship.' Student B plots the scatter diagram and notices the data forms a clear U-shaped curve. Explain who is more likely correct in their assessment of the relationship, and what this tells us about the limitations of r as a measure of association.

Lesson Summary

In this lesson you learned that bivariate data consists of paired observations (x, y), and we visualise them with a scatter diagram. The Pearson correlation coefficient (r) quantifies the strength and direction of a linear relationship, ranging from −1 (perfect negative) through 0 (no linear relationship) to 1 (perfect positive). We describe correlations as strong, moderate, or weak combined with positive or negative. The regression line of y on x (ŷ = ax + b) is found using least squares and always passes through the mean point (x̄, ȳ).

Use the regression equation for interpolation (predictions within the data range) but be cautious about extrapolation (predictions outside the range). The coefficient of determination (r²) tells you the proportion of variation in y explained by x. Above all, remember that correlation does not imply causation — always consider lurking variables and always check the scatter diagram for non-linear patterns before relying on r.

Varsity Tutors • IB Mathematics: Analysis and Approaches • Correlation & Regression — SL 4.2