Dummy Variables and Interaction Terms
How a regression handles categories (like sector or day-of-week) using 0/1 switch variables, and how multiplying two variables together lets the effect of one depend on the level of another instead of being forced to stay fixed.
Prerequisites: The Classical Linear Regression Assumptions
An ordinary regression coefficient is a single number, but a lot of real relationships aren't single numbers — a stock's beta to the market might genuinely differ on Mondays versus other days, or the effect of a factor might depend on which sector a stock is in. Plain linear regression, in its basic form, can't represent "which category something belongs to" (categories aren't numbers to multiply by) and can't represent "the slope changes depending on another variable" (an ordinary coefficient is fixed). Dummy variables solve the first problem and interaction terms solve the second, and together they let a linear regression flexibly capture both categorical differences and slopes that shift across conditions — all while staying, technically, a linear regression.
An analogy: light switches and thermostats
A dummy variable is a light switch: it's either 0 (off) or 1 (on), and flipping it shifts the regression's baseline up or down by a fixed amount, exactly like turning on a light shifts the room's brightness by a fixed amount regardless of anything else going on. An interaction term is more like a thermostat that changes how strongly a heater responds to the outside temperature: instead of just adding a fixed shift, it changes the slope of an existing relationship depending on another variable's value — the heater doesn't just turn fully on or off, its intensity of response ramps differently depending on conditions. Dummies shift the intercept; interactions bend the slope.
The mechanics, one symbol at a time
A dummy variable takes the value 1 for observations in a category and 0 otherwise — for instance, on Mondays and 0 on all other days. Adding it to a regression, , gives category members a different intercept () while sharing the same slope as everyone else — in plain English, is simply "how much higher or lower, on average, this category sits, holding fixed." An interaction term multiplies two variables together, , and adding it, , lets the category have both a different intercept and a different slope:
In plain English: without the interaction term, both groups are forced to share the exact same slope and can only differ by a fixed shift ; the interaction coefficient frees the model to let the slope itself differ between groups, which is exactly what's needed when you suspect the relationship, not just the baseline level, changes across categories.
Worked example 1: a sector dummy
A regression predicts monthly stock return from market beta exposure , with a dummy for tech-sector stocks and otherwise: . For a non-tech stock with : . For a tech stock with the same beta exposure : . The tech dummy adds a flat 0.8 percentage points on top, regardless of the beta level — tech stocks are predicted to outperform non-tech stocks with identical market exposure by a constant 0.8 points, no matter how high or low that exposure is.
Worked example 2: adding an interaction
Now suppose the fitted model includes an interaction: . For the same non-tech stock, , the prediction is unchanged at 1.52%. For a tech stock with : . But for a tech stock with higher exposure, : , compared to a non-tech stock at the same exposure, — tech now underperforms non-tech at high beta, a reversal that a model without the interaction term could never represent, since it would have forced the 0.8-point tech premium to stay constant at every level of exposure.
Interaction terms produce exactly this kind of "two lines with different slopes" picture — imagine two straight lines drawn instead of one curve, one for each category, crossing at the exposure level where the group difference flips sign.
What this means in practice
Dummy variables and interactions are the standard toolkit for encoding "which group does this belong to" and "does the relationship itself differ by group" inside an otherwise linear model — sector or country fixed effects, day-of-week seasonality in trading volume, or letting a strategy's factor exposure differ across market regimes. They're also how panel data fixed effects (see Panel Data and Fixed Effects) are built under the hood: one dummy per entity, absorbing entity-specific baseline differences before the variable of interest is estimated.
A dummy variable shifts a regression's intercept for a category (a fixed offset, same slope); an interaction term (a variable multiplied by the dummy, or by another variable) lets the slope itself differ across categories. Use a dummy alone when you expect a constant gap between groups, and add an interaction when you suspect the relationship changes across groups, not just the baseline level.
The classic mistake is adding an interaction term without also keeping both of its component "main effect" terms in the model (the plain and the plain alongside ). Dropping a main effect forces a specific, usually unintended, constraint — for instance, forcing both groups through the same intercept even though the data doesn't support it — and the interaction coefficient's meaning becomes distorted and hard to interpret. Always include the interaction alongside its full set of main effects unless there's a specific, well-justified reason not to.
Related concepts
Practice in interviews
Further reading
- Wooldridge, Introductory Econometrics, ch. 7
- Angrist & Pischke, Mostly Harmless Econometrics, ch. 3