# Interpreting a quadratic logarithmic term

Given the regression model

$y=\beta_0 + 300*ln(x_1) - 15 * (ln(x_1))^2 + \beta_3*x_2 + ... + u$

$x$ ranges from 1 000 to 30 000 (6.9 to 10.3 on a logarithmic scale). How to interpret the diminishing effect that $x_1$ has on $y$? Is it possible to interpret it for small changes in $x_1$ analog to a "normal" quadratic term, i.e. the partial effect can be calculated as

$\Delta y = [\beta_1 - 2*\beta_2 * ln(x1)]$

and the maximum (turning point) as $x_{1} = - \beta_1 / (2*\beta_2)$, which would yield 300 / 30 = 10 with e^10=22026? How to give a meaningful and illustrative interpretation of the effect? For example, the effect of a 1% increase of $x_1$ or going from 20 000 to 21 000?

### Edit

Thank you for the code and sorry for the delayed response. I managed to plot the marginal effect of x1 but decided to use the plot of the actual and predicted values of y against x1 while holding all other variables at their mean using the following Stata code:

reg y ln(x1) (ln(x1))^2 x2 x3 x4 x5
adjust x2 x3 x4 x5 if e(sample), gen(predict)
twoway line predict x1, sort || scatter y x1


I think this illustrates the effect of x1 on y really well and the plot is easy to understand despite the quadratic logarithmic term in the regression model.

Isn't the derivative that you want actually $\frac{dy}{dx_{1}}=\frac{300}{x_{1}}-\frac{30}{x_{1}}\ln x_{1}$? Your derivative is the change in $y$ for a small change in $\ln x_{1}$. I think it's probably easier to think about about changing $x_{1}$ on the original (non-logged) scale. That shows that the marginal effect of $x_{1}$ starts out positive for small $x_1$ and declines steeply until $x_{1}=e^{10}$ and is negative for $x_{1} \gt e^{10}$.

Here's some Stata code to make the graphs you asked about below. There might be a more elegant way to do the labels on the original scale, but that's all I got:

#delimit;
clear all;
set more off;

sysuse auto, clear;

gen lmpg=ln(mpg);

reg price c.lmpg##c.lmpg;

/* yhat at x of 18, 20 & 25 */
margins, at(lmpg=(=ln(18)' =ln(20)' =ln(25)'));

sum lmpg;
local mean = r(mean);
local sd = r(sd);

/* yhat at mean of ln(x) and at mean plus 1 sd */
margins, at(lmpg=(mean' =mean'+sd''));
marginsplot, xlabels(mean' "=round(exp(mean'),,01)'" =mean'+sd'' "=round(exp(mean'+sd'),.01)'");

/* The MARGINAL effect of x on y at mean and mean of ln(x) plus 1sd */
margins, dydx(lmpg) at(lmpg=(mean' =mean'+sd''));
marginsplot, xlabels(mean' "=round(exp(mean'),.01)'" =mean'+sd'' "=round(exp(mean'+sd'),.01)'");
`
• I am pretty sure the minimum of that derivative is $\frac{30}{e^{11}}<0$, at $x=e^{11}$, but maybe Will's calculus is better that mine. – Dimitriy V. Masterov Feb 7 '12 at 18:16
• Thank you both for your help. I think Will is right because of x1*=e^ (a/2b). However, I am not sure how to best present the result to the reader. I created a plot of the predicted values of y against ln(x1) while holding all other variables at their mean. Do you have a recommendation how to best discuss the numbers? Preferably, I would like to give two examples, thereby illustrating the changing effect but the discussion of a marginal change from 10000 to 10001 is hardly illuminating. – Ikm2012 Feb 7 '12 at 23:44
• I think a lot of this depends on the domain. If there are some salient levels for $x_{1}$, you can report $y$ or $frac{dy}{dx}$ for those values or graph the curve you talked with the salient values labeled. Personally, I prefer to use the unlogged scale axis labels, but then scale the axis (see this paper for an example: stata-journal.com/sjpdf.html?articlenum=gr0032). Another approach would be to take the mean or median of $x_{1}\pm\sigma$, and report what a standard deviation increase above the central moment would do to $y$ in your model. – Dimitriy V. Masterov Feb 8 '12 at 14:28
• Thank you for your recommendations. It seems that it is not that easy to scale the axis in Stata. I find your second approach particularly interesting. Do you have a suggestion or a link of how to do that in Stata? Is there an ado file that offers an easy to implement solution? – Ikm2012 Feb 8 '12 at 17:23
• I edited my response above to give you an example. – Dimitriy V. Masterov Feb 8 '12 at 19:42