Tutorials › Regression Analysis (Undergraduate) › Centering Predictors in Group-Slope Models

Interactions Among Groups · Tutorial 352 of 991

Centering Predictors in Group-Slope Models

See how centering changes the point at which group intercepts are interpreted without changing the fitted group lines.

Intermediate 9 min read

What You'll Learn

  • Write a group-specific slope model using indicator variables and interaction terms.
  • Derive the centered model by substituting the centered predictor algebraically.
  • Interpret each centered intercept at the chosen predictor value.
  • Verify that group slopes and slope contrasts are unchanged by centering.
  • Check that fitted values are identical before and after centering.
  • Recognize when centering improves interpretation and when it does not change the data’s information.

Why Center a Predictor in a Group-Slope Model?

In a group-slope regression, each group has its own fitted line. The intercept for a group is the fitted outcome when the quantitative predictor equals zero. But zero may be outside the observed range or may not be a useful comparison point. For example, a study-time value of zero might be possible but unrepresentative, while a predictor such as age could have zero far outside the data. Centering lets us describe group intercepts at a more useful predictor value, such as the sample mean or a policy-relevant value.

Centering is an algebraic re-expression of the same model. It does not shift the observed outcomes, change the group-specific slopes, or alter any fitted value. What changes is the predictor value at which the model’s intercept terms describe fitted outcomes and group differences.

The Group-Slope Model and Centering

Suppose there are \(K\) groups, with one designated as the reference group. Let \(D_g\) be an indicator for group \(g\): it equals 1 for observations in that group and 0 otherwise. Write the reference group’s intercept and slope as \(\beta_0\) and \(\beta_1\). For each non-reference group, \(\gamma_g\) represents its intercept difference from the reference group at \(x=0\), and \(\delta_g\) represents its slope difference from the reference group.

Definition: A group-slope model with a quantitative predictor \(x\) can be written as $$ Y_i=\beta_0+\beta_1x_i+\sum_{g=1}^{K-1}\gamma_gD_{ig}+\sum_{g=1}^{K-1}\delta_gD_{ig}x_i+\varepsilon_i. $$ Here \(Y_i\) is the outcome for observation \(i\), and \(\varepsilon_i\) is its error. The fitted reference-group line has intercept \(\beta_0\) and slope \(\beta_1\). The fitted line for group \(g\) has intercept \(\beta_0+\gamma_g\) and slope \(\beta_1+\delta_g\).

For interpreting this regression model, assume its conditional mean is linear in \(x\) within each group and that the included group and interaction terms represent the intended group-specific lines. For standard model-based inference, the usual additional assumptions are independent errors with mean zero and common variance; exact small-sample \(t\)- and \(F\)-inference also assumes normally distributed errors. The centering algebra below is an identity for the fitted model: it does not depend on the errors being normal or on a particular inference method.

Choose a constant \(c\), and define the centered predictor \(x_{c,i}=x_i-c\). Equivalently, \(x_i=x_{c,i}+c\). Substituting this expression for \(x_i\) gives the model in terms of the centered predictor.

$$ \begin{aligned} Y_i &=\beta_0+\beta_1(x_{c,i}+c) +\sum_{g=1}^{K-1}\gamma_gD_{ig} +\sum_{g=1}^{K-1}\delta_gD_{ig}(x_{c,i}+c) +\varepsilon_i\\ &=(\beta_0+c\beta_1)+\beta_1x_{c,i} +\sum_{g=1}^{K-1}(\gamma_g+c\delta_g)D_{ig} +\sum_{g=1}^{K-1}\delta_gD_{ig}x_{c,i} +\varepsilon_i. \end{aligned} $$
Key result: After centering at \(c\), the reference-group intercept is \(\beta_0+c\beta_1\). Group \(g\)'s intercept difference from the reference group is \(\gamma_g+c\delta_g\). The reference slope \(\beta_1\) and each slope difference \(\delta_g\) are unchanged.

The first new intercept is the fitted outcome for the reference group at \(x=c\), because \(x_c=0\) exactly when \(x=c\). For another group, \(\gamma_g+c\delta_g\) is its fitted difference from the reference group at \(x=c\). The slope terms stay as they were because adding or subtracting a constant from the predictor does not change how much the fitted outcome changes per one-unit increase in the predictor.

Worked Example: Centering Study Time at Five Hours

