# Alternatives to multilevel model with log transformed outcome

I'm working with linear mixed-effects model in Stata. Dataset has three levels of 100k observations, nested in 500 regions, nested in 70 regions.

Currently my modelling strategy is to use three-level model with random intercepts by lev2 and lev3 for (lev2 nested within lev3):

mixed y i.x1 i.x2 || lev3: || lev2:


My outcome y is log transformed to bring it more to normality (heavily skewed data on cost).

However, the dataset contains ~2% of observations where outcome is zero and cannot be log transformed.

What other solution could I use in order to be able to handle zero outcomes?

Update 1: Following this post on The Stata Blog, it might be possible to use Poisson model instead:

meglm y i.x1 i.x2 || lev3: || lev2:, family(poisson) link(log) vce(robust)


This solution however might not work in multilevel framework.

Update 2: Revisiting this problem I came across several papers that used negative binomial regression to analyze cost. Example can be found here (with more on PubMed

Langton JM, Reeve R, Srasuebkul P, Haas M, Viney R, Currow D, et al. (2016) Health service use and costs in the last 6 months of life in elderly decedents with a history of cancer: a comprehensive analysis from a health payer perspective. Br J Cancer, 114(11):1293–302. http://dx.doi.org/10.1038/bjc.2016.75

• Are the zeros real zeros? Or do they indicate that the cost is not known or was very small (say, below 100 or below 1 or something like that)? There are of course other transformations such as square-root transformation (or more generally Box-Cox), which actually is going to end up doing something similar to assuming a Poisson model. Apr 26, 2016 at 13:19
• Thanks Björn. Zero is legitimate zero cost - it's plausible to have it and looking at other variables it does make sense as in which categories these zeros appear. Apr 26, 2016 at 15:06
• In that case the idea of Poisson (or probably more appropriately Negative Binomial regression) is sensible, so are transformations that do not have a problem with zeros (whether it's log(x+1) or sqrt(x) or something else like 2*sqrt(x+3/8)). Apr 26, 2016 at 16:36
• Poisson was indeed an option. I still have two problems with it however. Firstly, at the Stata blog post I linked to there is no mention if such approach would be suitable for multilevel framework. Secondly - when I tried anyway - the models fail to estimate. Apr 27, 2016 at 7:02
• I don't know whether Stata can do it (I'd assume so, but if not e.g. SAS PROC GLIMMIX or PROC NLMIXED will do it), but in principle it is possible unless there is specific issues in the data set that make the model hard to estimate. One adds a random effect (e.g. a normal one) in the $\log \mu = x\beta$ and in principle this should work, assuming there is sufficient data (same for negative binomial). Good starting values for parameter estimates may be important or specific options (e.g. number of quadrature points). Apr 27, 2016 at 7:23

This is a great use case for the inverse hyperbolic sine transformation , : $$\log\left( y + \sqrt{y^2 + 1} \right)$$
It is not uncommon to offset a variable by a constant prior to taking its log when it cannot be log-transformed directly (for example because some observations are 0 and would map to $-\infty$).
For example, you could offset all of the observations for the variable by 1 and therefore have a log-transformed variable that is a positive reel. All the observation that are 0 in your original dataset will become $log(0 + 1) = 0$ You can find a thorough description of this issue in this related question.