Reading the Intercept and Coefficients
Sum-coded regression output can be unfamiliar because no category is assigned a coefficient of zero. Instead, the intercept represents the unweighted average of the fitted category means, and each category’s effect represents its difference from that average. To recover fitted means, combine the intercept with the appropriate category effect—including the implied effect for the category whose coefficient is not shown.
The precise interpretation depends on the coding convention used by the software. This tutorial uses the common sum-coding convention in which a factor with \(K\) categories has \(K-1\) displayed columns: the first \(K-1\) categories each receive a 1 in their own column and 0 in the others, while the last category receives \(-1\) in every column. Check the output’s contrast labels or model specification before decoding it; other conventions can use different coefficient scales.
The Three-Category Coding Pattern
For three categories, call them A, B, and C, the usual sum-coding pattern is:
| Category | Column for A | Column for B |
|---|---|---|
| A | 1 | 0 |
| B | 0 | 1 |
| C | -1 | -1 |
Write the model as \(\hat{y}=\hat{\beta}_0+\hat{\beta}_A x_A+\hat{\beta}_B x_B\), where \(x_A\) and \(x_B\) are the two coding columns. Substituting each category’s codes gives:
Thus, although software usually displays only two coefficients for this three-category factor, you can calculate all three category effects. The effect for C is \(-\hat{\beta}_A-\hat{\beta}_B\), not zero. Add each effect to the intercept to get that category’s fitted mean.
Worked Example: Recovering Three Fitted Category Means
Suppose a fictional regression output for a response measured in points reports an intercept of 18, a sum-coded coefficient of 4 for category A, and a sum-coded coefficient of \(-1\) for category B. Category C is the final category in the stated coding pattern. Find the fitted mean for each category.
First, find the implied effect for C. The effects must sum to zero, so:
Then add each effect to the intercept. For A, the fitted mean is \(18+4=22\) points. For B, it is \(18+(-1)=17\) points. For C, it is \(18+(-3)=15\) points.
The coefficient for A says that A’s fitted mean is 4 points above the unweighted average of the three fitted means. The coefficient for B says that B’s fitted mean is 1 point below that average. Category C is 3 points below it. These are differences in fitted response, not evidence that category membership causes a change.
Why the Coefficients Sum to Zero
The zero-sum constraint follows directly from the coding. For three categories, the category effects are \(\hat{\beta}_A\), \(\hat{\beta}_B\), and \(-\hat{\beta}_A-\hat{\beta}_B\). Their sum is:
Each category’s effect is therefore its fitted mean minus the average of the \(K\) fitted category means. To see this for three categories, average the three fitted means from the coding equations:
So the intercept is the unweighted arithmetic average of the three fitted category means. This is a property of the coding and fitted category means; it does not say that every observation is equally represented in the observed data.
The same result holds for \(K\) categories. Under the stated convention, the fitted mean for each of the first \(K-1\) categories is \(\hat{\beta}_0+\hat{\beta}_j\). The final category’s effect is minus the sum of the displayed effects, so its fitted mean is \(\hat{\beta}_0-\sum_{j=1}^{K-1}\hat{\beta}_j\). Adding all \(K\) fitted means cancels the displayed effects, leaving \(K\hat{\beta}_0\). Dividing by \(K\) shows that the intercept is their unweighted average, and the \(K\) category effects consequently sum to zero.
Worked Example: Reading Output for Two Categories
A fictional model compares two categories, North and South, for a response measured in minutes. The output reports an intercept of 72 minutes and a sum-coded coefficient of 5 minutes for North. Under the usual two-category coding, North has code 1 and South has code \(-1\). Calculate both fitted means.
For two categories, the effects must sum to zero. North’s effect is 5 minutes, so South’s implied effect is \(-5\) minutes. Equivalently, the model’s fitted values are:
The intercept is halfway between 77 and 67 minutes, as expected: \((77+67)/2=72\). North’s fitted mean is 5 minutes above the intercept, while South’s is 5 minutes below. The displayed coefficient is not the difference between the two category means; that difference is \(77-67=10\) minutes.
Unequal Category Sizes and the Meaning of the Intercept
The intercept is an unweighted average of category means, not generally the overall sample mean. When category sizes differ, the overall sample mean gives more weight to categories with more observations. This distinction is particularly useful when checking output from a categorical-only ordinary least squares model: its fitted category means are the within-category sample means, but their unweighted average need not equal the sample mean across all observations.
Worked Example: Unequal Sizes, Different Averages
Suppose a fictional data set has 4 observations in category A, 10 in category B, and 2 in category C. Their observed means, in response units, are 10, 14, and 20. Assume an ordinary least squares model with an intercept and sum coding, and no other predictors. The three categories are observed, so the fitted category means equal these observed means. Find the intercept and the displayed coefficients for A and B.
The intercept is the unweighted average of the three fitted category means:
The category effects are each fitted mean minus the intercept. Thus, A’s effect is \(10-14.67=-4.67\) response units, and B’s effect is \(14-14.67=-0.67\) response units. C’s implied effect is \(20-14.67=5.33\) response units. Using the rounded displayed coefficients, the constraint is visible up to rounding: \(-4.67+(-0.67)+5.33=-0.01\). The unrounded effects sum exactly to zero.
The fitted means can be checked from the output: A is \(14.67-4.67=10.00\), B is \(14.67-0.67=14.00\), and C is \(14.67+5.33=20.00\), to the displayed precision. In contrast, the mean across all 16 observations is weighted by category size:
The overall sample mean is 13.75 response units, not the 14.67 response-unit intercept. The unequal category sizes explain the difference; the intercept averages the three category means equally, whereas the overall sample mean weights each mean by its category’s sample size.
A Reliable Way to Decode the Output
Before calculating, confirm that the model has an intercept and that the factor really uses the sum-coding pattern described above. Read the category order from the software output or model specification: the category assigned the all-\(-1\) row is the one whose effect must be reconstructed. Then use this sequence.
Confirm which category has each coding row, and note the units of the response so the fitted means and effects can be reported in context.
Use the estimates, not their standard errors or test statistics, when the task is to calculate fitted category means.
Set it equal to the negative of the sum of the displayed category effects.
Add each category effect to the intercept. Check that the category effects sum to zero and that the intercept equals the unweighted average of the fitted means.
Common Mistake: Treating a Sum-Coded Category as the Baseline
A common error is to assume that the category without a displayed coefficient has an effect of zero, just as a reference category does under reference coding. That would make its fitted mean equal to the intercept, but it is not how the sum-coding pattern here works. The final category has an effect equal to the negative sum of the displayed effects; it is generally not zero.
For example, with three categories and displayed effects of 4 and \(-1\), the omitted effect is \(-3\), not 0. The resulting fitted mean for that category is the intercept minus 3 response units. Another mistake is to call the intercept the sample-size-weighted grand mean without checking the model and category sizes. Under the categorical-only model here, the intercept is the unweighted average of the fitted category means. Always distinguish that average from the overall mean of the observations.
Check Your Understanding
Use the stated sum-coding convention in each question.
- A three-category model reports an intercept of 30 points and displayed effects of 2 points for A and \(-4\) points for B. What is C’s implied effect, and what are all three fitted category means?
- In a two-category model, the intercept is 12 units and the displayed effect for the first category is \(-3\) units. Find both fitted means and their difference.
- Why is the coefficient for the category whose row contains all \(-1\) entries not generally zero?
- A categorical-only model has three observed groups with means 6, 9, and 15, and their sample sizes are unequal. What is the intercept under sum coding? Explain why it need not equal the overall sample mean.
- What should you check before using a software coefficient table to calculate category means?