Indicator Variables and Interactions
An indicator variable turns a category into a number a regression can use, and its coefficient is a difference in conditional means. An interaction lets a relationship differ by group, which changes what every other coefficient in the model means: once an interaction is present, the main effect is the effect at the reference value, not an overall effect.
Definition
An indicator (dummy) variable takes
Formal statement
Assumptions and scope
With an interaction in the model, the main effect of
is the group difference at the reference value , not an overall difference. Centringmoves that reference to a meaningful point. An indicator coefficient is a difference in conditional means. It is causal only when the design or an identification argument makes it so; the algebraic equality with
does not supply that.A categorical variable with
levels needs indicators alongside an intercept. Including allmakes singular and the coefficients individually undefined. Every indicator coefficient is a comparison against the omitted reference category, so changing the reference changes each coefficient's meaning without changing the model's fit.
An interaction is symmetric:
is equally the slope difference between groups and the change in the group gap per unit of . Testing an interaction for significance and dropping it when it fails to reject uses the data twice; whether the interaction belongs is a question about the research question, not only about a p-value.
A treatment-covariate interaction estimated in an experiment is a subgroup analysis, and its multiplicity must be accounted for if the subgroups were not specified in advance.
Worked material
Example
The same model, two reference points
A trial of a training programme fits, with
The naive reading. "The programme adds 2.4 points."
What
The difference at realistic values. The gap between the groups is
- at 5 years:
points - at 15 years:
points - at 25 years:
points
So the programme's benefit rises steeply with experience, and 2.4 understates it everywhere in the observed range.
What centring changes. Suppose mean experience is 12 years. Refitting with
Non-example
Readings the parameterisation does not support
"With an interaction in the model, the main effect is the average effect." It is the effect at the other variable's reference value. Those coincide only if the reference happens to be the mean, which is what centring arranges deliberately.
Reading an uncentred
Including all
Comparing indicator coefficients across models with different reference categories. Each is a comparison against whichever category was omitted; changing the reference changes every coefficient without changing the fit.
Dropping an interaction because its p-value exceeded 0.05, then reading the main effect as an overall effect. Testing and then conditioning on the test uses the data twice, and whether effects genuinely vary is a question about the research question, not only a threshold.
Treating a treatment-covariate interaction found after the fact as an established subgroup effect. Unless specified in advance, it carries the multiplicity of all the subgroups that could have been examined.
Contrast
Main effects with and without an interaction term
| No interaction in the model | Interaction present | |
|---|---|---|
| The group difference, everywhere | The group difference at | |
| Slopes | Forced equal across groups | Free to differ, by |
| Group gap | Constant | |
| Effect of centring | Changes | Changes |
| A single headline number | Defensible | Requires choosing a value of |
Why the misreading persists. Software labels
The diagnostic question. Ask what happens to the interaction term when the other variable is zero. It vanishes, which is exactly why
Symmetry.
What centring does and does not change. It relocates the reference point, changing
Common errors
Common misconception
In a model containing an interaction, the coefficient on a variable is still its overall effect, averaged across the values of the variable it interacts with.
Related units
Requires
Connected
- Regression Adjustment in Experiments (used by)
- ANOVA for Experimental Research (contrasts with)