Skip to content

Correlation and Regression

BoardPaperNotes
AQAPaper 1PMCC, regression lines
EdexcelP1Includes Spearman”s rank
OCR (A)Paper 1Similar
CIE (9709)P1, P6Correlation and regression in P1/P6

1. Pearson’s Product Moment Correlation Coefficient (PMCC)

Section titled “1. Pearson’s Product Moment Correlation Coefficient (PMCC)”

Definition. For bivariate data (x1,y1),,(xn,yn)(x_1,y_1),\ldots,(x_n,y_n)The PMCC is

r=SxySxxSyyr = \frac{S_{xy}}{\sqrt{S_{xx}\,S_{yy}}}

Where

Sxx=(xixˉ)2=xi2nxˉ2S_{xx} = \sum(x_i-\bar{x})^2 = \sum x_i^2 - n\bar{x}^2 Syy=(yiyˉ)2=yi2nyˉ2S_{yy} = \sum(y_i-\bar{y})^2 = \sum y_i^2 - n\bar{y}^2 Sxy=(xixˉ)(yiyˉ)=xiyinxˉyˉS_{xy} = \sum(x_i-\bar{x})(y_i-\bar{y}) = \sum x_i y_i - n\bar{x}\bar{y}

  • 1r1-1 \leq r \leq 1
  • r=1r = 1: perfect positive linear correlation
  • r=1r = -1: perfect negative linear correlation
  • r=0r = 0: no linear correlation (but there may be non-linear relationship)
  • rr measures the strength of linear relationship only
### 1.3 Real-World Applications

Economics: GDP per capita and life expectancy across countries show r0.7r \approx 0.7 to 0.850.85. The relationship is strong but non-linear at high income levels (diminishing returns). The PMCC captures the overall linear trend but underestimates the strength of the relationship at lower Incomes.

Medical studies: Dose-response relationships often yield strong positive PMCC values. A clinical Trial might find r=0.92r = 0.92 between drug dosage and reduction in blood pressure, suggesting a strong Linear dose-response. However, biological systems have thresholds and saturation points Where linearity breaks down.

Psychology: Study hours and exam scores often show moderate positive correlation (r0.4r \approx 0.4 to 0.70.7). The PMCC captures the linear trend, but individual variation means Prediction is imprecise — a student studying 10 hours could score anywhere on a wide range. This Illustrates that even a moderate rr does not guarantee accurate individual predictions.


2. Spearman’s Rank Correlation Coefficient

Section titled “2. Spearman’s Rank Correlation Coefficient”

When data are ranked, Spearman’s coefficient is

rs=16di2n(n21)r_s = 1 - \frac{6\sum d_i^2}{n(n^2-1)}

Where did_i is the difference in ranks for the ii-th pair.

  • Data is ordinal (ranked categories)
  • The relationship is monotonic but not necessarily linear
  • There are outliers that would distort the PMCC

When values are tied, assign the average of the ranks they would have occupied. The simplified Formula above does not account for ties — a correction factor is needed for tied data.

2.4 PMCC vs. Spearman’s Rank: When to Use Which

Section titled “2.4 PMCC vs. Spearman’s Rank: When to Use Which”
CriterionPMCCSpearman’s
Data typeContinuous (interval/ratio)Ordinal or continuous
Relationship typeLinear onlyAny monotonic
Sensitivity to outliersHighLow (ranks reduce impact)
Distribution assumptionBivariate normalNone
Power (when assumptions met)HigherLower

Key point: If the data has a strong linear relationship and no extreme outliers, PMCC is Preferred as it uses more information from the data. If the relationship is monotonic but Curved, or if outliers are present, Spearman’s is more appropriate.

Example. Consider judge rankings in a competition. The data is inherently ordinal, so Spearman’s Rank is the natural choice regardless of whether PMCC could technically be computed. Similarly, in a Psychology study measuring agreement between two raters on a Likert scale, Spearman’s is the Standard choice.


Problem. Find the line y=a+bxy = a + bx that minimises

S(a,b)=i=1n(yiabxi)2S(a,b) = \sum_{i=1}^{n}(y_i - a - bx_i)^2

Setting Sa=0\dfrac{\partial S}{\partial a} = 0 and Sb=0\dfrac{\partial S}{\partial b} = 0:

