Announcement

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

  • Fixed effects panel regression with robust standard error- which code to use?

    Hi,

    I'm using the following code to perform fixed effects panel regression
    Code:
    areg y x1 x2 i.year,a(HHID)
    I want to obtain robust standard errors and tried
    Code:
    areg y x1 x2 i.year,a(HHID) robust
    But on looking further, I found another option
    Code:
    vce(robust)
    and now I'm confused as to what is the difference between the two.

    I would greatly appreciate it if someone could explain the difference between these two options and which one would be appropriate for my purpose.

    Thanks,

  • #2
    Titir:
    there's no difference, as you can easily test yourself:
    Code:
    . use http://www.stata-press.com/data/r16/auto2.dta
    . areg mpg weight gear_ratio, absorb(rep78) robust
    
    Linear regression, absorbing indicators         Number of obs     =         69
    Absorbed variable: rep78                        No. of categories =          5
                                                    F(   2,     62)   =      58.56
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.6734
                                                    Adj R-squared     =     0.6418
                                                    Root MSE          =     3.5109
    
    ------------------------------------------------------------------------------
                 |               Robust
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          weight |  -.0051031   .0007151    -7.14   0.000    -.0065326   -.0036736
      gear_ratio |    .901478   1.502386     0.60   0.551    -2.101748    3.904704
           _cons |   34.05889   6.167363     5.52   0.000     21.73051    46.38727
    ------------------------------------------------------------------------------
    
    . areg mpg weight gear_ratio, absorb(rep78) vce(robust)
    
    Linear regression, absorbing indicators         Number of obs     =         69
    Absorbed variable: rep78                        No. of categories =          5
                                                    F(   2,     62)   =      58.56
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.6734
                                                    Adj R-squared     =     0.6418
                                                    Root MSE          =     3.5109
    
    ------------------------------------------------------------------------------
                 |               Robust
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          weight |  -.0051031   .0007151    -7.14   0.000    -.0065326   -.0036736
      gear_ratio |    .901478   1.502386     0.60   0.551    -2.101748    3.904704
           _cons |   34.05889   6.167363     5.52   0.000     21.73051    46.38727
    ------------------------------------------------------------------------------
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Titir:
      there's no difference, as you can easily test yourself:
      Code:
      . use http://www.stata-press.com/data/r16/auto2.dta
      . areg mpg weight gear_ratio, absorb(rep78) robust
      
      Linear regression, absorbing indicators Number of obs = 69
      Absorbed variable: rep78 No. of categories = 5
      F( 2, 62) = 58.56
      Prob > F = 0.0000
      R-squared = 0.6734
      Adj R-squared = 0.6418
      Root MSE = 3.5109
      
      ------------------------------------------------------------------------------
      | Robust
      mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      weight | -.0051031 .0007151 -7.14 0.000 -.0065326 -.0036736
      gear_ratio | .901478 1.502386 0.60 0.551 -2.101748 3.904704
      _cons | 34.05889 6.167363 5.52 0.000 21.73051 46.38727
      ------------------------------------------------------------------------------
      
      . areg mpg weight gear_ratio, absorb(rep78) vce(robust)
      
      Linear regression, absorbing indicators Number of obs = 69
      Absorbed variable: rep78 No. of categories = 5
      F( 2, 62) = 58.56
      Prob > F = 0.0000
      R-squared = 0.6734
      Adj R-squared = 0.6418
      Root MSE = 3.5109
      
      ------------------------------------------------------------------------------
      | Robust
      mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      weight | -.0051031 .0007151 -7.14 0.000 -.0065326 -.0036736
      gear_ratio | .901478 1.502386 0.60 0.551 -2.101748 3.904704
      _cons | 34.05889 6.167363 5.52 0.000 21.73051 46.38727
      ------------------------------------------------------------------------------
      thanks Carlo for your reply.

      Comment


      • #4
        You should be clustering your standard errors at the HHID level. Serial correlation is prevalent in panel data applications. Using "robust" with areg isn't doing that. In fact, if T is not pretty large, those standard errors aren't correct even for heteroskedasticity.

        Code:
        xtset HHID year
        xtreg y x1 ... xK i.year, fe vce(cluster HHID)

        Comment


        • #5
          Originally posted by Jeff Wooldridge View Post
          You should be clustering your standard errors at the HHID level. Serial correlation is prevalent in panel data applications. Using "robust" with areg isn't doing that. In fact, if T is not pretty large, those standard errors aren't correct even for heteroskedasticity.

          Code:
          xtset HHID year
          xtreg y x1 ... xK i.year, fe vce(cluster HHID)
          Thank you Prof. Wooldridge. I'll do that.

          Comment


          • #6
            Professor Wooldridge might be alluding to this paper
            Stock, James H., and Mark W. Watson. "Heteroskedasticity‐robust standard errors for fixed effects panel data regression." Econometrica 76, no. 1 (2008): 155-174
            which shows that robust only standard errors are not consistent in fixed effects panel data applications.

            Because of this, and as a matter of Stata syntax, once you switch to -xtreg- as Professor Wooldridge showed above, you do not even have the choice. Stata takes ownership of the whole situation, and computes cluster-robust standard errors (with clustering done at the panel level) whether you specify the robust only option, or the robust cluster(panel id) option.

            Here it is:

            Code:
            . sysuse auto, clear
            (1978 Automobile Data)
            
            . xtset rep
                   panel variable:  rep78 (unbalanced)
            
            . xtreg price mpg headroom, fe robust
            
            Fixed-effects (within) regression               Number of obs     =         69
            Group variable: rep78                           Number of groups  =          5
            
            R-sq:                                           Obs per group:
                 within  = 0.2549                                         min =          2
                 between = 0.0274                                         avg =       13.8
                 overall = 0.2139                                         max =         30
            
                                                            F(2,4)            =       4.02
            corr(u_i, Xb)  = -0.4159                        Prob > F          =     0.1105
            
                                              (Std. Err. adjusted for 5 clusters in rep78)
            ------------------------------------------------------------------------------
                         |               Robust
                   price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     mpg |  -297.1542   104.8356    -2.83   0.047    -588.2246   -6.083836
                headroom |  -334.6746   249.9078    -1.34   0.252     -1028.53    359.1808
                   _cons |   13476.44   2675.177     5.04   0.007     6048.955    20903.92
            -------------+----------------------------------------------------------------
                 sigma_u |  1266.7868
                 sigma_e |  2613.7617
                     rho |  .19021503   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            . xtreg price mpg headroom, fe robust cluster(rep)
            
            Fixed-effects (within) regression               Number of obs     =         69
            Group variable: rep78                           Number of groups  =          5
            
            R-sq:                                           Obs per group:
                 within  = 0.2549                                         min =          2
                 between = 0.0274                                         avg =       13.8
                 overall = 0.2139                                         max =         30
            
                                                            F(2,4)            =       4.02
            corr(u_i, Xb)  = -0.4159                        Prob > F          =     0.1105
            
                                              (Std. Err. adjusted for 5 clusters in rep78)
            ------------------------------------------------------------------------------
                         |               Robust
                   price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     mpg |  -297.1542   104.8356    -2.83   0.047    -588.2246   -6.083836
                headroom |  -334.6746   249.9078    -1.34   0.252     -1028.53    359.1808
                   _cons |   13476.44   2675.177     5.04   0.007     6048.955    20903.92
            -------------+----------------------------------------------------------------
                 sigma_u |  1266.7868
                 sigma_e |  2613.7617
                     rho |  .19021503   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            .
            as you see the standard errors are numerically equivalent whether I specify robust only, or robust cluster(panel id). This is because Stata itself automatically switches to cluster robust standard errors once you declare your data as a panel.

            Comment


            • #7
              Originally posted by Joro Kolev View Post
              Professor Wooldridge might be alluding to this paper
              Stock, James H., and Mark W. Watson. "Heteroskedasticity‐robust standard errors for fixed effects panel data regression." Econometrica 76, no. 1 (2008): 155-174
              which shows that robust only standard errors are not consistent in fixed effects panel data applications.

              Because of this, and as a matter of Stata syntax, once you switch to -xtreg- as Professor Wooldridge showed above, you do not even have the choice. Stata takes ownership of the whole situation, and computes cluster-robust standard errors (with clustering done at the panel level) whether you specify the robust only option, or the robust cluster(panel id) option.

              Here it is:

              Code:
              . sysuse auto, clear
              (1978 Automobile Data)
              
              . xtset rep
              panel variable: rep78 (unbalanced)
              
              . xtreg price mpg headroom, fe robust
              
              Fixed-effects (within) regression Number of obs = 69
              Group variable: rep78 Number of groups = 5
              
              R-sq: Obs per group:
              within = 0.2549 min = 2
              between = 0.0274 avg = 13.8
              overall = 0.2139 max = 30
              
              F(2,4) = 4.02
              corr(u_i, Xb) = -0.4159 Prob > F = 0.1105
              
              (Std. Err. adjusted for 5 clusters in rep78)
              ------------------------------------------------------------------------------
              | Robust
              price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
              -------------+----------------------------------------------------------------
              mpg | -297.1542 104.8356 -2.83 0.047 -588.2246 -6.083836
              headroom | -334.6746 249.9078 -1.34 0.252 -1028.53 359.1808
              _cons | 13476.44 2675.177 5.04 0.007 6048.955 20903.92
              -------------+----------------------------------------------------------------
              sigma_u | 1266.7868
              sigma_e | 2613.7617
              rho | .19021503 (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              
              . xtreg price mpg headroom, fe robust cluster(rep)
              
              Fixed-effects (within) regression Number of obs = 69
              Group variable: rep78 Number of groups = 5
              
              R-sq: Obs per group:
              within = 0.2549 min = 2
              between = 0.0274 avg = 13.8
              overall = 0.2139 max = 30
              
              F(2,4) = 4.02
              corr(u_i, Xb) = -0.4159 Prob > F = 0.1105
              
              (Std. Err. adjusted for 5 clusters in rep78)
              ------------------------------------------------------------------------------
              | Robust
              price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
              -------------+----------------------------------------------------------------
              mpg | -297.1542 104.8356 -2.83 0.047 -588.2246 -6.083836
              headroom | -334.6746 249.9078 -1.34 0.252 -1028.53 359.1808
              _cons | 13476.44 2675.177 5.04 0.007 6048.955 20903.92
              -------------+----------------------------------------------------------------
              sigma_u | 1266.7868
              sigma_e | 2613.7617
              rho | .19021503 (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              
              .
              as you see the standard errors are numerically equivalent whether I specify robust only, or robust cluster(panel id). This is because Stata itself automatically switches to cluster robust standard errors once you declare your data as a panel.
              Thank you Joro for your reply

              Comment

              Working...
              X