EuraStudy
Notes/Statistics/Correlation and linear regression
Notes · StatisticsUK · A-Levels

Correlation and linear regression

This topic analyses bivariate data through scatter diagrams, the product-moment and Spearman's rank correlation coefficients, and the least-squares regression line. It develops the meaning and calculation of each measure, the use of a regression model for prediction, the difference between interpolation and extrapolation, and the crucial distinction between correlation and causation.

5 sections·~12 min reading time·3 competencies·Level Foundation 1 · Standard 2 · Advanced 2

T·101010 / 18
Exam profile
AO1 · Calculate the PMCC, Spearman's coefficient and the least-squares regression coefficientsAO2 · Interpret correlation and regression in context, including their limitationsAO3 · Use a regression model to make and criticise predictions
Operators:calculatefinddetermineinterpretcommentpredict

basic level

The AS foundation expects scatter diagrams, the interpretation of the PMCC, and the use of a given regression line.

higher level

The full A-Level expects computing the PMCC and Spearman's coefficient, deriving the least-squares line, and reasoning about prediction and causation.

Depth

Reading depth: In depth

Text

Text size: Standard

Contents · 5 sections▾
  1. Correlation and linear regression
    • 01Scatter diagrams and correlation○
    • 02The product-moment correlation coefficient◐
    • 03Spearman's rank correlation coefficient◐
    • 04Least-squares regression●
    • 05Prediction, residuals and correlation versus causation●
§ 01

Scatter diagrams and correlation#

●○○FoundationLPPearson Edexcel 9ST0, Topic 7 (Paper 1)

A scatter diagram with strong negative correlation

Strong negative correlationScatter plot: y by x, Data: (1, 10); (2, 9); (3, 7); (4, 6); (5, 4); (6, 3)345678910123456yx
Fig. 1Points falling from upper left to lower right show strong negative correlation (here r = -0.995).

Key points

Bivariate data record two variables on each unit, and a scatter diagram plots one against the other to reveal any relationship. Correlation describes the strength and direction of a LINEAR association: positive correlation means yyy tends to rise with xxx, negative correlation means yyy tends to fall as xxx rises, and no correlation means no linear trend. The scatter below shows a strong negative correlation — the points fall almost along a downward line.
The strength of the association is judged by how closely the points cluster about a straight line. Tightly clustered points indicate strong correlation; a diffuse cloud indicates weak correlation. It is essential to look at the scatter before computing any coefficient, because a numerical correlation can be misleading when the true relationship is curved or when a single outlier distorts it.
Correlation captures only the LINEAR part of a relationship. Data lying on a perfect parabola can have a product-moment correlation near zero despite an exact functional relationship, because the linear trend cancels. A scatter diagram exposes such non-linear structure that a coefficient alone would hide, which is why the diagram and the number must always be read together.
The variables are labelled by role where one is thought to explain the other: the explanatory (independent) variable on the horizontal axis and the response (dependent) variable on the vertical axis. This ordering matters for regression in a later section, where the line is fitted to predict the response from the explanatory variable.
Worked example

Describing a scatter

A scatter of hours revised against test mark shows points rising from lower left to upper right, tightly clustered. Describe the correlation and name the explanatory variable.

  1. 01Direction

    Marks rise with hours revised, so the correlation is positive.

  2. 02Strength

    The tight clustering about a line indicates strong correlation.

  3. 03Roles

    Hours revised is the explanatory variable (horizontal axis); test mark is the response (vertical axis).

Result: The data show strong positive correlation, with hours revised as the explanatory variable.

Exam focus

  • Describe the direction and strength of correlation from a scatter diagram.
  • Recognise non-linear structure or outliers that a coefficient alone would miss.

Typical mistakes

  • Reading a correlation coefficient without inspecting the scatter for curvature or outliers.
  • Swapping the explanatory and response variables on the axes.

Active revision

Sketch what a scatter diagram would look like for two variables with weak positive correlation, and contrast it with strong positive correlation.

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 02

The product-moment correlation coefficient#

●●○StandardLPPearson Edexcel 9ST0, Topic 7 (Paper 1)

A scatter diagram with strong positive correlation

Hours revised vs test markScatter plot: test mark by hours revised, Data: (1, 3); (2, 4); (3, 4); (4, 6); (5, 7); (6, 7); (7, 9); (8, 10)34567891012345678test markhours revised
Fig. 2Hours revised (x) against test mark (y): eight points with r = 0.983.

Key points

