Scatter diagrams and linear regression

Scatter diagrams and linear regression

Spec 4.1–2 · Edexcel International A Level Maths: Revision notes

Studying this course? Keep your progress in one place.

Key facts

  • A scatter diagram shows direction, strength and whether the pattern is linear; the explanatory variable xx goes on the horizontal axis.
  • The least squares line is y=a+bxy=a+bx with b=SxySxxb=\dfrac{S_{xy}}{S_{xx}} and a=yˉ−bxˉa=\bar y-b\bar x; it passes through (xˉ,yˉ)(\bar x,\bar y).
  • Interpret bb as the change in yy per unit increase in xx, in context, using the word 'predicted'.
  • Interpolation (inside the data range) is usually reliable; extrapolation may not be.
  • If the data are coded, substitute back to give the line in the original variables.

Scatter diagrams and variables

A scatter diagram plots paired data to show direction, strength and whether the relationship is linear. The explanatory variable goes on the horizontal axis.

A scatter diagram plots paired data (x,y)(x,y) and shows whether there is a relationship between two variables.

Look for the direction (positive or negative), the strength (how closely points follow a line) and whether the pattern is roughly linear.

The explanatory variable xx is controlled or used to explain. The response variable yy is the one being predicted. Other letters may be used, such as tt for temperature or ss for sales.

510152025303550100150200250300350400xyline of best fit
Scatter diagram of sales (response, y) against temperature (explanatory, x), with a line of best fit (illustrative values): positive, strong, roughly linear.

Explanatory variable xx

  • Controlled or used to explain
  • Horizontal axis

Response variable yy

  • The one being predicted
  • Vertical axis

In a study of fertiliser and plant height, which is the explanatory variable?

The least squares regression line

The least squares line y=a+bxy=a+bx has gradient Sxy/SxxS_{xy}/S_{xx} and passes through the mean point.

The regression line of yy on xx is y=a+bxy=a+bx. It is the least squares line: the one that makes the sum of the squared vertical distances from the points to the line as small as possible. Derivations are not required.

Use Sxx=∑x2−(∑x)2nS_{xx}=\sum x^2-\frac{(\sum x)^2}{n} and Sxy=∑xy−∑x∑ynS_{xy}=\sum xy-\frac{\sum x\sum y}{n}.

The line always passes through (xˉ,yˉ)(\bar x,\bar y), so you can draw it by plotting that point and one other.

1234567891024681012141618xy(0, 2.6)(6, 11)y = 2.6 + 1.4x
The line y=2.6+1.4xy=2.6+1.4x passes through the mean point (6,11)(6,11).
  • Gradientb=SxySxxb=\dfrac{S_{xy}}{S_{xx}}
  • Intercepta=yˉ−bxˉa=\bar y-b\bar x

Worked example

∑x=30\sum x=30, ∑y=55\sum y=55, ∑x2=220\sum x^2=220, ∑xy=386\sum xy=386, n=5n=5. Find the regression line of yy on xx.

A regression line has b=2b=2, xˉ=3\bar x=3 and yˉ=10\bar y=10. What is aa?

Interpreting the line

The gradient is the change in the response per one-unit increase in xx; the intercept is the predicted response at x=0x=0, which may have no meaning.

Always interpret in the context of the question.

The gradient bb is the change in the response for each one-unit increase in the explanatory variable. The intercept aa is the predicted response when x=0x=0. It only has meaning if x=0x=0 is sensible and within the data.

Regression of yy on xx is for predicting yy from xx. It should not be rearranged to predict xx from yy.

5101520253050100150200250300350400xy(0, 120)(10, 205)s = 120 + 8.5t
The line s = 120 + 8.5t: the intercept is 120 (predicted sales at 0 °C) and the gradient 8.5 means each extra °C adds 8.5 pounds.
  • Gradient bbchange in yy per 1 unit of xx
  • Intercept aapredicted yy when x=0x=0

Worked example

Daily sales ss (pounds) against temperature tt (°C) give s=120+8.5ts=120+8.5t. Interpret the gradient.

When does the intercept aa have a sensible meaning?

Interpolation and extrapolation

Predictions inside the range of the data are usually reliable; predictions outside it may be unreliable.

Substitute a value of xx into the regression line to predict yy.

A model fitted for temperatures 12 °C to 28 °C should not be used at 5 °C. A good answer says the value is outside the range, so it is extrapolation, and the relationship may not continue.

For a 'comment on reliability' question, state the range of the data, say whether the value is inside it, and name interpolation or extrapolation.

0510152025303551228

Interpolation

  • xx inside the range of the data
  • Usually reliable

Extrapolation

  • xx outside the range of the data
  • May be unreliable: the linear relationship may not continue

A line is fitted using xx from 12 to 28. Predicting at x=20x=20 is...

Linear change of variable (coding)

Find the line in the coded variable as usual, then substitute the coding to convert back to the original variables.

Data are sometimes coded, for example u=x−405u=\frac{x-40}{5}, to make the numbers smaller.

A regression line of yy on uu can be found as usual, then converted back by substituting the coding. The gradient is divided by the coding factor.

Remember to give the final line in the original variables, and interpret the gradient with the original units.

10203040506070809010020406080100120140160xy(40, 89.4)y = 147 − 1.44x
The decoded line y = 147 − 1.44x. At x = 40 (u = 0) it passes through y = 89.4, as the line in u does.
  • Codingu=x−405u=\dfrac{x-40}{5}
  • Line in uuy=89.4−7.2uy=89.4-7.2u
  • Line in xxy=147−1.44xy=147-1.44x

Worked example

y=89.4−7.2uy=89.4-7.2u with u=x−405u=\frac{x-40}{5}. Find yy in terms of xx.

If y=a+buy=a+bu and u=x10u=\frac{x}{10}, the gradient of yy on xx is...

Try an exam question

For 55 pairs of data, ∑x=25\sum x=25, ∑y=60\sum y=60, ∑x2=135\sum x^2=135 and ∑xy=320\sum xy=320. Find the equation of the regression line of yy on xx in the form y=a+bxy=a+bx.

[5 marks]

That's the notes covered.

Carry on to the next subtopic.

Try a question

Find the value of bb.

1 mark, marked against the mark scheme

Revision notes