Tutorials › Exam SRM - Statistics for Risk Modeling › Centering the Predictor and the Intercept

Exam SRM · Simple Regression Foundations · Tutorial 7 of 926

Centering the Predictor and the Intercept

Learn to center a predictor, translate the intercept, and verify that centering at the sample mean makes the intercept equal the mean response.

Beginner 10 min read

What You'll Learn

  • Define a centered predictor using the sample mean.
  • Derive the relationship between centered and original intercepts.
  • Show why centering leaves the least-squares slope unchanged.
  • Verify that fitted values are identical under either predictor scale.
  • Distinguish centering at the mean from choosing another reference value.
  • Identify common errors in interpreting a centered intercept.

Why Center the Predictor?

In simple linear regression, the intercept describes the fitted response when the predictor is zero. That value may be awkward to interpret if zero is outside the observed range or has no practical meaning. Subtracting a reference value from the predictor changes where zero is located, so the intercept can describe the fitted response at a more useful predictor value.

Centering is a change of coordinates, not a new fitted relationship. When the predictor is centered at its sample mean, the least-squares slope and all fitted values remain unchanged, while the new intercept equals the mean response. This is an algebraic property of ordinary least squares with an intercept; it does not require normally distributed errors.

Definition: For observations \((x_i,y_i)\), \(i=1,\ldots,n\), let \(\bar{x}\) be the sample mean of the predictor. The predictor centered at its mean is \(z_i=x_i-\bar{x}\). The original least-squares line is \(\hat{y}_i=b_0+b_1x_i\). The centered representation is \(\hat{y}_i=a_0+a_1z_i\), where \(a_0\) and \(a_1\) are the centered-coordinate intercept and slope.

Assume the usual simple linear regression setup with an intercept: the observed predictor values are treated as fixed, there are at least two distinct predictor values, and coefficients are chosen to minimize the sum of squared differences between observed and fitted responses. The coefficient transformation below is purely algebraic. It does not depend on a distributional assumption for the errors.

How the Coefficients Change

Since \(z_i=x_i-\bar{x}\), the original predictor can be written \(x_i=z_i+\bar{x}\). Substitute this expression into the original fitted line:

$$ \hat{y}_i=b_0+b_1x_i =b_0+b_1(z_i+\bar{x}) =(b_0+b_1\bar{x})+b_1z_i. $$

This expresses the same fitted response using the centered predictor. The coefficient of \(z_i\) is still \(b_1\), and the intercept in the centered representation is \(b_0+b_1\bar{x}\). In other words, centering shifts the intercept to the fitted response at the reference value used for centering, without changing the slope.

Result: When \(z_i=x_i-\bar{x}\), the least-squares coefficients satisfy \(a_1=b_1\) and \(a_0=b_0+b_1\bar{x}\). With an intercept in the ordinary least-squares fit, \(b_0=\bar{y}-b_1\bar{x}\), so \(a_0=\bar{y}\). Thus the centered intercept is the fitted response at the predictor mean.

Why the Centered Intercept Equals the Mean Response

The key fact is that the least-squares line with an intercept passes through the point \((\bar{x},\bar{y})\). The intercept identity follows from the least-squares condition that the fitted line’s average equals the average observed response. To see this, write the fitted values as \(\hat{y}_i=b_0+b_1x_i\). Their average is

$$ \frac{1}{n}\sum_{i=1}^{n}\hat{y}_i =\frac{1}{n}\sum_{i=1}^{n}(b_0+b_1x_i) =b_0+b_1\bar{x}. $$

For ordinary least squares with an intercept, minimizing the sum of squared errors gives \(\sum_{i=1}^n(y_i-\hat{y}_i)=0\). Therefore, \(\sum_{i=1}^n\hat{y}_i=\sum_{i=1}^ny_i\), and the average fitted value is \(\bar{y}\). Consequently, \(b_0+b_1\bar{x}=\bar{y}\). In the centered representation, \(z_i=0\) when \(x_i=\bar{x}\), so the fitted response there is \(a_0\). Hence \(a_0=\bar{y}\).

1
Center the predictor.
For each observation, calculate \(z_i=x_i-\bar{x}\). This shifts the predictor origin to its sample mean.
2
Keep the slope.
Use the same slope because replacing \(x_i\) by \(z_i+\bar{x}\) only adds a constant term to the intercept.
3
Translate the intercept.
Set \(a_0=b_0+b_1\bar{x}\). For an ordinary least-squares line with an intercept, this is \(\bar{y}\).
4
Check a fitted value.
For each \(x_i\), compare \(b_0+b_1x_i\) with \(a_0+b_1(x_i-\bar{x})\). The expressions must agree.