Suppose a hypothetical regression compares students in two preparation groups. Let \(G=0\) denote the reference group and \(G=1\) the other group. The fitted model predicts quiz score in points from study time \(x\), measured in hours:

$$ \widehat{y}=40+3x+8G+2Gx. $$

For the reference group, \(G=0\), so its fitted line is \(\widehat{y}=40+3x\). Its intercept is 40 points at zero study hours, and its slope is 3 points per hour. For the other group, \(G=1\), the line is \(\widehat{y}=40+3x+8+2x=48+5x\). Its intercept is 48 points at zero hours, and its slope is 5 points per hour. The slope difference is 2 points per hour.

Now center study time at \(c=5\) hours by setting \(x_c=x-5\), so \(x=x_c+5\). Substitute:

$$ \begin{aligned} \widehat{y} &=40+3(x_c+5)+8G+2G(x_c+5)\\ &=55+3x_c+18G+2Gx_c. \end{aligned} $$

At five hours of study, \(x_c=0\). The reference group’s fitted score is now 55 points, and the other group’s fitted score is \(55+18=73\) points. The difference of 18 points is the groups’ fitted difference at five hours, not at zero hours. The slopes remain 3 and \(3+2=5\) points per hour, and their difference remains 2 points per hour.

Check that a fitted value is unchanged at seven hours. The original model gives \(40+3(7)=61\) points for the reference group and \(48+5(7)=83\) points for the other group. Since \(x_c=7-5=2\), the centered model gives \(55+3(2)=61\) and \(55+18+(3+2)(2)=83\). Both group predictions agree exactly.

What Is Preserved by Centering?

The algebra establishes more than an unchanged pair of slopes in one example. For every group \(g\), its slope is the coefficient on \(x\) plus its interaction adjustment, \(\beta_1+\delta_g\). After centering, the coefficient on \(x_c\) is still \(\beta_1\), and the group interaction coefficient is still \(\delta_g\). Thus every group slope is preserved. Subtracting any two group slopes also gives the same contrast before and after centering.

The fitted value for any observation is preserved because the centered equation was obtained by substituting \(x=x_c+c\) into the original equation and collecting terms. For each observation, \(x_c+c=x\), so both equations evaluate to the same number. This means the fitted lines, residuals, and overall fit are unchanged; centering has not added or removed information from the data.

The group difference at a predictor value also has a direct interpretation. Before centering, the fitted difference between group \(g\) and the reference group at \(x\) is \(\gamma_g+\delta_gx\). After centering, it is \((\gamma_g+c\delta_g)+\delta_gx_c\). Since \(x=x_c+c\), these are equal:

$$ \gamma_g+\delta_gx =\gamma_g+\delta_g(x_c+c) =(\gamma_g+c\delta_g)+\delta_gx_c. $$

So centering changes the intercept difference’s interpretation, not the group-difference line itself. Any predictor value represented before centering has the same fitted group difference afterward.

Worked Example: Centering a Predictor With Three Groups

Suppose a hypothetical model predicts daily equipment use, in minutes, from operating temperature \(x\), measured in degrees. Group A is the reference group; the indicators \(D_B\) and \(D_C\) identify groups B and C. The fitted model is

$$ \widehat{y} =12+0.8x-3D_B+0.4D_Bx+5D_C-0.2D_Cx. $$

The group lines are A: \(\widehat{y}=12+0.8x\), B: \(\widehat{y}=9+1.2x\), and C: \(\widehat{y}=17+0.6x\). Their slopes are 0.8, 1.2, and 0.6 minutes per degree, respectively. For example, B’s slope difference from A is \(1.2-0.8=0.4\) minutes per degree.

Center temperature at \(c=5\) degrees, so \(x_c=x-5\) and \(x=x_c+5\). Substituting into the model gives

$$ \begin{aligned} \widehat{y} &=12+0.8(x_c+5)-3D_B+0.4D_B(x_c+5)\\ &\qquad+5D_C-0.2D_C(x_c+5)\\ &=16+0.8x_c-D_B+0.4D_Bx_c+4D_C-0.2D_Cx_c. \end{aligned} $$

At \(x=5\), the centered predictor equals zero. The new intercepts are 16 minutes for A, \(16-1=15\) minutes for B, and \(16+4=20\) minutes for C. These equal the original fitted lines evaluated at five degrees: A gives \(12+0.8(5)=16\), B gives \(9+1.2(5)=15\), and C gives \(17+0.6(5)=20\). The slopes remain 0.8, 1.2, and 0.6 minutes per degree, so the slope contrasts are unchanged as well.

