I'm working with three level models in Stata. Example of one would be:

use http://www.stata-press.com/data/r14/productivity, clear 
sort region state year

mixed gsp unemp || region: || state:

What I'm interested in, are the regional level estimates of random effects, which I get using:

predict fit, fit
predict xb, xb
gen dif = fit - xb

Now for each state I get the random part of the regression equation, which I understand as 'deviation from overall mean':

su dif if year == 1970

    Variable |       Obs        Mean    Std. Dev.       Min        Max
         dif |        48   -.1460786    1.012167  -2.053711   2.068561

However, I'm struggling with correct interpretation of this region specific values.

What does the 2.07 deviation from the mean really tells me? Can I refer it somehow to original values of the outcome (remember that in this case it's log transformed)? Is there any transfomration of the data or results helpful in that? Or alternative way of summarizing variability across states?

Even more difficult is interpretation of the difference of state-level random effects across models with different degrees of adjustment. For instance unadjusted model estimates can be obtained as:

mixed gsp || region: || state:

predict fit0, fit
predict xb0, xb
gen dif0 = fit - xb

Now state's 6 adjusted estimates of random effects go from .0661106 in unadjusted model to .074564 in adjusted. How could that change be interpreted?


3 Answers 3


With natural logs, if $\Delta \ln(y)=\ln(y')-\ln(y) = \ln(\frac{y'}{y})=c$, that is equivalent to $\frac{y'}{y}=\exp{c}$. This means that -2.053711 corresponds to a ratio of .12825805, so that is shrinkage of 87% in gross state product from a combination of the region and state effect for that state in each year.

It is probably better not to collapse the two REs together like you did, but to look at them carefully. You can do this like this:

use http://www.stata-press.com/data/r14/productivity, clear 
sort region state year
mixed gsp unemp || region: || state:
predict double xb, xb
predict double fit, fitted
predict double u, residuals
predict double re_state, reffects relevel(state)
predict double re_region, reffects relevel(region)
assert gsp == fit + u
assert gsp - (xb + re_state + re_region + u) < .00001

You can get your data to the level of 48 state effects or 9 region effects and understand the variability.

If you leave unemployment of the model, you no longer have any variability in the xb term. It will be a constant.


I believe that what you are getting is not exactly correct. You get the fit correctly and this includes BLUPs (best unbiased linear predictors = estimated random effects for a given level). From my reading of your model, you should have BLUPs for an overall constant, a region effect, and state effect. However, your way of getting at these, gen dif=fit-xb, lumps all of those BLUPs together. You see the overall shrinkage effect on fitted values, but you do not see the constituent parts.

I think you would do better by getting your BLUPs by passing an , reffects to predict instead of what you are doing here. Then you could more directly compare effects across states and regions. You might benefit from reading this page at UCLA's IDRE or the mixed effects modeling information from Stata.


Perhaps one option might be to exponentiate the results:

gen exp_dif = exp(dif)

(since outcome is log transformed).

And then talk about percentage increases in region, over and above adjustment. So from the adjusted model, for state 1 we have estimate:

list if state == 1 &  year == 1970

     | state        gsp    exp_dif |
  5. |     1   10.25478   .8656541 |

That would translate to 13.4% decrease of gross state product?

  • 1
    $\begingroup$ I am not sure that $\exp(E[\ln(y) \vert x]) = E[y \vert x]$ because of Jensen's inequality. $\endgroup$
    – dimitriy
    Jul 24, 2020 at 4:16

Your Answer

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

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