\frac{\partial S}{\partial a} = -2\sum(y_i - a - bx_i) = 0 \implies \sum y_i = na + b\sum x_i \tag{1}

\frac{\partial S}{\partial b} = -2\sum x_i(y_i - a - bx_i) = 0 \implies \sum x_i y_i = a\sum x_i + b\sum x_i^2 \tag{2}

From (1): a=yˉbxˉa = \bar{y} - b\bar{x}.

Substituting into (2):

xiyi=(yˉbxˉ)xi+bxi2=nxˉyˉbnxˉ2+bxi2\sum x_i y_i = (\bar{y}-b\bar{x})\sum x_i + b\sum x_i^2 = n\bar{x}\bar{y} - bn\bar{x}^2 + b\sum x_i^2

xiyinxˉyˉ=b(xi2nxˉ2)\sum x_i y_i - n\bar{x}\bar{y} = b\left(\sum x_i^2 - n\bar{x}^2\right)

Sxy=bSxxS_{xy} = b\,S_{xx}

b=SxySxx=xiyinxˉyˉxi2nxˉ2\boxed{b = \frac{S_{xy}}{S_{xx}} = \frac{\sum x_i y_i - n\bar{x}\bar{y}}{\sum x_i^2 - n\bar{x}^2}}

a=yˉbxˉ\boxed{a = \bar{y} - b\bar{x}}


4. The Regression Line Passes Through (xˉ,yˉ)(\bar{x}, \bar{y})

Section titled “4. The Regression Line Passes Through (xˉ,yˉ)(\bar{x}, \bar{y})(xˉ,yˉ​)”

Theorem. The least squares regression line y=a+bxy = a + bx passes through the point (xˉ,yˉ)(\bar{x}, \bar{y}).

Proof. Substituting x=xˉx = \bar{x}:

y=a+bxˉ=(yˉbxˉ)+bxˉ=yˉy = a + b\bar{x} = (\bar{y} - b\bar{x}) + b\bar{x} = \bar{y}

So (xˉ,yˉ)(\bar{x}, \bar{y}) lies on the regression line. \blacksquare

Intuition. The regression line passes through the “centre of mass” of the data. This makes sense — the best-fit line should balance the data around it, just as the mean balances a univariate Dataset.


The residual for the ii-th data point is ei=yi(a+bxi)e_i = y_i - (a + bx_i).

Properties:

  • ei=0\sum e_i = 0 (the residuals sum to zero)
  • The least squares line minimises ei2\sum e_i^2
### 5.3 Regression of $y$ on $x$ vs. $x$ on $y$

The regression line of yy on xx minimises vertical residuals (yiy^iy_i - \hat{y}_i). The regression Line of xx on yy minimises horizontal residuals (xix^ix_i - \hat{x}_i).

These are different lines unless r=±1r = \pm 1. The two regression lines intersect at (xˉ,yˉ)(\bar{x}, \bar{y}).

A residual plot graphs the residuals eie_i against the fitted values y^i\hat{y}_i (or against xix_i).

What to look for:

  • Random scatter around zero: the linear model is appropriate.
  • Curved pattern (e.g., U-shape): the relationship is non-linear; a linear model is unsuitable.
  • Funnel shape (increasing spread): the variance is not constant (heteroscedasticity); predictions are less reliable at extremes.

Residual plots are a diagnostic tool — they reveal whether the assumptions of linear regression are Met. In A Level exams, you may be asked to comment on a residual plot to assess whether the Regression line is a good model.

An outlier is a point with a large residual — it falls far from the regression line. An influential point is an outlier with high leverage, meaning its xx-value is far from xˉ\bar{x}. Influential points can pull the regression line significantly toward themselves.

Effect on PMCC: A single influential point can dramatically change rr. For example, adding an Extreme point to a dataset with r=0.3r = 0.3 could push rr to 0.80.8 or change its sign entirely. This Is why it is essential to inspect scatter plots alongside numerical summaries.

Example. In a study of height vs. Salary across 50 people, most data shows weak positive Correlation (r0.2r \approx 0.2). If one NBA player earning millions is included, the PMCC may jump to r0.6r \approx 0.6Giving a misleading impression. In such cases, Spearman’s rank is more robust Because ranking reduces the disproportionate influence of extreme values.

Economic example: A regression model based on UK inflation data from 2010—2020 (rates between 0% and 3%) might predict negative inflation for certain conditions. Extrapolating to predict 2022 Inflation (which reached 11.1%) would produce wildly inaccurate results because the underlying Economic conditions changed entirely.

