# Box-Cox data transformation to enable linear regression

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"

• What would you hope to accomplish by transforming your response variable?
– Dave
Commented Jul 24, 2020 at 16:19
• Transformation of response variable was to make sure i get a good fitting model, considering the normality assumption in linear regression. Commented Jul 24, 2020 at 16:23
• 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.
– Dave
Commented Jul 24, 2020 at 16:38
• Cox very much deserves his (in this case) capital. Commented Jul 24, 2020 at 17:29
• There is no boxcox function in base R.
– whuber
Commented Jul 24, 2020 at 19:10

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.

• 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). Commented Jul 24, 2020 at 17:27
• 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.
– whuber
Commented Jul 24, 2020 at 19:09