Tutorials › Regression Analysis (Undergraduate) › Centering Both Predictors in an Interaction

Units, Scaling, and Centering · Tutorial 166 of 991

Centering Both Predictors in an Interaction

Learn to interpret an interaction model after shifting both predictors to meaningful reference values, and verify how its coefficients change without changing its fitted predictions.

Intermediate 9 min read

What You'll Learn

  • Write an interaction model using both uncentered predictors and their centered versions.
  • Calculate the transformed intercept, main effects, and interaction coefficient.
  • Interpret the intercept at both predictors’ reference values.
  • Interpret each main effect at the other predictor’s reference value.
  • Check that centering preserves fitted predictions and the interaction coefficient.
  • Avoid treating a conditional coefficient as an unconditional effect or a causal claim.

Why Center Both Predictors?

In an interaction model, the association between one predictor and the outcome depends on the value of the other predictor. As a result, a main-effect coefficient does not describe one universal slope: it describes a slope at a particular value of the other predictor. When the predictors have not been centered, that particular value is zero. If zero is not meaningful or is outside the observed range, the main-effect interpretations may be hard to use.

Centering both predictors replaces each with its difference from a chosen reference value. The model still describes the same fitted outcomes, but the intercept and main effects now refer to those reference values. This tutorial focuses on reading that numerical interaction model: its intercept describes the outcome at both references, and each main effect describes a slope at the other predictor’s reference.

The Model and Its Assumptions

Let \(x_1\) and \(x_2\) be two quantitative predictors, and let \(Y\) be a quantitative outcome. An interaction model with both main effects and their product can be written as

$$ E(Y\mid x_1,x_2)=\beta_0+\beta_1x_1+\beta_2x_2+\beta_3x_1x_2. $$

Here, \(E(Y\mid x_1,x_2)\) is the model’s conditional mean outcome at the stated predictor values. In a fitted model, use estimated coefficients \(b_0,b_1,b_2,b_3\) to calculate the fitted outcome \(\hat y\). The product term \(x_1x_2\) allows the slope for one predictor to vary with the other.

The model assumes that the conditional mean has the stated form over the range where it is used, including a product interaction and no additional terms. For usual regression inference, errors are taken to have conditional mean zero; independence and constant error variance are also commonly assumed for standard error calculations, with normal errors used for exact small-sample \(t\)-procedures. Centering is an algebraic change of predictor coordinates; it does not make these assumptions true. The interpretations below describe conditional associations in the model, not causal effects.

Choose reference values \(c_1\) for \(x_1\) and \(c_2\) for \(x_2\), and define the centered predictors

$$ u=x_1-c_1,\qquad v=x_2-c_2. $$

Thus \(u=0\) means \(x_1=c_1\), and \(v=0\) means \(x_2=c_2\). The reference values can be chosen for substantive meaning or because they are representative of the data, but they should be stated along with the resulting interpretations.

Definition: Centering both predictors in an interaction model means replacing \(x_1\) and \(x_2\) with \(u=x_1-c_1\) and \(v=x_2-c_2\), then expressing the model using \(u\), \(v\), and their product \(uv\). The intercept is then the fitted conditional mean at \(x_1=c_1\) and \(x_2=c_2\). Each main effect is a slope evaluated at the other predictor’s reference value.

How the Coefficients Change

Substitute \(x_1=u+c_1\) and \(x_2=v+c_2\) into the original model. Expanding the product gives

$$ \begin{aligned} \hat y &=b_0+b_1(u+c_1)+b_2(v+c_2)+b_3(u+c_1)(v+c_2)\\ &=b_0+b_1u+b_1c_1+b_2v+b_2c_2\\ &\quad+b_3uv+b_3c_2u+b_3c_1v+b_3c_1c_2\\ &=(b_0+b_1c_1+b_2c_2+b_3c_1c_2)\\ &\quad+(b_1+b_3c_2)u+(b_2+b_3c_1)v+b_3uv. \end{aligned} $$

