Video Transcript
The following table shows the
relation between the lifespan of cars in years and their selling price in thousands
of pounds. Find the equation of the line of
regression in the form π¦ hat is equal to π plus ππ₯, writing π and π to three
decimal places.
In this question, weβre given some
information given to us in the form of a table. Weβre given the lifespan of a
number of cars, which is measured in years, and weβre also told the selling price of
those cars in thousands of pounds. The question wants us to use this
table to find the line of regression which best fits this data. We need to give our answer in the
form π¦ equals ππ₯ plus π, giving our values of π and π to three decimal places
of accuracy. In answering this question, weβre
going to use the least squares regression method to find our line of best fit. So the first thing we should do is
recall how we do this.
To find the line of regression by
using least squares regression, we can find the values of π and π by using the
following formula. First, our value of π is equal to
π sub π₯π¦ divided by π sub π₯π₯, where itβs worth pointing out here π sub π₯π¦
is a measure of the covariance between π₯ and π¦ and π sub π₯π₯ is a measure of the
variance of π₯. We can find these by using the
following formula: π sub π₯π¦ is equal to the sum of π₯ times π¦ minus the sum of
π₯ multiplied by the sum of π¦ over π. And π sub π₯π₯ is equal to the sum
of π₯ squared minus the sum of π₯ all squared over π, where π is the number of
data points weβre given. Similarly, we can find the value of
π is equal to the mean of π¦ minus π times the mean of π₯.
And remember, we can find the mean
of a value by summing over this value and dividing by their number. So the mean of π¦ is the sum of π¦
over π, and the mean of π₯ is the sum of π₯ over π. Now, these formulas look very
intimidating. However, we only need to notice
there are four things we need to calculate to fully find the values of π and
π. We need to find the sum of π₯. We need to find the sum of π¦. We need to find the sum of π₯
multiplied by π¦. And we need to find the sum of π₯
squared. Then, all we need to do is plug
these values into our formula to find the values of π and π.
Before we find these four values,
there is one thing worth pointing out. In this question, weβre told that
the carβs lifespan is given by the variable π₯ and the selling price of our car is
given by the variable π¦, but this is not always given to us. When itβs not given to us, we
remember π₯ is our independent variable and π¦ is our dependent variable, so we
would need to look at the information weβre given to determine which variable is
independent and which variable is dependent. And in this case, it makes sense
for the carβs lifespan to be our independent variable because it is the one
affecting the selling price of the car. So letβs start by finding the sum
of our π₯-values and the sum of our π¦-values.
To find the sum of our π₯-values,
all we need to do is to add all of the π₯-values given to us in the table. Adding all of these π₯-values
together, we get 25. So the sum over π₯ is equal to
25. We can then do the same for the sum
over π¦. Weβre just going to need to add
together all of our π¦-values. We just add all of these values
together into our calculator giving us 553. So the sum of π¦ is equal to
553. But there are two more expressions
we need to find. We need to find the sum of π₯π¦,
and we need to find the sum of π₯ squared. Letβs start with the sum of π₯
squared. This means weβre going to need to
square all of our π₯-values before we add them together.
Our first π₯-value is five, so we
get five squared. Our second π₯-value is two, so we
need to add on two squared. Our third π₯ value is two, so we
need to add on another two squared. And we need to continue doing this
until weβve added the square of all of our π₯-terms. This gives us the following
expression for the sum of π₯ squared. And if we calculate this
expression, we see itβs equal to 97. All thatβs left to do now is to
find the sum of π₯ multiplied by π¦. And to do this, we need to look at
the columns of our table. In the first column of our table
when π₯ is equal to five, we have π¦ is equal to 71. So when weβre adding together all
of our π₯ multiplied by π¦, we need to multiply these together. We get five multiplied by 71.
Weβre then going to do exactly the
same in the second column of our table. In this column, we see when π₯ is
equal to two, π¦ is equal to 83. So we need to multiply these
together and add the result. And we need to carry this on for
every single column in our table. This gives us the following
expression for the sum of π₯π¦. And if we calculate this
expression, we get the sum of π₯π¦ is equal to 1857. Weβre now almost ready to find the
values of π and π. However, there is one more thing we
need to note. We need to find the value of π,
and itβs our number of data points. We can see from the table, we have
eight data point, so our value of π is eight.
Now that weβve found the sum of π₯,
the sum of π¦, the sum of π₯ squared, the sum of π₯π¦, and π, weβre ready to start
finding the values of π and π. Letβs start with finding the value
of π sub π₯π¦. We just need to substitute our
values for the sum of π₯π¦, the sum of π₯, the sum of π¦, and π into our
formula. Doing this, we get 1857 minus 25
multiplied by 553 over eight. And if we calculate this, we get
1031 divided by eight. Weβll then do exactly the same
thing to find the value of π sub π₯π₯. Remember, the sum of π₯ squared is
97, the sum of π₯ is equal to 25, and our value of π is equal to eight, so this
gives us 97 minus 25 squared over eight. And if we calculate this, we get
151 divided by eight.
Weβre now ready to find the value
of π. π will be the quotient of these
two values. So the exact value of π is going
to be 1031 over eight divided by 151 over eight. Of course, remember, whenever weβre
dividing two fractions, we can instead take the reciprocal of the second fraction
and multiply. This gives us 1031 over eight
multiplied by eight over 151. We can cancel the shared factor of
eight in the numerator and denominator, and this just leaves us with 1031 divided by
151. Now the question wants us to give
the answer to three decimal places. However, weβll do this at the
end. Instead, letβs now find an
expression for the value of π.
Once again, to find the value of
π, we need to substitute in our values for the sum of π¦, the sum of π₯, π, and
π. This gives us π is equal to 553
over eight minus 1031 over 151 multiplied by 25 over eight. And itβs very important we use the
exact value of π when we calculate this expression. Otherwise, when we round our value
of π, we might get the wrong answer. And if we calculate this
expression, we get that π is equal to 7216 divided by 151.
But remember, the question wants us
to give our values of π and π to three decimal places. Letβs start with our value of
π. Writing this out in its decimal
expansion, we get 47.7880 and this expansion continues. To write this to three decimal
places, we need to look at our fourth decimal place to determine whether we need to
round up or around down. The fourth decimal place is
zero. This is less than five, so we need
to round down. So our value of π is 47.788 to
three decimal places.
Letβs now do the same for our value
of π. Writing out the decimal expansion
of our fraction, we get 6.827 and this expansion continues. We look at the fourth decimal place
to determine whether we need to round up or round down. We see this is equal to eight which
is greater than or equal to five. So we need to round up, giving us
that to three decimal places our value of π is 6.828. And remember, the question wants us
to give this in the slopeβintercept form of a line. We get π¦ hat is equal to 6.828π₯
plus 47.788 which is our final answer.
Therefore, given a table with
different carsβ lifespans and their selling price, we were able to find the line of
regression giving the coefficients to three decimal places. We got π¦ hat would be equal to
6.828π₯ plus 47.788.