Courses › Statistics and Econometrics
Simple regression: fitting the line
Ordinary least squares, fitted values and residuals, R-squared, units and interpretation, and why a regression line is not automatically a causal effect.
Regression is the workhorse of applied economics. It is how economists estimate the return to a year of schooling, the effect of a price on sales, or how rents fall with distance from downtown. At its simplest, regression draws the best straight line through a scatter plot. This module is about what “best” means and how to read the line.
You will meet the population regression model, derive the ordinary least squares (OLS) estimates, work with fitted values and residuals, measure fit with R-squared and the standard error of the regression, and learn the traps: units, extrapolation, influential points, regression to the mean, and the big one, mistaking a regression line for a causal effect.
By the end of this module you will be able to
- Write the simple regression model and explain the role of the error term.
- Compute OLS slope and intercept from data and interpret them in the units of X and Y.
- Compute fitted values and residuals and state their algebraic properties.
- Compute and interpret R-squared and the standard error of the regression.
- Recognize influential observations, extrapolation and regression to the mean, and explain why a regression slope need not be causal.
What this module covers
- The regression model
- Ordinary least squares
- Fitted values and residuals
- Measuring fit: R-squared and the standard error of the regression
- Reading regressions with care
- Problem set with step-by-step solutions
- Module quiz
Lesson 6.1 Free lesson
The regression model
Module 2 introduced the conditional expectation E(Y | X), the average of Y for each value of X. The simple linear regression model assumes this average is a straight line in X:
- Y is the dependent variable (the outcome); X is the regressor or explanatory variable.
- β0 is the intercept and β1 the slope: the change in the average of Y when X rises by one unit.
- ui is the error term: everything other than X that makes observation i differ from the line.
The β’s are population parameters we never see; regression estimates them from a sample. The error term is not a mistake. It collects every other influence on Y: if Y is a worker’s wage and X is years of schooling, u contains experience, ability, occupation, location, luck and much else.
Worked example: Reading a regression line
Suppose the population relationship between a café’s iced coffee sales Y and the afternoon temperature X (°C) is E(Y | X) = 0 + 2.3X.
β₁ = 2.3: on days that are 1°C warmer, the café sells 2.3 more iced coffees on average.
On a 25°C day the average is 57.5 coffees. Any particular 25°C day will sell more or less, by the amount of that day’s error u.
β₀ = 0 is the average at 0°C. That is a long way outside the data (nobody records iced coffee sales in a snowstorm), so the intercept is best seen as positioning the line, not as a prediction.
Why the error term matters so much
Everything in the rest of the course turns on one question: is the error term related to X? If the other influences on Y are, on average, the same whatever the value of X, written E(u | X) = 0, then the regression slope measures how Y responds to X. If they are not, the slope mixes the effect of X with the effects of whatever travels with X. Lesson 5 and Module 8 come back to this.
Common mistake
Thinking regression assumes that X explains everything about Y. It assumes only that the average of Y is a straight line in X. Most of the variation can be in the error term; the model is still fine.
Key ideas
- Simple regression: Y = β₀ + β₁X + u, with E(Y | X) = β₀ + β₁X.
- β₁ is the change in average Y for a one-unit increase in X.
- The error term u holds every other influence on Y.
- Whether u is related to X decides whether the slope can be read as an effect.
Practice questions: Simple regression: fitting the line
Try these, then open each answer to check your work.
- 1.In Y = β₀ + β₁X + u, the error term u represents:
- Mistakes in recording Y
- The effect of X on Y
- All influences on Y other than X
- The intercept
Show answer
Answer: C. The error term collects everything other than X that affects Y.
- 2.OLS chooses the line that minimizes:
- The sum of residuals
- The sum of squared residuals
- The sum of absolute residuals
- The number of points off the line
Show answer
Answer: B. Ordinary least squares minimizes Σû², the sum of squared residuals.
- 3.Σ(X − X̄)(Y − Ȳ) = 60 and Σ(X − X̄)² = 20. The OLS slope is:
- 0.33
- 3
- 20
- 60
Show answer
Answer: B. 60/20 = 3.
Problems with step-by-step solutions
- 4.In the regression Wage = 8 + 1.6 × Schooling + u (wage in dollars per hour, schooling in years), interpret the slope and the intercept.
Show step-by-step solution
- Slope: each additional year of schooling is associated with a $1.60 higher average hourly wage.
- Intercept: the predicted average wage with zero years of schooling is $8. Few people in a typical sample have no schooling, so the intercept is mainly a positioning constant.
- 5.List three things that are likely to be in the error term of the wage regression in Problem 1.
Show step-by-step solution
- Work experience.
- Ability, motivation and family background.
- Occupation, industry, city and luck. (Any reasonable factors are fine.)
Get the full module
The complete module adds every lesson, interactive graphs, a full problem set with step-by-step solutions, and a quiz. The academy opens in January 2027: join the waitlist for the founding price (lifetime access for $179).
Join the waitlist Try a full module free
More practice: free practice questions for this course.