Statalist


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

RE: st: Creating a loop for bsample


From   Farasat Bokhari <[email protected]>
To   [email protected]
Subject   RE: st: Creating a loop for bsample
Date   Sat, 25 Jul 2009 13:22:35 -0700 (PDT)

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);






--- On Sat, 7/25/09, Maarten buis <[email protected]> wrote:

> From: Maarten buis <[email protected]>
> Subject: RE: st: Creating a loop for bsample
> To: [email protected]
> Date: Saturday, July 25, 2009, 8:30 AM
> 
> --- On Sat, 25/7/09, Farasat Bokhari wrote:
> > Best i could tell the bootstrap does not let me
> specify
> > obs. weights when selecting the sample while the
> bsample
> > does.
> 
> Unfortunately no: the weights in -bsample- are just an
> alternative way of creating the bootstrap sample: if an 
> observation is not selected it will get a weight 0, if it
> is selected once it gets a weight 1, if it is selected
> twice it gets a weight 2, etc.
> 
> > 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.  
> 
> How to do that is tough. You could take a look at the 
> talk by Stas Kolenikov at the Summer Stata Users' meeting 
> last year: http://ideas.repec.org/p/boc/nsug08/19.html .
> 
> 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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index