Back to homeMathematics · 4th ESO A · Change subject
Start for free
ESO Y4A · Mathematics
statistics · Bivariate statistics

Regression line

With covariance you already know whether two variables rise together or not. The next step is to draw a line that summarises that trend and lets you estimate a value of $Y$ from a value of $X$: if you know someone's height, what weight would you expect?

Before you start, make sure you know: Linear functions and functions of the form y = mx + c (3rd ESO)
Before you start, make sure you know: Statistical measures (3rd ESO)

The line of best fit

Scatter plot with positive correlation where the regression line fits the points, passing exactly through the centre of gravity marked with the means of both variables. XY (x̄, ȳ) the line passes through the centre of gravity and follows the trend of the points
Practice★☆☆Not started
Calculate the equation of the regression line of $Y$ on $X$ for a bivariate distribution with the following known statistical parameters: the mean of $X$ is…

Calculate the equation of the regression line of $Y$ on $X$ for a bivariate distribution with the following known statistical parameters: the mean of $X$ is $\bar{x} = 5$, the mean of $Y$ is $\bar{y} = 12$, the variance of $X$ is $\sigma_x^2 = 4$ and the covariance is $\sigma_{xy} = 6$. Express the result in the form $y = mx + n$.

Solve
Practice★☆☆Not started
The means of two statistical variables are $\bar{x} = 10$ and $\bar{y} = 25$. Check mathematically whether the line $y = 1,5x + 10$ can be a valid regression line for…

The means of two statistical variables are $\bar{x} = 10$ and $\bar{y} = 25$. Check mathematically whether the line $y = 1,5x + 10$ can be a valid regression line for this data set, justifying your answer using a fundamental property that all regression lines must satisfy.

Solve

Using the line to predict, with caution

Scatter plot and regression line distinguishing the interpolation zone, within the range of observed data, from the extrapolation zone outside it. observed data:5-15 h yx (h/week) 51540 extrapolate y < 0!
Practice★☆☆Not started
The equation of the regression line of weight ($Y$, in kg) on height ($X$, in cm) of a group of students is $y = 0,8x - 60$. Estimate the approximate weight of a student…

The equation of the regression line of weight ($Y$, in kg) on height ($X$, in cm) of a group of students is $y = 0,8x - 60$. Estimate the approximate weight of a student who is $170$ cm tall.

Solve
Practice★★☆Not started
The regression line of the number of ice creams sold ($Y$) against the maximum daily temperature in $^\circ\text{C}$ ($X$) is $y = 15x - 120$. If a temperature of…

The regression line of the number of ice creams sold ($Y$) against the maximum daily temperature in $^\circ\text{C}$ ($X$) is $y = 15x - 120$. If a temperature of $30^\circ\text{C}$ is forecast for tomorrow, estimate how many ice creams will be sold. Furthermore, if on another day $255$ ice creams were sold, explain whether it is theoretically correct to use this same line to estimate the temperature on that day, or whether a rigorous procedure would require calculating a different line.

Solve

The correlation coefficient r

We can calculate the line of $Y$ on $X$ if $\sigma_x^2>0$, even if the fit is poor. If all the values of $X$ are equal, that formula divides by zero and does not determine a unique gradient. The correlation coefficient also requires $\sigma_y>0$: if one variable is constant, $r$ is not defined, it is not zero.

Comparison of two scatter plots: on the left, strong linear correlation with data almost on the line; on the right, correlation close to zero with widely scattered points. r close to ±1: points almost on the line r close to 0: points widely scattered
Practice★☆☆Not started
In a bivariate study, the equation of the regression line of $Y$ on $X$ is $y = 0,2x + 15$. Knowing that the covariance calculated for these data is $\sigma_{xy} = 3,5$,…

In a bivariate study, the equation of the regression line of $Y$ on $X$ is $y = 0,2x + 15$. Knowing that the covariance calculated for these data is $\sigma_{xy} = 3,5$, briefly justify whether the gradient of the line obtained is consistent with the sign of the covariance.

Solve
Practice★☆☆Not started
The relationship between two variables has been analysed, obtaining the equation $y = -3x + 20$ as the regression line of $Y$ on $X$. Is it possible for the linear…

The relationship between two variables has been analysed, obtaining the equation $y = -3x + 20$ as the regression line of $Y$ on $X$. Is it possible for the linear correlation coefficient of this distribution to be $r = 0,85$? Give reasons for your answer based on the relationship between the gradient and the correlation.

Solve
Practice★★☆Not started
Look at the two scatter diagrams, A and B, which show the relationship between two variables and include their respective regression lines. In which of the two…

