# Effect of quadratic term when variable's range is negative

I am running a Linear Model where I want to include a quadratic term. The dependent and the explanatory variables are all in logarithmic terms.

Further, due to Log transformation the range of X is completely negative, from -8 to -4

I thus run:

log(y)= b0 + b1*log(x) + b2*log(X)^2 + e


... I obtain that both b1 and b2 are negative.

Does the total effect of X increase and then decrease after a certain value of X?

I am aware of the fact that the interpretation of the coefficient is not trivial with log variables squared. But I am only interested in signs.

Moreover, the signs with the linear variables and the quadratic terms are: b1 >0 and b2<0.

• You said " I obtain that both b1 and b2 are negative." then you said "b1 >0 and b2<0"..If b2 is negative, then yes, the effect of $\log x$ increases and then decreases. Jul 23, 2016 at 15:19
• @RobertLong Your comment meshes with my answer, but whether a turning point is seen within the observed range depends on the magnitudes too. Jul 23, 2016 at 15:26
• @RobertLong. I said b1 >0 and b2<0 in the case I do not take the logs of the variable. Jul 23, 2016 at 15:29
• The range of a variable has a conventional meaning in statistics, and is necessarily non-negative. Can you explain what you mean without using the term "range"? Jul 24, 2016 at 6:10

I think what you should mean is that $\log X$ is negative with a range from $-8$ to $-4$. If $X$ itself were negative, then its logarithm is complex and not defined for this kind of statistical model.

The answer depends entirely on the values of the coefficients, even though it is given that both are negative. Anything can happen from decreasing monotonically over your range to increasing monotonically; a turning point may or may not appear within your range.

We can illustrate generically in terms of some $x$, here equal to your $\log X$.

Hence there is no substitute for plotting using your estimated coefficients.

While I was writing this, you edited so that you now first say that both coefficients are negative, and then later say that one is positive and the other is negative. That needs clarifying! Whichever it is, the principle is the same: just the plot the linear and quadratic terms to see how they behave for your observed range. (Thinking about how they would behave for rather smaller and larger values is usually a good idea too.)

• Thanks, however plotting does not help because of the data structure. I have 20,000 observations and X takes only 136 unique values. Thus what I get when I plot are just stripes with some red pattern of the effect which is not very informative. What I am doing on R is the following. 1 ) ols1 <- lm(log(y)~ log(x) + I(log(x)^2)) 2) plot(log(y)~ log(x)) 3) points(log(x), fitted(ols1), col='red', pch=20) Jul 23, 2016 at 15:23
• You are asking about the effect of using a linear and quadratic effect and I am explaining how to think about that. The only simple way to understand them is to plot! Sure, other variables may swamp their combined effect, but that's a different question. I can't comment on how best to approach this in R but it's just high school algebra. The number of observations and of distinct (not unique) values is not material to this question. Jul 23, 2016 at 15:25
• I got the point. Since the only thing which matter is range, do you think that plotting using a sequence with the same range of the variables would suffice? Or should I just turn to not transformed variables? Further, the total effect the coefficients of log(x) and (log(x))^2 may be interpreted somehow? Jul 23, 2016 at 15:35
• I don't quite understand what new thing you are asking that we can answer. I plotted mathematical functions in my favourite software and naturally have no, and did not need, access to your data; you should be able to do the same in any decent software. It's a bad idea to think that the two terms have separate effects; they are yoked together and it's how they behave together that is crucial. I don't think any of us can tell on this evidence whether the transformation is itself a good idea. Jul 23, 2016 at 15:39

Although you are estimating a log-log model it is still a linear model, so the question comes down to how a quadratic function behaves.

The intercept has no bearing on the shape, so we can just consider:

$$f(x) = ax + bx^2$$

It is clear from inspection that if $b$ is negative then the shape is a parabola that increases and then decreases, which answers the question that you posed ("Does the total effect of X increase and then decrease after a certain value of X?") and this is not affected at all by the log transformations.

Differentiating and setting to zero we find:

$$a +2bx = 0$$

Hence, $x= -a/2b$ is the turning point (the certain value) that you mentioned, though whether this occurs within the range of your data depends on the values of $a$ and $b$.