The full academy launches January 2027. Join the waitlist for the $179 founding price.
Waldbauer Academy of Economics

Courses › Statistics and Econometrics

Second and third year · Module 6 of 15

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.

By Maximus S. Waldbauer · About 3 hours, including the problem set and quiz.

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

What this module covers

  1. The regression model
  2. Ordinary least squares
  3. Fitted values and residuals
  4. Measuring fit: R-squared and the standard error of the regression
  5. Reading regressions with care
  6. Problem set with step-by-step solutions
  7. 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:

Yi = β0 + β1Xi + ui

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. 1.In Y = β₀ + β₁X + u, the error term u represents:
    1. Mistakes in recording Y
    2. The effect of X on Y
    3. All influences on Y other than X
    4. The intercept
    Show answer

    Answer: C. The error term collects everything other than X that affects Y.

  2. 2.OLS chooses the line that minimizes:
    1. The sum of residuals
    2. The sum of squared residuals
    3. The sum of absolute residuals
    4. The number of points off the line
    Show answer

    Answer: B. Ordinary least squares minimizes Σû², the sum of squared residuals.

  3. 3.Σ(X − X̄)(Y − Ȳ) = 60 and Σ(X − X̄)² = 20. The OLS slope is:
    1. 0.33
    2. 3
    3. 20
    4. 60
    Show answer

    Answer: B. 60/20 = 3.

Problems with step-by-step solutions

  1. 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
    1. Slope: each additional year of schooling is associated with a $1.60 higher average hourly wage.
    2. 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.
  2. 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
    1. Work experience.
    2. Ability, motivation and family background.
    3. 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.