Tutorials › Regression Analysis (Undergraduate) › Reading Reference-Coded Regression Output

Coding Categorical Predictors · Tutorial 315 of 991

Reading Reference-Coded Regression Output

Read reference-coded output by identifying the baseline first, then adding each category’s indicator coefficient to the intercept to obtain its fitted mean.

Beginner 10 min read

What You'll Learn

  • Identify the reference category from the omitted indicator.
  • Interpret the intercept as the fitted mean for the reference category.
  • Interpret each indicator coefficient as a difference from the reference mean.
  • Calculate fitted means for all categories from regression output.
  • Distinguish coefficient estimates from standard errors and other output columns.
  • Check whether a reported mean is consistent with the fitted model.

From Regression Output to Category Means

Regression software often reports a table of coefficient estimates rather than a separate fitted mean for every category. Under reference-cell coding, that table is enough to recover the mean for each category. The key is to identify which category is the reference: its mean is represented by the intercept, while each other category’s mean is the intercept plus that category’s indicator coefficient.

This reading applies to a model with one categorical predictor and a quantitative outcome. It focuses on what the coefficient estimates say, not on testing differences or comparing coding schemes. The calculations are useful when checking software output, writing results in context, or translating a coefficient table into a table of fitted group means.

Model: Suppose a categorical predictor has \(K\) categories, one of which is designated as the reference category. For each non-reference category \(j\), let \(I_j=1\) when an observation is in category \(j\), and \(I_j=0\) otherwise. The reference-coded model is $$ Y=\beta_0+\beta_1 I_1+\beta_2 I_2+\cdots+\beta_{K-1}I_{K-1}+\varepsilon. $$ The model’s fitted value for the reference category is \(\hat\beta_0\). Its fitted value for non-reference category \(j\) is \(\hat\beta_0+\hat\beta_j\). Thus \(\hat\beta_0\) is the reference category’s fitted mean, and \(\hat\beta_j\) is the difference between category \(j\)’s fitted mean and the reference category’s fitted mean.

The reference category has no indicator column in the model. Its indicators are all zero, so substituting its indicator values leaves only the intercept. For an observation in non-reference category \(j\), that category’s indicator is 1 and the other category indicators are 0. Substitution therefore adds exactly one indicator coefficient to the intercept.

The coefficient table may list the intercept first and the indicator terms underneath it. The label attached to an indicator usually names the category represented by that indicator. For example, a row labelled “Program B” means the coefficient for the Program B indicator, relative to the omitted reference category. The intercept is not the overall average across all categories; in this model, it is the fitted mean for the reference category.

Reading the Coefficients and Reconstructing Means

To read a reference-coded coefficient table, first find the outcome and the name of the factor’s reference category. Software may state the reference in a separate note, show it in a factor-level display, or make it clear from the omitted category. Then read the intercept and each indicator estimate. The estimates, not the standard errors or test statistics, are the values used to calculate fitted means.

1
Find the reference category.
Check the output labels or model specification to identify the category whose indicator is omitted.
2
Read the intercept.
It is the fitted outcome mean for the reference category in the one-factor model.
3
Read each indicator estimate.
Each estimate is the fitted mean for its labelled category minus the fitted mean for the reference category.
4
Add to recover each non-reference mean.
For category \(j\), calculate \(\hat\beta_0+\hat\beta_j\), and keep the outcome’s units.

A positive indicator estimate means that the category’s fitted mean is higher than the reference category’s fitted mean. A negative estimate means it is lower. The sign describes a difference from the reference, not whether the category mean itself is positive or negative. The intercept and the indicator estimate must be combined before reporting the category’s fitted mean.

Worked Example: Recovering Three Fitted Means

Suppose a hypothetical analysis models quiz score, in points, by instructional format. The reference category is Lecture, and the software reports these coefficient estimates:

TermEstimate
Intercept72.0
Format: Discussion5.5
Format: Online-3.0

The model is \(\widehat{Y}=72.0+5.5I_{\text{Discussion}}-3.0I_{\text{Online}}\), where the two indicators equal 1 for their named category and 0 otherwise. Lecture is the reference category, so both indicators are 0 for a Lecture observation:

$$ \widehat{Y}_{\text{Lecture}}=72.0+5.5(0)-3.0(0)=72.0\text{ points}. $$

For Discussion, the Discussion indicator is 1 and the Online indicator is 0. Its fitted mean is:

$$ \widehat{Y}_{\text{Discussion}}=72.0+5.5(1)-3.0(0)=77.5\text{ points}. $$

For Online, the Discussion indicator is 0 and the Online indicator is 1:

$$ \widehat{Y}_{\text{Online}}=72.0+5.5(0)-3.0(1)=69.0\text{ points}. $$

The Discussion coefficient says its fitted mean is 5.5 points above the Lecture fitted mean; the Online coefficient says its fitted mean is 3.0 points below the Lecture fitted mean. The reconstructed fitted means are 72.0, 77.5, and 69.0 points. These describe model estimates, not evidence that instructional format caused a difference in scores.

Why the Estimates Correspond to Group Means

In this one-factor model, every observation in the same category has the same fitted value. For a category with observed outcomes \(y_1,\ldots,y_m\), the least-squares fit chooses a fitted value \(c\) to minimize the sum of squared residuals within that category. The minimizing value is the category’s sample mean. The argument is direct: differentiating the within-category sum of squares with respect to \(c\) gives zero at the sample mean.

