Ok. Thanks, I will see what alternative is available to create subsample(s) where selection is based on the original weights. Thanks,fb
----- Original Message ----
> From: Austin Nichols <[email protected]>
> To: [email protected]
> Sent: Saturday, July 25, 2009 11:47:42 PM
> Subject: Re: st: Creating a loop for bsample
>
> Farasat Bokhari:
> No--don't use the weight option in -bsample-. If you want to do it
> the quick-n-dirty way, save the relevant subset of data, -use- and
> resample with -bsample- (unweighted resample) then do weighted
> estimation on each draw using the original sample weights (the N
> totals will be wrong in each resample, but this is likely not a big
> deal, depending on what you want)--or ask Stas Kolenikov (see also
> http://ideas.repec.org/p/boc/nsug08/19.html or find him in DC this
> week or next) about the right way (if you resample you are supposed to
> redo all the weights and poststratification etc. for each draw).
>
> On Sat, Jul 25, 2009 at 4:22 PM, Farasat
> Bokhariwrote:
> > I think I have the looping and posting commands figured out and the results
> looks fine. However, I am now worried per your comment: I understand that
> bsample changes the values of the weight variable to be 0,1,2, etc. to indicate
> how many times this obs. is chosen in the sample BUT i thought it was doing the
> selection based on the original values of the weights. If this is not so the
> clearly my code is not doing what I thought it was (else its ok). My code is
> given below (your thoughts would be appreciated).
> >
> > fb
> >
> > ------code below --------
> >
> >
> > set memory 99999k
> > set matsize 400
> > #delimit ;
> > cd I:\bokhari\fb_research\analysis\adhd\schoollaws\schoollaws_data;
> > use nschschlaws2003;
> >
> > #delimit;
> > svyset idnumr [pw=weight], strata(state);
> > gen myflag1 = 0;
> > replace myflag1 = 1 if sample1 == 1 & pubsch == 1;
> > gen wt2 = weight;
> >
> >
> > #delimit;
> > postfile mysim assistance rewards sanctions using simres2, replace ;
> >
> > forvalues i = 1/100 {
> > bsample 6700 if myflag1 == 1, weight(wt2)
> > quietly: probit adhd assistance rewards sanctions gender age black othrace
> hispanic family2 family3 family4 poverty1-poverty7 edu1 edu2 conachive1
> conachive2 schcalls1 schcalls2 if wt2!=0 [fw=wt2]
> > replace wt2 = weight
> > local b1 = _b[assistance]
> > local b2 = _b[rewards]
> > local b3 = _b[sanctions]
> > post mysim (`b1') (`b2') (`b3')
> > display "Run Done:" `i'
> > }
> > postclose mysim
> >
> > #delimit;
> > clear all;
> > #delimit;
> > use simres2;
> >
> > mean assistance rewards sanctions;
> > mean assistance rewards sanctions, level(90);
> >
>
> *
> * 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/