Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: xtmixed - standardized resuduals plot

 From Tobias Friedli To statalist@hsphsun2.harvard.edu Subject Re: st: xtmixed - standardized resuduals plot Date Fri, 3 Sep 2010 16:15:07 +0200

```Thank you very much Maarten, thats exactly what i was looking for!

Could you maybe, if you have time, have a very quick look at another of my questions: "-xtmixed- Crossed effets & hierarchy"

I dont know anybody else to ask, and i cant find any more theory about my problem. This would be really nice.

regards, Toby

Tobias Friedli
Bachelor Student at the University of Zurich

On 03.09.2010, at 13:22, Maarten buis wrote:

> --- On Fri, 3/9/10, Hobst wrote:
>> I have used xtreg to fit a 3-level hierarchical model. To
>> test if the residuals on the different levels are in fact
>> nomally distributed i would like to plot histograms of
>> the standardized residuals for level-1 r(ijk), level-2
>> r(jk) and level-3 r(k).
>
> You can get the residuals using -predict-, see the example
> below or -help xtmixed postestimation-. I used -hangroot-
> as a more convenient way of comparing the histogram with
> the theoretical normal distribution. To install it, type in
> Stata -ssc install hangroot-.
>
> *------------ begin example ---------------------
> webuse productivity, clear
> xtmixed gsp private emp hwy water other unemp ///
>        || region: || state:, mle
>
> predict re, re
> predict re*, reff
>
> // these variables are used to make sure that each
> // higher level unit (region or state) contributes
> // only one observation when potting their level
> // residuals
> bys region (re1): gen byte regionmark = _n == 1
> bys state (re2) : gen byte statemark  = _n == 1
>
> hangroot re, ci
> hangroot re1 if regionmark, ci
> hangroot re2 if statemark, ci
> *---------------- end example --------------------
> (For more on examples I sent to the Statalist see:
> http://www.maartenbuis.nl/example_faq )
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```