Dealing with 0's in loglog regression by using indicator functions I(x > 0)?

Assume we want to estimate the following model

$$y = e^{\beta_0} * x_1^{\beta_1} * x_2{\beta_3}$$ which we can linearize into $$\log(y) = \beta_0 + \beta_1 * \log x_1 + \beta_2 * \log x_2$$

Assume that the IV's can have zero value entries.

To deal with this why does one not just insert indicator variables as:

$$\log(y) = \beta_0 + I(x_1 > 0)\beta_1 * \log x_1 + I(x_2 > 0)\beta_2 * \log x_2$$ where as $$I(x > 0) = 1$$ if $$x > 0$$ else $$0$$.

I have not seen anyone do this and i wonder why is that?

• zero observations of X contribute nothing to the regression because any value of coefficients produces zero output, i.e. exact match to left hand side. thus, you can simply remove the zero values from the training data set. keeping zeros only props up regression diagnostics without actually helping with accuracy of the estimation Nov 15, 2023 at 17:11
• we still have the intercept? just removing them might not be possible since it may remove a large portion of the dataset, lets say we have alot of ($x1=0, x_2 >0$) and ($x_1 > 0, x_2=0$) datapoints. Nov 15, 2023 at 17:20
• If you look at your model, which is the first expression, you will see @Aksakal 's point - a zero for either $x_1$ or $x_2$ makes the output zero regardless of the values of the coefficients, so the observation contributes nothing to the estimation procedure. Consequently, dropping the observation(s) is the right thing to do. Nov 15, 2023 at 17:25
• You might find it insightful and constructive to think about how $\log y$ can differ from the modeled expression. For example, maybe $\log y$ is a measurement that varies randomly above and below the model; or maybe $y$ has been rounded; or whatever. That perhaps is the most important consideration for resolving your problem, because it leads to very different solutions.
– whuber
Nov 15, 2023 at 18:10
• another thing you didn't touch on is the errors: are they multiplicative? if they're additive then the log transformation itself would be problematic. consider $y=x^\beta+\varepsilon$ - how would you log transform this? Nov 15, 2023 at 18:27

• edited it, meant $log(y) = \beta_0 + I(x_1 > 0)\beta_1 * x_1 + I(x_2 > 0)\beta_2 * x_2$ ... thus the intercept remains.. is it still an issue? Nov 15, 2023 at 16:21
• My comment still applies. The prediction for $x1=1/1000000$ will still be very different from the prediction for $x1=0$ Nov 17, 2023 at 15:58