ECON 310 · Econometrics I

Interaction Terms

Learn how multiplying two variables lets a regression say that the effect of one thing depends on the level of another.

Key takeaways

  • An interaction term is the product of two variables, such as Temperature × Weekend.
  • It lets the effect of one variable change with the level of another.
  • With an interaction in the model, a single coefficient no longer tells the whole story of a variable's effect.
  • A dummy alone shifts a line; a dummy interacted with a variable tilts the line.
  • Keep the plain versions of both variables in the model when you include their product.

Picture Rosa, who runs an ice cream truck. She knows hot days bring more customers. She also knows weekends bring more customers. A regression with temperature and a weekend dummy captures both. But Rosa has a hunch that goes beyond that: on a hot weekend, each extra degree seems to bring in a lot more people than on a hot weekday. On weekdays, people are at work and a warm afternoon barely matters. On weekends, a warm afternoon means the park fills up.

That hunch is not "temperature matters" and not "weekends matter." It is that the effect of temperature depends on whether it is a weekend. A model with only the two plain variables cannot say that, because it gives temperature one slope for every day of the week. To let the slope change, we add something new: an interaction term, which is two variables multiplied together. This lesson shows how it works, how to read it, and the traps that catch beginners.

From parallel lines to a tilt

Recall from the dummy variable lesson that a dummy shifts a regression line up or down but keeps the slope the same. That gives parallel lines. Interactions break the parallel rule.

Let Temp be the temperature in degrees above 60°F, so Temp = 20 means 80°F. Let Weekend equal 1 on Saturdays and Sundays, 0 otherwise. Suppose Rosa's regression of daily sales (in dollars) gives:

Sales = 300 + 8 × Temp + 100 × Weekend + 6 × (Temp × Weekend)

The last piece is the interaction: for each row of data you multiply the two variables to make a new column, and that column gets its own coefficient. On a weekday, Weekend = 0, so the last two terms vanish:

Weekday: Sales = 300 + 8 × Temp

On a weekend, Weekend = 1, so we plug in and collect terms:

Weekend: Sales = 300 + 8 × Temp + 100 + 6 × Temp
       = 400 + 14 × Temp

Now the two groups have different intercepts (300 and 400) and different slopes (8 and 14). Each extra degree adds $8 to a weekday's sales and $14 to a weekend's sales. Check one point. At Temp = 20, a weekday gives 300 + 8 × 20 = 300 + 160 = 460. A weekend gives 400 + 14 × 20 = 400 + 280 = 680. Using the original formula for the weekend: 300 + 160 + 100 + 6 × 20 = 300 + 160 + 100 + 120 = 680. The two routes agree.

The weekend line is higher and steeper
Daily sales ($) Weekday Weekend Weekday Weekend Degrees above 60°F Daily sales ($) Weekday Weekend Weekday Weekend Degrees above 60°F

Weekday slope 8, weekend slope 14. The gap between the lines widens as it gets hotter.

Look at the widening gap. At Temp = 0 the weekend beats the weekday by $100. At Temp = 20 it wins by $220. The weekend "premium" is not one number. It is 100 + 6 × Temp, and it grows with the heat.

How to read every coefficient

This is where people go wrong, so slow down. In a model with an interaction, each plain coefficient answers a narrower question than before.

  • 300 (the intercept): weekday sales when Temp = 0, meaning 60°F.
  • 8 (on Temp): the temperature slope when Weekend = 0. It is the weekday slope, not "the" effect of temperature.
  • 100 (on Weekend): the weekend gap when Temp = 0. It is the gap at 60°F, not "the" effect of weekends.
  • 6 (on the interaction): how much steeper the temperature slope is on weekends than on weekdays. This is the difference in slopes.

The total effect of a variable now depends on the other one. A formula captures it:

The effect of temperature depends on the day
ΔSales ÷ ΔTemp = 8 + 6 × Weekend ΔSales ÷ ΔTemp = Effect of one more degree The answer now has two cases, not one number. 8 = Base slope (weekdays) The coefficient on Temp alone. 6 × Weekend = Weekend adjustment Zero on weekdays, six on weekends. ΔSales ÷ ΔTemp = 8 + 6 × Weekend ΔSales ÷ ΔTemp = Effect of one more degree The answer now has two cases, not one number. 8 = Base slope (weekdays) The coefficient on Temp alone. 6 × Weekend = Weekend adjustment Zero on weekdays, six on weekends.

