Interaction Terms
- #intro-econometrics
- #interaction-terms
- #chow-test
- #chow-fisher-test
- #hedonic-pricing
- #dummy-variables
- #F-test
- #OLS
Interaction Terms
Part of: Intro Econometrics | Key concepts: Interaction Term, Chow Test, Chow-Fisher Test, Hedonic Pricing, Dummy Variable, F-test, Omitted Variable Bias
Where this lecture sits
The thread from last weekLast week (Lec_10-Dummy Variables) showed how a dummy variable lets each group have its own intercept — but it forced every group to share the same slope (parallel lines). That is a strong, often wrong, assumption: the marginal effect of education on wage, or of alcohol content on price, may genuinely differ across groups. This lecture removes that straitjacket. The interaction term lets the slope itself vary across groups, and the Chow test gives a formal way to ask "are these two (or more) groups described by the same regression, or by genuinely different ones?"
The lecture has three strands:
- Hedonic pricing (a worked review of Omitted Variable Bias): how adding product-characteristic controls flips the sign of the time trend in computer prices — and what "controlling for quality" really buys you. Needed for HW 7.
- Interaction terms: dummy × continuous (different slopes), and dummy × dummy (interaction between two categories).
- Chow / Chow-Fisher tests: two equivalent ways (pooled-with-dummies, or separate regressions) to test whether groups share a common regression function, including how to count the restrictions .
Part 0 — Review: dummies and categorical variables
Quick recap of the machinery this lecture builds on.
A binary dummy (=1 if observation is in category A, else 0) enters linearly:
Splitting by group, the slope is shared and only the intercept moves by :
| Group | Model becomes | Intercept |
|---|---|---|
| Not A | ||
| A |
For a variable with categories we create dummies; the omitted group is the base category and every coefficient is read relative to it. To test whether the categorical variable matters as a whole, restrict all its dummies to zero jointly and use an F-test (); for a single binary dummy a t-test suffices.
The limitation that motivates todayDummies give different intercepts but a common slope — parallel lines. The whole point of an interaction term is to break the parallelism and let each group's line tilt differently.
Part 1 — Hedonic pricing (omitted-variable bias in action)
The questionBased on the paper "Price Indexes for Microcomputers", we want to measure how PC prices changed over 1980–1988, the years personal computers became mainstream. The dependent variable is the (log) list price; the running variable is
YEAR.
The naïve regression — a misleading non-result
ln_price ~ YEARCoefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.99242 1.33905 4.475 9.4e-06 *** YEAR 0.01779 0.01565 1.137 0.256 Multiple R-squared: 0.0024 F-statistic: 1.293 on 1 and 528 DFThe time trend is positive and insignificant (, ). Read literally: "PC prices barely moved, if anything rose slightly, over the decade." That is the opposite of the truth.
Why the naïve coefficient is wrong: the product changedA 1988 computer is not the same product as a 1980 one — it has more RAM, a faster processor, a bigger disk. The raw
YEARcoefficient mixes two things: the price change of a fixed computer and the price change from buying a better computer. Quality is an omitted variable correlated withYEAR, so is biased toward zero (even positive). This is exactly the Omitted Variable Bias story from Lec_10-Dummy Variables.
Adding controls — the sign flips
Add processor-type dummies (PROC16, PROC32; 8-bit is the base), a black-and-white screen dummy (DBW) and a portable dummy (DPORT):
ln_price ~ YEAR + PROC16 + PROC32 + DBW + DPORTCoefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.56651 1.31025 12.644 <2e-16 *** YEAR -0.11315 0.01556 -7.270 1.3e-12 *** PROC16 0.85908 0.07327 11.724 <2e-16 *** PROC32 1.87927 0.11994 15.668 <2e-16 *** DBW 0.16282 0.06376 2.554 0.0109 * DPORT -0.17039 0.08616 -1.978 0.0485 * Multiple R-squared: 0.363Now
YEARis negative and highly significant: holding processor and screen type fixed, prices fell ≈11% per year. Once we stop comparing apples (cheap old machines) to oranges (powerful new ones), the genuine downward price trend appears.
Full specification — the hedonic model
Add the logged quantitative characteristics (ln_ram, ln_mhz, ln_hardisc, ln_slots, ln_numflp):
Full model —ln_price ~ YEAR + processor/screen dummies + logged characteristicsCoefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 30.43992 1.18295 25.732 <2e-16 *** YEAR -0.30154 0.01487 -20.277 <2e-16 *** PROC16 0.27929 0.05751 4.856 1.6e-06 *** PROC32 0.67969 0.10863 6.257 8.4e-10 *** DBW 0.12001 0.04471 2.684 0.0075 ** DPORT 0.44401 0.06478 6.854 2.1e-11 *** ln_ram 0.20183 0.02839 7.110 4.0e-12 *** ln_mhz 0.32726 0.05338 6.131 1.8e-09 *** ln_hardisc 0.19372 0.01543 12.556 <2e-16 *** ln_slots 0.18755 0.03039 6.171 1.4e-09 *** ln_numflp 0.60119 0.07045 8.534 <2e-16 *** Multiple R-squared: 0.726With full quality controls,
YEAR: a quality-constant computer got ≈30% cheaper each year, and jumps from 0.36 to 0.73. The more characteristics we hold fixed, the more of the apparent price stability is revealed to be quality improvement.
What hedonic pricing meansHedonic pricing decomposes the price of a heterogeneous good into the implicit prices of its characteristics. The coefficient on
YEARthen measures the price change of a "computer unit" of constant quality — what you would actually pay over time for the same bundle of features. It is the standard method for building quality-adjusted price indexes for goods with lots of variation: PCs, real estate, cars.
Two modelling rules from this example
- Dummy variables always enter linearly (you cannot take a log of a 0/1 variable).
- Take logs of the quantitative characteristics — this is a demand/price function, so a log-log form gives coefficients that read as elasticities and tends to fit better.
Part 2 — Interaction terms: letting slopes differ
The motivating gapDummies move the intercept but keep the lines parallel. What if the regression lines for two groups have different slopes — e.g. an extra year of schooling raises men's wages by more (or less) than women's? We need a term that lets the marginal effect of a continuous variable depend on group membership. That term is the interaction term.
Constructing the interaction
Interact the dummy male with the continuous variable schooly:
The interaction term is literally the product of the two variables. For women it switches off; for men it equals schooly:
What each group's line looks like
| Group | Model becomes | Intercept | Slope | |
|---|---|---|---|---|
| Women | ||||
| Men |
Interpreting the four coefficients
- = intercept for the base group (women).
- = slope (return to schooling) for the base group (women).
- = the intercept gap between men and women (the pure dummy effect).
- = the slope gap: how much more (or less) a year of schooling is worth to men than to women.
So men's return to schooling is . With and , men start higher but their line is flatter — the lines can even cross. The two groups now differ in both slope and intercept.
The boxed takeaway
Worked R example — does the return to schooling differ by sex?
ln_wage ~ schooly + age_g + agesq + origin_ussr + married + divorced + male + schooly_maleCoefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.63033498 0.08722324 -7.227 5.3e-13 *** schooly 0.09289182 0.00330030 28.146 <2e-16 *** ... male 0.12722976 0.06557115 1.940 0.0524 . schooly_male -0.00025413 0.00457271 -0.056 0.9557The interaction
schooly_maleis tiny and insignificant (): the return to a year of schooling is essentially the same for men and women. The intercept gapmaleis significant only at ≈10%.
Interactions inflate collinearity
maleandschooly_maleare highly correlated by construction (one is the other timesschooly), so adding the interaction term drains significance frommale— its t-value fell onceschooly_maleentered. A jointly-relevant pair can look individually weak; reach for a joint F-test when in doubt (same lesson as multicollinearity in Lec_08-Goodness of Fit & Multicollinearity).
Interactions between two dummies
You can also interact a dummy with another dummy — useful for asking whether a penalty is compounded for people in two categories at once.
Are USSR-born women penalised more than additive effects predict?Build
ussr_male = origin_ussr × maleand estimateln_wage ~ ... + origin_ussr + male + ussr_male:origin_ussr -0.15648770 0.02660990 -5.881 4.2e-09 *** male 0.11306168 0.01512553 7.475 8.4e-14 *** ussr_male 0.07107255 0.03873032 1.835 0.0665 .The four group intercepts (assume everyone single) are built by adding the relevant coefficients:
Group Intercept Women, Israel (base) Men, Israel Women, USSR Men, USSR The interaction
ussr_maleis only marginally significant (): USSR-born men recover a little of the immigrant penalty relative to what the two separate dummies alone would predict, but the evidence is weak.
Why the interaction term is the deviation from additivityWithout
ussr_male, the model forces the USSR penalty to be identical for men and women (and the male premium identical across origins). The interaction coefficient measures exactly the departure from that additive assumption — the "extra" effect of being in both categories at once.
Part 3 — Interaction terms vs. separate regressions
You can let every coefficient differ by group in two equivalent ways:
- One pooled regression with the group dummy interacted with every regressor.
- Separate regressions, one per group.
When to prefer separate regressionsInteracting the dummy with many regressors gets unwieldy fast (one extra term per variable). Running separate regressions for men and women is cleaner and — importantly — allows the error variance to differ between groups, which improves efficiency if the groups really are heteroskedastic relative to each other. The pooled-with-interactions model implicitly assumes a common error variance.
Estimating ln_wage ~ schooly + age_g + agesq + origin_ussr + married + divorced separately on women and on men gives visibly different coefficient vectors (e.g. women's intercept vs men's , women's return to schooling vs men's ). The formal question — are these differences real, or sampling noise? — is answered by the Chow test.
Part 4 — Chow tests: do two groups share one regression?
The Chow testA Chow test asks whether two (or more) groups are described by the same regression function (same intercept and same slopes) or by different ones. It is just an F-test of a joint restriction, with a specific name. There are two equivalent implementations.
Version A — using dummy variables (pooled)
Start from and allow the group man to differ in both intercept and slope by adding the dummy and its interaction:
- Men:
- Women:
The null "men and women share one regression" is
The restricted model is the pooled . Test with the usual F-statistic:
We reject if the intercept differs (), the slope differs (), or both.
Wage regressions for men vs women> lfit <- lm(ln_wage ~ schooly + male + schooly_male, mydata) > lfit_r <- lm(ln_wage ~ schooly, mydata) > anova(lfit, lfit_r) Res.Df RSS Df Sum of Sq F Pr(>F) 1 10169 6809.3 2 10171 6847.5 -2 -38.245 28.558 4.3e-13 ***on with : reject . Men and women do not share the same wage regression.
With many regressors the restriction count growsIf the base model has several explanatory variables, allowing all of them to differ by group means interacting the dummy with each one. For a model with intercept + 4 slopes, letting every coefficient vary adds 5 terms, so — an F-test with 5 restrictions.
Version B — using separate regressions
Equivalently, fit the model separately on each group and combine the residual sums of squares. For men and women , the null is
and the statistic uses the pooled RSS as restricted, and the sum of the group RSSs as unrestricted:
What and mean here
- = total number of observations (both groups pooled).
- = total number of parameters in the unrestricted model = parameters in the men's model plus parameters in the women's model.
- = the number of restrictions.
Worked separate-regression Chow test (6-regressor wage model)With , , pooled , , and (7 parameters 2 groups), : Reject: men and women have different wage regressions. (Same conclusion as Version A — the two versions are equivalent.)
Comparison of the two versions
| Version A — dummies (pooled) | Version B — separate regressions | |
|---|---|---|
| What you estimate | one regression with dummy + interactions | one regression per group |
| Restricted RSS | RSS of pooled model (no dummies) | RSS of pooled model (no dummies) |
| Unrestricted RSS | RSS of the dummy-interacted model | (sum across groups) |
| Error variance | assumed common across groups | allowed to differ across groups |
| Result | identical F and decision ... | ... to Version A |
| Best when | few regressors; want common-variance efficiency | many regressors; worried about group heteroskedasticity |
Counting the restrictions
— count parameters, subtractFor (3 parameters):
Groups Unrestricted df Restricted df 2 groups (A, W) (3 params 2) 3 groups (A, W, F) (3 params 3) Shortcut: — the number of coefficient equalities the null imposes.
Chow tests over timeIf the "group" is a time period (e.g. before vs after a policy), the Chow test becomes a structural-stability / structural-break test: define a dummy = 1 in one period, build interaction terms, and F-test whether the relationship is stable across periods.
Part 5 — The Chow-Fisher test (three or more groups)
The Chow-Fisher test generalises the separate-regression Chow test to more than two groups — here, the demand for alcoholic beverages split into beer, wine, and spirits.
Setup — demand for alcohol (British Columbia 2012)Log-log demand function (logs because it is a demand model): where
abv= % alcohol by volume.
Interactions reveal group-specific elasticities
Add interaction terms between the product-type dummies and ln abv (spirits is the base):
Because the outcome and abv are both logged, (and + each interaction) is a price elasticity with respect to abv:
Price elasticity of abv by product typeWith , (beer), (wine):
- Spirits (base):
- Wine:
- Beer:
The price sensitivity to alcohol content is strongest for wine, weakest for beer — exactly the kind of group-varying slope a single common coefficient would hide.
The Chow-Fisher F-statistic
Run separate regressions for beer, wine, and spirits and combine their RSSs against the pooled (restricted) RSS:
Activity 11, part 4 — the null and the test statisticThe null says every coefficient is equal across the three product types: With 9 parameters per group:
- (each of the 9 coefficients set equal across the two extra groups).
- (parameters in all three group regressions).
- . Beer, wine, and spirits do not follow a common demand regression.
Don't confuse andcounts all parameters in the unrestricted (all-groups-separate) model; counts the equality restrictions the null imposes, which is (params per group) (groups ). For 3 groups and 9 params: but , not 27.
Practice exam — adding , model choice, and OVB
SetupResearchers believed and alone explain : A researcher suspects also matters and estimates: (All of are strictly positive.)
1(a) — How did the researcher conclude matters? From the p-value of , here . It is far below 5%, so the coefficient on (in model 3) is significant ⟹ the variable is relevant.
1(b) — Why is model (3) better than model (2)? Compare (or equivalently the RSSs): . Model (3) explains more variation, so the specification fits better than the raw one.
2 — Which assumption does model (1) violate? (assume model 3 is the truth)If model (3) is the true DGF, then model (1) omits the relevant regressor , which is absorbed into the error . If and are correlated, then in model (1) the error is correlated with the regressor : . This violates assumption A2, (mean independence of the error from the regressors) — answer (ii). The other classical assumptions (zero mean, no autocorrelation, homoskedasticity) are not what fails.
3 — If and are uncorrelated, how do and compare?Omitting from model (1) generally causes omitted-variable bias in the other coefficients, so we'd normally expect . But OVB only transmits through correlation between the omitted variable and the included one. If , omitting does not bias the coefficient on : — answer (iii). This is the precise condition under which OVB vanishes: no correlation between the omitted and included regressor.
Summary
- Hedonic pricing / OVB review: regressing PC
ln_priceonYEARalone gives a positive, insignificant trend because newer machines are better machines — quality is an omitted variable correlated with time. Adding characteristic controls flipsYEARto strongly negative (≈−30%/yr with full controls). TheYEARcoefficient then measures the price of a constant-quality "computer unit". Rules: dummies enter linearly, quantitative characteristics enter as logs (demand function). - A dummy variable gives different intercepts but a common slope (parallel lines). An interaction term — the product of a dummy and a continuous variable — gives different slopes. In : is the intercept gap, is the slope gap, and the value-1 group's slope is .
- Dummy × dummy interactions measure the departure from additivity — the extra effect of being in two categories at once (e.g. USSR-born and male). Interactions are highly collinear with their parents, so they drain individual significance; lean on joint F-tests.
- Letting every coefficient differ by group can be done by interacting the dummy with every regressor (pooled) or by separate regressions. Separate regressions are cleaner with many regressors and allow group-specific error variances.
- A Chow test is an F-test of "do the groups share one regression?". Version A (dummies): all dummy + interaction coefficients , unrestricted RSS from the interacted model. Version B (separate): unrestricted RSS , restricted RSS from the pooled model. The two are equivalent.
- Counting restrictions: ; ; = pooled sample size. For the 3-group alcohol model with 9 params: , .
- The Chow-Fisher test extends the separate-regression Chow test to 3+ groups (beer/wine/spirits). Interactions with
ln abvreveal different elasticities per type (wine 2.03, spirits 1.52, beer 0.55), and the F-test rejects a common demand regression. - Exam OVB rule: omitting a relevant variable biases an included coefficient only if the two are correlated. Correlated ⟹ A2 violated, , bias. Uncorrelated ⟹ that coefficient stays unbiased ().
Related Notes
- Previous: Lec_10-Dummy Variables — different intercepts per group (the parallel-lines case this lecture generalises)
- Next: Lec_12-Heteroskedasticity — non-constant error variance (and why separate-group regressions can be more efficient)
- Foundational: Lec_08-Goodness of Fit & Multicollinearity — the joint F-test and collinearity (which interactions worsen)
- Concepts: Interaction Term, Chow Test, Chow-Fisher Test, Hedonic Pricing, Omitted Variable Bias, F-test, Dummy Variable
- Hub: Intro Econometrics