Thanks. But I can't use the bootstrap since it does not let me use weights. The issue is the following: I have a complex survey design dataset with about 100K obs. Of these, about 49K satisfy a certain criteria to be the relevant population (children in public schools and within a certain age group, ie. myflag1 == 1). The main probit tests the impact of certain state laws on an outcome for these children and is positive and significant. I then create a falsefication test by checking what these laws do to children in a different criteria (pvt. school students to whom the law does not apply) and find that the probit coefficients are not significant. So far so good. However, the pvt. school population is very small (about 6,700) and so this could be just a power issue. To test if this is a power issues, I want to select 6,700 obs. from public school population (hence the criteria if myflag1 ==1) and then re-run the original probit on this smaller
set. Since different obs. have different weights associated with them, I want to create the smaller set based on these weights (hence the need for "bsample 6700 if myflag1 == 1, weight(wt2)" and repeat the process about 500 times.
Best i could tell the bootstrap does not let me specify obs. weights when selecting the sample while the bsample does. Hence I need to manually loop the code given below. Will follow up on the "post" to see how to save the results but still need to know the syntex for creating the loop.
fb
--- On Fri, 7/24/09, Maarten buis <[email protected]> wrote:
> From: Maarten buis <[email protected]>
> Subject: RE: st: Creating a loop for bsample
> To: "stata list" <[email protected]>
> Date: Friday, July 24, 2009, 7:43 PM
>
> --- 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/
>
*
* 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/