Bookmark and Share

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: R2dicho after xtlogit


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: R2dicho after xtlogit
Date   Tue, 22 Mar 2011 13:48:35 +0000 (GMT)

--- On Tue, 22/3/11, Joerg Eulenberger wrote:
> Tom Snijders and Roel Bosker described in the book:
> "Multilevel Analysis: An introduction to basic and
> advanced multilevel modeling" on page 225 a measured
> value of explained variance for a binary two level
> model (R2dicho)
> 
> Has everyone a stata-syntax (do or ado) to calculate these
> measured value after xtlogit?

*------------------ begin example --------------------
webuse union, clear
xtlogit union age grade i.not_smsa south##c.year

tempname sigma_f2 tau_02 tau_r2
predict double xb if e(sample)
sum xb if e(sample)
scalar `sigma_f2' = r(Var)

scalar `tau_02' = exp( [lnsig2u]_b[_cons] )
scalar `tau_r2' = _pi^2/3

di `sigma_f2' / (`sigma_f2' + `tau_02' + `tau_r2')
*------------------ 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index