Look at the two scatter diagrams, A and B, which show the relationship between two variables and include their respective regression lines. In which of the two distributions will making an estimate of $Y$ from a value of $X$ using the regression line be more reliable? Give reasons for your answer based on the visual concepts of correlation and dispersion.

A B
Solve

Correlation is not causation

An $r$ close to $1$ tells you that two variables move together very regularly. It does not tell you why.

It is the same caution you already saw with Simpson's paradox in the previous section: the numbers in a table or a correlation coefficient summarise what happens, but interpreting them as why it happens requires reasoning about the context, not just looking at the figure.

Causal diagram showing how a common cause, attendance at the fair, produces a correlation between sales of water and sales of souvenirs without one causing the other. attendance at the fair sales of water sales of souvenirs

Spreadsheet investigation: practice and results

Question: is the number of days of practice in the previous week related to the number of correct answers in the same 20-question activity? Define what counts as a day of practice and use the same activity and conditions for everyone. In two classes of 20 people, draw five names from each by lot. Ask for voluntary, anonymous responses, and record the non-responses: they are not zeros. Random selection helps, but ten participants and a single activity do not guarantee that they represent the whole school. Do not attribute differences to innate ability or gender.

Before collecting data, rehearse with these five fictitious pairs, not with real students' results:

Row A: days of practice B: correct answers
2 1 12
3 2 13
4 3 15
5 4 14
6 5 16
  1. Write the headings in A1:B1 and the pairs in A2:B6. Keep each pair in its row when sorting. Check that days are between 0 and 7 and correct answers between 0 and 20; review impossible values with the person who recorded them.

  2. In E1 write Gradient and in F1 =SLOPE(B2:B6,A2:A6). In E2 write Intercept and in F2 =INTERCEPT(B2:B6,A2:A6). You should obtain $0{,}9$ and $11{,}3$. The Y values come first in these formulae.

  3. In E3 write Correlation and in F3 =CORREL(A2:A6,B2:B6): it should give $0{,}9$. With =AVERAGE(A2:A6) and =AVERAGE(B2:B6) check the means $3$ and $14$.

  4. Select A1:B6 and insert an XY scatter chart, with days on the horizontal axis and correct answers on the vertical axis. Add a linear trendline and display its equation. Check $y=0{,}9x+11{,}3$; do not join the points as if they were a path over time. Look for curvature or isolated points before accepting a linear fit.

  5. In C1 write Prediction and in C2 =$F$1*A2+$F$2; copy down to C6. In D1 write Residual and in D2 =B2-C2; copy down to D6. The predictions are $12{,}2;13{,}1;14;14{,}9;15{,}8$ and the residuals $-0{,}2;-0{,}1;1;-0{,}9;0{,}2$. Having residuals is normal: the line does not pass through all the data points.

  6. For four days, the prediction is $14{,}9$ correct answers; it is an estimate, not a promise or a mark. Do not extrapolate to ten days in a week. If a column is constant, explain why the correlation cannot be calculated.

The names of functions and the separators may change depending on the language of the application; look for the equivalent functions for gradient, regression intercept and Pearson correlation.

Conclusion: in the fictitious data there is a positive linear association, but it has not been proved that practising more is the only cause. Prior knowledge, help or the type of practice may all have an influence. In a real investigation, present the question, selection, non-responses, chart, fit and limitations; do not automatically generalise to the whole school. Keep the data free of personal identifiers.

Modifying an algorithm and checking it

The procedure above is an algorithm: validate pairs → plot → check variation and shape → fit → calculate residuals → interpret. If someone sorts A and B separately, they destroy the pairs: go back to the original table to correct it.

Design instructions to add another pair and extend all the ranges, including the chart. Test them with the fictitious pair $(3,14)$: it lies on the line and keeps the gradient and intercept unchanged. Then change the unit of X by multiplying each value by 7: the new gradient should be $0{,}9/7$, but the intercept, the corresponding predictions and the correlation do not change. Explain which step you need to modify and why. Finally, create a warning that stops the fit if all the values of X are equal.

Working together and learning from mistakes

Take turns collecting data, checking and explaining. Each person must run at least one formula and justify one conclusion; share out tasks without gender stereotypes. When results differ, compare data and ranges before deciding. If you get stuck, identify whether the difficulty lies in the data, the formula or its interpretation, and try with three pairs first. Ask for help by explaining what you have tried. Finish with one sentence about the mistake you found and the change of strategy that helped.

Back to the start: To estimate weight from height, we calculate the regression line of $Y$ (weight) on $X$ (height) using the means, the covariance and the variance of height; by substituting the height into the equation we obtain the expected weight, provided that the correlation coefficient is high and we do not extrapolate outside the measured range.

Summary

See all the exercises in this section