Why the Coding Matters
A regression model can represent a two-arm randomized study using one numerical variable for treatment assignment. The coding looks simple, but the meaning of the coefficient depends on which arm is assigned the value one and which is assigned zero. Getting that choice clear prevents a common interpretation error: reporting a control-minus-treatment contrast when the question asks for treatment minus control.
Suppose each of \(n\) participants is randomly assigned to a treatment arm or a control arm. Let \(Y_i\) be the outcome for participant \(i\), measured in its stated units. This tutorial concerns the assignment indicator and the interpretation of its coefficient—not how to estimate that coefficient or carry out inference.
The Zero-One Coding and Its Model
A participant’s assignment is a group label, not a quantity that measures how much treatment the participant received. Coding the two labels as zero and one gives a convenient way to include assignment in a model with an intercept. The numerical difference between the codes is a bookkeeping choice; it does not mean that treatment is “one unit more” in a scientific dose scale.
For the basic two-arm representation, write the conditional mean outcome as
Here \(\beta_0\) is the model’s mean outcome for the reference group, and \(\beta_1\) is the change in that model mean when the indicator changes from zero to one. This is a two-group mean representation: the conditional mean for each arm is specified, without requiring a straight-line relationship across a range of treatment doses.
If the model is written for individual outcomes with an error term,
the relevant mean-model condition is \(E(\varepsilon_i\mid T_i)=0\). This condition ensures that the model’s conditional means are \(\beta_0\) and \(\beta_0+\beta_1\) in the two arms. No normality or equal-variance assumption is needed just to interpret these coefficients. Additional assumptions may be needed for particular inferential procedures, but they are not part of the coding itself.
Justifying the Coefficient Interpretation
The translation follows by substituting each possible indicator value into the model. For control, \(T_i=0\), so the indicator term disappears. For treatment, \(T_i=1\), so the indicator term contributes \(\beta_1\). Subtracting the control mean from the treatment mean leaves exactly that coefficient:
This interpretation depends on the coding and model as stated. If the zero group changes, the reference group changes. If the one group changes, the direction of the coefficient changes. Always write down what zero and one mean before describing the coefficient in words.
In a randomized study, the contrast can also have a causal interpretation, provided assignment was genuinely randomized and the outcome under each assignment is well-defined. In the standard potential-outcome notation, \(Y_i(1)\) and \(Y_i(0)\) are participant \(i\)’s outcomes under treatment and control assignment, respectively. Under random assignment, consistency (the observed outcome equals the potential outcome under the assignment received), and no interference between participants, the expected treated-versus-control outcome contrast corresponds to the average effect of assignment. The indicator’s coding does not create this causal interpretation; it comes from the study design and assumptions. If participants do not always take the treatment they were assigned, \(T_i\) still represents assignment, and the coefficient describes the assignment contrast rather than automatically describing the effect of treatment received.
Worked Example: Coding the Assignment Column
In a hypothetical trial, six participants are assigned to a new exercise program or to usual care. The question is to represent assignment to the program with a zero-one indicator. The recorded labels are:
| Participant | Assigned arm | \(T_i\) |
|---|---|---|
| A | Usual care | 0 |
| B | Program | 1 |
| C | Program | 1 |
| D | Usual care | 0 |
| E | Usual care | 0 |
| F | Program | 1 |
The coding rule is \(T_i=1\) for program assignment and \(T_i=0\) for usual-care assignment. Thus usual care is the reference group. Participant D, for example, has \(T_D=0\); participant F has \(T_F=1\). These values describe assigned arms, regardless of whether an individual followed the assigned program.
Suppose the outcome is weekly exercise time in hours and the model uses coefficients \(\beta_0\) and \(\beta_1\). The model assigns mean \(\beta_0\) hours to usual care and mean \(\beta_0+\beta_1\) hours to program assignment. The program-minus-usual-care contrast is therefore \((\beta_0+\beta_1)-\beta_0=\beta_1\) hours. The units of the coefficient follow the units of the outcome.
Reading a Fitted Equation in Context
When coefficients have already been estimated, the same substitutions apply to the fitted equation. Use the estimated coefficient values to compute each arm’s fitted mean, then subtract in the direction required by the question. This is interpretation of the coded terms; it does not by itself explain how estimates or uncertainty are obtained.
Worked Example: Interpreting a Positive Coefficient
A hypothetical randomized study records a symptom score, with higher scores indicating more symptoms. Assignment is coded \(T_i=1\) for a new treatment and \(T_i=0\) for standard care. Suppose the fitted model is
For standard care, substitute \(T_i=0\):
For treatment assignment, substitute \(T_i=1\):
The fitted treatment-minus-control contrast is \(14.8-18.0=-3.2\) score points, which is the indicator coefficient. In context, the fitted mean symptom score for those assigned to treatment is 3.2 points lower than the fitted mean for those assigned to standard care. The negative sign indicates the direction; it does not mean the outcome itself is negative.
Worked Example: Reversing the Indicator Coding
Suppose the same kind of symptom outcome is instead coded with \(C_i=1\) for standard-care assignment and \(C_i=0\) for treatment assignment. A hypothetical fitted equation is
Now treatment is the reference group, because treatment has \(C_i=0\). Its fitted mean is \(14.8+3.2(0)=14.8\) points. The standard-care fitted mean is \(14.8+3.2(1)=18.0\) points. The coefficient \(3.2\) is standard care minus treatment, not treatment minus standard care.
To report the requested treatment-minus-standard-care contrast, subtract in that direction:
Reversing which arm is coded one reverses the coefficient’s contrast direction. The underlying two fitted arm means have not changed; only the reference category and coefficient sign have changed.
Why the Reference Group Is Useful
With an intercept in the model, the zero-coded group supplies the baseline represented by the intercept. The indicator coefficient then tells how far the one-coded group’s model mean is above or below that baseline. This makes the model easy to read: one coefficient gives the reference level, and the other gives the contrast relative to it.
This setup is useful for clear communication as well as calculation. Before reporting a coefficient, state the outcome, its units, which assignment is coded one, which is coded zero, and the contrast direction. For example, “the coefficient is the program-assignment minus usual-care difference in mean weekly exercise hours” is more informative than “the treatment coefficient is negative.”
Worked Example: Translating a Coefficient Into a Sentence
In a hypothetical randomized study, the outcome is a six-week mobility score, measured in points. The indicator is \(T_i=1\) for assignment to a coaching program and \(T_i=0\) for assignment to a comparison program. A fitted indicator coefficient is \(2.6\).
Because comparison assignment is coded zero, it is the reference group. The coefficient is coaching minus comparison:
A suitable interpretation is: “The fitted mean mobility score for participants assigned to coaching is 2.6 points higher than the fitted mean for participants assigned to the comparison program.” The direction is positive, and the units are points. The statement describes assignment groups; it does not claim that every participant’s score increased by 2.6 points or that the program caused a 2.6-point change for each person.
Common Mistakes and a Reliable Check
The most frequent error is to interpret the coefficient without first checking the zero-one mapping. A positive coefficient does not inherently mean “treatment is better,” and a negative coefficient does not inherently mean “treatment is worse.” The signs answer a directional question only after the reference group and outcome scale are known. If higher outcome values are undesirable, a negative contrast may represent a favorable direction; if higher values are desirable, it may represent an unfavorable direction.
- Wrong reasoning: “The coefficient is \(-3.2\), so the treatment group has a mean of \(-3.2\).”
Correction: The coefficient is the difference from the reference-group mean. The treatment-group fitted mean is the intercept plus the coefficient when treatment is coded one. - Wrong reasoning: “Treatment is always the reference group.”
Correction: The zero-coded group is the reference group. Read the coding rule; do not infer it from the study’s labels. - Wrong reasoning: “The indicator records whether the participant actually received treatment.”
Correction: It records whichever variable the analyst defined. In a randomized assignment analysis, it ordinarily records assignment, even if treatment receipt differs from assignment. - Wrong reasoning: “A positive coefficient always means a beneficial effect.”
Correction: Determine which arm is coded one, which is coded zero, and whether higher outcome values are desirable. A coefficient’s sign alone does not establish benefit.
A quick check is to write the fitted value at zero and at one, then subtract them in the requested order. If the result does not equal the coefficient under treatment-one coding, revisit the substitutions or the direction of subtraction.
Check Your Understanding
Use the coding rule in each question, and state contrast directions and outcome units where appropriate.
- If \(T_i=1\) means assignment to treatment and \(T_i=0\) means assignment to control, which arm is the reference group?
- For \(E(Y_i\mid T_i)=\beta_0+\beta_1T_i\), write the conditional mean for each assignment arm and express treatment minus control.
- A fitted model is \(\widehat{Y}_i=42-1.5T_i\), where \(Y_i\) is a test score in points and treatment is coded one. What are the two fitted means, and what is their treatment-minus-control contrast?
- If an indicator is instead coded one for control and zero for treatment, which contrast does its coefficient represent?
- Why should an assignment indicator not automatically be described as a measure of treatment received?