Medical example: A linear dose-response model calibrated for doses of 0—50 mg might predict y=3y = -3 for a dose of 0 mg, which is physically impossible (negative response). The model is only Valid within its calibration range. Biological systems exhibit thresholds and saturation Effects that linear models cannot capture.

General principle: Always state the range of the original data and note that predictions outside This range are unreliable. In exam questions, you will lose marks if you extrapolate Without commenting on the limitation.


If we code u=xpqu = \dfrac{x-p}{q} and v=yrsv = \dfrac{y-r}{s}And find the regression line v=c+duv = c + du Then:

  • The gradient in terms of original variables: b=sqdb = \dfrac{s}{q}d
  • The intercept: a=r+scbpa = r + s \cdot c - b \cdot p

Coding does not change the PMCC or Spearman’s rank correlation coefficient.

Why? PMCC is based on standardised quantities. Coding xu=(xp)/qx \mapsto u = (x-p)/q is a linear Transformation (shift by ppScale by 1/q1/q), and rr is invariant under linear transformations of Either variable. Similarly, Spearman’s uses ranks, which are unaffected by any monotonic Transformation including linear coding.

Effect on regression: Coding changes the gradient and intercept of the regression line, as shown In Section 6, but the underlying relationship between the variables is unchanged. The coefficient of Determination r2r^2 is also invariant under coding.

6.2 Worked Example: Coding with Economic Data

Section titled “6.2 Worked Example: Coding with Economic Data”

An economist records quarterly revenue and advertising spend. To simplify calculations, she codes u=x/10u = x/10 (where xx is advertising in GBP) and v=y/1000v = y/1000 (where yy is revenue in GBP).

If the coded regression line is v=2.3+0.7uv = 2.3 + 0.7uThen in original variables:

y1000=2.3+0.7(x10)\frac{y}{1000} = 2.3 + 0.7\left(\frac{x}{10}\right)

y=2300+70xy = 2300 + 70x

The gradient b=70b = 70 means each additional GBP spent on advertising is associated with an increase Of GBP 70 in revenue. The PMCC calculated from the coded data would be identical to the PMCC from The original data.


Problem 1Calculate the PMCC for the data: $(1,2)$, $(2,3)$, $(3,5)$, $(4,4)$, $(5,7)$.
Solution 1$n=5$$\bar{x}=3$$\bar{y}=4.2$.

\sum x^2 = 55$$\sum y^2 = 103$$\sum xy = 74.

Sxx=555(9)=10S_{xx} = 55 - 5(9) = 10. Syy=1035(17.64)=10388.2=14.8S_{yy} = 103 - 5(17.64) = 103 - 88.2 = 14.8. Sxy=745(3)(4.2)=7463=11S_{xy} = 74 - 5(3)(4.2) = 74 - 63 = 11.

r=1110×14.8=11148=1112.1660.904r = \dfrac{11}{\sqrt{10 \times 14.8}} = \dfrac{11}{\sqrt{148}} = \dfrac{11}{12.166} \approx 0.904.

If you get this wrong, revise: Pearson’s PMCC — Section 1.

Problem 2Find the equation of the regression line of $y$ on $x$ for the data in Problem 1.
Solution 2$b = S_{xy}/S_{xx} = 4/10 = 0.4$.

b=SxySxx=1110=1.1b = \dfrac{S_{xy}}{S_{xx}} = \dfrac{11}{10} = 1.1.

a=yˉbxˉ=4.21.1(3)=4.23.3=0.9a = \bar{y} - b\bar{x} = 4.2 - 1.1(3) = 4.2 - 3.3 = 0.9.

Regression line: y=0.9+1.1xy = 0.9 + 1.1x.

If you get this wrong, revise: Least Squares Regression — Section 3.

Problem 3For the data below, calculate Spearman's rank correlation coefficient.

| xx | 10 | 20 | 30 | 40 | 50 | | yy | 15 | 25 | 18 | 35 | 42 |

Solution 3Ranks of $x$: 1, 2, 3, 4, 5. Ranks of $y$: 1, 3, 2, 4, 5.

| dd | 0 | -1 | 1 | 0 | 0 |

d2=0+1+1+0+0=2\sum d^2 = 0 + 1 + 1 + 0 + 0 = 2.

