Announcement

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

  • How to bootstrap standard errors using PCSE model and instrument variable?

    Hi Statalist users,

    I would be very grateful for advice on the following problem. I need estimate a 2SLS regression using the PCSE model (xtpcse). I understand that doing 2SLS "by hand" will produce incorrect standard errors, but cannot use xtivreg or xtivreg2because they do not support the panel corrected standard errors model. Based on my somewhat limited understanding, one possible fix is to bootstrap the standard errors. The basic procedure I followed (modified from a suggestion here: https://stats.stackexchange.com/ques...gression-stata) is:
    program my2sls
    xtset country year
    //first stage regression
    xtpcse x1 z x2 x3 x4
    predict x1_hat, xb
    //second stage regression
    xtpcse y x1_hat x2 x3 x4
    drop x1_hat
    end
    //bootstrap SEs
    bootstrap, rep(100) seed(123):my2sls

    However, I received the error message:
    Bootstrap replications (10)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    xxxxxxxxxx
    insufficient observations to compute bootstrap standard errors
    no results will be saved
    r(2000);
    I have tried the advice on this thread (https://www.statalist.org/forums/for...s-will-be-save) to specify the nodrop option, but get the same error. I have spent the day searching on various forums but have not found a workable solution.

    Any suggestions as to how to resolve this issue would be highly appreciated. I am using Stata 13.1.

    Very many thanks in advance.

  • #2
    I wonder if you have sufficient sample size for this exercise. Clearly, it is sampling and ending up with a sample for which it cannot do the estimates.

    I might be tempted to drop any observations that have missing data before starting. I might also try a different seed. You might also want to set trace on and see if it tells you any more.

    Another strategy would be to move to sem which probably will let you do the covariances you want.

    Comment


    • #3
      Phil Bromiley thank you very much for the reply. I tried dropping observations with missing data and a different seed, and unfortunately neither worked. I set trace on, and the problem seems to be "repeated time values within panel" as copied below.
      - di in red "repeated time values within panel"
      repeated time values within panel
      - }
      - else {
      di in red "repeated time values in sample"
      }
      - exit 451
      }
      ------------------------------------------------------------------------ end tsset ---
      }
      -------------------------------------------------------------------------- end xtset ---
      --------------------------------------------------------------------------- end my2sls ---
      - `traceoff'
      = set trace off
      an error occurred when bootstrap executed my2sls, posting missing values
      insufficient observations to compute bootstrap standard errors
      no results will be saved
      r(2000);
      I then tried to specify the cluster and idcluster options: bootstrap, rep(50) seed(1) cluster(country) idcluster(newcountry) trace:my2sls

      And get the following error message:

      Bootstrap replications (50)
      repeated time values within panel
      the most likely cause for this error is misspecifying the cluster(), idcluster(), or group()
      option


      I can't figure out what I'm doing wrong here, any ideas or suggestions would be much appreciated.

      Thanks again!

      Comment

      Working...
      X