Regression now says if there is a relationship, we need to be able to define that relationship
by one single straight line.
So we have a set of points.
And in regression, what we're trying to do is fit a line to those set of points.
And what we're looking for is the best line that represents those set of points.
The best line that will represent those set of points.
Because I could draw a lot of different lines, but the one we want is the one we draw such
that the distance between the points and the line is the minimum.
That's what we want.
So that's the one that will best represent the set of points.
So that's why the regression line is called the line of base fit, and it's also called
the least squares line, okay?
It's also called the least squares line.
So it uses what we call the least squares principle.
For example, when we find the distances between the points here and the line, the distances
below the line will be equal to the distances above the line.
So just like what we did when we calculated variance, we can’t just add all of them
up, we will get zero.
So we square those distances and then the formula we use, or the software will find
the line that gives us the shortest of the distances between the points and the line.
You can see there's a negative relationship here.
Here we're looking at relationship between how long customers wait at a doctor's office
and the satisfaction rating.
And you can see that the relationship is negative here, that the longer customer wait, the lower
they rated the service can see the satisfaction rating is low if they waited a long time.
Which, of course, what you'll expect, right?
Regression equation.
So that line actually has an equation.
If you remember, some people might remember from high school, y equals MX plus B equation
of the line.
So basically M is the slope, b is the Y intercept.
So something similar to what we're trying to do here.
It’s just that we are more interested in what is the slope in a particular situation
mean.
Sorry?
Slope is M. In this case, Y intercept is B. What does the Y intercept mean?
What we just need to know is that when you have the equation, the standalone value like
this is your Y intercept and the one that is multiplying the x is the slope.
Okay?
So very important that this is the slope and the standalone guy is your Y intercept.
So what we're trying to do is fit in line to that relationship.
So you will see the equation written in this form or in that form.
And one thing you'll notice is that we have a hat on that y, okay?
Because in regression we have a difference between y and y hat.
Now, why are the actual values of y?
So when we list the values of x and y, so we say these are x values, two, four, six,
and these are y values, right?
5 8 11 and so on.
These are the actual y values, the actual point.
But then when we draw the line, because when we obtain an equation, for example, have an
equation that says y equals two plus or let's say one plus two x, something like that.
So if this is my equation of the line, then this one here is my Y hat.
Because all the points are not on the line.
Okay?
So this one will be used to predict my Y values.
So, for example, if I add this equation, my Y hat here, if I plug in a two into that equation,
I will get a five.
All right?
If I plug in a four, I will get a nine.
If I plug in a six, I will get it 13.
So you can see that the actual points may be different from the line.
The y hat is an estimate based on the actual values of Y.
We have here is what we're trying to do.
So let me show you here.
This point here, you can call it 19.
X is 19 here, and Y is, let's just say 80 here.
Okay?
So that point on your line will be 19 and 80.
Okay.
That point there.
Okay, so now on the line, on the line, that point is 19, and let's say 75.
On the line.
Okay?
So question is why do we need the line?
For several reasons.
Sometimes we want to predict something; we want to estimate.
So, for example, 25 here.
If somebody waits for 25 minutes, we can use that because we have nobody here that actually
waited for 25 minutes, we can use that here and trace it to the line and estimate that
person will rate that hospital or doctor's office… will give them a rating of about
70.
Okay, so that is your y hat.
You don't have why you don't actually have someone that waited for 25 minutes, you understand?
So that is why we obtain the equation of the line and then we use this for prediction.
So we obtain that equation of that line and then we just use it to estimate.
And sometimes we use it to project a little bit into the future.
But we don't want to do that because sometimes the values might change after a particular
range.
For example, when kids are young, the amount of food they can eat starts to increase.
And then when they get to a particular age, the amount of food they eat does not really
change that much anymore.
So that's why we don't use the regression line to project too far outside of the range
of data values we have.
Because if you think the amount of food they eat is increasing and you just keep projecting,
right?
Yeah.
You will be going up.
Whereas after a particular age, it just stays flat.
So anyway, let's go back here.
So again, we are formalized here, which we're not going to be using for the slope and the
yintercept here.
But one thing we will be required to do is know what the slope and yintercept mean, especially
the slope very important because it's used a lot to describe relationships.
Let's talk about the yintercept.
This is the equation of this line.
We didn't put the heart and the Y because we actually don't have points around here.
So we just say this is the question of the line.
Now, this is the point where the line crosses the Y axis.
This is your Y axis here.
So that point there is called the Y intercept.
The point where the line the equation of the line crosses the Y axis is the yintercept.
Okay?
In this case, it's two.
But the way we would like to see the yintercept is the value of Y when x is zero.
And you can see X is zero here.
X is zero here.
So it’s the value of Y when X is zero.
So whatever we're trying to measure, when that thing is zero, then the Y intercept represents
the value of Y or the expected value of Y.
Now, what about slope?
Slope is rise over run.
Rise over Run.
Although we want a deeper meaning than that.
But mainly if you want to do this geometrically, what you do is you calculate this distance.
This distance from here to there is six.
This distance from here to there is two.
Then you will say this slope is three.
That's if you're doing it geometrically.
But what we're interested in is the real interpretation of the slope.
Let's see how it works.
I'm going to use this equation here and then come up with some numbers over here.
So x and y.
So I'm going to say I have 0 1 2 3 4 5 and so on.
So I'm going to plug in zero here.
I'm going to get it to plug in one.
I'm going to get five, and then eight, and then eleven, and then 14, and then 17, and
so on.
Now, notice that as X increases by one, y is increasing by three.For every unit increasing
x, y increases by the amount of slope.
So see, the slope here is three.
So that's the definition we will be working with.
What is the definition of the slope?
Slope is the amount of change in Y for a unit increase in X.
By unit we mean one.
How much we expect Y to change for a unit increase in X.
If X changes by one by how much we expect Y to change.
So that is our definition of slope.
So here's just a quick example.
So here we're looking at some people with prior convictions, how many times they've
been convicted in the past and how long they were sentenced for in years.
So we have all these numbers here which are plotted here.
So these are the points and that is the line.
So we use software to generate the equation which you see up here, and which is also down
here, which is the regression equation.
So from this equation you can see that this is your yintercept.
And this is your slope.
So if we ask you to interpret the yintercept.
It’s essentially amount of sentencing or sentence that you expect someone with zero
priors to have.
That is, when X is zero, y will be this number.
So if someone has zero priors, that is zero prior convictions.
We expect them to be sentenced to two years on average.
Again, these things are averages.
Okay?
So that's how we will interpret the Y intercept.
That is, if prior is zero, what is sentence going to be pretty much on average.
Now, what about the slope?
How do we interpret that?
So, from what we saw before, we said slope means if X goes up by one, by how much will
Y change?
In this case, it's telling us Y will go up by about 2.8.
So for every additional conviction, sentence length increases on average by about 2.8 years
for that particular kind of crime.
So that is what it's saying.
So that's what is explained here.
For every additional conviction sentence length increases on average by about 2.8 years.
But the primary goal of obtaining this line, like I said, is to use it to make estimates
or make predictions.
So for example, if you look here, we don't have anybody, have anybody here with six prior
convictions.
So we can trace that to the line here and then bring it over here.
We can use that to estimate the sentence length for someone with six prior convictions.
All we just need to do is plug that into the equation.
X is six.
And we plug that into the equation and it will give us approximately 19 when we plug
that in.
So that is what we use that for.
And then we have how this is done in Excel here.
We also have a BAII two plus calculator.
You can also use that to generate your slope and y-intercept.
The coefficient of determination.
Now, the coefficient of determination is r squared.
We use upper case R for other reasons, but it is essentially the same thing as just taking
the R, the correlation coefficient that we had before and just squaring it.
That is essentially the same thing.
Which means that your R squared will have to be between zero and one.
Because remember, your R r is between negative one and one.
But what does it mean?
Loosely, this is what it means.
So let's take X as the time spent on watching videos in this class, for students last semester
and why is their final grade.
So for this student, we're going to say, how many hours is this person?
Or let's say minutes.
So this person watched for 305 minutes.
Grade was 75.
This person watched for 420 minutes.
Grade was 82.
This person watched for only 95 minutes and still managed to get a 71 and so on.
So let's assume we now run this in Excel and we compute Rsquared and we find out Rsquared
is something like 0.4.
So what is this telling us?
It’s this.
It's called determination.
Coefficient of determination.
So it’s saying final grades in this course are determined.
Okay, basically I'm talking loosely here, determined by the time spent watching videos,
40% of the time.
Better way, 40% of what makes your final grade what it is can be attributed to how much time
you spend watching those videos.
So 40% of what makes ...the word we use is variation, which we're going to get into.
That is 40% of what makes a student grade differ from or vary or change from one person
to another is time spent watching videos.
So we're essentially saying that the remaining 60% of the time, other factors are responsible.
There are a lot of other factors that could be responsible for the remaining 60%.
So that's what we mean by coefficient of determination.
So again, if I throw you that number, you can have a general idea of what it means.
So we're just saying if this is final grade and we want to say what is determining final
grade, we would say 40% of it will be time spent on videos, and then we're going to have
other things filling the rest of it.
So the way we say is technically is this.
We say it’ss the percent or proportion of the variation.
So variation again means when you move around how the values changing …in y. y in this
case is Grade.
Proportional variation in Y that is explained.
So that is our functional word here.
The key word is explained.
So watch out for that word when we're talking about R squared.
So explain or accounted for by the variation in X.
Or sometimes we just say by X.
So basically, how much changes in y can be attributed to x.
That is what R squared is.
So in this case, we're saying the amount of changes in final grade that is attributable
or that X captures is 40%.
So in the last question we did, R squared will be this number, and we just use that
definition.
We say this percent of the variation in Y is explained by X.
So sometimes if I tell you that r, correlation coefficient, is 0.4 and then R squared coefficient
of determination will be zero four squared, which is 0.16.
But if I tell you that R squared 0.64 and that r is .8.
It is that correct?
It is partially correct because r could also have been negative 0.8, because if you square
this, you will get point 64.
If you square this one, you will get .64, right?
Okay.
Because when you take the square root of a number, r is supposed to be plus or minus,
right?
Okay.
Because this is what we give you some questions.
We give it to you, and then we want you to pick one.
But then we will give you additional information.
And the additional information will have to be the relationship.
Is it positive or negative?
But then we won't really give it to you explicitly and tell you the relationship is positive.
What we do is we give you the equation of the line.
So we could say the equation of the line is negative three X plus two.
Okay?
So if we give you that, then you can go look at the slope.
Your slope and R will always have the same sign, because if it's sloping upward, then
the correlation will also be upward.
So once we give you that, you will know that this one here has to be a negative relationship.
But if it changes and becomes negative three plus two X, then that is a positive relationship
because the slope is two now.
okay?
So let's go again.
So I said if we give you R squared and it's a multiple choice question, and then we give
you some option, including this and that.
But like I said, we will give you additional information, like, oh, this is the equation
of the line.
But most people don't see that.
They just say, okay, I have R square.
I want to find r.
They take the square root.
The calculation shows 0.8.
They pick 0.8 and move on.
They could get lucky if the slope is positive.
See, the slope is positive here.
But if the slope is negative, then this becomes the answer, right?
Okay.
Thanks for watching!