Choosing a Center and Interpreting Results

A useful center is one that makes the intercept meaningful. Common choices include the sample mean of the predictor, a scientifically important value, or a value near the middle of the observed range. If \(c=\bar{x}\), then each group intercept describes that group’s fitted outcome at the overall sample mean of \(x\). This does not mean each group has that same mean predictor value; the selected center is a single value used to re-express the model.

The choice of center should be stated with its units. If \(x\) is measured in hours and the model is centered at five hours, then \(x_c\) is measured in hours relative to five: \(x_c=0\) means five hours, and \(x_c=2\) means seven hours. The numerical value of a fitted intercept has the outcome’s units, while a slope has outcome units per predictor unit.

Centering may make some coefficient interpretations more useful, but it does not make an implausible extrapolation valid. If the selected center lies outside the data’s predictor range, an intercept at that center still represents a model prediction there, but it may be poorly supported by observations. Choose a center that fits the question and the data rather than assuming centering itself improves the evidence.

Worked Example: Preserving a Group Difference at a Specific Value

Consider a hypothetical outcome measured in points with two group lines: A has fitted line \(\widehat{y}_A=20+4x\), and B has fitted line \(\widehat{y}_B=11+7x\). Their fitted difference, B minus A, at \(x\) is

$$ (11+7x)-(20+4x)=-9+3x. $$

Center at \(c=4\), giving \(x_c=x-4\). The centered lines are A: \(\widehat{y}_A=36+4x_c\), because \(20+4(x_c+4)=36+4x_c\); and B: \(\widehat{y}_B=39+7x_c\), because \(11+7(x_c+4)=39+7x_c\). The intercept difference is now \(39-36=3\) points, the group difference at \(x=4\).

At \(x=6\), \(x_c=2\). The original lines predict \(20+4(6)=44\) points for A and \(11+7(6)=53\) points for B, a difference of 9 points. The centered lines predict \(36+4(2)=44\) and \(39+7(2)=53\), again a difference of 9 points. The group slopes, their difference of \(7-4=3\) points per predictor unit, and the predictions are all unchanged; only the intercepts now refer to \(x=4\).

Common Mistakes

  • Thinking centering changes the group slopes. Replacing \(x\) by \(x-c\) changes where zero is, not the size of a one-unit increase. The slope coefficient and each interaction coefficient remain the same.
  • Reading a centered intercept as the outcome at \(x=0\). In the centered model, \(x_c=0\) means \(x=c\). State the chosen center whenever interpreting an intercept.
  • Changing the predictor but forgetting to transform all terms. In a group-slope model, \(x\) appears both alone and multiplied by group indicators. Substitute \(x=x_c+c\) into every occurrence, including every interaction term.
  • Claiming that centering changes fitted values or cures a model problem. The fitted values are identical after the coefficient transformation. Centering does not by itself fix an incorrect linear form, unsupported extrapolation, or a lack of data.
  • Confusing an intercept change with a slope change. The group intercept difference changes from \(\gamma_g\) to \(\gamma_g+c\delta_g\), while the slope difference remains \(\delta_g\). These are distinct quantities with distinct interpretations.
Key takeaway: Centering \(x\) at \(c\) replaces \(x\) by \(x_c=x-c\). The reference intercept becomes the fitted outcome at \(x=c\), and each group’s intercept difference becomes its fitted difference at \(x=c\). Group slopes, slope contrasts, fitted values, and residuals remain unchanged.

Check Your Understanding

Use the model and definitions in this tutorial to answer the following questions.

  1. A reference group has fitted line \(\widehat{y}=10+2x\), and another group has fitted line \(\widehat{y}=14+5x\). What are the two fitted lines’ slopes and their slope difference?
  2. For the lines in question 1, center at \(c=3\). Find each centered intercept and verify that the slopes are unchanged.
  3. In a group-slope model, a group’s slope difference from the reference group is \(\delta_g\). What is that difference after centering at \(c\), and why?
  4. If a predictor is centered at 8 units, what original predictor value does a centered value of \(-2\) represent?
  5. Explain why centering changes the interpretation of the intercepts but not the fitted value for any observation.