Announcement

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

  • Errors occur when doing bootstrapping with xtivreg and clustered standard errors at firm level

    Hi, my current object is to run a IV regression with fixed effects and clustered standard errors at firm level, and to have the bootstrapped standard errors from 100 repetitions for hypothesis testing.
    But I have errors occur when running commands as below:
    Code:
    xtset gvkey fyear
    bootstrap, reps(100) cluster(gvkey): xtivreg y (x1 x2 x3 x4 = z1 z2 z3 z4) w1 w2 w3 w4 w5, fe vce(cluster gvkey)
    Errors occur like
    Bootstrap replications (100): repeated time values within panel
    the most likely cause for this error is misspecifying the cluster(), idcluster(), or group() option
    r(451);
    And I have also tried similar commands like:
    Code:
    xtivreg y (x1 x2 x3 x4 = z1 z2 z3 z4) w1 w2 w3 w4 w5, fe vce(bootstrap, reps(100)) cluster(gvkey)
    But it seems that `xtivreg` does not have the `cluster` option.

    I have already checked for any duplicated observations, and things go well when I run without IV before:
    Code:
    xtreg y x1 x2 x3 x4 w1 w2 w3 w4 w5, fe vce(bootstrap, reps(100)) cluster(gvkey)
    I wonder whether there will be other ways to do such regression with established commands, thank you!

  • #2
    Clustering in panels is a bit more complicated. See https://www.stata.com/support/faqs/s...th-panel-data/.

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      Clustering in panels is a bit more complicated. See https://www.stata.com/support/faqs/s...th-panel-data/.
      Thank you very much for your kind reply and I have successfully run the below commands by referring to your link:

      Code:
      gen new_gvkey = gvkey
      tsset new_gvkey fyear
      bootstrap, reps(100) cluster(gvkey) idcluster(new_gvkey): xtivreg y (x1 x2 x3 x4 = z1 z2 z3 z4) w1 w2 w3 w4 w5, fe vce(cluster gvkey)
      And I wonder whether I get you right through the commands above, thank you again!

      Comment


      • #4
        a successful kluge.

        might try ivreghdfe. it does not require you xtset/tsset the data.

        Comment


        • #5
          Originally posted by George Ford View Post
          a successful kluge.

          might try ivreghdfe. it does not require you xtset/tsset the data.
          Thank you for your kind advice, but when I tried to run the `ivreghdfe`:

          Code:
          ivreghdfe y (x1 x2 x3 x4= z1 z2 z3 z4) w1 w2 w3 w4 w5, absorb (gvkey) vce (cluster gvkey)
          It appears that
          option vce() not allowed
          r(198);
          or
          Code:
          ivreghdfe y (x1 x2 x3 x4= z1 z2 z3 z4) w1 w2 w3 w4 w5, absorb (gvkey) cluster (gvkey)
          It appears that
          last estimates not found
          r(301);
          I wonder whether I understand your advice well, thank you again!

          Comment


          • #6
            make sure you install ftools, reghdfe, and ivreg2
            HTML Code:
            https://github.com/sergiocorreia/ivreghdfe#installation

            Comment

            Working...
            X