The product-moment correlation coefficient (PMCC), denoted rrr, measures the strength and direction of a linear relationship on a scale from −1-1−1 to +1+1+1. A value of +1+1+1 means the points lie exactly on a line of positive gradient, −1-1−1 an exact line of negative gradient, and 000 no linear association. It is computed from the summation quantities r=SxySxx Syyr = \dfrac{S_{xy}}{\sqrt{S_{xx}\,S_{yy}}}r=Sxx​Syy​​Sxy​​.
The building blocks are Sxy=∑xy−∑x∑ynS_{xy} = \sum xy - \dfrac{\sum x \sum y}{n}Sxy​=∑xy−n∑x∑y​, Sxx=∑x2−(∑x)2nS_{xx} = \sum x^2 - \dfrac{(\sum x)^2}{n}Sxx​=∑x2−n(∑x)2​ and Syy=∑y2−(∑y)2nS_{yy} = \sum y^2 - \dfrac{(\sum y)^2}{n}Syy​=∑y2−n(∑y)2​. The numerator SxyS_{xy}Sxy​ measures how xxx and yyy vary together (positive when they rise together), and the denominator scales it by the spread of each variable so that rrr is dimensionless and bounded.
For the scatter of hours and marks below, the summations give Sxx=42S_{xx} = 42Sxx​=42, Syy=43.5S_{yy} = 43.5Syy​=43.5 and Sxy=42S_{xy} = 42Sxy​=42, so r=4242×43.5=0.983r = \dfrac{42}{\sqrt{42 \times 43.5}} = 0.983r=42×43.5​42​=0.983 (3 s.f.). This value, close to 1, confirms the strong positive linear relationship visible in the diagram.
Interpretation must be careful and contextual. A high ∣r∣|r|∣r∣ indicates a strong LINEAR relationship, not a causal one, and rrr is sensitive to outliers and undefined if either variable is constant. Because rrr is unaffected by which variable is called xxx and by linear rescaling of the data, it is a pure measure of linear association, distinct from the regression line, which does depend on the roles of the variables.
r=SxySxx Syy,Sxy=∑xy−∑x∑ynr = \frac{S_{xy}}{\sqrt{S_{xx}\,S_{yy}}}, \quad S_{xy} = \sum xy - \frac{\sum x \sum y}{n}r=Sxx​Syy​​Sxy​​,Sxy​=∑xy−n∑x∑y​

The product-moment correlation coefficient

Ranges from −1-1−1 to +1+1+1; SxxS_{xx}Sxx​ and SyyS_{yy}Syy​ are the corrected sums of squares.

Worked example

Computing the PMCC

Eight students give ∑x=36\sum x = 36∑x=36, ∑y=50\sum y = 50∑y=50, ∑xy=267\sum xy = 267∑xy=267, ∑x2=204\sum x^2 = 204∑x2=204, ∑y2=356\sum y^2 = 356∑y2=356 (n=8n = 8n=8). Find the PMCC.

  1. 01Corrected sums

    Sxx=204−3628=42S_{xx} = 204 - \dfrac{36^2}{8} = 42Sxx​=204−8362​=42; Syy=356−5028=43.5S_{yy} = 356 - \dfrac{50^2}{8} = 43.5Syy​=356−8502​=43.5; Sxy=267−36×508=42S_{xy} = 267 - \dfrac{36 \times 50}{8} = 42Sxy​=267−836×50​=42.

  2. 02Apply the formula

    r=4242×43.5=421827r = \dfrac{42}{\sqrt{42 \times 43.5}} = \dfrac{42}{\sqrt{1827}}r=42×43.5​42​=1827​42​.

    r=421827=0.983r = \frac{42}{\sqrt{1827}} = 0.983r=1827​42​=0.983
  3. 03Interpret

    r=0.983r = 0.983r=0.983 (3 s.f.), a strong positive linear correlation between hours revised and test mark.

Result: r=0.983r = 0.983r=0.983 (3 s.f.), indicating a strong positive linear relationship.

Exam focus

  • Compute rrr from SxxS_{xx}Sxx​, SyyS_{yy}Syy​ and SxyS_{xy}Sxy​ and interpret its size and sign in context.
  • State that rrr measures linear association only and is affected by outliers.

Typical mistakes

  • Forgetting to take the square root in the denominator, or using SxxSyyS_{xx}S_{yy}Sxx​Syy​ un-rooted.
  • Interpreting a high rrr as evidence of causation.

Active revision