The change in sales from one more degree is a base slope plus an adjustment that switches on for weekends.

On a weekday, that is 8 + 6 × 0 = 8. On a weekend, it is 8 + 6 × 1 = 14. Same arithmetic as before, just organized differently.

Is the interaction real? Testing it

The coefficient 6 comes with a standard error like every other coefficient (see the standard errors lesson). Suppose its standard error is 2. Then t = 6 ÷ 2 = 3, comfortably beyond the usual cutoff near 2. That is evidence the weekend slope really differs from the weekday slope. If t had been 0.5, Rosa could not tell the slopes apart, and she would probably drop the interaction and keep the simpler model.

You can also test whether the two groups differ in any way, intercept or slope, with an F test. The restrictions are that the Weekend coefficient and the interaction coefficient are both zero (q = 2). The F test lesson shows the machinery. This is useful because a single t test on each piece can miss a combined difference.

Worked example: what an interaction buys you

Suppose Rosa wants to plan her ice cream stock for next Saturday, forecast at 85°F, so Temp = 25. She tries two models and compares.

Model A, no interaction: Sales = 280 + 10 × Temp + 150 × Weekend. This forces one slope of 10 on every day. Its prediction for Saturday is 280 + 10 × 25 + 150 = 280 + 250 + 150 = 680.

Model B, with the interaction: the model above. Its prediction is 400 + 14 × 25 = 400 + 350 = 750.

The two models disagree by $70, and the hot Saturday is where they disagree most. Model A lumps weekdays and weekends together when it picks a slope, so it averages the two (about 10) and underestimates how steeply weekends respond. At a mild temperature, say Temp = 0, Model A predicts 280 on weekdays and 430 on weekends, while Model B says 300 and 400. The models are roughly right near the middle of the data and wrong at the extremes, which is exactly where a stock-up decision hurts.

Notice what this teaches. When an interaction is real, leaving it out is not a harmless simplification. It is a form of bias, much like the problem in the omitted variable bias lesson: you have left out a variable (the product) that belongs in the model, and the plain coefficients absorb its effect and become misleading.

Two dummies interacted

Interactions work with two dummies too. Suppose a regression of wages includes a dummy for college graduate and a dummy for living in a big city. Their product equals 1 only for people who are both. Its coefficient says whether the city premium is bigger for graduates than for non-graduates, beyond the sum of the two separate premiums. With two dummies there are four groups, and the model gives each its own average: neither, graduate only, city only, and both. The interaction coefficient is the extra amount the "both" group earns on top of adding the two single effects.

Two numbers multiplied

Interactions are not limited to dummies. You can multiply two ordinary numbers. Suppose an economist studies wages and includes Education (years) and Experience (years) along with their product:

Wage = b0 + b1 × Education + b2 × Experience + b3 × (Education × Experience)

Then the payoff to one more year of education is b1 + b3 × Experience. If b3 is positive, education pays off more for people with more experience. The same logic holds: the slope is no longer a single number but a rule that depends on the other variable. To summarize the result you pick sensible values, such as 5, 10 and 20 years of experience, and compute the slope at each.

Building and reading an interaction
1 Spot the hunch Does the effect of X seem to depend on Z? 2 Multiply Create a new column equal to X times Z. 3 Keep the parents Leave X and Z in the model along with the product. 4 Test Check the t statistic on the product term. 5 Translate Compute the effect of X at meaningful values of Z. Spot the hunch Does the effect of X seem to depend on Z? 1 Multiply Create a new column equal to X times Z. 2 Keep the parents Leave X and Z in the model along with the product. 3 Test Check the t statistic on the product term. 4 Translate Compute the effect of X at meaningful values of Z. 5

The same five steps work for dummies and for ordinary numbers.

Why keep the plain variables?

If you include Temp × Weekend, also include Temp and Weekend. Dropping them forces strange assumptions. Without the plain Weekend term, you would be saying that weekdays and weekends have exactly the same sales at 60°F, which is an assumption you did not mean to make. Without plain Temp, you would claim that temperature has no effect on weekdays. Unless theory demands those restrictions, keep the parents.

Common mistakes