Worked Calculations

Worked Example: Centering Monthly Exposure

A hypothetical portfolio study records monthly exposure \(x\), in thousands of exposure units, and a response \(y\), in dollars per exposure unit, for three groups. The observations are \((2,5)\), \((4,8)\), and \((6,11)\). Find the original and centered least-squares lines, then verify their fitted values.

Method. First calculate the sample means and the centered-sums slope. Then translate the intercept. This avoids treating the centered intercept as if it were still the response at \(x=0\).

The predictor and response means are \(\bar{x}=(2+4+6)/3=4\) and \(\bar{y}=(5+8+11)/3=8\). The centered predictor values are \(-2,0,2\), and the centered response values are \(-3,0,3\). Thus the numerator for the slope is \((-2)(-3)+(0)(0)+(2)(3)=12\), and its denominator is \((-2)^2+0^2+2^2=8\). Therefore, \(b_1=12/8=1.5\).

The original intercept is \(b_0=\bar{y}-b_1\bar{x}=8-(1.5)(4)=2\), so the original line is \(\hat{y}=2+1.5x\). Center the predictor using \(z=x-4\). The centered intercept is \(a_0=b_0+b_1\bar{x}=2+(1.5)(4)=8\), giving \(\hat{y}=8+1.5z\).

Check the fitted values. At \(x=2\), the original line gives \(2+1.5(2)=5\); the centered line gives \(8+1.5(-2)=5\). At \(x=4\), both give \(8\). At \(x=6\), the original line gives \(2+1.5(6)=11\); the centered line gives \(8+1.5(2)=11\). The two lines agree at all observations, and the centered intercept is \(\bar{y}=8\).

Worked Example: Centering a Predictor Measured in Days

For a hypothetical operational study, let \(x\) be the number of days a claim has been open and \(y\) be its processing cost in hundreds of dollars. Three observed pairs are \((10,12)\), \((20,15)\), and \((30,19)\); a fourth is \((40,22)\). Calculate both lines and the fitted cost at 30 days.

Method. Compute the slope from centered sums and use the means to obtain both intercepts. This makes it clear that the slope is not multiplied or divided by the amount subtracted during centering.

The means are \(\bar{x}=(10+20+30+40)/4=25\) and \(\bar{y}=(12+15+19+22)/4=17\). The predictor deviations are \(-15,-5,5,15\); the response deviations are \(-5,-2,2,5\). The sum of cross-products is \(75+10+10+75=170\). The sum of squared predictor deviations is \(225+25+25+225=500\). Hence \(b_1=170/500=0.34\) hundred dollars per day.

The original intercept is \(b_0=17-(0.34)(25)=8.5\), so \(\hat{y}=8.5+0.34x\). With \(z=x-25\), the centered intercept is \(a_0=8.5+(0.34)(25)=17\), and the centered line is \(\hat{y}=17+0.34z\).

At 30 days, \(z=30-25=5\). The original line gives \(8.5+(0.34)(30)=18.7\), and the centered line gives \(17+(0.34)(5)=18.7\). The fitted cost is \(18.7\) hundreds of dollars, or \(\$1{,}870\). As a check, the centered intercept \(17\) is the fitted response at 25 days, not at zero days.

Worked Example: Centering at a Value Other Than the Mean

A hypothetical model relates a device’s operating age \(x\), in months, to a maintenance score \(y\). The observed pairs are \((100,4)\), \((120,7)\), and \((140,10)\). Find the line centered at the mean age, then rewrite it using \(w=x-100\). Explain why the latter intercept is not the mean response.

Method. Fit the ordinary least-squares line, then express the same line using each reference value. This avoids assuming that every centered predictor has an intercept equal to \(\bar{y}\).

Here \(\bar{x}=(100+120+140)/3=120\) and \(\bar{y}=(4+7+10)/3=7\). The predictor deviations from the mean are \(-20,0,20\), and the response deviations are \(-3,0,3\). The cross-product sum is \((-20)(-3)+0+(20)(3)=120\); the squared-predictor-deviation sum is \(400+0+400=800\). Thus \(b_1=120/800=0.15\) score points per month. The original intercept is \(b_0=7-(0.15)(120)=-11\), so \(\hat{y}=-11+0.15x\).

