Statalist


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

RE: st: Creating a loop for bsample


From   Maarten buis <[email protected]>
To   stata list <[email protected]>
Subject   RE: st: Creating a loop for bsample
Date   Fri, 24 Jul 2009 19:43:12 +0000 (GMT)

--- Farasat Bokhari wrote:
> I need to create replicas of bsample followed by probit and save the
> coefficients.  Can some one show me how to create the loop and save
> results? Specifically, i need to run the following command 500 time
> and save the coefficients of the probit:
>
>
> #delimit;
> use nschschlaws2003;
> gen wt2 = weight;
> gen myflag1 = 0;
> replace myflag1 = 1 if sample1 == 1 & pubsch == 1;
> 
> /* the loop part beging below:*/
> 
> #delimit;
> bsample 6700 if myflag1 == 1, weight(wt2);
>
> #delimit;
> probit adhd assistance rewards sanctions
>       gender age black othrace hispanic family2 family3 family4
>       poverty1-poverty7 edu1 edu2 conachive1 conachive2 schcalls1    
>       schcalls2 [fw=wt2];
>
> replace wt2 = weight;
>
> /* end of what i need to loop */

The easiest solution is to let Stata do the looping and collecting 
of the results for you by just to typing: 

probit varlist, vce(bootstrap, reps(500))

If you want to do the looping yourself then you can store the 
results using the -post command-, see -help post-.

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      

*
*   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