← All topics

Dummy Variables & Interactions

Two groups (circles and triangles) each have their own relationship between x and y. A model with a dummy variable for group lets each group have its own intercept but forces the same slope on both — the dashed lines below are always parallel. A model that adds an interaction between x and group lets the slopes differ too — the solid lines. Turn up "true slope difference" and watch the dashed lines become a visibly worse fit for both groups, while the solid lines track them correctly.

Group A Group B No-interaction fit (forced parallel) Interaction fit (separate slopes)

Group is dummy coded as group = 0 for Group A and group = 1 for Group B.

No interaction: ŷ = – + –·x + –·group  |  SSE = –

Group A (group = 0): ŷ = – + –·x

Group B (group = 1): ŷ = – + –·x

With interaction: ŷ = – + –·x + –·group + –·(x·group)  |  SSE = –

Group A (group = 0): ŷ = – + –·x

Group B (group = 1): ŷ = – + –·x

SS reduction from adding the interaction = – (df = 1, out of SSEno interaction = –)