# Calculating threshold turn value using mean centered quadratic terms in regression

I have a question on calculating the threshold value or value at which the quadratic relationship turns. The formula for calculating the turn is at $x = -b/2a$, following from $ax^{2}+bx+c$.

My question is this: when using the mean centered quadratic terms, do you add the mean value back to calculate the threshold turn value on the non-centered term (for purposes of interpretation when writing up results and findings).

• Could you perhaps present an example of what you mean?
– whuber
Commented Jul 13, 2013 at 2:31

If you center $x$ prior to running your regression, then the uncentered value of $x$ at which scores are predicted to reach their extreme (be it a minimum or maximum) is indeed $-b/2a + \bar{x}$, where $\bar{x}$ denotes the mean of $x$. However, the corresponding value of $y$, namely the predicted maximum or minimum score, needs to be calculated with $x=-b/2a$ regardless of whether $x$ was centered prior to entering the model or not.

For example, here are mock values for $x$ and $y$ (I am using R here, but of course, any statistical package is going to lead you to the same conclusion):

x<-1:10 #uncentered
mean(x) #mean of x is 5.5
x_c <- as.numeric(scale(x, center=T, scale=F)) #centered
y<-c(1.2, 3.3, 6, 7, 12, 18, 16, 16, 8, 6)


The resulting data (with 10 observations) are shown in the following table:

    x  x_c    y
1   1 -4.5  1.2
2   2 -3.5  3.3
3   3 -2.5  6.0
4   4 -1.5  7.0
5   5 -0.5 12.0
6   6  0.5 18.0
7   7  1.5 16.0
8   8  2.5 16.0
9   9  3.5  8.0
10 10  4.5  6.0


The scatterplots showing y plotted against the uncentered predictor (left) and mean-centered predictor (right) look like this:

Everything looks the same, except that the x-axis shifts going from one plot to the next (in other words, all of the points were shifted horizontally but not vertically, by a magnitude of $\bar{x}=5.5$). We can then regress $y$ on uncentered $x$ and $x^2$, and on centered $x$ and $x^2$, and look at the coefficients:

#run regressions
fit.uncentered <- lm(y ~ x + I(x^2))
fit.centered <- lm(y ~ x_c + I(x_c^2))

> fit.uncentered$coefficients (Intercept) x I(x^2) -8.053333 7.014242 -0.550000 > fit.centered$coefficients
(Intercept)         x_c    I(x_c^2)
13.8875000   0.9642424  -0.5500000


The coefficient for the quadratic term ($-0.55$) does not change whether $x$ is centered or not (i.e., the $a$ in $y=ax^2+bx+c$). However, the intercept ($c$) and the coefficient affiliated with the linear term ($b$) do change. This means that the value of $x$ at which the predicted score will reach its extreme value ($-b/2a$) does vary depending on centering. In the following, I calculate $-b/2a$ separately for the uncentered and centered equations:

#inflection point for uncentered equation: a=-0.55, b=7.014242
print(-7.014242/(2*-0.55)) #-b/2a = 6.376584

#inflection point for centered equation: a=-0.55, b=0.9642424
print(-0.9642424/(2*-0.55)) #-b/2a = 0.876584; this is indeed 6.376584 - mean(x)


Thus, the uncentered value of $x$ at which the predicted score reaches its maximum or minimum is $6.38$; the corresponding centered value of $x$ is $0.88$, which--as you deduced--is exactly the uncentered value minus the mean ($0.88=6.38-5.5$). In other words, the inflection point in the curve comes at $-b/2a + \bar{x}$, if $a$ and $b$ are values taken from the centered equation. The following plot shows the same scatterplots as above, but with the predicted scores superimposed, and vertical and horizontal lines showing the values of $x$ and $y$ (respectively) at which the maximum predicted score is reached:

This makes it clear that: (1) the predicted value of $y$ that corresponds to the turning point of the curve does NOT depend on centering; however, (2) the value of $x$ at which the predicted value of $y$ is maximal or minimal DOES depend on centering, such that the uncentered value of $x$ at which $y$ is predicted to reach its extreme value is:

• $-b/2a$, if $x$ entered the model UNCENTERED
• $-b/2a + \bar{x}_{u}$, if $x$ entered the model CENTERED (and $x_u$ is $x$ uncentered)

Note that in order to compute the predicted value of $y$ at the turning point, $-b/2a$ must be used as the predictor value regardless of centering. In the following, I compute the predicted score at $x=-b/2a$ using the uncentered and centered equations:

#using uncentered equation, -b/2a from uncentered equation
predict(fit.uncentered, newdata=data.frame(x=6.376584)) #14.31012

#using centered equation, -b/2a from centered equation
predict(fit.centered, newdata=data.frame(x_c=0.876584)) #14.31012

#using centered equation, -b/2a from UNCENTERED equation (i.e. -b/2a + mean(x))
predict(fit.centered, newdata=data.frame(x_c=6.376584)) #-2.32738 instead of 14.31012