rs=16×25(251)=112120=10.1=0.9r_s = 1 - \dfrac{6 \times 2}{5(25-1)} = 1 - \dfrac{12}{120} = 1 - 0.1 = 0.9.

If you get this wrong, revise: Spearman’s Rank Correlation — Section 2.

Problem 4Prove that $\sum e_i = 0$ where $e_i = y_i - (a + bx_i)$ are the residuals of the least squares regression line.
Solution 4$$\sum e_i = \sum y_i - na - b\sum x_i = n\bar{y} - n(\bar{y} - b\bar{x}) - bn\bar{x} = n\bar{y} - n\bar{y} + nb\bar{x} - nb\bar{x} = 0 \quad \blacksquare$$

If you get this wrong, revise: Residuals — Section 5.1.

Problem 5Data is coded using $u = x - 10$ and $v = y/2$. The coded regression line is $v = 0.5 + 0.3u$. Find the regression line of $y$ on $x$.
Solution 5Original: $y/2 = 0.5 + 0.3(x-10)$.

y=1+0.6(x10)=1+0.6x6=0.6x5y = 1 + 0.6(x-10) = 1 + 0.6x - 6 = 0.6x - 5.

So y=5+0.6xy = -5 + 0.6x.

If you get this wrong, revise: Coding in Regression — Section 6.

Problem 6A student finds $r = 0.95$ between ice cream sales and drowning deaths. The student concludes ice cream causes drowning. Explain the flaw.
Solution 6Correlation does not imply causation. Both ice cream sales and drowning deaths are influenced by a **confounding variable**: hot weather. In summer, more people buy ice cream and more people swim, leading to more of both. The correlation is real but the causal claim is not supported.

If you get this wrong, revise: Properties — Section 1.2.

Problem 7Given $S_{xx} = 80$$S_{yy} = 200$And $S_{xy} = 100$Find $r$$b$ (gradient of $y$ on $x$), and the proportion of variance in $y$ explained by $x$.
Solution 7$r = \dfrac{100}{\sqrt{80 \times 200}} = \dfrac{100}{\sqrt{16000}} = \dfrac{100}{126.49} \approx 0.791$.

b=SxySxx=10080=1.25b = \dfrac{S_{xy}}{S_{xx}} = \dfrac{100}{80} = 1.25.

Proportion of variance explained =r2=0.625= r^2 = 0.625 (62.5%).

If you get this wrong, revise: Least Squares Regression — Section 3.

Problem 8The regression line of $y$ on $x$ is $y = 2 + 3x$ with $\bar{x} = 5$. What is $\bar{y}$?
Solution 8Since the regression line passes through $(\bar{x}, \bar{y})$:

yˉ=2+3(5)=17\bar{y} = 2 + 3(5) = 17.

If you get this wrong, revise: The Regression Line Passes Through (xˉ,yˉ)(\bar{x}, \bar{y}) — Section 4.

Problem 9A residual plot shows a clear U-shaped pattern. What does this suggest about the regression model, and what would be a more appropriate approach?
Solution 9

A U-shaped residual plot indicates the relationship between the variables is non-linear (likely Quadratic). The linear regression model is inappropriate because it fails to capture the curvature. A more appropriate approach would be to fit a quadratic model y=a+bx+cx2y = a + bx + cx^2Or to apply a Transformation (e.g., taking logarithms) to linearise the relationship.

If you get this wrong, revise: Residual Plots — Section 5.4.

Problem 10Two datasets have the same PMCC of $r = 0.85$. Dataset A has $n = 10$ observations; Dataset B has $n = 100$ observations. Explain why Dataset B provides stronger evidence of a real association.
Solution 10

With a larger sample size, the PMCC is estimated more precisely (smaller standard error). For n=10n = 10The PMCC must exceed approximately 0.632 to be significant at the 5% level (two-tailed). For n=100n = 100The threshold is approximately 0.197. While both datasets show the same correlation, Dataset B provides far stronger statistical evidence because random fluctuations are much less Likely to produce r=0.85r = 0.85 with 100 observations.

If you get this wrong, revise: Properties — Section 1.2.

Problem 11Eight students were ranked by two teachers for a presentation. The rankings are:
StudentABCDEFGH
Teacher 125173846
Teacher 216284735

Calculate Spearman’s rank correlation coefficient and interpret the result.