Centering at the mean gives \(z=x-120\), with intercept \(-11+(0.15)(120)=7\). Therefore, \(\hat{y}=7+0.15z\). For the alternative reference value, \(w=x-100\), substitute \(x=w+100\) into the original line: \(\hat{y}=-11+0.15(w+100)=4+0.15w\). This intercept is \(4\), the fitted response at 100 months. It is not \(\bar{y}=7\), because \(w=0\) represents 100 months rather than the mean age of 120 months.

Check the original observations: the line predicts \(4\) at 100 months, \(7\) at 120 months, and \(10\) at 140 months. Both centered forms give the same respective predictions.

What Centering Does—and Does Not Do

The main benefit is interpretation. If the predictor mean is a sensible reference point, the centered intercept directly gives the fitted response for an observation at that mean. Centering can also make calculations easier when predictor values are large: deviations from the mean may be simpler to handle than the raw values.

Centering does not change the fitted relationship or improve its fit by itself. It does not change the slope, any fitted value, or the ordering of the predictor values. It changes the coordinate origin and, consequently, the numerical value and interpretation of the intercept. A centered intercept is not automatically a causal effect or a response observed for a particular individual; it is the fitted response at the reference predictor value.

The identity \(a_0=\bar{y}\) depends on centering at \(\bar{x}\) and fitting ordinary least squares with an intercept. It need not hold if the predictor is centered at another value, if the fit is constrained to pass through the origin, or if a different fitting method is used. The algebraic equality of the original and transformed expressions still holds when coefficients are translated consistently, but the mean-response conclusion is specific to the stated least-squares setup.

Common Mistake

A frequent error is to subtract the predictor mean from the predictor and then leave the intercept unchanged. For the second worked example, that mistake would retain \(8.5\) as the centered intercept and produce \(\hat{y}=8.5+0.34(x-25)\). At \(x=25\), this incorrectly predicts \(8.5\), even though the original line predicts \(8.5+0.34(25)=17\). The correction is to translate the intercept as well: \(a_0=b_0+b_1\bar{x}=17\). Then \(17+0.34(25-25)=17\), matching the original line.

A related interpretation error is to claim that the centered intercept is always \(\bar{y}\). That is true when centering at \(\bar{x}\) under ordinary least squares with an intercept. If the reference value is \(c\), the transformed intercept is \(b_0+b_1c\), the fitted response at \(x=c\). It equals \(\bar{y}\) only when \(c=\bar{x}\) (or in the special case of a zero slope).

Key takeaway: Centering at the sample predictor mean replaces \(x_i\) by \(x_i-\bar{x}\). The slope and fitted values stay the same; the intercept becomes \(\bar{y}\), the fitted response at \(x=\bar{x}\).

Check Your Understanding

For each problem, keep track of the reference value represented by a centered predictor.

  1. A least-squares line with an intercept has \(b_0=3\), \(b_1=0.8\), and \(\bar{x}=5\). Find the centered intercept when \(z=x-\bar{x}\), and state the fitted response at the predictor mean. (Answer: centered intercept \(=7\); fitted response at \(x=5\) is \(7\).)
  2. For observations with \(\bar{x}=10\), a fitted line is \(\hat{y}=2+0.5x\). Rewrite it using \(z=x-10\), then give the prediction at \(x=14\). (Answer: \(\hat{y}=7+0.5z\); prediction \(=9\).)
  3. A predictor is centered at \(c=20\), and the original fitted line is \(\hat{y}=-4+0.3x\). What is the centered intercept, and is it necessarily the sample mean response? (Answer: centered intercept \(=2\), the fitted response at \(x=20\); it is not necessarily the sample mean response.)
  4. Observed predictor values are \(2,4,8\), and the observed responses lie exactly on \(\hat{y}=1.5x\). Find the centered intercept when centering at the predictor mean, and verify the fitted response there. (Answer: \(\bar{x}=14/3\), \(\bar{y}=7\), and the centered intercept and fitted response at \(x=14/3\) are both \(7\).)
  5. A fitted line is \(\hat{y}=5+2x\), and the predictor is recoded as \(z=x-3\). A candidate writes \(\hat{y}=5+2z\). Identify the corrected centered line and the prediction at \(x=4\). (Answer: \(\hat{y}=11+2z\); at \(x=4\), \(z=1\) and the prediction is \(13\).)
Clinical Biostats