For a data set with Sxx=42S_{xx} = 42Sxx​=42, Syy=43.5S_{yy} = 43.5Syy​=43.5 and Sxy=42S_{xy} = 42Sxy​=42, find rrr and interpret it.

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 03

Spearman's rank correlation coefficient#

●●○StandardLPPearson Edexcel 9ST0, Topic 7 (Paper 1)

Ranking table for Spearman's coefficient

Judges' rankingsTable with 5 columns and 6 rows, Data: Competitor · Judge A rank · Judge B rank · d · d^2; P · 1 · 2 · -1 · 1; Q · 2 · 1 · 1 · 1; R · 3 · 4 · -1 · 1; S · 4 · 3 · 1 · 1; T · 5 · 6 · -1 · 1; U · 6 · 5 · 1 · 1COMPETITORJUDGE A RANKJUDGE B RANKDD^2P12-11Q2111R34-11S4311T56-11U6511
Fig. 3Two judges rank six competitors; the rank differences give sum of d^2 = 6, so r_s = 0.829.

Key points

Spearman's rank correlation coefficient rsr_srs​ measures the strength of a MONOTONIC relationship — whether yyy consistently increases (or decreases) with xxx, even if not linearly. Each variable is replaced by its ranks, and the coefficient is computed from the differences in rank: rs=1−6∑d2n(n2−1)r_s = 1 - \dfrac{6\sum d^2}{n(n^2 - 1)}rs​=1−n(n2−1)6∑d2​, where ddd is the difference in the two ranks for each unit and nnn is the number of units.
Spearman's coefficient is used in place of the PMCC when the data are ranks or ordinal, when the relationship is monotonic but not linear, or when outliers would distort the PMCC — ranking is resistant to extreme values. Like the PMCC it ranges from −1-1−1 to +1+1+1, with +1+1+1 for perfect agreement of the rankings and −1-1−1 for perfectly reversed rankings.
The table below shows two judges' rankings of six competitors. The rank differences give ∑d2=6\sum d^2 = 6∑d2=6, so rs=1−6×66(62−1)=1−36210=0.829r_s = 1 - \dfrac{6 \times 6}{6(6^2 - 1)} = 1 - \dfrac{36}{210} = 0.829rs​=1−6(62−1)6×6​=1−21036​=0.829 (3 s.f.). This high positive value indicates that the two judges largely agree on the order of merit, though not perfectly.
When the raw data are quantitative, computing both coefficients can be informative: a Spearman value much larger than the PMCC suggests a monotonic but non-linear relationship, while close values suggest the relationship is approximately linear. Choosing the appropriate coefficient, and justifying the choice, is an examined AO2 skill.
rs=1−6∑d2n(n2−1)r_s = 1 - \frac{6\sum d^2}{n(n^2 - 1)}rs​=1−n(n2−1)6∑d2​

Spearman's rank correlation coefficient

ddd is the difference in ranks for each unit; ranges from −1-1−1 to +1+1+1; resistant to outliers.

Worked example

Computing Spearman's coefficient

Two judges rank six competitors, giving ∑d2=6\sum d^2 = 6∑d2=6. Find rsr_srs​ and interpret it.

  1. 01Identify n

    There are n=6n = 6n=6 competitors, so n(n2−1)=6×35=210n(n^2 - 1) = 6 \times 35 = 210n(n2−1)=6×35=210.

  2. 02Apply the formula

    rs=1−6×6210=1−36210r_s = 1 - \dfrac{6 \times 6}{210} = 1 - \dfrac{36}{210}rs​=1−2106×6​=1−21036​.

    rs=1−36210=0.829r_s = 1 - \frac{36}{210} = 0.829rs​=1−21036​=0.829
  3. 03Evaluate and interpret

    rs=0.829r_s = 0.829rs​=0.829 (3 s.f.), a strong positive agreement between the two judges' orderings.

Result: rs=0.829r_s = 0.829rs​=0.829 (3 s.f.), indicating strong agreement between the judges.

Exam focus

  • Rank the data, form ddd and d2d^2d2, and apply the Spearman formula.
  • Justify choosing Spearman's coefficient over the PMCC (ordinal data, non-linear monotonic, outliers).

Typical mistakes

  • Using the raw data instead of the ranks in the formula.
  • Mishandling tied ranks (assign the mean of the tied positions).

Active revision

Six items are ranked by two methods with rank differences squared summing to 20. Find rsr_srs​ and interpret it.

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 04

Least-squares regression#

●●●AdvancedLPPearson Edexcel 9ST0, Topic 7 (Paper 1)

