Representing Two Groups With One Indicator
A multiple regression equation can include predictors that describe categories as well as numerical measurements. When a predictor has exactly two categories, one simple representation is a zero-one indicator: assign 0 to one category and 1 to the other. This lets the fitted equation give a separate prediction for each category while retaining a single coefficient for their modeled difference.
The coefficient depends on which category is assigned 1. It does not, by itself, establish that group membership causes a change in the response. In an observational setting, for example, groups may differ in other ways. The regression coefficient describes the relationship represented by the fitted model, with the other included predictors held fixed.
The Model and Its Interpretation
Consider a response \(Y\), a two-category predictor \(D\), and one other predictor \(X\). A multiple regression model with no interaction between \(D\) and \(X\) can be written as
Here, \(i\) indexes the observations, \(\beta_0\) is the intercept, \(\beta_1\) is the coefficient for \(X\), \(\beta_2\) is the coefficient for the indicator, and \(\varepsilon_i\) represents the part of the response not captured by the model. The conditional mean model is
For \(D=0\), the modeled mean response at a particular value \(X=x\) is \(\beta_0+\beta_1x\). For \(D=1\), at that same value of \(X\), it is \(\beta_0+\beta_1x+\beta_2\). Subtracting the first expression from the second gives \(\beta_2\). Thus, the indicator coefficient is a modeled group difference at a fixed value of \(X\). With several other predictors, the same comparison holds when all of them are fixed at the same values.
This interpretation relies on the additive model: it assumes the modeled difference between the groups is constant across the values of the other predictors. It also assumes that the stated regression form is a reasonable description of the conditional mean response. Standard regression inference additionally relies on appropriate error assumptions, such as independent errors and constant error variance; normal errors are used for exact small-sample inference. Those inference assumptions are not needed merely to read the fitted coefficient as a model-based difference.
A coefficient is not automatically a comparison of the groups’ unadjusted averages. If other predictors are in the model, \(\beta_2\) compares modeled means at matched values of those predictors. Interpreting such a comparison also requires that the model can reasonably make the comparison: if the groups have no observations near the same values of the other predictors, the fitted comparison may rely heavily on extrapolation.
Worked Example: Interpreting an Adjusted Group Difference
Suppose a hypothetical clinic fits a model for a patient’s reduction in systolic blood pressure, measured in mmHg. Let \(D=0\) represent standard care and \(D=1\) represent an added coaching program. Let \(X\) be age in years. The fitted equation is
The model is additive: it assumes the modeled difference between coaching and standard care is the same at every age. For a 60-year-old receiving standard care, substitute \(X=60\) and \(D=0\):
For a 60-year-old in the coaching group, substitute \(X=60\) and \(D=1\):
The modeled difference, coaching minus standard care, is \(18.0-21.6=-3.6\) mmHg, matching the indicator coefficient. In this model, at the same age, the coaching group has a predicted blood pressure reduction 3.6 mmHg lower than the standard-care group. The negative sign describes the direction of the modeled difference; it does not show that coaching caused the difference.
Why the Coefficient Is a Difference
The interpretation follows directly from the model. For a general set of other predictors \(X_1,\ldots,X_k\), write the additive model as
At fixed values \(x_1,\ldots,x_k\), the modeled mean for the group coded 0 is \(\beta_0+\sum_{j=1}^{k}\beta_jx_j\). For the group coded 1, it is \(\beta_0+\sum_{j=1}^{k}\beta_jx_j+\beta_D\). Their difference is
All terms that apply equally to both groups cancel. This is why the indicator coefficient compares the groups while holding the other modeled predictors fixed. It is an algebraic interpretation of the specified model, not a claim that every pair of individuals with the same measured predictors will have responses differing by exactly that amount.
Worked Example: A Group-Only Model
Consider hypothetical response values with no other predictors in the model. Group A is coded \(D=0\) and has values 4, 6, and 5. Group B is coded \(D=1\) and has values 7, 8, and 9. The fitted model is \(\widehat{Y}=b_0+b_1D\). First calculate the group averages:
For observations in group A, \(D=0\), so the model predicts \(b_0\). For observations in group B, \(D=1\), so it predicts \(b_0+b_1\). Least squares chooses these two fitted values to minimize the sum of squared residuals. Within each group, the constant that minimizes squared deviations from the observed values is that group’s average. Therefore, the fitted value for A is 5 and the fitted value for B is 8:
The fitted equation is \(\widehat{Y}=5+3D\). It predicts 5 for group A and 8 for group B, a fitted difference of 3 response units. In this special group-only model, the indicator coefficient equals the difference between the observed group averages. Once other predictors are added, the coefficient instead represents the model’s adjusted difference at fixed values of those predictors.
Changing Which Group Is Coded 1
The choice of which category receives 0 is a coding choice. Reversing the coding reverses the direction of the comparison, so the indicator coefficient changes sign. The fitted values themselves do not have to change; the equation is simply expressed with a different reference category.
Worked Example: Reversing the Coding
Suppose a hypothetical clinic models patient waiting time in minutes using age \(X\) and clinic type. Initially, \(D=0\) means daytime clinic and \(D=1\) means evening clinic. The fitted model is
At age 50, the daytime prediction is
The evening prediction at the same age is \(52+2+4.5=58.5\) minutes. The modeled evening-minus-daytime difference is 4.5 minutes.
Now define \(R=1\) for daytime and \(R=0\) for evening. For every observation, \(D=1-R\). Substitute this into the original equation:
The new indicator coefficient is \(-4.5\) minutes. Because \(R=1\) now denotes daytime, this coefficient describes daytime minus evening: the modeled daytime wait is 4.5 minutes shorter at the same age. At age 50, the new equation gives \(56.5+2-4.5=54\) minutes for daytime and \(56.5+2=58.5\) minutes for evening, exactly the same predictions as before.
Common Mistakes and Limits
- Ignoring the coding direction. A coefficient of 3 does not mean simply “the group has a response 3 units higher.” State which group is coded 1, which is coded 0, and take the difference in that order.
- Calling an adjusted comparison an average difference. With other predictors in the model, the indicator coefficient is a modeled difference at the same values of those predictors. It need not equal the raw difference between the two groups’ sample averages.
- Claiming causation from the sign of the coefficient. A positive or negative coefficient describes a modeled association. Without a design and assumptions that support causal conclusions, it does not show that changing group membership would change the response.
- Assuming the group difference must be constant in reality. The additive equation imposes a constant modeled difference across values of the other predictors. If a difference varies with another predictor, this model may not represent it adequately.
When reporting a fitted indicator coefficient, give the response units, name the group coded 1 and the group coded 0, and specify that other included predictors are held fixed. This wording makes the comparison’s direction and adjusted nature explicit.
Check Your Understanding
Answer each question using the coding and model stated.
- A fitted model is \(\widehat{Y}=12+2X-5D\), where \(D=0\) denotes group A and \(D=1\) denotes group B. What is the modeled difference, B minus A, at a fixed value of \(X\)?
- Using that model, calculate the predictions for groups A and B when \(X=4\). What is their difference?
- Why need the coefficient of an indicator in a model with other predictors not equal the raw difference in group averages?
- If group A is recoded as 1 and group B as 0, what happens to the sign and direction of the indicator coefficient?
- What does the additive indicator model assume about the group difference across values of the other predictors?