Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Blups after xtmixed/xtmelogit


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Blups after xtmixed/xtmelogit
Date   Thu, 11 Mar 2010 18:24:12 -0000

For -labmask-, -search- to identify its Stata Journal source. 

Nick 
n.j.cox@durham.ac.uk 

Maarten buis

--- On Thu, 11/3/10, Neal Beck wrote:
> Using most recent S11, I am looking for an easy way (stress
> easy way) to produce nice output of blups with their se's.

I think the trick is not to think of these predictions as matrices or vectors, but instead as variables (temporarily) added to your dataset.
See for example the example below: 

*----------------- begin example ------------------
webuse pig, clear
xtmixed weight week || id:

predict b*, reffects
predict se*, reses

bys id (b1): keep if _n == 1

gen lb = b1 - invnormal(0.975)*se1
gen ub = b1 + invnormal(0.975)*se1

sort b1
gen x = _n
labmask x, values(id)
label variable x "id"

twoway rcap lb ub x ||                       ///
       scatter b1 x,                         ///
       mlab(id) mlabpos(0) msymbol(none)     ///
       xlabel(1/48, val angle(vertical))     ///
       legend(order(2 "blup"                 ///
                    1 "95% conf. int."))     ///
       xsize(7) 
*---------------- end example -------------------

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index