Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Experiments and Causal Effects  ›  Lesson

Regression: Holding Other Things Fixed

Econometrics 15 minA regression coefficient is the change in the outcome per unit of one input while the other inputs in the model are held fixed, and leaving out a confounder shifts its effect onto the inputs that remain.

Regression: Holding Other Things Fixed

The operations head wants to know how much a late delivery costs Pantry in customer ratings. You cannot randomly make deliveries late to find out. You have months of order data instead, but there is a catch: deliveries run late more often on rainy days, and rain puts customers in a worse mood on its own. A simple comparison of late and on-time orders blends the two effects together.

The rule

A regression coefficient is the outcome's change per unit, others held fixed.

A linear regression writes the outcome as a sum of parts, one per input:

rating=b0+b1⋅minutes late+b2⋅rain+error\text{rating} = b_0 + b_1 \cdot \text{minutes late} + b_2 \cdot \text{rain} + \text{error}

Here rain is 1 on a rainy day and 0 on a dry one. In Python with the statsmodels library, the fit is one line:

import statsmodels.formula.api as smf

fit = smf.ols("rating ~ minutes_late + rain", data=orders).fit()
print(fit.params.round(2))
# Intercept       4.60
# minutes_late   -0.03
# rain           -0.20

Read each coefficient as a sentence:

  • Intercept, 4.60: the predicted rating for an on-time order on a dry day.
  • minutes_late, −0.03: comparing orders on the same kind of day, each extra minute late goes with a rating 0.03 lower. Ten minutes late costs about 0.3 stars.
  • rain, −0.20: at the same lateness, rainy-day orders are rated 0.2 lower.

When the same data are fitted with lateness alone, its coefficient is −0.04. The difference is omitted variable bias: without rain in the model, lateness was quietly taking the blame for some of rain's effect, because the two travel together.

Regression can only hold fixed what you put in it. A confounder you never recorded, such as a rider who is both slow and rude, still biases the result. So a coefficient from observational data is an estimate of an effect only if you believe the important confounders are in the model.

The shortcut

To predict, plug in and add. To interpret, say "comparing orders that are alike in everything else in the model."

Predicting two ratingsStep 1 of 4
  1. Start from the intercept

    Every prediction starts at 4.60, the on-time, dry-day rating.

Drills

Answer fast — trust the rule.

Using rating = 4.60 − 0.03 × minutes late − 0.20 × rain, what is the predicted rating for an order 10 minutes late on a rainy day?
4.6−0.03×10−0.2×1= ?4.6 - 0.03 \times 10 - 0.2 \times 1 = \,?
quick drill

What does the coefficient −0.03 on minutes_late mean?

Same weather, one order on time and one 30 minutes late. How much lower is the late order's predicted rating?
0.03×30= ?0.03 \times 30 = \,?
quick drill

With lateness alone, the coefficient was −0.04. Adding rain changed it to −0.03. Why?

quick drill

Which problem can regression NOT fix?

Remember

  • A coefficient is the outcome's change per unit, others held fixed.
  • Predict by plugging in and adding; interpret with "comparing orders alike in everything else".
  • Trap: leaving out a confounder, which shifts its effect onto the variables you kept.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainExplain the lateness model

The fitted model is rating = 4.60 − 0.03 × minutes late − 0.20 × rain. Explain both coefficients to the operations head in plain words, say what ten extra minutes of lateness costs in rating, and explain why the lateness coefficient changed from −0.04 to −0.03 when rain was added.