$$ \begin{aligned} S(c)&=\sum_{i=1}^{m}(y_i-c)^2,\\ \frac{dS(c)}{dc}&=-2\sum_{i=1}^{m}(y_i-c)=0,\\ mc&=\sum_{i=1}^{m}y_i,\\ c&=\frac{1}{m}\sum_{i=1}^{m}y_i=\bar{y}. \end{aligned} $$

Because each observation belongs to exactly one category, the total residual sum of squares is the sum of these within-category sums of squares. Minimizing it therefore sets each category’s fitted value to that category’s sample mean. As a result, for an ordinary least-squares fit of this one-factor model with observed data in every category, the reconstructed fitted means match the observed category means. The intercept and indicator estimates express those means using the chosen reference as the starting point.

Worked Example: Checking the Calculations Against Group Means

A hypothetical data set records completion time, in minutes, for three route types. The observed times are: Short route, 18, 22, and 20; Medium route, 25, 27, and 26; Long route, 31, 29, and 34. Suppose Short is the reference category. First calculate the observed means:

$$ \bar{y}_{\text{Short}}=\frac{18+22+20}{3}=20,\quad \bar{y}_{\text{Medium}}=\frac{25+27+26}{3}=26,\quad \bar{y}_{\text{Long}}=\frac{31+29+34}{3}=31.3\text{ minutes}. $$

The one-factor reference-coded regression output should therefore have an intercept of 20 minutes. Its Medium coefficient is the Medium mean minus the Short mean, and its Long coefficient is the Long mean minus the Short mean:

$$ \hat\beta_{0}=20,\qquad \hat\beta_{\text{Medium}}=26-20=6,\qquad \hat\beta_{\text{Long}}=31.3-20=11.3. $$

Recover the two non-reference fitted means by adding each coefficient to the intercept:

$$ \widehat{Y}_{\text{Medium}}=20+6=26\text{ minutes},\qquad \widehat{Y}_{\text{Long}}=20+11.3=31.3\text{ minutes}. $$

The arithmetic recovers the three group means: 20, 26, and 31.3 minutes. The Long coefficient is a difference of 11.3 minutes relative to Short; it is not the Long route’s mean completion time.

Reading Output Carefully

Software tables contain several numbers for each term. A typical row may include an estimate, a standard error, a test statistic, and a p-value. Only the estimate is the coefficient to use in the addition that recovers a fitted mean. A standard error measures uncertainty in an estimate; it is not another part of the fitted-value equation. A test statistic and p-value address an inferential question, not the arithmetic needed to reconstruct category means.

The model also determines what a reported fitted mean represents. In the one-factor model above, it is the fitted mean for that category, and least squares makes it equal to the sample category mean when each category has observations. The algebraic reading of the estimates does not, by itself, establish that the model is appropriate or that an estimated difference is statistically distinguishable from zero. Inferences based on standard errors and p-values require the assumptions relevant to the regression procedure, including an appropriate model for the errors and independence as required by the data collection and analysis.

Worked Example: Interpreting a Negative Indicator Estimate

In a hypothetical analysis of monthly water use, measured in cubic meters per household, the reference category is Standard plan. The coefficient table reports an intercept estimate of 14.2 and an indicator estimate of \(-2.6\) for Efficient plan. Calculate and interpret the fitted mean for each category.

For Standard plan, its indicator is zero, so the fitted mean is the intercept:

$$ \widehat{Y}_{\text{Standard}}=14.2\text{ cubic meters}. $$

For Efficient plan, its indicator is one. Substituting the two estimates gives:

$$ \widehat{Y}_{\text{Efficient}}=14.2+(-2.6)=11.6\text{ cubic meters}. $$

The fitted mean for Efficient plan is 2.6 cubic meters below the fitted mean for Standard plan. The negative sign does not mean that the fitted water use is negative: the category mean is 11.6 cubic meters. This is a description of the model’s estimated difference, not a causal conclusion about the effect of changing plans.

Common Mistakes

  • Calling the intercept the overall mean. In this model, the intercept is the fitted mean for the reference category. Identify the omitted category before interpreting it.
  • Reporting an indicator coefficient as a category mean. An indicator estimate is a difference from the reference mean. Add it to the intercept to obtain the fitted mean for that category.
  • Adding the wrong output column. Use coefficient estimates, not standard errors, test statistics, or p-values, in the fitted-mean calculation.
  • Ignoring the sign. A negative estimate means the named category is lower than the reference by the absolute value of the estimate. It does not make the fitted mean itself negative.
  • Switching the reference category in mid-calculation. Every indicator coefficient in the table is interpreted relative to the same omitted reference category named by the model.
  • Turning an association into a causal statement. A difference between fitted category means is not, on its own, evidence that category membership caused the outcome difference.
Key takeaway: Under reference-cell coding, the omitted category is the baseline. The intercept is its fitted mean, and each indicator estimate is the difference between its named category’s fitted mean and the baseline mean. Add the estimate to the intercept to recover the named category’s fitted mean.

Check Your Understanding

Use the reference category and coefficient estimates to answer each question.

  1. A model uses Region A as its reference category. The intercept estimate is 48, and the Region B indicator estimate is 7. What are the fitted means for Regions A and B?
  2. A coefficient table lists an intercept of 10.5 and a coefficient of \(-1.2\) for Group C. State the fitted mean for Group C and interpret the coefficient relative to the reference group.
  3. Why is an indicator coefficient not generally the fitted mean for its category?
  4. A software table reports an estimate of 4.0 and a standard error of 1.5 for a category indicator. Which number is used with the intercept to calculate that category’s fitted mean?
  5. In a one-factor least-squares model with observations in every category, why does each fitted category mean equal its observed sample mean?