Announcement

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

  • Bootstrapping with weighted least squares

    I am running a regression where the dependent variable is a group-level mean, so following the advice of Angrist and Pischke (2009) and Solon et al. (2015), I am running Weighted Least Squares (WLS) where the weights are the group sizes:

    reg y i.T [aweight=groupSize]

    Because I have a small number of groups (36), I would like to conduce inference via the bootstrap. However, I find that the built-in vce(bootstrap)method returns an error when weights are specified, and the Stata manual ([R] Base Reference, pg. 154) states

    bootstrap is not meant to be used with weighted calculations.
    This leads me to wonder if there is a statistical reason that bootstrapping should not be combined with weighted estimators, or if this is just something that happens not to have been coded into Stata.

    I have experimented with the user-written boottest command, and found that this does not return an error after a weighted regression. Neither its help file nor the accompanying Stata Journal paper (Roodman et al 2019) warn against weights, and Appendix A of the paper discusses observation weights (although it does not mention whether anything needs to be done in the boottest command to implement this).

    Many thanks for any advice,

    Bert

    PS:

    Stata 17.0 MP born_date = "08 Mar 2023"
    Windows 11
    boottest 4.1.0 13 July 2022

    Angrist, J. D., & Pischke, J.-S. (2009). Mostly Harmless Econometrics: An Empiricist’s Companion. Princeton University Press.

    Roodman, D., Nielsen, M. Ø., MacKinnon, J. G., & Webb, M. D. (2019). Fast and wild: Bootstrap inference in Stata using boottest. Stata Journal, 19(1), 4–60. https://doi.org/10.1177/1536867X19830877

    Solon, G., Haider, S. J., & Wooldridge, J. M. (2015). What Are We Weighting For? Journal of Human Resources, 50(2), 301–316. https://doi.org/10.3368/jhr.50.2.301


    Last edited by Bert Lloyd; 25 Apr 2023, 14:14.

  • #2
    Hi, Bert,
    Have you come up with an answer to your question? I'm encountering the same issue with bootstrapping + weights.
    Thank you!

    Comment


    • #3
      I would also like to hear an explanation by StataCorp regarding this weights issue, as I am not aware of potential fatal problems when bootstrapping and probability weights are combined. You can either use boottest, and if you want to stick to the regular approach, you can write a wrapper for your regression command, as such:

      Code:
      clear all
      sysuse nlsw88
      set seed 123
      gen w = runiform() * 0.1
      
      
      
      cap program drop wrapper
      program define wrapper, eclass
          syntax, cmd(string)
          `cmd'
          matrix res = e(b)
          ereturn post res
      end
      
      
      
      bootstrap _b, reps(100) seed(123): ///
          wrapper, cmd(reg wage hours tenure [pweight=w])
      estat bootstrap
      Last edited by Felix Bittmann; 15 Mar 2025, 11:15.
      Best wishes

      (Stata 16.1 MP)

      Comment


      • #4
        TBH I don't remember how this turned out, although I do remember getting confused about whether, if I were to do it by hand, I would want to apply the group size weights as sampling probabilities for the bootstrap draws or if that would be "double-counting."

        Comment

        Working...
        X