# How do you use a Log-linear model when you have negative Xs?

I am trying to us a Log-linear model to derive an elasticity. However, some of my Xs are negative numbers. Being as the model relies on the natural log of the Ys and the Xs, how can this model work when the natural log can only be taken of X>0?

• There are a few tricks. A good one is to transform the variable to a positive only number. If your variable is a net value, maybe a gross value would be more appropriate. Can you be more specific? – Jamzy Jun 7 '19 at 9:56
• Sure thing: my Xs are observations of liquidity gaps, most of which tend to be in surplus, but some of which are also deficits (hence the negative numbers). I thought about what you said and considered perhaps taking the absolute values of all the numbers but I'm not confident that this is the right way to find a meaningful elasticity. I am also wondering how legitimate of a workaround adding some constant to all the Xs (and the Ys?) would be? – Maddy Jun 7 '19 at 10:02
• (p.s. I also realize you were't suggesting using absolute values -- this was just my first impulse to get around negative numbers) – Maddy Jun 7 '19 at 10:18
• Adding some arbitrary constant is usually not recommended, unfortunately. I'm just thinking here... If you have a gap, that's a gap between two positive numbers. what about the log difference between the two. If your gap is defined as a-b, why not try log(a)-log(b). Might give you something meaningful. – Jamzy Jun 7 '19 at 14:46

The elasticity of Y with respect to X is often estimated by running a regression like this: $$\ln Y = \alpha + \beta \ln X + error$$
Let's go back to the textbook (Varian (1992), p. 235) for the definition of the elasticity of $$Y$$ with respect to $$X$$: $$\epsilon(Y,X) =\frac{\partial Y}{\partial X} \cdot \frac{X}{Y}$$ Which equals another common definition of the elasticity: $$=\frac{\partial \ln Y}{\partial \ln X}$$ which we often use when estimating the elasticity with linear regressions.