0
$\begingroup$

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?

$\endgroup$
7
  • 1
    $\begingroup$ 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 $\endgroup$
    – Aksakal
    Nov 15, 2023 at 17:11
  • $\begingroup$ 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. $\endgroup$ Nov 15, 2023 at 17:20
  • 1
    $\begingroup$ 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. $\endgroup$
    – jbowman
    Nov 15, 2023 at 17:25
  • 1
    $\begingroup$ 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. $\endgroup$
    – whuber
    Nov 15, 2023 at 18:10
  • 1
    $\begingroup$ 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? $\endgroup$
    – Aksakal
    Nov 15, 2023 at 18:27

1 Answer 1

1
$\begingroup$

Your suggestion is equivalent to using the function if x<=0 then 0 else log (x). This has a big discontinuity at 0, since the log of a small number is a large negative number.

If most values of X are large, and none are negative, then the usual workaround is log(x+1).

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$ Nov 15, 2023 at 16:21
  • $\begingroup$ My comment still applies. The prediction for $x1=1/1000000$ will still be very different from the prediction for $x1=0$ $\endgroup$ Nov 17, 2023 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.