This is the same fitted model written in centered coordinates. The calculation just groups terms by the constant, \(u\), \(v\), and \(uv\); it does not alter any predicted outcome for a given pair of original predictor values.

Coefficient transformation: If the original fitted model is \(\hat y=b_0+b_1x_1+b_2x_2+b_3x_1x_2\), then the centered model is
$$ \hat y=b_0^*+b_1^*u+b_2^*v+b_3^*uv, $$
where
$$ \begin{aligned} b_0^*&=b_0+b_1c_1+b_2c_2+b_3c_1c_2,\\ b_1^*&=b_1+b_3c_2,\\ b_2^*&=b_2+b_3c_1,\\ b_3^*&=b_3. \end{aligned} $$

The intercept adds up the model’s terms at the two references. The centered \(x_1\) main effect includes \(b_3c_2\), because its slope is evaluated at \(x_2=c_2\); the centered \(x_2\) main effect includes \(b_3c_1\) for the corresponding reason. The interaction coefficient stays the same.

Worked Example: Interpreting Both Main Effects at Chosen References

Suppose a hypothetical model predicts a quiz score in points from weekly study hours \(x_1\) and the number of practice tests \(x_2\):

$$ \hat y=40+2x_1+3x_2+1.5x_1x_2. $$

The study team chooses \(c_1=5\) hours and \(c_2=2\) tests as reference values. Set \(u=x_1-5\) and \(v=x_2-2\). Applying the coefficient formulas gives

$$ \begin{aligned} b_0^*&=40+2(5)+3(2)+1.5(5)(2)=71,\\ b_1^*&=2+1.5(2)=5,\\ b_2^*&=3+1.5(5)=10.5,\\ b_3^*&=1.5. \end{aligned} $$

The centered equation is \(\hat y=71+5u+10.5v+1.5uv\). The intercept, 71 points, is the predicted score for a student studying 5 hours per week and taking 2 practice tests. The \(u\) coefficient, 5 points per study hour, is the model’s study-hour slope when the student takes 2 practice tests. The \(v\) coefficient, 10.5 points per test, is the practice-test slope when the student studies 5 hours per week. The interaction coefficient says that the study-hour slope increases by 1.5 points per hour for each additional practice test, within this model.

Reading the Conditional Slopes

The slope interpretations follow directly by collecting the terms involving each predictor. In the original model, hold \(x_2\) fixed. The terms that vary with \(x_1\) are \(b_1x_1+b_3x_1x_2=(b_1+b_3x_2)x_1\), so the slope for \(x_1\) is \(b_1+b_3x_2\). Similarly, holding \(x_1\) fixed gives an \(x_2\) slope of \(b_2+b_3x_1\).

At the reference values, these slopes become \(b_1+b_3c_2=b_1^*\) and \(b_2+b_3c_1=b_2^*\). Equivalently, in the centered model the slope for \(u\) at a specified \(v\) is \(b_1^*+b_3^*v\), and the slope for \(v\) at a specified \(u\) is \(b_2^*+b_3^*u\). Setting the other centered predictor to zero gives the main-effect interpretation. This is why a main effect in an interaction model must always be reported with the other predictor’s value.

Worked Example: Choosing Different Reference Values

Use the hypothetical score model \(\hat y=40+2x_1+3x_2+1.5x_1x_2\), but now center weekly study hours at \(c_1=6\) and practice tests at \(c_2=1.5\). The centered predictors are \(u=x_1-6\) and \(v=x_2-1.5\).

Calculate each coefficient:

$$ \begin{aligned} b_0^*&=40+2(6)+3(1.5)+1.5(6)(1.5)=70,\\ b_1^*&=2+1.5(1.5)=4.25,\\ b_2^*&=3+1.5(6)=12,\\ b_3^*&=1.5. \end{aligned} $$

