Module 3 of 3 · Lesson 2 of 3
Indicator Variables and Interactions
Indicator coding and interactions, and how the reference category determines a main effect.
What you will be able to do
Given a model containing indicators and interactions, the learner can state what each coefficient means, identify the reference point it depends on, and recover a quantity of interest from the parameterisation.
Orientation
A coefficient on an interaction term is not "the effect of the interaction". What each coefficient means depends on what the others are holding fixed, and the main effect is the one people misread.
The arithmetic is elementary. The difficulty is that a coefficient's meaning depends on how the model was parameterised, so the same number answers different questions depending on what else is in the equation.
Intuition
What the group coefficient reports before and after centring
The canonical intuition establishes that an indicator coefficient is a difference between conditional means, and that adding an interaction changes what that coefficient refers to. This block follows one fitted model through that change.
Fit
Without the interaction term,
With the interaction term present, the group difference is
After centring
Centring therefore does not improve the model. It moves the reference point of the group coefficient to a value within the data, so that the coefficient reports a comparison someone asked for.
Definition
Indicators, interactions, and what each coefficient means
The canonical statement gives the two regressions and what each coefficient equals. Three readings of it decide whether the numbers are reported correctly, and none is stated above.
The algebraic identity is not the warrant. That OLS with an intercept returns
An interaction moves what the main effect means. In
The reference category is a choice that shows up in every coefficient. With
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
Worked example
An effect that is not what it looks like
Problem. A study of a tutoring programme reports:
where baseline runs from 20 to 90 with mean 60, and
Goal. Say what the coefficients report and give the effect on a defensible scale.
Relevant principle. With an interaction present, the coefficient on
Step 1: locate the reference point.
Reason: setting baseline to 0 zeroes the interaction term, leaving
Step 2: judge whether that point is meaningful. Baseline scores run from 20 to 90. Zero is outside the data entirely, so 3.10 describes a student who does not exist in this sample.
Reason: a fitted surface is estimated where the data are; reading it elsewhere extrapolates.
Step 3: write the effect as a function.
Step 4: evaluate across the observed range.
- at
: points - at
(the mean): points - at
: points
Reason: the negative interaction means the benefit shrinks as baseline rises, reversing sign in the upper range.
Step 5: restate the finding. The programme helps weaker students modestly, does essentially nothing at the average, and is associated with slightly worse outcomes for the strongest. "Raises scores by 3.1 points" is true at no observed value of baseline.
Result. The effect is
Check. Centring baseline at its mean would give a
Interpretation. Report the effect at substantively chosen values of baseline, or centre and report the average-case effect alongside the interaction. Also note that this is a subgroup pattern: unless the variation by baseline was specified in advance, it is a hypothesis for the next study rather than an established finding.
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
Exercise
1: fully structured. A model gives
(a) What is the fitted line for
Check: (a)
2: partly structured. An analyst centres a covariate at its mean and refits, reporting that the treatment coefficient changed from 1.2 to 4.8.
(a) Did the model change? (b) What do the two numbers mean? (c) Which should be reported?
Check: (a) no, fitted values, residuals and
3: unstructured. A clinical report states: "In our model including a treatment-by-age interaction, the treatment coefficient was 0.4 (
Assess both conclusions. Patients range from 45 to 80 years, and age was entered uncentred.
Check: the first conclusion is unsupported, 0.4 is the treatment effect at age zero, far outside the 45-to-80 range, so its non-significance says nothing about the effect at any age anyone in the study had. The effect at age
What to carry forward
Indicator coefficient.
In a two-arm experiment. OLS on an intercept and a treatment indicator returns
Interaction model.
The key reading. With an interaction present,
Centring. Subtracting a meaningful value from
Subgroup caution. A treatment-covariate interaction not specified in advance carries the multiplicity of every subgroup that could have been examined.
The recurring error. Reading a main effect as an overall effect when an interaction is in the model.