Scatter with the least-squares regression line

Regression of mark on hours revisedScatter plot: test mark by hours revised, Data: (1, 3); (2, 4); (3, 4); (4, 6); (5, 7); (6, 7); (7, 9); (8, 10)34567891012345678test markhours revised
Fig. 4The least-squares regression line y = 1.75 + x fitted to the hours-and-marks data.

Key points

The least-squares regression line of yyy on xxx is the straight line y=a+bxy = a + bxy=a+bx that minimises the sum of the squared vertical distances (residuals) from the points to the line. Minimising this sum leads to the coefficients b=SxySxxb = \dfrac{S_{xy}}{S_{xx}}b=Sxx​Sxy​​ for the gradient and a=yˉ−bxˉa = \bar{y} - b\bar{x}a=yˉ​−bxˉ for the intercept, so the line always passes through the mean point (xˉ,yˉ)(\bar{x}, \bar{y})(xˉ,yˉ​).
The gradient bbb is the estimated change in the response for a unit increase in the explanatory variable, and this is where the interpretation lives: a gradient of 1 mark per hour means each extra hour of revision is associated with about one more mark on average. The intercept aaa is the predicted response when x=0x = 0x=0, which is meaningful only if x=0x = 0x=0 is within or near the range of the data.
For the hours-and-marks data, b=SxySxx=4242=1b = \dfrac{S_{xy}}{S_{xx}} = \dfrac{42}{42} = 1b=Sxx​Sxy​​=4242​=1 and a=yˉ−bxˉ=6.25−1×4.5=1.75a = \bar{y} - b\bar{x} = 6.25 - 1 \times 4.5 = 1.75a=yˉ​−bxˉ=6.25−1×4.5=1.75, giving the line y=1.75+xy = 1.75 + xy=1.75+x, drawn through the scatter below. Each additional hour of revision is associated with about one extra mark, and a student revising for 5 hours is predicted to score 1.75+5=6.751.75 + 5 = 6.751.75+5=6.75.
The regression of yyy on xxx is not the same as the regression of xxx on yyy: minimising vertical distances gives a different line from minimising horizontal ones, unless the correlation is perfect. The choice of which variable is the response therefore matters, and the line of yyy on xxx should be used only to predict yyy from xxx.
b=SxySxx,a=yˉ−bxˉ,y=a+bxb = \frac{S_{xy}}{S_{xx}}, \qquad a = \bar{y} - b\bar{x}, \qquad y = a + bxb=Sxx​Sxy​​,a=yˉ​−bxˉ,y=a+bx

Least-squares regression of y on x

Minimises the sum of squared vertical residuals; the line passes through (xˉ,yˉ)(\bar{x}, \bar{y})(xˉ,yˉ​).

Worked example

Fitting the least-squares line

For the hours-and-marks data with Sxx=42S_{xx} = 42Sxx​=42, Sxy=42S_{xy} = 42Sxy​=42, xˉ=4.5\bar{x} = 4.5xˉ=4.5 and yˉ=6.25\bar{y} = 6.25yˉ​=6.25, find the regression line and predict the mark for 5 hours.

  1. 01Gradient

    b=SxySxx=4242=1b = \dfrac{S_{xy}}{S_{xx}} = \dfrac{42}{42} = 1b=Sxx​Sxy​​=4242​=1.

  2. 02Intercept

    a=yˉ−bxˉ=6.25−1(4.5)=1.75a = \bar{y} - b\bar{x} = 6.25 - 1(4.5) = 1.75a=yˉ​−bxˉ=6.25−1(4.5)=1.75, so the line is y=1.75+xy = 1.75 + xy=1.75+x.

  3. 03Predict

    At x=5x = 5x=5, y^=1.75+5=6.75\hat{y} = 1.75 + 5 = 6.75y^​=1.75+5=6.75.

    y^=1.75+5=6.75\hat{y} = 1.75 + 5 = 6.75y^​=1.75+5=6.75
  4. 04Interpret

    Each extra hour is associated with about 1 more mark; 5 hours predicts a mark of about 6.75.

Result: The regression line is y=1.75+xy = 1.75 + xy=1.75+x, predicting a mark of 6.75 for 5 hours of revision.

Exam focus

  • Compute bbb and aaa from the summations and state the regression line.
  • Interpret the gradient and intercept in the context of the data.

Typical mistakes

  • Swapping Sxy/SxxS_{xy}/S_{xx}Sxy​/Sxx​ for Sxy/SyyS_{xy}/S_{yy}Sxy​/Syy​ when finding the gradient.
  • Interpreting the intercept when x=0x = 0x=0 lies far outside the data range.

