Basic Statistics Intro


Basic Statistics Intro

Simon
So Hope, we've been talking about simple linear regression, and the big idea is that we want to predict one variable using another. Today we're diving into the core method behind it all: the least squares method.

Hope
Right, and I remember our earlier example—the restaurant where we wanted to predict the tip amount based on the total bill. At first, when we only had the tip data, our best guess was just the mean tip, which was $10. That gave us a sum of squared errors of 120.

Simon
Exactly. But now we have both the bill and the tip for six meals. The whole point of regression is to see if we can do better than just using the mean. The least squares method is how we find the line that minimizes those squared errors.

Hope
So the least squares criterion says we want to minimize the sum of the squared differences between the actual tip and the tip predicted by the line. That sum is called the sum of squared residuals.

Simon
And the formula looks a bit intimidating, but it's really just saying: for each data point, take the observed y minus the predicted y, square it, and add them all up. We want that total as small as possible.

Hope
Before we get into calculations, what are the first steps? I know we always start with a scatter plot.

Simon
Absolutely. Step one: plot the data to see if there's a linear pattern. In our case, the points do seem to fall along a line. Also, make sure the axes are scaled properly so you're not distorting the picture.

Hope
And if the points were just a random blob, we'd stop right there. No point forcing a linear model on non-linear data.

Simon
Step two is checking the correlation. It's optional but useful. Our correlation coefficient was 0.866, which confirms a strong positive linear relationship.

Hope
Now step three: find the mean of each variable. The average bill was $74, and the average tip was $10. That point—(74, 10)—is called the centroid.

Simon
And it's crucial because the regression line must pass through the centroid. That gives us one point on the line automatically.

Hope
Alright, so how do we actually compute the slope and intercept? I remember there's a formula with a table.

Simon
Yes. For the slope, b1, we compute the sum of the products of the deviations from the means, divided by the sum of the squared deviations of x. Setting up a table makes it really easy.

Hope
So for each meal, we find the deviation of the bill from its mean, and the deviation of the tip from its mean. Then we multiply those together and add them up. That gives the numerator.

Simon
And for the denominator, we take each bill deviation, square it, and add them up. In our data, the numerator was 615 and the denominator was 4,206. So b1 = 615 / 4,206 ≈ 0.1462.

Hope
Then the intercept b0 is just the mean of y minus the slope times the mean of x. So b0 = 10 − 0.1462 × 74 ≈ −0.8188. So our regression line is predicted tip = −0.8188 + 0.1462 × bill.

Simon
And that matches Excel's output almost exactly—just a tiny rounding difference in the intercept. So we can trust our hand calculations.

Hope
Now let's interpret it. The slope of 0.1462 means that for every additional dollar on the bill, we expect the tip to increase by about $0.15.

Simon
And the intercept? A bill of $0 would give a predicted tip of −$0.82, which doesn't make sense in real life. But that's okay—the intercept isn't always meaningful. It's just part of the equation.

Hope
We also confirmed that the centroid (74,10) lies on the line. If you plug x=74 into the equation, you get ŷ ≈ 10. So that checks out.

Simon
Now the big question: Is this regression line actually better than just using the mean? We'll have to compare the sum of squared residuals from this line to the 120 we had before. That's coming up in the next video.

Hope
Great. So we've covered the least squares method—the heart of regression. We plotted the data, checked the correlation, found the centroid, and calculated the line step by step.

Simon
And we know that the line goes through the centroid and minimizes those squared differences. Perfect foundation for what comes next.

Ask anything
We've read this whole study set, so questions about it get the best answers.