0
$\begingroup$

I am performing multiple linear regression to predict a score (dependent variable) from multiple categorical variables. My dependent variable has skewed distribution with a large number of zero values but no negative values. Can I use Box-Cox transformation in this scenario?

I tried to run it in R, but got the error message - "Error in boxcox.default(linreg1) : response variable must be positive"

$\endgroup$
6
  • 1
    $\begingroup$ What would you hope to accomplish by transforming your response variable? $\endgroup$ – Dave Jul 24 '20 at 16:19
  • $\begingroup$ Transformation of response variable was to make sure i get a good fitting model, considering the normality assumption in linear regression. $\endgroup$ – CBGodbole Jul 24 '20 at 16:23
  • 2
    $\begingroup$ Normality, when we assume it, has to do with the error term, not the pooled distribution of the observations of the response variable. Further, that assumption has to do with parameter inference, not prediction. (We even get the Gauss-Markov theorem to work without a normal error term!) That said, it seems like you are in a situation where a zero-inflated generalized linear model might be more appropriate than a linear model. $\endgroup$ – Dave Jul 24 '20 at 16:38
  • $\begingroup$ Cox very much deserves his (in this case) capital. $\endgroup$ – Nick Cox Jul 24 '20 at 17:29
  • $\begingroup$ There is no boxcox function in base R. $\endgroup$ – whuber Jul 24 '20 at 19:10
1
$\begingroup$

Box-Cox transformation works fine with zeros. Hope you are using boxcox.fit() in package named geoR.

However, you can solve your problem of skewness with other transformations like:

  1. Square root transformation. However, often the square root is not a strong enough transformation to deal with the high levels of skewness.
  2. Use log(x+1) transformation which is a widely accepted way of feature transformation.

Also, I don't understand why you are doing transformation of the dependent variable. I agree with @dave for the assumption of normality in regression.

$\endgroup$
2
  • 1
    $\begingroup$ This starts optimistic and ends with suitable strong warnings, so is a little contradictory. If you have a spike at zero it will remain a spike at the left-hand edge of your transformed distribution (or exceptionally the right-hand edge if your transformation reverses order). $\endgroup$ – Nick Cox Jul 24 '20 at 17:27
  • $\begingroup$ The OP's remark that there are a "large number" of zeros just about guarantees an attempt at a Box-Cox transformation will be unsatisfactory. $\endgroup$ – whuber Jul 24 '20 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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