Reading a plain coefficient as the full effect. In the example, "temperature adds $8 per degree" is true only for weekdays. On weekends, it adds $14. If you quote 8 as the temperature effect, you have told only half the story.

Worrying about the wrong thing: collinearity. The product Temp × Weekend moves with Temp and with Weekend, so the three variables overlap. That can make individual standard errors large and individual t statistics weak. It is not a mistake in the model. It is a side effect of the interaction, and the joint F test is still reliable. A common trick, called centering, subtracts a typical value (such as the average temperature) from the variable before multiplying. Centering makes the plain coefficients easier to interpret, because they now describe the effect at an average value instead of at zero. It does not change the model's predictions. See the multicollinearity lesson for the broader picture.

Interpreting at an impossible value. The Weekend coefficient of 100 is the gap at Temp = 0. If Temp = 0 means 60°F, that is fine. But if you had measured temperature in raw degrees, Temp = 0 would mean 0°F, a value never seen in the data, and the plain coefficients would be hard to interpret. That is another reason to define variables so that zero is meaningful.

Hunting for interactions until one pops up. Try twenty interactions and about one will look significant by luck alone. Choose interactions because theory or common sense suggests them before looking at the output.

Words to know

Interaction term a new variable made by multiplying two variables, letting the effect of one depend on the other.

Main effect the coefficient on a plain variable that also appears in an interaction.

Slope shift a change in the slope of a line between groups, captured by an interaction.

Intercept shift a change in the height of a line between groups, captured by a dummy alone.

Centering subtracting a typical value from a variable so its coefficients describe effects at that typical value.

Marginal effect the change in the outcome from a one-unit rise in a variable, which with an interaction depends on another variable.

Moderator a variable, such as Weekend here, that changes the strength of another variable's effect.

Check yourself

  1. In your own words, what does an interaction term let a regression do that two plain variables cannot?
  2. Using Sales = 300 + 8 × Temp + 100 × Weekend + 6 × (Temp × Weekend), predict sales on a weekend when Temp = 10.
  3. Using the same model, what is the effect of one more degree of temperature on a weekday, and on a weekend?
  4. The interaction coefficient is 6 with a standard error of 2. Compute the t statistic and say what it suggests.
  5. Why is the coefficient of 100 on Weekend not "the effect of weekends" in this model?
  6. Explain why you should normally keep Temp and Weekend in the model when you include their product.
Show the answers
  1. It lets the effect of one variable change with the level of another, so slopes can differ across groups or across values.
  2. Sales = 300 + 8 × 10 + 100 + 6 × 10 = 300 + 80 + 100 + 60 = 540.
  3. Weekday: 8 dollars per degree. Weekend: 8 + 6 = 14 dollars per degree.
  4. t = 6 ÷ 2 = 3, which is beyond the usual cutoff near 2, so the weekend slope likely differs from the weekday slope.
  5. With an interaction, 100 is the weekend gap only at Temp = 0; the full gap is 100 + 6 × Temp, which grows with temperature.
  6. Dropping them imposes unintended assumptions, such as equal weekday and weekend sales at 60°F or no temperature effect on weekdays.

A free self-study program written for 4Economics with AI writing tools and not reviewed line by line by a person. It is not an accredited degree and awards no credit. Check anything you rely on against a textbook or primary source. Report an error.

In this unit: Multiple regression

  1. Multiple Regression and Holding Things ConstantMultiple regression adds more predictors so each slope shows the link between x and y with the other variables held fixed.10 min
  2. Omitted Variable BiasLeaving out a variable that affects the outcome and relates to your predictor makes the slope wrong. Learn the size and direction of the error.10 min
  3. Testing Several Coefficients: The F TestLearn how the F test checks whether a group of regression variables matters together, even when each one looks weak alone.11 min
  4. Dummy VariablesSee how 0-or-1 variables let a regression handle categories like seasons or yes-or-no features, and how to avoid the dummy trap.11 min
  5. Interaction TermsLearn how multiplying two variables lets a regression say that the effect of one thing depends on the level of another.10 min
  6. Logs, Squares and Functional FormLearn how squares and logarithms let a straight-line regression fit curves, and how to read the coefficients in each form.10 min
  7. Choosing Which Variables to IncludeLearn how to decide what goes into a regression, and why leaving out and piling in variables both cause trouble.10 min

In the news