Main content

## AP®︎/College Statistics

### Course: AP®︎/College Statistics > Unit 5

Lesson 5: Analyzing departures from linearity- R-squared intuition
- R-squared or coefficient of determination
- Standard deviation of residuals or root mean square deviation (RMSD)
- Interpreting computer regression data
- Interpreting computer output for regression
- Impact of removing outliers on regression lines
- Influential points in regression
- Effects of influential points
- Identify influential points
- Transforming nonlinear data
- Worked example of linear regression using transformed data
- Predict with transformed data

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Interpreting computer regression data

Interpreting computer generated regression data to find the equation of a least-squares regression line. Predictors and coefficients. S and R-squared.

## Want to join the conversation?

- In this case, how to interpret the values of T and P?

Thanks in advance!(5 votes)- T (which you will find as "t" in R language summary function results) is the coefficient divided by the standard error. A large t value means that it is very likely that the coefficient will be significant. You should generally keep in your regression model those variables with a large absolute value in this field.

P (which you will find as "Pr(>|t|)" in R's summary function results) is a measure of how likely it is that your coefficient will be zero for the corresponding variabie. You will generally prefer to keep in your model those variables with a low value in this field.

Hope you find it useful!(8 votes)

- So
**S**is exactly the same as the root-mean-square deviation (RMSD)?(6 votes)- Sal says S is the 'typical error' or the standard deviation of the residuals, so I think you are correct?(1 vote)

- Why is b equal to constant coefficient and m equal to caffeine coefficient? Can anyone please elaborate more?(2 votes)
- It's literally just how the computers calls the things it calculates.

We asked the computer to perform a least-squares regression analysis on some data with

x = caffeine consumed and y = hours studying

So imagine the data on a scatterplot, with caffeine consumed as the x-axis, and hours studying as the y-axis.

Now the computer calculates things and finds us a least-squares regression line. But, instead of just giving us the line in the form y = mx + b, it decides to put things into a weird table format.

First you have a column called "predictors", with "constant" and "caffeine" underneath. This is because with a least-squares line you can "predict" the value of y (hours studying) with

y = mx + b

where b is the "constant" that takes part in your prediction, and x is the caffeine. So b and x are the "predictors" of y.

Now the coefficient of x is m, and since x is the "caffiene" portion of your predictors, the coefficient of your caffeine predictor is m.

For b, you can imagine the equation as

y = mx + bx^0

And now, if you consider bx^0 as the "constant" predictor, the coefficient on it is b.

Ultimately, "constant coefficient" and "Caffeine coefficient" are just names the computer gave to m and b.(7 votes)

- What is the least amount of information you need to know to find the equation of a line?(1 vote)
- To find the equation of the line, you need the slope and y-intercept. Solving for the slope just requires two points on the line that you're solving for.

Hope this helps!😄(2 votes)

- In this case, does the constant b, representing the y-intercept, show that the minimum number of hours spent studying was 2.544? Since our slope is positive, and when x=0 (minimum caffeine intake) that is the value of b?(1 vote)
- I could be wrong, but I believe that 2.544 would represent the predicted minimum amount of hours spent studying as this is a best fit line, and not the exact value of every data point.(1 vote)

- I'm confused because in the practice problems after the video, they use the same question but it says that the correct answer ŷ=2.544+0.164x. Is it because the order of numbers is different?(1 vote)
- Yeah its just in a different order, the answer isn't different it was just written differently(1 vote)

- Does correlation coefficient 'r' always equal to sqrt of coefficient of determination R2?

When I tried to derive the relation of r from relation of R2, I was not successful. please explain.

I don't think that r is sqrt of R2. Then, why in this video, it is mentioned like that?(1 vote) - If we have to have the x be certain dates like 1955 then 1961 how would we set the x's up to put them into the calculator?(1 vote)
- None of the videos explain as to how we can figure out the slope and the intercept to achieve a least squares regression line without the help of the computer.

Please explain how to do it manually.(1 vote) - Positive slope means positive r. Negative slope means negative r. Just memorise that?(0 votes)
- Yes, it is best to think of it through intuition.(3 votes)

## Video transcript

- [Narrator] In other videos, we've done linear regressions by hand, but we mentioned that most regressions are actually done using some
type of computer or calculator. And so what we're going
to do in this video, is look at an example of
the output that we might see from a computer, and to
not be intimidated by it, and to see how it gives us the equation for the regression line, and some of the other data it gives us. So here it tells us,
Cheryl Dixon is interested to see if students who
consume more caffeine tend to study more as well. She randomly selects 20
students at her school, and records their caffeine
intake in milligrams and the number of hours spent studying. A scatterplot of the data
showed a linear relationship. This is a computer output
from a least-squares regression analysis on the data. So we have these things
called the predictors, coefficient, and then we
have these other things, standard error of coefficient, T and P, and then all of these things down here, how do we make sense of this in order to come up with an equation for our linear regression? So let's just get
straight on our variables. Let's just say that we say that Y is the thing that we're trying to predict, so this is the hours spent studying, hours studying. And then let's say X is what we think explains the hours studying, or is one of the things that
explains the hours studying, and this is the amount
of caffeine ingested, so this is caffeine consumed in milligrams. And so, our regression
line would have the form Y hat, this tells us that
this is a linear regression, it's trying to estimate the
actual Y values for given Xs, is going to be equal to, MX plus B. Now how do we figure out what M and B are, based on this computer output? So when you look at this table here, this first column says predictor, and it says constant, and it has caffeine. And so all this is saying is, when you're trying to predict
the number of hours studying, when you're trying to predict Y, there's essentially two inputs there. There is the constant value,
and there is your variable, in this case caffeine, that
you are using to predict the amount that you study. And so this tells you
the coefficients on each. The coefficient on a
constant is the constant. You could view this as the coefficient on the
X to the zeroth term. And so the coefficient on the constant, that is the constant, two point five four four. And then, the coefficient on the caffeine, well, we just said that X
is the caffeine consumed, so this is that coefficient, zero point one six four. So just like that, we actually have the equation for the regression line, that is why these computer
things are useful. So, we can just write it out, Y hat is equal to zero point one six four X plus two point five four four, two point five four four. So that's the regression line, what is this other
information they give us? Well, I won't give you a
very satisfying answer, because all of this is actually useful for inferential statistics. To think about things like, well, what is the probability
that this is chance that we got something to fit this well? So this right over here is the R squared, and if you wanted to
figure out the R from this, you would just take the square root here, we could say that R is going
to be equal to the square root of zero point six zero zero three two, depending on how much precision you have. But you might say, well how do we know if R is the positive square
root, or the negative square root of that, R
can take on values between negative one and positive one. And the answer is, you would
look at the slope here. We have a positive slope,
which tells us that R is going to be positive. If we had a negative slope, then R, then we would take the
negative square root. Now this right here is
the adjusted R squared, and we really don't have
to worry about it too much when we're thinking about
just bivariate data, we're talking about
caffeine and hours studying in this case. If we started to have more variables that tried to explain the hours studying, then we would care about
adjusted R squared, but we're not gonna do that just yet. Last but not least, this S variable. This is the standard
deviation of the residuals, which we study in other videos. And why is that useful? Well that's a measure of
how well the regression line fits the data, it's a
measure of, we could say, the typical error. So big takeaway, computers are useful, they'll give you a lot of data, and the key thing is how
do you pick out the things that you actually need, because
if you know how to do it, it can be quite straightforward.