Finding the Line: How Regression Predicts the Future
A real estate analyst has data on 200 houses: square footage and sale price. She wants to predict the price of a house that just hit the market, based only on its size. Regression analysis is the statistical tool that draws the 'best fit' line through scattered data points and turns that line into a prediction formula.
What You'll Learn
- What a linear regression equation (y = mx + b) represents in real data - How the 'line of best fit' is chosen mathematically - What R² (r-squared) tells you about how good a model is - How to spot when regression predictions should NOT be trusted
The Line of Best Fit
Plot square footage (x-axis) against sale price (y-axis) for 200 houses, and you'll see a scattered cloud of points, generally trending upward — bigger houses tend to cost more. Linear regression finds the single straight line that minimizes the total squared distance between the line and every data point. This method is called 'least squares.' The resulting line might be: Price = $150 × SquareFootage + $40,000. Here, $150 is the slope (each additional square foot adds about $150 in price) and $40,000 is the y-intercept (a theoretical baseline price at zero square feet, which is really just a math anchor point, not a real house).
Using the Equation to Predict
For a 1,800-square-foot house: Price = $150 × 1,800 + $40,000 = $270,000 + $40,000 = $310,000. That's the model's prediction — not a guarantee, but a data-driven estimate based on the pattern in 200 other houses. Real estate sites like Zillow use much more complex versions of this same idea (with dozens of variables, not just square footage) to generate their 'Zestimate' price predictions.
Real-world models rarely use just one variable. Multiple regression adds more predictors at once — square footage, number of bedrooms, neighborhood, age of the house — combining them into one equation: Price = b0 + b1(sqft) + b2(bedrooms) + b3(age) + ...
R²: How Good Is the Fit?
R² (r-squared) ranges from 0 to 1 and tells you what percentage of the variation in the outcome (price) is explained by your predictor (square footage). An R² of 0.85 means 85% of the price differences between houses can be explained by size alone — pretty strong. An R² of 0.20 means size barely explains price at all, and other factors (location, condition, school district) are doing most of the work. Always check R² before trusting a regression prediction.
When Regression Goes Wrong
Regression assumes the relationship is roughly linear and that the future will behave like the past. Two classic failures: extrapolation (predicting far outside your data range — using data from 1,000-3,000 sq ft houses to predict a 10,000 sq ft mansion is unreliable) and correlation-causation confusion (ice cream sales and drowning deaths both rise in summer heat — one doesn't cause the other; a third factor, temperature, drives both).
Match each regression term to its correct meaning.
Terms
Definitions
Drag terms onto their definitions, or click a term then click a definition to match.
A regression model predicting exam scores from hours studied has an R² of 0.10. What does this tell you?
A company's data covers stores with 2,000-8,000 customers per month. Using their regression model to predict revenue for a hypothetical store with 500,000 monthly customers is risky because of which problem?
Build Your Own Regression
Collect 10 real paired data points (e.g., hours of sleep vs. next-day energy rating 1-10, or a plant's daily watering amount vs. its height over 10 days). Plot the points on graph paper or a spreadsheet. Draw your best-guess line of best fit by eye. Write the approximate slope and y-intercept of your line, then use it to predict one new value outside your original 10 points. Note whether that prediction feels reliable or is extrapolation.
Just because two variables move together in a regression doesn't mean one causes the other. Always ask: could a third hidden factor be driving both? This is one of the most common statistical mistakes in news reporting.
Want to keep learning?
Sign up for free to access the full curriculum — all subjects, all ages.
Start Learning Free