Announcement

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

  • xtabond2 with bootstrap

    Hello

    I am using Stata 14.1 on a Windows 10 machine with i7, xtaboad2 and bootstrap, I would like your suggestions and comments to improve the following. The earlier posts on this issue also does not reveal any solution so far.

    The following code is used but that does not work and give results in the warning/error as shown. I would appreciate if I can get a hint to reolve this issue and get the bootstrapping results.

    . bootstrap, reps(1000): xtabond2 n l1.n k rec, gmm(l1.n) iv(k rec) twostep robust small
    time-series operators are not allowed with bootstrap without panels, see tsset
    r(198);

    . bootstrap, reps(1000): xtabond2 n n k rec, gmm(n) iv(k rec) twostep robust small
    (running xtabond2 on estimation sample)

    Bootstrap replications (1000)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 150
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 200
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 250
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 300
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 350
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 400
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 450
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 500
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 550
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 600
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 650
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 700
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 750
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 800
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 850
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 900
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 950
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1000
    insufficient observations to compute bootstrap standard errors
    no results will be saved
    r(2000);


  • #2
    Right now, your bootstrap is resampling individual observations, not panels, breaking the time structure of the dataset. You need to use clustered bootstrapping, see the FAQ:

    http://www.stata.com/support/faqs/st...th-panel-data/

    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

    Comment


    • #3
      Dear Jorge,

      I did try the FAQ and other discussions on previous Statalist archives. All these gives the similar error.

      I did run the suggested FAQ as:

      xtset id
      xtabond2 n l1.n k rec, gmm(l1.n) iv(k rec) vce(bootstrap (_b[k] - _b[rec]),rep(10) seed(123))
      program my_xtboot,rclass
      summarize d.`1',meanonly
      scalar mean`1'=r(mean)
      summarize d.`2',meanonly
      scalar mean`2'=r(mean)
      return scalar ratio=scalar(mean`1')/scalar(mean`2')
      end
      generate newid = id
      tsset id year
      generate sample=1-missing(rec,ys)
      keep if sample
      bootstrap ratio=r(ratio),rep(10) seed(123) cluster(id) idcluster(newid) nowarn:my_xtboot rec ys

      and the that also gives the error as:

      Bootstrap replications (10)
      ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
      repeated time values within panel
      the most likely cause for this error is misspecifying the cluster(), idcluster(), or group() option

      Did I work wrong something? As I changed the cluster and idcluster with alternates and still the same warning.

      I wish this can be helped.

      Regards

      Comment


      • #4
        I see you were trying to replicate the example in the FAQ. You need to tsset (xtset) by newid before bootstrapping, not by id:

        Code:
        use http://www.stata-press.com/data/r14/nlswork, clear
        xtset idcode year
        cap program drop my_xtboot
        program my_xtboot,rclass
        summarize d.`1',meanonly
        scalar mean`1'=r(mean)
        summarize d.`2',meanonly
        scalar mean`2'=r(mean)
        return scalar ratio=scalar(mean`1')/scalar(mean`2')
        end
        generate newid = idcode
        xtset newid year
        generate sample=1-missing(ttl_exp,hours)
        keep if sample
        bootstrap ratio=r(ratio),rep(10) seed(123) cluster(idcode) idcluster(newid) nowarn:my_xtboot ttl_exp hours
        Jorge Eduardo Pérez Pérez
        www.jorgeperezperez.com

        Comment


        • #5
          Dear Jorge,

          Thanks for your response. No, I did not try to replicate the the FAQ but wished to transfer the FAQ to my problem. May be I did not make it clear enough in my original post. I wish to bootstrap results from the xtabond2 which I cant do it with bootstrap prefix as you can see in the original post. The problem is there were a few past discussions and these were also not completely resolved as the results from those examples were also not possible to be replicated.

          Can you help me how to bootstrap results from xtabond2?

          Comment


          • #6
            I am reluctant to keep advising on this because a quick search about bootstrapping on dynamic panel data models did not yield any application of the full nonparametric bootstrap, even with clustering, for these models. I found a few papers that discuss parametric alternatives, e.g. http://www.sciencedirect.com/science...0440761500041X

            Alternatively, you can try a least squares dummy variable estimator instead of GMM, if you have a long panel. See http://www.stata-journal.com/article...article=st0091
            Jorge Eduardo Pérez Pérez
            www.jorgeperezperez.com

            Comment


            • #7
              Dear Sir, I found the same problem. Have you found a solution to bootstrap in xtabond2?

              Comment

              Working...
              X