Solution 11

The data is already ranked, so:

StudentABCDEFGH
did_i1-1-1-1-1111
di2d_i^211111111

di2=8\sum d_i^2 = 8.

rs=16×88(641)=148504=10.0952=0.905r_s = 1 - \dfrac{6 \times 8}{8(64 - 1)} = 1 - \dfrac{48}{504} = 1 - 0.0952 = 0.905 (3 s.f.).

This indicates very strong positive agreement between the two teachers’ rankings, suggesting Consistent assessment standards.

If you get this wrong, revise: Spearman’s Rank Correlation — Section 2.

Problem 12A medical researcher collects data on blood pressure ($x$ mmHg) and cholesterol level ($y$ mg/dL) for 12 patients. She finds $\bar{x} = 132$$\bar{y} = 218$$S_{xx} = 3600$$S_{yy} = 28900$$S_{xy} = 8100$.

(a) Calculate the PMCC and interpret it. (b) Find the regression line of yy on xx. (c) Predict the Cholesterol level for a patient with blood pressure of 150 mmHg. Comment on the reliability.

Solution 12

(a) r=81003600×28900=8100104040000=8100102000.794r = \dfrac{8100}{\sqrt{3600 \times 28900}} = \dfrac{8100}{\sqrt{104040000}} = \dfrac{8100}{10200} \approx 0.794.

This indicates a strong positive linear correlation between blood pressure and cholesterol level.

(b) b=SxySxx=81003600=2.25b = \dfrac{S_{xy}}{S_{xx}} = \dfrac{8100}{3600} = 2.25.

a=2182.25×132=218297=79a = 218 - 2.25 \times 132 = 218 - 297 = -79.

Regression line: y=79+2.25xy = -79 + 2.25x.

(c) When x=150x = 150: y=79+2.25(150)=79+337.5=258.5y = -79 + 2.25(150) = -79 + 337.5 = 258.5 mg/dL.

This prediction is reasonably reliable since 150 is within (or close to) the range of the data. However, n=12n = 12 is a small sample, so there is considerable uncertainty. The prediction should not Be treated as precise.

If you get this wrong, revise: Least Squares Regression — Section 3, and Extrapolation — Section 5.2.

Problem 13Data is coded using $u = (x - 20)/5$ and $v = (y - 100)/10$. The coded PMCC is $r = 0.64$ and the coded regression line of $v$ on $u$ is $v = 1.2 + 0.8u$.

Find: (a) The PMCC for the original data. (b) The regression line of yy on xx in original Variables.

Solution 13

(a) Coding does not change the PMCC, so r=0.64r = 0.64 for the original data.

(b) Start from the coded line:

y10010=1.2+0.8×x205\frac{y - 100}{10} = 1.2 + 0.8 \times \frac{x - 20}{5}

y10010=1.2+0.16(x20)\frac{y - 100}{10} = 1.2 + 0.16(x - 20)

y10010=1.2+0.16x3.2\frac{y - 100}{10} = 1.2 + 0.16x - 3.2

y10010=0.16x2.0\frac{y - 100}{10} = 0.16x - 2.0

y100=1.6x20y - 100 = 1.6x - 20

y=80+1.6xy = 80 + 1.6x

If you get this wrong, revise: Coding in Regression — Section 6, and Effect of Coding on Correlation — Section 6.1.

Problem 14A dataset of 15 observations has regression line $y = 5 + 2x$ with $\bar{x} = 10$. A 16th observation $(25, 70)$ is added. Without recalculating, explain qualitatively how this point would affect: (a) The gradient of the regression line. (b) The PMCC.
Solution 14

The point (25,70)(25, 70) has x=25x = 25Which is far from xˉ=10\bar{x} = 10So it has high leverage. Its predicted yy-value from the current line would be y^=5+2(25)=55\hat{y} = 5 + 2(25) = 55But the actual Value is 7070. The residual is 7055=1570 - 55 = 15Which is positive and large.

(a) Since the point lies above the regression line and has high leverage, it will increase the Gradient (pull the line upward at the right side).

(b) Since the point lies close to the general positive trend (above the line in the same direction As the overall slope), it will likely increase the PMCC slightly. However, if the point were Below the trend, it could decrease rr significantly — a single influential point can change rr by A large amount.

If you get this wrong, revise: Outliers and Influential Points — Section 5.5.