Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: xtmixed - standardized resuduals plot
From
Maarten buis <[email protected]>
To
[email protected]
Subject
Re: st: xtmixed - standardized resuduals plot
Date
Fri, 3 Sep 2010 11:22:20 +0000 (GMT)
--- 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/