Statalist


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

st: AW: AW: loop with xtmixed


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: AW: loop with xtmixed
Date   Wed, 27 Jan 2010 11:06:20 +0100

<> 

Here is an example:


*************
clear*
set obs 1000

gen byte idj=int(runiform()*25+1)
gen varx=rnormal()
gen byte GROUP=irecode(runiform(), 0, .2, .4, .7, 1)
gen vary =10+2*GROUP+.5*varx+rnormal()

statsby b_cons = _b[_cons] se_cons = _se[_cons],  /* 
*/ by(idj) clear : xtmixed vary varx ||GROUP: ,  /* 
*/ mle var covar(un)

li, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Mittwoch, 27. Januar 2010 10:59
An: [email protected]
Betreff: st: AW: loop with xtmixed


<> 

-forvalues- is pretty much neutral w.r.t. the things you put inside the
loop. But here, -statsby- will serve you better. The -if- condition must go
before the comma anyway...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Flavia Fossati
Gesendet: Mittwoch, 27. Januar 2010 10:56
An: [email protected]
Betreff: st: loop with xtmixed

Dear List,

I was wondering if there is a possibility to make a fovalue loop with 
the xtmixed command. I tried this way but it doesn't work (option if is 
not allowed):

forvalues j= 1(1)25{
xtmixed vary varx ||GROUP: , mle var covar(un) if idj== `j'
replace b_cons = _b[_cons] if idj==`j'
replace se_cons = _se[_cons] if idj==`j'
}

best,
flavia
*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index