Announcement

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

  • robust standard error for IV panel regression

    Hi
    I have been running panel data random effect 2sls (G2SLS) and i want to robust to heteroskedasticity and autocorrelation any advice on how to perform it in Stata as i know we robust to heteroskedasticity and autocorrelation using cluster(id) in panel fixed or random effect but this choice is not available for G2sls

  • #2
    You have to be more specific regarding which command you are using, and which Stata you are using.

    What you are saying might have been true in old Stata like Stata 7 say.

    But as of now in Stata 15,

    xtivreg, re

    does accept robust and cluster options.

    Comment


    • #3
      Here:

      Code:
      .  webuse nlswork, clear
      (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
      
      . xtivreg ln_w age c.age#c.age not_smsa 2.race (tenure = union birth south), re vce(cluster idcode)
      
      G2SLS random-effects IV regression              Number of obs     =     19,007
      Group variable: idcode                          Number of groups  =      4,134
      
      R-sq:                                           Obs per group:
           within  = 0.0664                                         min =          1
           between = 0.2098                                         avg =        4.6
           overall = 0.1463                                         max =         12
      
      
                                                      Wald chi2(5)      =     643.00
      corr(u_i, X)       = 0 (assumed)                Prob > chi2       =     0.0000
      
                                   (Std. Err. adjusted for 4,711 clusters in idcode)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
            tenure |   .1391798   .0104381    13.33   0.000     .1187216     .159638
               age |   .0279649   .0080686     3.47   0.001     .0121507     .043779
                   |
       c.age#c.age |  -.0008357   .0001415    -5.91   0.000     -.001113   -.0005584
                   |
          not_smsa |  -.2235103   .0146421   -15.26   0.000    -.2522084   -.1948123
                   |
              race |
            black  |  -.2078613   .0165504   -12.56   0.000    -.2402995   -.1754231
             _cons |   1.337684   .1173549    11.40   0.000     1.107673    1.567695
      -------------+----------------------------------------------------------------
           sigma_u |  .36582493
           sigma_e |  .63031479
               rho |  .25197078   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      Instrumented:   tenure
      Instruments:    age c.age#c.age not_smsa 2.race union birth_yr south
      ------------------------------------------------------------------------------
      
      .

      Comment


      • #4
        dear Joro Kolev thank you for responding i'm using Stata 13 and the command is xtivreg y x1 x2 x3 (z= I1 I2), re

        Comment


        • #5
          Originally posted by Saleh-albrmaki Mousa View Post
          dear Joro Kolev thank you for responding i'm using Stata 13 and the command is xtivreg y x1 x2 x3 (z= I1 I2), re
          OK, Stata 13 does not allow the -xtivreg, re vce(cluster)- option.

          Just bootstrap the standard errors, like that:

          Code:
          . webuse nlswork, clear
          (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
          
          . xtivreg ln_w age c.age#c.age not_smsa 2.race (tenure = union birth south), re vce(bootstrap, reps(1000) nodots)
          
          G2SLS random-effects IV regression              Number of obs      =     19007
          Group variable: idcode                          Number of groups   =      4134
          
          R-sq:  within  = 0.0664                         Obs per group: min =         1
                 between = 0.2098                                        avg =       4.6
                 overall = 0.1463                                        max =        12
          
          
                                                          Wald chi2(5)       =    277.74
          corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000
          
                                         (Replications based on 4134 clusters in idcode)
          ------------------------------------------------------------------------------
                       |   Observed   Bootstrap                         Normal-based
               ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                tenure |   .1391798   .0114555    12.15   0.000     .1167274    .1616323
                   age |   .0279649   .0079696     3.51   0.000     .0123447    .0435851
                       |
           c.age#c.age |  -.0008357   .0001417    -5.90   0.000    -.0011134   -.0005579
                       |
              not_smsa |  -.2235103   .0233905    -9.56   0.000    -.2693548   -.1776659
                       |
                  race |
                black  |  -.2078613   .0169946   -12.23   0.000      -.24117   -.1745526
                 _cons |   1.337684   .1235172    10.83   0.000     1.095595    1.579773
          -------------+----------------------------------------------------------------
               sigma_u |  .36582493
               sigma_e |  .63031479
                   rho |  .25197078   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Instrumented:   tenure
          Instruments:    age c.age#c.age not_smsa 2.race union birth_yr south
          ------------------------------------------------------------------------------
          Be warned that this might take some time, depending on how large and complicated is your dataset.

          Comment


          • #6
            Originally posted by Saleh-albrmaki Mousa View Post
            dear Joro Kolev thank you for responding i'm using Stata 13 and the command is xtivreg y x1 x2 x3 (z= I1 I2), re
            Please note https://www.statalist.org/forums/help#version. Thanks.
            Joro's helpful advice could have reached you earlier had you specified from your first post of this thread that you are using a (quite) out-of-date Stata release.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X