Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootstraped SE for a multilevel model wtih weights

    Hello, I am trying to bootstrap my multilevel model but there are weights for the first level, my model has individuals (caseid) within states (states) but there are sample weights with the first level of the model, the individuals. I tried writing the bootstrap in two different ways, both shown below, but neither works, if anyone has any advice or could provide any help it would be greatly appreciated.


    Code:
    
    . 
    . local contrls ppage biosex income education householdsize ///
    >                     children employment race maritalstatus ///
    >                                         handgun_law
    
    . 
    . bootstrap, reps(100) cluster(states) seed(20): melogit firearm_locked `contrls' [pw=weight] || states:, or  
    weights not allowed
    r(101);
    
    
    
    ****
    svyset caseid [pw=weight], strata(states) 
    
    bsweights bs_, n(-1) reps(50) seed(1000) 
    
    svyset [pw=weight}, bsrw(bs_*)
    
    
    
    local contrls ppage biosex income education householdsize ///
                        children employment race maritalstatus ///
                        handgun_law 
    svy bootstrap _b: melogit firearm_locked `contrls' || states:, or  
    
    
    . ****
    . svyset caseid [pw=weight], strata(states) 
    
    Sampling weights: weight
                 VCE: linearized
         Single unit: missing
            Strata 1: states
     Sampling unit 1: caseid
               FPC 1: <zero>
    
    . 
    . bsweights bs_, n(-1) reps(50) seed(1000) 
    # of PSUs to bootstrap is not positive in some strata
    r(194);

  • #2
    Just some thoughts:
    1. You can make the first approach work by writing a wrapper program and using bsample. This is then the "naive" approach. Stata does not allow this since it is unclear if the results are valid. Keep in mind that the option cluster() ensures that the entire cluster is drawn if selected. Does this make sense in your case? How many states are in your sample?
    2. I do not know bsweights and this is a very old command, so I am not sure if this works well with modern Stata versions. In any case, the documentation lists some examples, non of which use the svy prefix. I am not sure if you can combine the bsweights command and svy. Try using just the weights in the final model as such [pweight=...]
    3. In the documentation of the command, there are various alternatives for the option n(). Have you tried other values besides -1? Does this change anything?
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment


    • #3
      Felix Bittmann there are 48 states in my sample, yes all the individuals should be sampled from within each state

      Comment

      Working...
      X