Therefore \(\hat y=70+4.25u+12v+1.5uv\). The fitted score at 6 study hours and 1.5 practice tests is 70 points. At 1.5 tests, the study-hour slope is 4.25 points per hour; at 6 study hours, the practice-test slope is 12 points per test. These are different conditional slopes from those in the first example because the reference values changed. The fitted predictions for any fixed \(x_1,x_2\) have not changed.

Checking the Re-expression

A direct prediction check is a useful way to confirm that the centered coefficients and reference values have been combined correctly. For \(x_1=5\) hours and \(x_2=2\) tests in the first example, the centered values are \(u=0\) and \(v=0\). The centered model predicts 71 points, matching the original model:

$$ 40+2(5)+3(2)+1.5(5)(2)=71. $$

Worked Example: Predicting Away From Both References

Use the first centered equation, \(\hat y=71+5u+10.5v+1.5uv\), for a student who studies 6 hours per week and takes 1 practice test. Then \(u=6-5=1\) hour and \(v=1-2=-1\) test.

Substitute these values:

$$ \hat y=71+5(1)+10.5(-1)+1.5(1)(-1)=64. $$

The predicted score is 64 points. Checking in the original equation gives \(40+2(6)+3(1)+1.5(6)(1)=64\), the same result. At this student’s value of \(x_2=1\), the model’s study-hour slope is \(5+1.5(-1)=3.5\) points per hour. At \(x_1=6\), its practice-test slope is \(10.5+1.5(1)=12\) points per test. The main effects of 5 and 10.5 in the centered equation apply at \(v=0\) and \(u=0\), respectively, not at every predictor value.

Common Mistakes and Why the Reference Values Matter

A frequent error is to read a main effect in the centered model as a slope that applies regardless of the other predictor. In an interaction model, the slope changes with the other predictor, so the main effect is conditional. Another error is to say the intercept is the overall or average outcome. It is the predicted conditional mean at the specific pair of reference values; it equals an overall mean only under additional conditions, not simply because predictors were centered.

Centering both predictors is useful because it can make the intercept and the two main effects easier to communicate. The choices do not remove the interaction, change the predictions, or establish a causal interpretation. Reference values should be identified in the same units as the original predictors, and interpretations should keep the outcome units attached. For instance, a slope measured in score points per study hour is not a percentage change in score.

  • Wrong: “The study-hour coefficient is the increase in score for every additional hour, regardless of practice tests.”
  • Correction: “It is the increase in predicted score per additional study hour when practice tests equal the stated reference value.”
  • Wrong: “The centered intercept is the average score.”
  • Correction: “It is the predicted score when both predictors equal their chosen reference values.”
  • Wrong: “The interaction coefficient proves that extra study causes a higher score.”
  • Correction: “It describes how the model’s conditional association between study hours and predicted score changes with practice-test count; it does not by itself establish causation.”
Key takeaway: With both predictors centered, the intercept describes the fitted outcome at both reference values. The first main effect is the slope when the second predictor is at its reference, and the second main effect is the slope when the first predictor is at its reference. The interaction coefficient and fitted predictions are unchanged by this re-expression.

Check Your Understanding

Use the model and ideas in this tutorial to answer the questions.

  1. In \(\hat y=b_0+b_1x_1+b_2x_2+b_3x_1x_2\), what does the coefficient \(b_1\) describe before centering, and at what value of \(x_2\) is that slope evaluated?
  2. For \(c_1=4\) and \(c_2=3\), write the formula for the centered intercept in terms of \(b_0,b_1,b_2,b_3\).
  3. Suppose \(b_2=2\), \(b_3=0.5\), and \(c_1=6\). What is the centered coefficient for \(v\), and what is its interpretation?
  4. Does centering both predictors change the interaction coefficient or fitted predictions? Explain briefly.
  5. A student says, “The centered intercept is the average outcome because both predictors are centered.” What is the precise correction?