Announcement

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

  • Quantile regression: bsqreg vs qreg2

    Dear Stata users,

    I have a cross-sectional datatset on all cities in the United States (n=35,933), which is the entire population of interest in this study. My goal is to estimate the effect of a state law X on a city level outcome Y. The law varies from state to state (and no two states are the same), but it is constant for all cities within each state. X is a continuous index, Y is log-transformed total size of city budget in dollars.

    There are theoretical reasons to believe that the effect of the law X will be different for different values of Y. Thus, in addition to OLS regression, I would like to estimate quantile regressions. The cities are grouped into clusteres (i.e. into 50 states), so I need to account for that. It seems that Stata has two potential solutions, -bsqreg- and user-written - qreg2-. Below is the code I use to implement this, where stid is a variable for state id's.


    Code:
    set seed 10101
    
    foreach q in 10 25 50 75 90 {
    
    
    bsqreg Y X $controls, q(`q') reps(1000)
        eststo BSQR_`q'
    
    qreg2  Y X $controls, q(`q') c(stid)
        eststo QR_`q'
    
    }
    My main question stems from the fact that the two functions provide somewhat different findings and I am not sure which one is more trustworthy. Results from -bsqreg- find significant association between X and Y the further away we move from the median in either direction (i.e. for upper and lower quantiles), whereas qreg2 does not.

    In that regard, given that i have the entire population of interest, can i trust the results from -bsqreg- estimation and why? I have read somewhere a while ago that the main challenge with bootstrapped estimation is that it is time and resource consuming, and that's where qreg2 comes in handy. I, of course, would not mind the computer running for a day or so if the outcomes os more interesting and valuable results.

    I am using Stata/SE 13.1 on Windows 10 x64.

    Thank you
    Last edited by Michael Foreman; 03 May 2018, 11:08. Reason: quantile regression, bsqreg, qreg2, bootstrapped, clustered standard errors

  • #2
    Dear Michael Foreman,

    The bsqreg command dos not provide "clustered" standard errors, so I expect that those results will be comparable to what you get with qreg2 without clustering. If you want to account for clustering with bootstrap you have to use the bootstrap command with the cluster option. Note, however, that the standard errors obtained by bootstrapping clusters asymptotically have no advantage over the standard errors provided by qreg2.

    Best wishes,

    Joao

    Comment


    • #3
      Originally posted by Joao Santos Silva View Post
      Dear Michael Foreman,

      The bsqreg command dos not provide "clustered" standard errors, so I expect that those results will be comparable to what you get with qreg2 without clustering. If you want to account for clustering with bootstrap you have to use the bootstrap command with the cluster option. Note, however, that the standard errors obtained by bootstrapping clusters asymptotically have no advantage over the standard errors provided by qreg2.

      Best wishes,

      Joao
      Dear Joao,

      Thank you for the prompt reply. If as robustness check I wanted to account for clustering in bootstrapped quantile regression, is there a way to implement it in Stata? I don't seem to see an option in help files.

      Comment


      • #4
        Yes, check the option cluster in the bootstrap command.

        All the best,

        Joao

        Comment


        • #5
          Joao,

          Thank you, now I understand what you meant. Would the following code be a correct way of accounting for clustering with bootstrap given my data?

          Code:
          set seed 10101
          
          foreach q in 10 25 50 75 90 {
          bootstrap, reps(500) cluster(stid): qreg  Y X $controls, q(`q') 
              eststo QR_`b'
          }


          I did not know about the stand alone boostrap function, and now it prompted another question. My initial goal was also to use seemingly unrelated equation model as I have several outcomes variables at the city level determined simultaneously. As far as I know, there is no way to account for error clustering with sureg function. Thus, I wonder if i can use boostrap to do that. Would it be appropriate to use boostrapped standard errors with clustering in the following way:

          Code:
          set seed 10101
          
          bootstrap, reps(500) cluster(stid):
          sureg (Y X $controls) ///
                   (Y2 X $controls2) ///
                   (Y3 X $controls3) ///
                   (Y4 X $controls4), ///
                  corr isure
          Thank you.

          Comment


          • #6
            It looks correct to me, but it is not clear that you'll gain a lot by using SURE.

            Best wishes,

            Joao

            Comment


            • #7
              Thank you for your help, Joao.

              Comment

              Working...
              X