Indicator Variables and Interactions

An indicator, or dummy, variable represents membership in a category:

\[D_i\in\{0,1\}.\]

Difference in levels

In the model

\[Y_i=\beta_0+\beta_1D_i+\varepsilon_i,\]

the conditional means are

\[E[Y\mid D=0]=\beta_0, \qquad E[Y\mid D=1]=\beta_0+\beta_1.\]

Therefore,

\[E[Y\mid D=1]-E[Y\mid D=0]=\beta_1.\]

If $D_i=W_i$ is treatment assignment in a two-arm experiment, OLS with an intercept gives

\[\hat\beta_1=\bar Y_1-\bar Y_0.\]

This algebraic equality does not by itself make the contrast causal; causal interpretation comes from Randomized Assignment or another identification argument.

Interaction with a continuous variable

Consider

\[Y=\beta_0+\beta_1X+\beta_2D+\beta_3XD+\varepsilon.\]

For $D=0$,

\[E[Y\mid X,D=0]=\beta_0+\beta_1X.\]

For $D=1$,

\[E[Y\mid X,D=1] =(\beta_0+\beta_2)+(\beta_1+\beta_3)X.\]

Thus $\beta_2$ is the group difference at $X=0$, and $\beta_3$ is the difference in slopes. Centering $X$ at a meaningful value makes $\beta_2$ easier to interpret.

Experimental interpretation

Treatment-covariate interactions allow the treatment effect to vary with baseline covariates. They are also used in fully interacted regression adjustment:

\[Y_i=\alpha+\tau W_i+X_i^\top\beta+W_iX_i^\top\gamma+\varepsilon_i.\]

Common trap

When an interaction is present, the main effect of $D$ is not an overall treatment effect. It is the effect at the reference value $X=0$ unless variables were centered or the model was otherwise parameterized.

See