Regression line
You already have the covariance and the correlation coefficient: numbers that describe the relationship. Now it is time to build the tool that predicts: the regression line. There are two, depending on which variable you want to estimate from the other, and each one is fitted by minimising a different error.
The regression line of $Y$ on $X$
A group of 1st Bachillerato students has conducted a study on the relationship between the daily time (in hours) spent using a popular short-video social network ($X$)…
A group of 1st Bachillerato students has conducted a study on the relationship between the daily time (in hours) spent using a popular short-video social network ($X$) and the battery percentage remaining on their mobile at the end of the day ($Y$). The data obtained from 6 classmates are as follows:
| Hours of use ($X$) | 1.5 | 2 | 3 | 3.5 | 4 | 5 |
|---|---|---|---|---|---|---|
| % Battery ($Y$) | 75 | 68 | 50 | 45 | 32 | 20 |
a) Calculate the centre of gravity of the distribution $(\bar{x}, \bar{y})$.
b) Find the covariance $\sigma_{xy}$ and the linear correlation coefficient $r$. Interpret the result obtained regarding the sign and the strength of the relationship.
c) Determine the equation of the regression line of $Y$ on $X$.
d) If a student uses the social network for 2.5 hours, what battery percentage is estimated to remain? Is this prediction reliable? Justify your answer based on the coefficient of determination $r^2$.
A study on study habits in Year 12 analyses the relationship between the number of weekly hours spent reading, $X$, and the mark obtained in the Spanish exam, $Y$. The…
A study on study habits in Year 12 analyses the relationship between the number of weekly hours spent reading, $X$, and the mark obtained in the Spanish exam, $Y$. The regression line of $Y$ on $X$ is:
$y = 0,65x + 3,2$
- a) Justify whether the correlation between both variables is positive or negative.
- b) If a student spends $8$ weekly hours reading, what mark is estimated for them in the exam?
The regression line of $X$ on $Y$
The grades of 50 students in Economics ($X$) and Geography ($Y$) have a mean of 6,5 in both subjects. The variance in Economics is 4 and in Geography it is 2,25. It is…
The grades of 50 students in Economics ($X$) and Geography ($Y$) have a mean of 6,5 in both subjects. The variance in Economics is 4 and in Geography it is 2,25. It is known that the correlation coefficient is $r = 0,8$.
- a) If a student has obtained a 4 in Economics, estimate their grade in Geography.
- b) If another student has obtained a 9 in Geography, estimate their grade in Economics using the appropriate regression line.
- c) Compare both estimates and explain why the same line cannot be used for both cases if we want to minimize the mean squared error.
In a study on sleep habits and academic performance, the following regression lines were obtained for the variables $X$ (daily hours of sleep) and $Y$ (average term…
In a study on sleep habits and academic performance, the following regression lines were obtained for the variables $X$ (daily hours of sleep) and $Y$ (average term mark):
Regression line of $Y$ on $X$: $y = 0,65x + 3,2$
Regression line of $X$ on $Y$: $x = 1,15y - 0,45$
a) Knowing that both lines intersect at the centre of gravity of the distribution, calculate the mean hours of sleep ($\bar{x}$) and the students' average mark ($\bar{y}$).
b) Calculate the linear correlation coefficient $r$ from the gradients of both lines.
c) State with reasoning whether the correlation is positive or negative and whether it is strong or weak.
The residual: the error of a prediction
An athletics coach analyses the relationship between the height of his athletes in cm ($X$) and their stride length in cm ($Y$). The data for 5 athletes are: (160, 110),…
An athletics coach analyses the relationship between the height of his athletes in cm ($X$) and their stride length in cm ($Y$). The data for 5 athletes are: (160, 110), (170, 120), (175, 125), (180, 132) and (190, 145).
a) Obtain the regression line of $Y$ on $X$.
b) What stride length would be expected for an athlete who is 185 cm tall?
c) Calculate the prediction error (residual) for the athlete who is 180 cm tall. The error is defined as the difference between the actual value and the value estimated by the line: $e = y_i - \hat{y}_i$.
d) If the correlation coefficient were $r = 0,98$, what could you state about the reliability of the coach's predictions?
In a contingency table relating level of education ($X$) and income ($Y$) for a sample, some data have been lost. We know the following parameters: $\bar{x} = 3$;…
In a contingency table relating level of education ($X$) and income ($Y$) for a sample, some data have been lost. We know the following parameters:
$\bar{x} = 3$; $\bar{y} = 2\,400$; $s_x^2 = 1,2$; $s_y^2 = 160\,000$ and the regression line of $Y$ on $X$ is $y = 300x + 1\,500$.
-
Calculate the coefficient of determination $R^2$ and interpret the percentage of the variance in income that is explained by the level of education.
-
If an individual has an education level of $X=5$ and their actual income is $3\,200$ €, calculate the prediction error (residual) made by the line.
Predicting with caution: interpolating and extrapolating
A pet adoption centre wants to predict the time it takes for a dog to be adopted ($Y$, in days) based on its age ($X$, in years). They have collected data from 10 dogs…
A pet adoption centre wants to predict the time it takes for a dog to be adopted ($Y$, in days) based on its age ($X$, in years). They have collected data from 10 dogs and obtained a correlation of $r = 0,85$. The mean age is 4 years and the mean number of days until adoption is 25 days. The standard deviation of age is 2 years and that of the days is 10 days.
a) Find the equation of the regression line.
b) Estimate how long it will take for a 0.5-year-old puppy to be adopted.
c) Estimate how long it will take for a 12-year-old senior dog.
d) Of the two previous estimates, indicate which is more reliable and why, taking into account the range of the original data (ages between 1 and 8 years).
A sociologist analyses the relationship between weekly time spent watching television ($X$, in hours) and concentration ability in a specific test ($Y$, scale from 0 to…
A sociologist analyses the relationship between weekly time spent watching television ($X$, in hours) and concentration ability in a specific test ($Y$, scale from 0 to 100). Data from 10 teenagers yielded the following partial results:
$\sum x_i = 150$; $\sum y_i = 620$; $\sum x_i^2 = 2\,850$; $\sum y_i^2 = 41\,500$; $\sum x_iy_i = 8\,400$.
Find:
-
The covariance $s_{xy}$ and the correlation coefficient $r$.
-
The regression line of $Y$ on $X$.
-
A student spends 40 hours per week watching television. Calculate their estimated score on the test. Analyse whether this estimate is an interpolation or an extrapolation and discuss its real validity in the context of the problem.
Lab: comparing a line and a parabola with a spreadsheet
A cooperative is studying the cost of an advertising campaign. These data are simulated for practice: t is the number of batches of adverts and s is the total cost, in hundreds of euros.
| t | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| s | 0,9 | 2,2 | 5,0 | 9,8 | 17,1 |
Before calculating, plot the points and make a prediction: does the cost of each additional batch seem constant or increasing?
-
Write
tin A1 andsin B1; place the five pairs in A2:B6. Create an XY scatter plot, not a chart that treats the quantities as category labels. -
Obtain a linear fit and a degree-2 polynomial fit using your spreadsheet's fitting/trendline tool. Display the equations and keep enough decimal places. Compare the coefficients with the calculation below.
-
In C2 write
=-1+4*A2(linear prediction) and in D2=1+A2^2(quadratic); fill down to row 6. In E2 write=B2-C2and in F2=B2-D2: these are the residuals, observed minus predicted. -
In G2 write
=E2^2, in H2=F2^2and in I2=(B2-7)^2; fill down. Here 7 is the mean of the five costs. Add up each column; for example,=G2+G3+G4+G5+G6avoids depending on the language of the functions.
The curvature can be seen by plotting the data together with both models:
The scatter plot and the residuals favour the parabola over this interval. At $t=2{,}5$, it predicts $7{,}25$ hundred euros; this is interpolation. At $t=10$, it predicts $101$ hundred euros, but this is a distant extrapolation: neither the fit nor its $R^2$ guarantees that the cost structure will hold. Compare with a new data point before using the model to make decisions.
Interpolating a parabola through three points forces it to pass through them; a regression with more data minimises the residuals and, in general, does not pass through all of them. They are not the same procedure.