Lawfare Academy

Regression and Business Forecasting · Chapter 4 of 6

Categorical predictors and interactions without coefficient shortcuts

Return to the linked course unit →

DEVELOPED COURSE TEXT

Categorical predictors and interactions without coefficient shortcuts

Coding defines the reference comparison

An indicator variable represents a category through a specified coding scheme. With an intercept and a complete set of category indicators, some columns can be redundant; a reference or other identifying constraint is needed. The reference category affects coefficient interpretation, not the underlying fitted comparisons when parameterizations are equivalent. State the coding and the predictor units whenever presenting an equation.

An interaction makes an effect conditional

An X-by-group term allows the relationship between X and Y to differ across groups under the model. The main group coefficient then describes a difference at the reference value of X, not necessarily a constant difference at every X. Likewise, the main X slope applies to the reference group under a usual indicator coding. Interpret predicted contrasts at meaningful predictor values instead of reading each coefficient as an unconditional effect.

Centering changes interpretation, not fitted outcomes

Re-expressing X around a meaningful value can make the intercept and group contrast easier to discuss. If interactions are transformed consistently, fitted outcomes remain unchanged. Centering does not by itself solve a causal problem or create new data support. A categorical predictor can stand for a bundle of circumstances; its coefficient is not automatically an explanation of why the categories differ.

Worked records

Record 1

A fictional model is Y = 20 + 4X + 6D − 2XD, where D=0 for group A and D=1 for B. X ranges from 0 to 5 in the relevant observations.

Develop the reasoning

For A the line is 20+4X; for B it is 26+2X. B−A is 6−2X: six units at X=0, zero at X=3 and −4 at X=5. Saying B is always six units higher ignores the interaction. With centered predictor W=X−3, substitute X=W+3 to obtain Y=32+4W+0D−2WD. The group coefficient is now zero because it describes the difference at X=3. Predictions did not change. This is a model-based descriptive comparison; the equation alone does not establish causal differences between the groups.

Progressive practice — optional

1. Foundation

Find predicted outcomes for both groups at X=1.

Compare the worked reasoning

A is 24 and B is 28, a difference of four.

Change the record

X changes to 4.

Compare the changed-record reasoning

A is 36 and B is 34, a difference of −2. The contrast depends on X.

2. Application

Does a zero centered group coefficient prove no group difference anywhere?

Compare the worked reasoning

No. It means no modeled difference at the centering value, while the interaction permits differences elsewhere.

Change the record

The interaction is also zero in a revised model.

Compare the changed-record reasoning

That revised specification has a constant group contrast, but its adequacy needs evidence rather than an algebraic preference.

3. Transfer

The manager changes the reference group and the main coefficients change. Must predictions have changed?

Compare the worked reasoning

Not if the equation is an equivalent reparameterization.

Change the record

The interaction term is accidentally omitted during the change.

Compare the changed-record reasoning

That changes the model, not merely its coding. Check predictions at several values to detect the mistake.

Sources and scope