Let's do another example where we have some data.
We want to fit a line to that data, and maybe use that to
estimate some of the data that we didn't
collect, so to speak.
So the first thing they ask us, let's look at the chart
first of all.
This is birth year.
They started in 1930.
They go all the way up to the year 2000 in
increments of 10 years.
They tell us the life expectancy in years.
So a good thing for us.
I think this is the United States.
The life expectancy has been steadily increasing.
The first thing they ask us to do is to make a scatter plot
of the data.
I did this on Excel ahead of time.
This is what I got.
As you can see in 1930 it was 59.7.
In 1940 it was 62.9.
These blue dots are just plotting each
of these data points.
1930 is 57.9.
It's that data point right there.
In 1940 it was 62.9.
It's that data point right there.
So I just went ahead and plotted all of them.
Then I let Excel figure out a line of best fit.
I didn't go into the math of how to do this.
We'll do that in future videos.
It's out of the scope of introductory algebra.
But Excel figured out that the line of best fit, the line
that is least far away from all of these points, that
minimizes the distance from all of these points, is y is
equal to 0.2395x minus 400.99.
I'm not going to go into what r squared is just yet.
But it's a measure of how good this line is actually fitting.
So let's use that.
Let's use this table.
Let's use our line of best fit to answer the
rest of their questions.
So the second question is, use the line of best fit to
estimate the life expectancy of a person born in 1955.
So we have two options.
We could just eyeball it.
1955 is right there.
So if you go up from 1955 you're going to hit the line
of best fit.
Let me do it in different color, because that's the same
color as the dots.
In 1955 you're going to hit the line of
best fit right there.
If I were to just eyeball it, it looks
like it's right there.
This is 1, 2, 3, 4, 5.
So these are increments of 2.
So it looks like about 77 years.
So 1955, it looks roughly equal to 77-- no, no sorry--
67 years-- let me be clear, it sounded suspicious-- a 67 year
life expectancy.
Now we can use the equation of this line of best fit to come
up with the exact value.
When x is equal to 1955, what is y?
What is the life expectancy in years?
Let's get our calculator out for this.
Actually let me use a graphing calculator for
this one right now.
So let me clear this.
Let me clear everything.
Then let's just punch in 1955 for x.
So we have 0.2395 times 1955, that's our x-value, minus
400.99 is equal to 67.23.
So our line of best fit gives us the exact
answer of 67.23 years.
So our eyeballing it wasn't that far off.
So that's what our line of best fit would predict, if we
assume that a linear model is a good model to
describe this data.
All we know right now are linear models, so
that's what we'll use.
It actually looks pretty good.
It seems like it fits the data pretty, pretty good.
Let's do the next part.
Use linear interpolation to estimate the life expectancy
of a person born in 1955.
Now linear interpolation means let's take the data points
around 1955.
So you have this data point from 1950.
You have this data point from 1960.
Let's draw a line between those two data points and
assume that the 1955 number would be right in between on
the line there.
Now we could figure out the equation of that line.
We have two points.
We have the 1950 data and we have the 1960 data.
We could figure out the slope of the line.
We could figure out its y-intercept.
Then we can substitute 1955 in there.
But this is a line, and 1955 is right in
between these two points.
It's 5 from either one.
So on this point right here, that's on that linear
interpolation, on that orange, will just be halfway
between these two.
So we can even average those.
So let's do that.
So if we just average those, 68.2 plus 69.7 is equal, and
then we want to divide it.
That answer means our previous answer.
So that number divided by 2 is equal to 68.95.
So part 2, through linear interpolation we get 68.95.
Is that what I got?
68.95, so that is this point right here.
So linear interpolation is giving us a slightly higher
estimate than our line of best fit across all of the data.
You can even eyeball it if you look at it right there.
Let's do the next one.
Use a line of best fit to estimate the life expectancy
of a person born in 1976.
Once again, we can use the equation of the line of best
fit, plug in 1976 here and see what it gets us.
We can eyeball it.
1975 is there.
1976 is there.
It'll be right around there.
Let's actually use the actual equation.
So in 1976, this is going to be the line of best fit, the
line of best fit is going to give us, if we actually figure
out what this line value gives us, so we get 0.2395 times
1976 minus 400.99.
So 72.26 years, so it gives us 72.26 years.
So it equals 72.26.
Let me make this clear here.
These columns, this one right here, is line of best fit.
This one right here is interpolation.
Now they want to use linear interpolation to estimate the
life expectancy of a person born in 1976.
So what they want us to do is draw a line between these two
points, and then use that line, not the whole line of
best fit, to figure out what 1976 might have been.
Now before, 1955 was right in between those two values.
1976 is not right in between those values.
So let's actually figure out the equation of this line
using the points, these two points, 1970 comma 70.8, and
1980 comma 73.7.
Let's figure out the slope of that line, of
this line right here.
So the slope is the change in y over change in x.
It's going to be 73.7 minus 70.8.
That's how much we change in the y direction, divided by
how much we change in the x direction, 1980 minus 1970.
So this is going to be equal to 3.7 minus 0.8 is 2.9.
So it's 2.9 over 10.
So it's equal to 0.29.
We changed 2.9 years in life expectancy every 10 years over
that time period right there, or 0.29 per year.
Now what's the equation of that line?
Well we know that the point 1970 and 70.8 is on that line.
So if we say the equation is y is equal to mx plus b, we know
that y is equal to 70.8 when-- we know m is 0.29-- when x is
equal to, or when the year is equal to 1970,
times 1970 plus b.
Now we can calculate our y-intercept.
So what is our y-intercept?
We'll get our calculator out.
We have to subtract this from both sides.
So b is equal to 70.8 minus 0.29 times 1970.
Let's get our calculator out.
There we go.
All right, 70.8 minus 0.29 times 1970 is
equal to minus 500.5.
So this is equal to negative 500.5.
So the equation of our interpolation line-- remember
we're just finding the equation of this line between
1970 and 1980-- is, that equation is y is equal to
0.29x minus 500.5.
Now if we want to figure out what that line, if we want to
interpolate 1976, we just have to put 1976 in there for x.
So what is life expectancy in 1976?
Get our calculator out again.
0.29 times 1976 minus 500.5 is equal to 72.54.
So we get 72.54 is what happens?
It's the number we get when we do linear interpolation
between those two data points.
All we did is we figured out the equation of the line
between those two points.
Then we plugged in the number 1976 to get 72.54.
That's a slightly, slightly higher number than what the
line of best fit gave us.
But it's pretty, pretty close in either scenario.
Now let's do this last part.
Use the line of best fit to estimate the life expectancy
of a person born 2012.
This is what's cool about the line of best fit.
We don't have 2012 here.
2012 goes off the table.
But we could just keep continuing on with this line
right here-- now I'm using the wrong color-- keep continuing
with this line right here and see what does this line equal
when the year is equal to 2012?
So all we have to do is put 2012 in for x and we'll get
what the line of best fits tells us.
We'll get the calculator out again.
So we have 0.2395 times 2012 minus
400.99 is equal to 80.88.
So this last part, in 2012 if you were to use a line of best
fit, the average life expectancy in the U.S. will be
80.88 years.
Anyway, hopefully you found that to be interesting.
Sometimes dealing with data can be a little bit hairy.
These aren't nice, clean numbers.
But it gives you a little sense of why slope, and y-
intercept, and interpolation, and fitting a line, is
actually very important to analyzing data and coming to
conclusions from that data.