Skip to content
Marlbridge

Study Guides

Cambridge O Level Statistics: Scatter diagrams, correlation and lines of best fit (4040)

Study guide to scatter diagrams, positive and negative correlation, and fitting a line of best fit by semi-averages, for Cambridge O Level Statistics.

Subject
Statistics
Level
O LEVELS
Topic
Scatter diagrams, correlation and lines of best fit
Updated

Aligned to Cambridge O Level Statistics (4040), For examination in 2025-2027. Official specification .

Syllabus page (what it covers and how it is assessed): Cambridge O Level Statistics.

Syllabus points this page covers

4040

  • 9.1 Elementary ideas of correlation
  • 9.2 Lines of best fit

Found an error? Report a correction.

Need help with this topic? Request a free trial class for O Level Statistics (4040).

This guide covers sections 9.1 and 9.2 of the Cambridge O Level Statistics (4040) syllabus for examination in 2025, 2026 and 2027. Topic 9 is “Bivariate distributions and their representation by scatter diagrams”. Section 9.1 asks for elementary ideas of correlation, including the terms positive, negative, strong and weak correlation. Section 9.2 asks for lines of best fit, including the method of semi-averages, the derivation of the equation of the fitted straight line in the form y = mx + c, and the use and limitations of a line of best fit in prediction.

Useful links: the Cambridge O Level Statistics hub, the printable checklist, the revision notes and the practice questions. Means and grouped data are covered in averages and formation of frequency distributions. To find out where you stand first, try the free 10-minute diagnostics.

What this unit covers

Syllabus point What you must be able to do
9.1 scatter diagrams Plot paired data and read a scatter diagram
9.1 correlation Use the terms positive, negative, strong and weak correctly
9.2 semi-averages Split the data into two halves and find the mean point of each
9.2 equation Find m and c in y = mx + c for the fitted line
9.2 prediction Use the line to estimate values and say when the estimate is unreliable

Bivariate data and scatter diagrams

Bivariate data means two measurements taken on each item or person, such as a height and a weight, or a price and the number sold. Each pair becomes one point on a scatter diagram.

  • Put the variable you think explains or controls the other on the horizontal axis. Call it x.
  • Put the variable that responds on the vertical axis. Call it y.
  • Plot each pair (x, y) as a small cross. Do not join the points.
  • Pick scales so that the points fill most of the grid, and name each axis with its quantity and unit.

A scatter diagram lets you see a pattern that a table of numbers hides. It also shows any point that sits far from the rest, which is called an outlier.

Correlation (9.1)

Correlation describes how closely two variables follow a straight-line pattern together.

Description What the points look like
Positive correlation As x increases, y tends to increase. The points slope upwards from left to right.
Negative correlation As x increases, y tends to decrease. The points slope downwards from left to right.
Strong The points lie close to a straight line.
Weak The points are widely scattered, but a trend can still be seen.
No correlation The points show no straight-line trend at all.

You combine two words: “strong positive correlation” or “weak negative correlation”. A sketch of each case, with x across and y up:

Strong positive     Weak negative      No correlation
      .  .'               .   .          .     .
    . .'               .     .  .         .  .    .
  . .'                  .  .    .       .    .   .
 .'                        .   .          .    .

When you describe correlation in an answer, say three things: the type (positive or negative), the strength (strong or weak), and what it means for the two variables in the context of the question. “Strong positive correlation: pupils who revise for longer tend to score higher” earns more than the two words alone.

Worked example 1

A teacher records the hours of revision (x) and the test score out of 100 (y) for eight pupils.

Hours, x 1 2 3 4 5 6 7 8
Score, y 35 42 41 55 58 66 64 78

Describe the correlation.

Plotting the points, they climb steadily from (1, 35) to (8, 78). They stay close to a straight line, with small wobbles at x = 3 and x = 7.

Answer: strong positive correlation. Pupils who revise for more hours tend to get higher scores.

Correlation is not cause

Two variables can be correlated without one causing the other. Ice cream sales and sunburn cases both rise in hot weather. Neither causes the other: hot weather drives both. A third variable that drives both is called a lurking variable. When you are asked for a comment, say that the correlation shows an association, and name a plausible reason or a third factor.

Lines of best fit (9.2)

A line of best fit is one straight line placed to show the trend in the points. You can only sensibly draw one when the correlation is reasonably strong. For data with no correlation, a line has no meaning.

An eye-drawn line should pass close to the mean point, which is (mean of x, mean of y), and should have about as many points above it as below it. Fitting by eye gives different lines for different people. The syllabus therefore asks for a fixed method, which is the method of semi-averages.

The method of semi-averages

  1. Write the pairs in order of increasing x.
  2. Split them into two groups of equal size, a lower half and an upper half. If there is an odd number of pairs, leave out the middle pair.
  3. For the lower half, find the mean of the x values and the mean of the y values. This gives the point A = (x̄₁, ȳ₁).
  4. Do the same for the upper half to get the point B = (x̄₂, ȳ₂).
  5. Plot A and B and draw the straight line through them. This is the line of best fit.
  6. Find its equation: gradient m = (ȳ₂ − ȳ₁)/(x̄₂ − x̄₁), then substitute A into y = mx + c to find c.

The 4040 syllabus does not set a rule for an odd number of pairs. Leaving out the middle pair, as in step 2, is the usual convention, and it is sensible to say so in your answer. If a question tells you what to do, follow the question.

Worked example 2 (even number of pairs)

The age of a car in years (x) and its value in thousands of dollars (y):

