Skip to content

The regression line and prediction

The regression line and prediction

The regression line

When there is a linear relation, y\displaystyle y is predicted from x\displaystyle x with one straight line that runs “through the middle” of the points – the regression line. The dashed line is the regression line of the son’s height on the father’s height:

165170175180185190195160165170175180185190195Father's height (cm)Son's height (cm)r= 0.97
  • The prediction of y\displaystyle y for a value of x\displaystyle x is the point on the line above x\displaystyle x.
  • The line is one straight line for every value of x\displaystyle x, not broken lines as in the means graph.
  • There is only one line for which the sum of the squares of the points’ vertical distances from it is the smallest – that is the regression line.
The equation of the regression line

The regression line predicting y\displaystyle y from x\displaystyle x passes through the point of the means (xˉ,yˉ)\displaystyle (\bar{x},\bar{y}), and its slope m\displaystyle m is set by the correlation coefficient and the standard deviations:

m=r⋅SySx\displaystyle m=r\cdot\frac{S_y}{S_x}
y−yˉ=m(x−xˉ)\displaystyle y-\bar{y}=m(x-\bar{x})
Why the slope depends on r\displaystyle r
  • The sign: Sx\displaystyle S_x and Sy\displaystyle S_y are positive, so the slope has the sign of r\displaystyle r – the line rises in a positive relation and falls in a negative one.
  • The size: when r=1\displaystyle {r}={1} the points lie on the line, and an x\displaystyle x one standard deviation larger predicts a y\displaystyle y one standard deviation larger: m=SySx\displaystyle {m}={\frac{S_y}{S_x}}.
  • When the relation is weaker, the prediction is “pulled” towards the mean yˉ\displaystyle \bar{y}: for the son of a very tall father the predicted height is less extreme. When r=0\displaystyle {r}={0}, m=0\displaystyle {m}={0} – the prediction is always yˉ\displaystyle \bar{y}.
Example: two tests

Pupils sat two maths tests.
In the first test: xˉ=70\displaystyle {\bar{x}}={70}, Sx=5\displaystyle {S_x}={5}.
In the second test: yˉ=75\displaystyle {\bar{y}}={75}, Sy=8\displaystyle {S_y}={8}.
The correlation coefficient between the two tests is r=0.7\displaystyle {r}={0.7}.
A pupil scored 80 in the first test. What is the prediction of the pupil’s mark in the second test?

  • m=0.7⋅85=1.12\displaystyle {m}={0.7\cdot\frac{8}{5}}={1.12}.
  • y−75=1.12(x−70)\displaystyle {y-75}={1.12(x-70)}, that is y=1.12x−3.4\displaystyle {y}={1.12x-3.4}.
  • 1.12⋅80−3.4=86.2\displaystyle {1.12\cdot80-3.4}={86.2}: the prediction is 86.2.
  • For a pupil who scored 70, the mean, the prediction is 75 – the mean of the second test.
Exercise 1

A large company recorded every day the number of employees who caught flu (x\displaystyle x) and the number of employees who worked from home (y\displaystyle y).
xˉ=10\displaystyle {\bar{x}}={10}, Sx=1.2\displaystyle {S_x}={1.2}.
yˉ=25\displaystyle {\bar{y}}={25}, Sy=2.3\displaystyle {S_y}={2.3}.
r=0.65\displaystyle {r}={0.65}.

a

Work out the slope of the regression line, to two decimal places.

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

    b

    Write the equation of the regression line in the form y=mx+b\displaystyle {y}={mx+b}. Start from yˉ+m(x−xˉ)\displaystyle \bar{y}+m(x-\bar{x}), with the rounded slope.

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

      c

      By the regression line, how many employees will work from home on a day when 15 employees caught flu?

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

        d

        Why, in your opinion, is r≠1\displaystyle r\neq1?

        Exercise 2

        Among 300 teenagers, the relation between age (x\displaystyle x, in years) and the number of minutes a day they spend on social networks (y\displaystyle y) was examined.
        The mean age is 15.4 years, and the standard deviation 1.2 years.
        The mean time is 75 minutes, and the standard deviation 24 minutes.
        r=0.72\displaystyle {r}={0.72}.

        a

        Find the equation of the regression line predicting the time on social networks from the age, and write it on the board.

        b

        By the regression line, how many minutes a day does a girl aged 16 years and 3 months spend on social networks?

          / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

          / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

          Exercise 3

          A lecturer looked at whether there is a linear relation between students’ number of absences from lectures (x\displaystyle x) and their mark in the final exam (y\displaystyle y).
          The mean number of absences is xˉ=10\displaystyle {\bar{x}}={10}, and the mean mark yˉ=70\displaystyle {\bar{y}}={70}.
          The correlation coefficient is negative.
          The equation of the regression line is one of these: y=10x−30\displaystyle {y}={10x-30}, y=x+60\displaystyle {y}={x+60}, y=−2x+70\displaystyle {y}={-2x+70}, y=−2x+90\displaystyle {y}={-2x+90}.

          a

          Which one? Explain.

          b

          The standard deviations are Sy=10\displaystyle {S_y}={10}, Sx=4\displaystyle {S_x}={4}. Work out the correlation coefficient.

            / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

            / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

            c

            For which number of absences does the regression line predict the mark 80?