# Backtransforming the vertex of a quadratic function

I have created a model for which it was necessary to scale my predictor values by subtracting by the mean and dividing by the standard deviation of the X values. This resulted in variables centered around a mean of 0 and standard deviation of 1, and allowed my model to converge (the values prior to scaling were quite large).

My model includes quadratic (e.g., distance^2 to roads) and associated linear terms (e.g., distance to roads), and I'm interested in determining the maximum values (i.e., the vertex) for each quadratic term where b > 0. I believe my steps should be as follows, but confirmation would be quite useful:

1) Determine the vertex (v) of the quadratic variable by using the term v = -b/2a where b is the coefficient/beta of the quadratic term and a is the beta of the linear term.

2) Back transform this maximum value v by: v * σ + μ where σ is the standard deviation of the unstandardized, squared values of X and μ is the mean of the unstandardized, squared values of X.

3) Take the square root of the resulting backtransformed maximum value to convert from distance^2 to distance.

Is this correct? My results, while interpretable in the context of my study, make me question the validity of this approach. I appreciate any insight.

## 1 Answer

Your model appears to take the form

$$\mathbb{E}(Y) = \alpha + \beta Z + \gamma Z_2.$$

$Z$ and $Z_2$ are standardized versions of an explanatory variable $X$ and its square $X^2$, respectively, so that $\sigma Z + \mu = X$ and $\sigma_2 Z_2 + \mu_2 = X^2$, with $\sigma$ and $\sigma_2$ the (necessarily positive) standard deviations of $X$ and $X^2$ in the dataset.

The coefficients in the model are $\alpha$, $\beta$, and $\gamma$ which are estimated by $a$, $b$, and $c$, respectively: the latter two are the "betas" of $X$ and $X^2$ when $Y$ itself has been standardized. Finally, $a$ depends on all other variables. In particular, it is not constant in the dataset if there are any other non-constant variables in the regression. We will see that does not matter.

Re-expressing the fit in terms of $X$ and $X^2$ gives

\eqalign{ \mathbb{E}(Y) &= a + b\left(\frac{X-\mu}{\sigma}\right) + c\left(\frac{X^2-\mu_2}{\sigma_2}\right) \\ &= \left(a - \frac{b\mu}{\sigma}-\frac{c\mu_2}{\sigma_2}\right) + \left(\frac{b}{\sigma}\right)X + \left(\frac{c}{\sigma_2}\right)X^2. }

(Because varying $X$ does not change any of the other variables, $a$ disappears altogether from these expressions.)

The vertex occurs where the variation in the expectation with respect to $X$ is zero:

$$0 = \frac{d\mathbb{E}(Y)}{dX} = \frac{b}{\sigma} + \frac{2 c}{\sigma_2}X,$$

with the unique solution

$$X^{*} = -\left(\frac{b}{\sigma}\right) / \left(\frac{2 c}{\sigma_2}\right) = -\left(\frac{b}{2c}\right)\left(\frac{\sigma_2}{\sigma}\right)$$

provided $c\ne 0$. This estimate of the vertex will be a minimum when the second derivative $2 c/\sigma_2$ is positive: that is, necessarily $c\gt 0$.

As a double-check, $b$ and $c$ have the same units of measure as $Y$ (because $Z$ and $Z_2$ are unitless); $\sigma$ is in the units of $X$ (such as a distance); and $\sigma_2$ is in the squared units of $X$. Thus the units of $X^{*}$ are those of $\sigma_2/\sigma$: the same units as $X$, as it should be.

In this analysis it did not matter what values $\sigma$, $\sigma_2$, $\mu$, or $\mu_2$ might have had. In particular, if you chose to standardize using non-standard estimates of dispersion or location, the formula for the vertex would remain unchanged.

### Edit

Comments suggest that $Z_2 = Z^2 = ((X-\mu)/\sigma)^2$. In this case

$$0 = \frac{d\mathbb{E}(Y)}{dX} = \frac{b}{\sigma} + \frac{2 c}{\sigma^2}(X-\mu),$$

with solution

$$X^{*} = \left(\frac{-b}{2c}\right)\sigma + \mu.$$

Little else changes in the analysis. It is no longer the case that $c$ is the beta (i.e., the standardized coefficient) for $X^2$, but that matters little. $X^{*}$ is still a vertex if and only if $c$ is positive.

• In this situation, would you recommend standardizing $Z$ and then using the square of the standardized $Z$ in the model, or also standardizing the square as Beth has done? – Matthew Drury Jun 18 '15 at 20:24
• @whuber - That clears things up a lot; thank you. To clarify - X* is the estimate of the vertex, but the second derivative (while not the estimate of the vertex) indicates whether the estimate is a minimum or maximum? – Beth S. Jun 18 '15 at 20:26
• Yes, Beth, that is correct. @Matthew It matters little: once $Z$ is standardized, its square normally won't be far from standardized. If one's software is blind to the fact that $Z^2$ is actually the square of $Z$, and treats it as just one more variable, then it will separately standardize each variable, as I have assumed here. The possibility of this nuance is precisely why I started out this answer with the cautious "appears to take." I know from your many excellent answers here that you would find it easy to carry out this analysis in either case, but for completeness I will include it. – whuber Jun 18 '15 at 20:39
• If both $b$ and $c$ are negative, then (1) $X^{*}$ is positive and (2) it is a maximum rather than a minimum. The only way you can obtain a negative estimate for a (minimum) vertex is when $c$ is positive and $b$ is positive. These conclusions have to be modified according to the edit when $Z_2=Z^2$: then you have to consider whether the vertex is to the right or left of $\mu$ rather than positive or negative, respectively. – whuber Jun 18 '15 at 20:50
• When $c$ is negative, the vertex will exist and be a maximum. The sign of $c$ tells us whether the parabola is concave up ($c$ positive) or down ($c$ negative). When $c=0$, it degenerates to a line. The sign of $b$ is the sign of the slope when $X$ is equal to its mean value. By sketching some pictures you can identify all the constraints on $b$, $c$, and $X^{*}$. For instance, when $b\lt 0$ and $c\gt 0$, the curve must be descending when $X$ is at its mean, reach a minimum at some greater value $X=X^{*}$, and then go back up again. – whuber Jun 18 '15 at 21:35