Age, x 1 2 3 4 5 6 7 8 9 10
Value, y 21.5 19.8 18.4 16.1 15.0 12.9 11.7 9.8 8.9 6.6

Find the equation of the line of best fit by semi-averages.

The x values are already in order. There are 10 pairs, so each half has 5.

Lower half (x = 1 to 5)
  mean x = (1+2+3+4+5)/5 = 3
  mean y = (21.5+19.8+18.4+16.1+15.0)/5 = 90.8/5 = 18.16
  A = (3, 18.16)

Upper half (x = 6 to 10)
  mean x = (6+7+8+9+10)/5 = 8
  mean y = (12.9+11.7+9.8+8.9+6.6)/5 = 49.9/5 = 9.98
  B = (8, 9.98)

Gradient  m = (9.98 − 18.16)/(8 − 3) = −8.18/5 = −1.636

Use A:  18.16 = −1.636 × 3 + c
        c = 18.16 + 4.908 = 23.068

Answer: y = −1.636x + 23.068, which is about y = 23.07 − 1.64x.

Check: the overall mean point is (5.5, 14.07). Putting x = 5.5 into the line gives y = −1.636 × 5.5 + 23.068 = 14.07, so the line passes through the mean point. This always happens when the two equal halves together contain all the data, as here. With an odd number of pairs and the middle pair left out, it need not.

Worked example 3 (unordered data, odd number of pairs)

Daily maximum temperature in °C (x) and the number of cold drinks sold at a kiosk (y):

x 24 18 30 21 27 15 33
y 62 41 80 49 73 30 93

Find the line of best fit by semi-averages.

Step 1, order by x:

x:  15  18  21 | 24 | 27  30  33
y:  30  41  49 | 62 | 73  80  93

Step 2: there are 7 pairs, so leave out the middle pair (24, 62). Each half has 3 pairs.

Lower: mean x = (15+18+21)/3 = 18     mean y = (30+41+49)/3 = 120/3 = 40
Upper: mean x = (27+30+33)/3 = 30     mean y = (73+80+93)/3 = 246/3 = 82

A = (18, 40),  B = (30, 82)
m = (82 − 40)/(30 − 18) = 42/12 = 3.5
40 = 3.5 × 18 + c  →  c = 40 − 63 = −23

Answer: y = 3.5x − 23. The gradient means about 3.5 more drinks are sold for each extra degree.

Using the line for prediction

Once you have y = mx + c, put an x value in to estimate y. To estimate x from a given y, rearrange: x = (y − c)/m.

Worked example 4

Using the line from example 3, estimate the sales when the maximum temperature is 26 °C, and when it is 40 °C.

x = 26:  y = 3.5 × 26 − 23 = 91 − 23 = 68
x = 40:  y = 3.5 × 40 − 23 = 140 − 23 = 117

The first estimate is 68 drinks. The temperatures in the data run from 15 °C to 33 °C, so 26 °C lies inside that range. Estimating inside the range is called interpolation and is usually reasonably reliable.

The second estimate is 117 drinks, but 40 °C lies outside the range of the data. Estimating outside the range is called extrapolation. It assumes the same straight-line pattern continues, which may not be true. At very high temperatures people might stay indoors and sales could fall.

Limitations of a line of best fit

  • It is reliable only when the correlation is strong. With weak correlation, a predicted value could be well away from the true one.
  • Extrapolation is risky. The pattern may change outside the data.
  • The line can give impossible values. In example 2, setting y = 0 gives x = 14.1 years, and the line gives a negative value at 15 years. A car cannot have negative value.
  • It describes the sample you have. A small sample, or data from one place or time, may not apply elsewhere.
  • An outlier can pull the line away from the trend. Check whether the outlier is an error before deciding whether to keep it.
  • A strong correlation does not show that x causes y.

Interpreting m and c

The gradient m tells you how far y moves when x goes up by 1. In example 2, m = −1.636 means the value falls by about 1.636 thousand dollars (1,636 dollars) each year. The constant c is the value of y when x = 0. In example 2, c = 23.068 would be an estimated value when new of about 23.068 thousand dollars. Always give the answer in the units of the question, and check whether x = 0 makes sense in context.

Common errors

  • Swapping the axes, so that the response variable is put on the horizontal axis without a reason.
  • Joining the plotted points with a ruler instead of drawing one straight line.
  • Splitting the data into halves before ordering by x.
  • For an odd number of pairs, putting the middle pair into one half, so that the halves are unequal.
  • Using the gradient formula the wrong way round, as (x̄₂ − x̄₁)/(ȳ₂ − ȳ₁).
  • Calling a scatter “strong” because the line is steep. Strength depends on how close the points lie to the line, not on the steepness.
  • Predicting far outside the data without comment.

Next steps

Work through the practice questions, then use the revision notes to check what you recall. The topic after this one in the syllabus is time series, which uses a different kind of trend line based on moving averages. For general exam technique see exam preparation, and for the full list of outcomes use the checklist.

Official syllabus

Cambridge O Level Statistics (4040) syllabus, for examination in 2025, 2026 and 2027, published by Cambridge University Press & Assessment (Cambridge International Education). Sections 9.1 and 9.2.

Get free revision emails (optional)

Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.

Subjects (optional, up to 6)

Choose a qualification to see its subjects.

Related resources

Related articles

Studying this with a teacher

Working through Statistics O LEVELS?

This page is free and stays free. If you would rather be taught it, Marlbridge runs Statistics classes one-to-one and in small groups of up to 15, online in your own time zone. The first trial class is free. WhatsApp replies within an hour (8am–11pm Pakistan time, every day); email the same day.