Updated · By Pete Bromfield, IB examiner

IA statistics, step by step · Correlation and regression

Pearson's correlation and the regression line, step by step

AA SLAA HLAI SLAI HL

Is there a straight-line relationship, how strong is it, and what is the line? Here are r, r² and the regression line worked by hand from the deviations, with the scatter graph, the AI HL significance test and the limits of what it all shows.

Example data, invented for this guide. The context is realistic, but the numbers were made up to show the method. Use your own collected or sourced data in your IA.

When to use it

  • Two numerical variables measured on the same individuals.
  • The scatter graph shows a roughly straight-line pattern.
  • You want to predict one variable from the other, inside the range of the data.

Course fit: Every course: scatter diagrams, Pearson's product-moment correlation coefficient r and the regression line of y on x are in the SL core of AA and AI (AA SL also has x on y). Testing whether the population correlation is zero is AI HL.

New course (first assessment May 2029): the IB has confirmed that the hypothesis test for the correlation coefficient (testing ρ = 0) is not on the AI HL syllabus from 2029 (AI curriculum updates). You can still use it in an IA if you explain it clearly.

The example data

Twelve students recorded their recreational screen time on one school day and how long they slept that night (from a phone sleep tracker).

Example data: sleep the following night
ix: Daily screen time (h)y: Sleep the following night (h)
11.58.6
228.1
32.58.4
437.9
53.57.6
647.8
74.57.2
857.4
95.56.9
1067.1
1176.5
1286.2

r, r² and the regression line

Every quantity comes from the deviations from the means. A GDC does all of this in one command; showing it once by hand makes clear what r measures.

Step 1 · Means and deviations

x̄ = 4.3750,   ȳ = 7.4750,   n = 12

Deviations from the means
ixyx − x̄y − ȳ(x − x̄)(y − ȳ)(x − x̄)²(y − ȳ)²
11.58.6−2.8751.125−3.2348.2661.266
228.1−2.3750.6250−1.4845.6410.3906
32.58.4−1.8750.9250−1.7343.5160.8556
437.9−1.3750.4250−0.58441.8910.1806
53.57.6−0.87500.1250−0.10940.76560.01562
647.8−0.37500.3250−0.12190.14060.1056
74.57.20.1250−0.2750−0.034380.015630.07563
857.40.6250−0.07500−0.046880.39060.005625
95.56.91.125−0.5750−0.64691.2660.3306
1067.11.625−0.3750−0.60942.6410.1406
1176.52.625−0.9750−2.5596.8910.9506
1286.23.625−1.275−4.62213.141.626
Σ−15.78744.5635.9425

Step 2 · Pearson's correlation coefficient r

r = Σ(x − x̄)(y − ȳ) / √[Σ(x − x̄)² Σ(y − ȳ)²] = −15.787 / √(44.563 × 5.9425) = −0.9702

r² = 0.9412: about 94.1% of the variation in y is associated with the linear relationship with x. On its own terms, a very strong negative linear correlation.

Scatter graph of sleep the following night against daily screen time
Always draw the scatter graph first: a straight-line pattern is what makes Pearson's r and the line meaningful.

In the full worked analysis

  • The rest of the working: steps 3 to 4
  • What the example shows, in context
  • On a GDC: TI-84 Plus CE, TI-Nspire CX and Casio fx-CG50
  • What examiners look for
  • Common mistakes
  • Limitations to discuss

How this maps to the IA criteria

These are the current criteria A–E, for exams up to November 2028. For the new courses (first assessment May 2029) the IB has confirmed one set of four criteria for SL and HL: A Problem specification (4 marks), B Abstraction (6), C Computation (4) and D Interpretation (6), still 20 marks and 20% of the grade at both levels — see the IB's new AA and AI subject briefs. The detailed descriptors come with the new guide; check with your teacher which criteria apply to you. The advice is our summary, not the IB's wording.

Get feedback on your write-up Self-check your draft

Frequently asked questions

What is a good r value in a Maths IA?

There is no pass mark. Describe strength and direction honestly (|r| near 1: strong; near 0: little linear correlation), check the scatter graph, and interpret r² as the proportion of variation explained.

Do I need to calculate r by hand?

Show one calculation clearly so the examiner sees you understand it, then use technology and say so. At HL, more of the mathematics shown or derived helps Criterion E.

Is correlation enough for a statistics IA?

On its own it is often thin, especially at HL. Combine it with a good question, careful data, a test where your course has one, and real reflection on causation and limitations.

Next steps

Related: Spearman's rank correlation · Is my data normal?. Or analyse your own data, find a data set in the IA data bank, and see what the IA package adds.

Free: the IA checklist an examiner uses

Every check for Criteria A–E in a 4-page PDF, the mistakes that cost the most marks and a self-assessment grid. We'll email it with a short IA tip every few days, timed to your deadline if you give it. Free — no account, no payment.