Step-by-Step Guide to Performing Linear Regression in Excel
Learn how to create a scatter plot, add trend lines, and calculate correlation, slope, and intercept for linear regression using Excel.
File
How to do a linear regression on excel
Added on 09/28/2024
Speakers
add Add new speaker

Speaker 1: I want to show you how you can make a linear regression on Excel. So what I'm going to do is just look at two variables. I have my X variable which we think of as our explanatory variable. And then I've got my Y variable which responds to that. So that would be the interest rates going to explain the median home price. All right, so we're going to be using a scatter plot. A scatter plot requires two variables. This will be my X-axis, that will be my Y-axis. So I highlight both of these variables. I do not highlight the average, that's not part of it. Insert, you just go ahead, you make your scatter plot. All right, so now I have a scatter plot and I want to try to figure out the correlation and the equation for the scatter plot. So I've got some couple issues. I would like to have axis labels, a title. I'd like to have a trend line. There's a couple ways I can add these in. I can use my chart elements and add in my title right here, which I actually have right there. So I'm going to do an axis title on the horizontal and an axis title on the vertical. And I can just type in my correct one. I can also add in my trend line right here. It's linear, so I can put that in here. Another option for doing that, just so you know, is also I can go to quick chart layouts. And there actually is a chart layout right here that happens to have both a trend line and all the labels. I'm going to actually click on that and just use that. I don't need that key right there. I'm going to move this so I can actually see it. I might also make it a little bit bigger so it's really clear. All right. So now I'm going to put that up high. I have an issue with the way this actually looks. I have all this empty space, and I can't really focus on what's happening here. So I'm going to actually double click on this axis, the x-axis. And I realize that my data doesn't really start until about 6. So if it actually started at 5, my minimum was at 5, I could really see what's happening a lot better. Same with here. I have a lot of empty space here. So it doesn't need to start at 0. If it started at something like 100,000, so again, I'm going to just click over to here, Axis Options, and I'm going to set a minimum here at 100,000. And now I've really made it so that you can really focus on what is happening. This is my trend line. I'm going to double click that trend line there. And I really want to be able to make that clear, so I might have it be actually a separate color. So make it red. I also want to see it thicker so it can really come through. And I'd rather have it actually be a straight line rather than dashed. So my graph now has a lot of information on it. I've got my, I can see what my slope is. I can see my intercept. R squared, we'll deal with later. I'll talk more about that. And I can see what the line looks like. It's definitely negatively sloped. So what I want to now find is my correlation. That's that measurement of strength. One way to do it is to get all the z-scores and do it the long way. But a real quick way to do it is to simply type in coral, OK? Coral. And then coral, you just highlight your x-axes, comma, then highlight your y-axes. So I'm going to come over here and highlight that explanatory variable, comma. Then I'm going to highlight my response variable. And let's see how strong that relationship is. So I end up with a negative relationship as I expected to make it easier to see. I'm going to just go to just two decimal points. So my correlation coefficient, R, is actually going to be negative 0.62. I can also find my slope and intercept. I can look at them here. But sometimes it's hard to be really accurate when you're looking at them there. So I can equally have found them by just typing in slope. Double click on that. And then here it tells you the y's and then the x's. So it actually tells me to put it in this order here. Comma for the y. And then I'm going to go over to my x's. And there's my slope, as you can see. And for my intercept, equals intercept. Exactly the same. And again, my y's go in first, as it actually tells you. Comma. And then you put in your x. Enter. So we have the same numbers here as there. This tells me that my slope, so that would be that for every unit increase in the interest rate, the actual price of the house will go down. We can actually put that in dollars. It will drop down by over $23,000. The intercept is telling me that if the interest rate, so if this interest rate down here had been zero, the price of the home would be $393,000. Well, above that. So these two are really good pieces of information about what's happening. And I can see that I do have a somewhat strong relationship.

ai AI Insights
Summary

Generate a brief summary highlighting the main points of the transcript.

Generate
Title

Generate a concise and relevant title for the transcript based on the main themes and content discussed.

Generate
Keywords

Identify and highlight the key words or phrases most relevant to the content of the transcript.

Generate
Enter your query
Sentiments

Analyze the emotional tone of the transcript to determine whether the sentiment is positive, negative, or neutral.

Generate
Quizzes

Create interactive quizzes based on the content of the transcript to test comprehension or engage users.

Generate
{{ secondsToHumanTime(time) }}
Back
Forward
{{ Math.round(speed * 100) / 100 }}x
{{ secondsToHumanTime(duration) }}
close
New speaker
Add speaker
close
Edit speaker
Save changes
close
Share Transcript