Active revision

Given Sxx=42S_{xx} = 42Sxx​=42, Sxy=42S_{xy} = 42Sxy​=42, xˉ=4.5\bar{x} = 4.5xˉ=4.5 and yˉ=6.25\bar{y} = 6.25yˉ​=6.25, find the regression line of yyy on xxx.

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 05

Prediction, residuals and correlation versus causation#

●●●AdvancedLPPearson Edexcel 9ST0, Topic 7 (Paper 1)

Key points

A residual is the vertical gap between an observed point and the regression line, e=y−y^e = y - \hat{y}e=y−y^​, where y^=a+bx\hat{y} = a + bxy^​=a+bx is the predicted value. Least squares makes the residuals sum to zero and their squared total as small as possible. A pattern in the residuals — curvature, or a fanning-out spread — is a warning that a straight-line model is inadequate, so residuals are the standard diagnostic for the fit.
Prediction using the line is trustworthy only within the range of the data (interpolation). Extending the line beyond the observed range (extrapolation) assumes the linear pattern continues where there is no evidence for it, and can give absurd predictions — the hours-and-marks line would eventually predict a mark above the maximum available. Any prediction should be accompanied by a comment on whether it is interpolation or extrapolation.
The most important interpretive point is that correlation does not imply causation. A strong rrr between two variables can arise because one causes the other, because both are driven by a third (confounding) variable, or by pure coincidence. Ice-cream sales and drowning incidents correlate because both rise in hot weather, not because one causes the other; asserting causation from correlation alone is a serious and frequently penalised error.
Establishing causation requires more than a correlation: a plausible mechanism, the ruling out of confounders, and ideally a controlled experiment (the subject of the final topic). The honest conclusion from a regression analysis is therefore an association with a stated strength and range of validity, together with an explicit caution against reading it as cause and effect.
e=y−y^,y^=a+bxe = y - \hat{y}, \qquad \hat{y} = a + bxe=y−y^​,y^​=a+bx

Residual

The vertical distance from a point to the line; patterns in the residuals reveal a poor fit.

Worked example

A residual and a caution on extrapolation

For the line y=1.75+xy = 1.75 + xy=1.75+x, find the residual at the point (4, 6) and comment on predicting the mark for 20 hours of revision.

  1. 01Predicted value

    y^=1.75+4=5.75\hat{y} = 1.75 + 4 = 5.75y^​=1.75+4=5.75.

  2. 02Residual

    e=y−y^=6−5.75=0.25e = y - \hat{y} = 6 - 5.75 = 0.25e=y−y^​=6−5.75=0.25.

    e=6−5.75=0.25e = 6 - 5.75 = 0.25e=6−5.75=0.25
  3. 03Extrapolation

    20 hours lies far beyond the data range (1 to 8 hours), so the prediction 1.75+20=21.751.75 + 20 = 21.751.75+20=21.75 is unreliable extrapolation and may exceed the maximum possible mark.

Result: The residual at (4, 6) is +0.25; predicting for 20 hours is unreliable extrapolation.

Exam focus

  • Compute a residual and use residual patterns to comment on the fit.
  • Distinguish interpolation from extrapolation and warn against inferring causation.

Typical mistakes

  • Extrapolating far beyond the data and trusting the prediction.
  • Concluding that one variable causes another purely from a strong correlation.

Active revision

Using y=1.75+xy = 1.75 + xy=1.75+x, find the residual for the point (4, 6) and comment on whether predicting the mark for 20 hours is reliable.

Active recall

Recall the key points — then reveal.

Sources: GCE AS and A level subject content (Statistics) (Department for Education / Ofqual)

Contents

Section -- / 05

    • 01Scatter diagrams and correlation○
    • 02The product-moment correlation coefficient◐
    • 03Spearman's rank correlation coefficient◐
    • 04Least-squares regression●
    • 05Prediction, residuals and correlation versus causation●

0/5 Read

From notes into training

Correlation and linear regression

Reinforce this topic with matching tasks from the question bank.

~12
min
3
Competencies
Practise

References & sources

Sources

Pearson Edexcel

  • Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification

Department for Education / Ofqual

  • GCE AS and A level subject content (Statistics)

Previous topic

Probability distributions

Next topic

Introduction to hypothesis testing

EuraStudy·Notes T·10·MMXXVI

Carry on to the next topic — your learning path is kept.