Announcement

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

  • F-test for Fixed Effect With Robust SE

    Hi everyone,

    A few days ago i made a post and some of my questions answered very well.
    But there's still a lil bit of confusion in Fixed Effect Model particularly F-test for Individual Effect Dummies (testparm) with Fixed Effect Robust Standard Error.
    So here it is:

    After using vce(robust) option for xtreg, fe command, i couldn't get my F-test (joint test) for my individual effect dummies (u_i) that i included in my model. I know that stata omits it because someone explained it to me. But, i still want to report it on my paper, because i think it could be necesarry (or it couldn't) to report F test for u_i, to provide the reasons why i included it in my model.
    I don't know is it a right assumption or not, but i assumed that we could choose to pooled or not to pooled the data, to include or not to include individiual and time effect based on these F test (F test, for u_i (time invariant effect) and δ_t (for time variant effect)).

    So my question is:
    How to conduct F test (that omits) for individual effect (u_i) in fixed effect with robust standard error (xtreg, fe vce(robust))?

    here is how i did fixed effect model with robust SE. i still could do F test for time effect (that i assumed as δ_t or dummy variables for time effect) by doing testparm over my year dummy variables.

    Code:
    . xtreg Y X1 X2 i.year, fe vce(robust)
    
    Fixed-effects (within) regression               Number of obs     =        222
    Group variable: year                            Number of groups  =         74
    
    R-sq:                                           Obs per group:
         within  = 0.5916                                         min =          3
         between = 0.6470                                         avg =        3.0
         overall = 0.6243                                         max =          3
    
                                                    F(4,73)           =     100.72
    corr(u_i, Xb)  = 0.1511                         Prob > F          =     0.0000
    
                                      (Std. Err. adjusted for 74 clusters in id)
    ------------------------------------------------------------------------------
                 |               Robust
               Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              X1 |   .8808422   .1626354     5.42   0.000     .5567103    1.204974
              X2 |   16.65939   13.84521     1.20   0.233    -10.93408    44.25285
                 |
           year |
           2017  |  -.5542752   .3520155    -1.57   0.120    -1.255841    .1472906
           2018  |  -2.224763    .567658    -3.92   0.000    -3.356104   -1.093422
                 |
           _cons |  -.1550369   1.315367    -0.12   0.906    -2.776559    2.466485
    -------------+----------------------------------------------------------------
         sigma_u |  2.9370361
         sigma_e |  2.7763652
             rho |  .52809954   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . testparm i.year
    
     ( 1)  2017.year = 0
     ( 2)  2018.year = 0
    
           F(  2,    73) =    7.83
                Prob > F =    0.0008
    i've got an idea about using the reg command with addition of individual and time dummies. But because i read that in reg. command, robust and cluster(id) options using a different method, so if anybody could confirm which one should i choose and is it a right (or wrong) thing to do?

    Code:
    . reg Y X1 X2 i.id i.year, vce(robust)
    
    Linear regression                               Number of obs     =        222
                                                    F(77, 144)        =      44.20
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.8589
                                                    Root MSE          =     2.7764
    
    ------------------------------------------------------------------------------
                 |               Robust
               Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              X1 |   .8808422    .166491     5.29   0.000     .5517603    1.209924
              X2 |   16.65939   12.42937     1.34   0.182    -7.908193    41.22696
                 |
            id |
           APLN  |   .2947118   1.225192     0.24   0.810    -2.126972    2.716396
           ASDM  |   1.050584   1.462409     0.72   0.474    -1.839978    3.941145
           ASII  |     2.8694   2.413574     1.19   0.236     -1.90121     7.64001
           ASJT  |    2.31474   1.607534     1.44   0.152    -.8626728    5.492152
           ASMI  |   4.015512   1.669058     2.41   0.017      .716494    7.314531
           ASRI  |  -3.831059   .9604417    -3.99   0.000    -5.729445   -1.932674
           ASRM  |   2.211627   1.556897     1.42   0.158    -.8656974    5.288952
           BACA  |  -.0261848   .7748567    -0.03   0.973    -1.557747    1.505378
           BAPA  |   1.378856   1.827293     0.75   0.452    -2.232926    4.990638
           BBCA  |   .0173037   .6407342     0.03   0.978    -1.249156    1.283763
           BBMD  |   .3834314    .738184     0.52   0.604    -1.075645    1.842507
           BBNI  |   .2716186   .7533377     0.36   0.719     -1.21741    1.760647
           BBRI  |   .2827238   .6037333     0.47   0.640    -.9106003    1.476048
           BBTN  |   -.077315   .8124557    -0.10   0.924    -1.683195    1.528565
           BCIP  |   2.590771   1.405957     1.84   0.067    -.1882089    5.369752
           BDMN  |   .4528766   .9091776     0.50   0.619    -1.344181    2.249934
           BEST  |  -2.037454   1.330063    -1.53   0.128    -4.666422    .5915147
           BINA  |  -.1135588   .7325616    -0.16   0.877    -1.561522    1.334404
           BJBR  |    .561522    .830212     0.68   0.500    -1.079454    2.202498
           BJTM  |   .7062759   .9025418     0.78   0.435    -1.077666    2.490217
           BKSL  |  -1.372539   .6198285    -2.21   0.028    -2.597676   -.1474013
           BMRI  |   .3669541   .8332335     0.44   0.660    -1.279994    2.013903
           BNBA  |   .3175581   .7390014     0.43   0.668    -1.143134     1.77825
           BNGA  |   .2506866   .7081542     0.35   0.724    -1.149033    1.650406
           BNII  |  -.0686958   .7415254    -0.09   0.926    -1.534376    1.396985
           BOLT  |   2.443337   4.159148     0.59   0.558    -5.777531    10.66421
           BRAM  |   2.319903    1.84863     1.25   0.212    -1.334053    5.973858
           BSDE  |   1.708504   1.436532     1.19   0.236    -1.130908    4.547917
           COWL  |  -4.949813   1.340089    -3.69   0.000    -7.598599   -2.301026
           CTRA  |  -.0605993   .8110554    -0.07   0.941    -1.663711    1.542513
           DART  |  -1.910334   .9455116    -2.02   0.045    -3.779209   -.0414595
           DILD  |   .4385749    .690611     0.64   0.526    -.9264696    1.803619
           DMAS  |  -.8064493   1.466592    -0.55   0.583    -3.705279     2.09238
           DUTI  |   2.279153   .8200434     2.78   0.006     .6582761    3.900031
           FMII  |  -5.050991   3.634907    -1.39   0.167    -12.23566    2.133676
           GMTD  |   1.609945   .7361016     2.19   0.030      .154985    3.064905
           GPRA  |   .7070048   .9660833     0.73   0.465    -1.202531    2.616541
           INDS  |   .3487059   2.395833     0.15   0.884    -4.386837    5.084249
           JRPT  |    4.44845   1.494431     2.98   0.003     1.494595    7.402305
           JTPE  |    .834028   3.572804     0.23   0.816    -6.227887    7.895942
           KIJA  |  -2.493057   1.432208    -1.74   0.084    -5.323924    .3378107
           LINK  |   5.043667   4.371182     1.15   0.250    -3.596301    13.68364
           LPCK  |   6.240876   6.955493     0.90   0.371    -7.507178    19.98893
           LPGI  |   1.179102   .8410096     1.40   0.163    -.4832171     2.84142
           LPKR  |   .7737229   1.459914     0.53   0.597    -2.111906    3.659352
           MARI  |   4.511691     6.4431     0.70   0.485     -8.22358    17.24696
           MDIA  |   3.637022   4.998187     0.73   0.468    -6.242271    13.51631
           MDLN  |  -5.018098   2.952339    -1.70   0.091    -10.85362    .8174219
           MEGA  |   3.629563   3.339883     1.09   0.279    -2.971967    10.23109
           MKPI  |   5.926182   2.035153     2.91   0.004     1.903549    9.948814
           MMLP  |   .8126784    2.50436     0.32   0.746    -4.137377    5.762734
           MNCN  |     1.6835   2.823976     0.60   0.552    -3.898301    7.265301
           MREI  |   2.293249   1.157294     1.98   0.049     .0057712    4.580727
           MTLA  |   3.542054   1.936665     1.83   0.069    -.2859105    7.370019
           MYRX  |  -2.469469   .7999408    -3.09   0.002    -4.050612   -.8883258
           NISP  |   .0944043   .7654037     0.12   0.902    -1.418474    1.607282
           PLIN  |   1.818417   3.990349     0.46   0.649    -6.068808    9.705643
           PNBN  |  -.5133411   .6766237    -0.76   0.449    -1.850739    .8240564
           PNIN  |   1.555931   .8908233     1.75   0.083    -.2048478     3.31671
           PPRO  |  -7.645823    1.93914    -3.94   0.000    -11.47868   -3.812969
           PWON  |    .827668   1.376719     0.60   0.549     -1.89352    3.548856
           RDTX  |   1.647971   1.343093     1.23   0.222    -1.006753    4.302695
           RODA  |   .2733828   1.023854     0.27   0.790    -1.750341    2.297106
           SCBD  |   2.449009   .9853489     2.49   0.014     .5013928    4.396625
           SCMA  |   11.37837   6.599241     1.72   0.087     -1.66552    24.42227
           SDRA  |  -.2775776   .5947717    -0.47   0.641    -1.453188    .8980333
           SMDM  |  -.2651635   .9403621    -0.28   0.778     -2.12386    1.593533
           SMRA  |  -.8117748   .9704148    -0.84   0.404    -2.729872    1.106323
           SMSM  |   7.956638    7.70801     1.03   0.304    -7.278821     23.1921
           TARA  |  -1.243613   1.169836    -1.06   0.290    -3.555881    1.068655
           TLKM  |   4.399757   4.520706     0.97   0.332    -4.535757    13.33527
           VINS  |   2.005052   1.621869     1.24   0.218    -1.200693    5.210797
           VIVA  |  -4.834313    4.09723    -1.18   0.240     -12.9328    3.264169
                 |
           year |
           2017  |  -.5542752   .4074146    -1.36   0.176    -1.359561    .2510102
           2018  |  -2.224763   .5223219    -4.26   0.000    -3.257171   -1.192354
                 |
           _cons |  -1.037165   .6538399    -1.59   0.115    -2.329528    .2551992
    ------------------------------------------------------------------------------
    
    . testparm i.id
    
     ( 1)  2.id = 0
     ( 2)  3.id = 0
     ( 3)  4.id= 0
    .
    . (to save the space)
    .
     (71)  72.id = 0
     (72)  73.id = 0
     (73)  74.id = 0
    
           F( 73,   144) =   10.22
                Prob > F =    0.0000
    
    . testparm i.year
    
     ( 1)  2017.year = 0
     ( 2)  2018.year = 0
    
           F(  2,   144) =    9.39
                Prob > F =    0.0001
    Thank you.
    Last edited by Samuel Renhoar; 27 May 2020, 00:05.

  • #2
    I don't think I would worry much about this. You get strong results with robust standard errors with regression and if you look at the xtreg you will see that half of the variance is in the fixed effects. For fixed effects not to matter, the variance of fixed effects should be very small. I'm sure this varies by area, but in my area we don't normally bother testing the significance of fixed effects.
    One of the big issues between fixed effect and conventional regression is that you are running a very different model. Xtreg with fixed effects basically use only the within panel variance. Regression without panel dummies mixes within panel variance and cross panel variance. Part of the question is what is your theoretical stance – if you want to understand within panel behavior over time, fixed effects makes sense no matter what. If on the other hand you want to understand cross panel variance, then a different estimator like the Mundlak or xthybrid estimators makes sense.

    Comment


    • #3
      Samuel:
      I do share Phil's comments.
      At the top of that, my guess is that you -regress- model may suffer from quasi-extreme multicolinearity, as you have a significan R-sq but most of your coefficients do not reach statistical significance and 95% CIs are really wide.
      I would run -estat vif- after -regress-.
      Besides, unlike in -xtreg-, -cluster- and -robust- options do a different job under -regress-. Usually, the first option is used when you detect heteroskedastcity amd -cluster()- is the way to go when you detect autocorrelation. If you have both heteroskedasticity and autocorrelation, the advice is to go -cluster()-.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Phil:
        When you said "if you look at the xtreg you will see that half of the variance is in the fixed effects", did you referring to rho number under the xtreg command?
        Correct me if i'm wrong, i assumed that when i'm using fixed effect model and include the fixed and time dummies, my goal is to only control the parameter of my predictor (to have a better estimation), that is to say that the main purpose of my research is only to find the parameter of my predictor, so i don't really need to worry about the variance. Is that a correct assumption?

        To be honest i don't understand your last words about variance but i only assumed that my goal is as i mentioned before.
        Anyway, thank you phil i think i don't have to worry about it anymore.

        Comment


        • #5
          Carlo:

          in order to do -estat vif- which command do you mean to run before estat vif?
          regress Y X1 X2 i.id i.year, vce (robust)
          or
          xtreg Y X1 X2 i.year, fe vce(robust)

          I'm sorry Carlo, i don't get this words, "Usually, the first option is used when you detect heteroskedastcity amd -cluster()- is the way to go when you detect autocorrelation. If you have both heteroskedasticity and autocorrelation, the advice is to go -cluster()-"
          what do you mean by "first option","heteroskedasticity amd", and what is difference between tw?

          Comment


          • #6
            Carlo:

            this a complete sentence for my last questions (this bug doesn't let me to complete my words)
            what do you mean by "first option","heteroskedasticity amd", and what is difference between these two cases, because it seems like both cases ended with the same cluster command?

            Comment


            • #7
              Samuel:
              under -regress- , -robust- option takes heteroskedasticity only into account: hence, if you have heteroskedasticity only, you are safe with -robust-.
              If you have serial correlation only, you should go -cluster(), which is Always robust to heteroskedasticity if you detect both these nuisances at the same time.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Samuel:
                Code:
                regress Y X1 X2 i.id i.year, vce (robust)
                estat vif
                or
                Code:
                regress Y X1 X2 i.id i.year, vce (robust)
                estat vce, corr
                Code:
                xtreg Y X1 X2 i.year, fe vce(robust)
                
                estat vce, corr
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Carlo:

                  for #7, Thank you carlo now its crystal clear.

                  for#8 let me show all of those result

                  this for code number 1
                  Code:
                  . reg Y X1 X2 i.id i.year, vce (robust)
                  
                  Linear regression                               Number of obs     =        222
                                                                  F(77, 144)        =      44.20
                                                                  Prob > F          =     0.0000
                                                                  R-squared         =     0.8589
                                                                  Root MSE          =     2.7764
                  
                  ------------------------------------------------------------------------------
                               |               Robust
                             Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                            X1 |   .8808422    .166491     5.29   0.000     .5517603    1.209924
                            X2 |   16.65939   12.42937     1.34   0.182    -7.908193    41.22696
                               |
                            id |
                         APLN  |   .2947118   1.225192     0.24   0.810    -2.126972    2.716396
                         ASDM  |   1.050584   1.462409     0.72   0.474    -1.839978    3.941145
                         ASII  |     2.8694   2.413574     1.19   0.236     -1.90121     7.64001
                         ASJT  |    2.31474   1.607534     1.44   0.152    -.8626728    5.492152
                         ASMI  |   4.015512   1.669058     2.41   0.017      .716494    7.314531
                         ASRI  |  -3.831059   .9604417    -3.99   0.000    -5.729445   -1.932674
                         ASRM  |   2.211627   1.556897     1.42   0.158    -.8656974    5.288952
                         BACA  |  -.0261848   .7748567    -0.03   0.973    -1.557747    1.505378
                         BAPA  |   1.378856   1.827293     0.75   0.452    -2.232926    4.990638
                         BBCA  |   .0173037   .6407342     0.03   0.978    -1.249156    1.283763
                         BBMD  |   .3834314    .738184     0.52   0.604    -1.075645    1.842507
                         BBNI  |   .2716186   .7533377     0.36   0.719     -1.21741    1.760647
                         BBRI  |   .2827238   .6037333     0.47   0.640    -.9106003    1.476048
                         BBTN  |   -.077315   .8124557    -0.10   0.924    -1.683195    1.528565
                         BCIP  |   2.590771   1.405957     1.84   0.067    -.1882089    5.369752
                         BDMN  |   .4528766   .9091776     0.50   0.619    -1.344181    2.249934
                         BEST  |  -2.037454   1.330063    -1.53   0.128    -4.666422    .5915147
                         BINA  |  -.1135588   .7325616    -0.16   0.877    -1.561522    1.334404
                         BJBR  |    .561522    .830212     0.68   0.500    -1.079454    2.202498
                         BJTM  |   .7062759   .9025418     0.78   0.435    -1.077666    2.490217
                         BKSL  |  -1.372539   .6198285    -2.21   0.028    -2.597676   -.1474013
                         BMRI  |   .3669541   .8332335     0.44   0.660    -1.279994    2.013903
                         BNBA  |   .3175581   .7390014     0.43   0.668    -1.143134     1.77825
                         BNGA  |   .2506866   .7081542     0.35   0.724    -1.149033    1.650406
                         BNII  |  -.0686958   .7415254    -0.09   0.926    -1.534376    1.396985
                         BOLT  |   2.443337   4.159148     0.59   0.558    -5.777531    10.66421
                         BRAM  |   2.319903    1.84863     1.25   0.212    -1.334053    5.973858
                         BSDE  |   1.708504   1.436532     1.19   0.236    -1.130908    4.547917
                         COWL  |  -4.949813   1.340089    -3.69   0.000    -7.598599   -2.301026
                         CTRA  |  -.0605993   .8110554    -0.07   0.941    -1.663711    1.542513
                         DART  |  -1.910334   .9455116    -2.02   0.045    -3.779209   -.0414595
                         DILD  |   .4385749    .690611     0.64   0.526    -.9264696    1.803619
                         DMAS  |  -.8064493   1.466592    -0.55   0.583    -3.705279     2.09238
                         DUTI  |   2.279153   .8200434     2.78   0.006     .6582761    3.900031
                         FMII  |  -5.050991   3.634907    -1.39   0.167    -12.23566    2.133676
                         GMTD  |   1.609945   .7361016     2.19   0.030      .154985    3.064905
                         GPRA  |   .7070048   .9660833     0.73   0.465    -1.202531    2.616541
                         INDS  |   .3487059   2.395833     0.15   0.884    -4.386837    5.084249
                         JRPT  |    4.44845   1.494431     2.98   0.003     1.494595    7.402305
                         JTPE  |    .834028   3.572804     0.23   0.816    -6.227887    7.895942
                         KIJA  |  -2.493057   1.432208    -1.74   0.084    -5.323924    .3378107
                         LINK  |   5.043667   4.371182     1.15   0.250    -3.596301    13.68364
                         LPCK  |   6.240876   6.955493     0.90   0.371    -7.507178    19.98893
                         LPGI  |   1.179102   .8410096     1.40   0.163    -.4832171     2.84142
                         LPKR  |   .7737229   1.459914     0.53   0.597    -2.111906    3.659352
                         MARI  |   4.511691     6.4431     0.70   0.485     -8.22358    17.24696
                         MDIA  |   3.637022   4.998187     0.73   0.468    -6.242271    13.51631
                         MDLN  |  -5.018098   2.952339    -1.70   0.091    -10.85362    .8174219
                         MEGA  |   3.629563   3.339883     1.09   0.279    -2.971967    10.23109
                         MKPI  |   5.926182   2.035153     2.91   0.004     1.903549    9.948814
                         MMLP  |   .8126784    2.50436     0.32   0.746    -4.137377    5.762734
                         MNCN  |     1.6835   2.823976     0.60   0.552    -3.898301    7.265301
                         MREI  |   2.293249   1.157294     1.98   0.049     .0057712    4.580727
                         MTLA  |   3.542054   1.936665     1.83   0.069    -.2859105    7.370019
                         MYRX  |  -2.469469   .7999408    -3.09   0.002    -4.050612   -.8883258
                         NISP  |   .0944043   .7654037     0.12   0.902    -1.418474    1.607282
                         PLIN  |   1.818417   3.990349     0.46   0.649    -6.068808    9.705643
                         PNBN  |  -.5133411   .6766237    -0.76   0.449    -1.850739    .8240564
                         PNIN  |   1.555931   .8908233     1.75   0.083    -.2048478     3.31671
                         PPRO  |  -7.645823    1.93914    -3.94   0.000    -11.47868   -3.812969
                         PWON  |    .827668   1.376719     0.60   0.549     -1.89352    3.548856
                         RDTX  |   1.647971   1.343093     1.23   0.222    -1.006753    4.302695
                         RODA  |   .2733828   1.023854     0.27   0.790    -1.750341    2.297106
                         SCBD  |   2.449009   .9853489     2.49   0.014     .5013928    4.396625
                         SCMA  |   11.37837   6.599241     1.72   0.087     -1.66552    24.42227
                         SDRA  |  -.2775776   .5947717    -0.47   0.641    -1.453188    .8980333
                         SMDM  |  -.2651635   .9403621    -0.28   0.778     -2.12386    1.593533
                         SMRA  |  -.8117748   .9704148    -0.84   0.404    -2.729872    1.106323
                         SMSM  |   7.956638    7.70801     1.03   0.304    -7.278821     23.1921
                         TARA  |  -1.243613   1.169836    -1.06   0.290    -3.555881    1.068655
                         TLKM  |   4.399757   4.520706     0.97   0.332    -4.535757    13.33527
                         VINS  |   2.005052   1.621869     1.24   0.218    -1.200693    5.210797
                         VIVA  |  -4.834313    4.09723    -1.18   0.240     -12.9328    3.264169
                               |
                          year |
                         2017  |  -.5542752   .4074146    -1.36   0.176    -1.359561    .2510102
                         2018  |  -2.224763   .5223219    -4.26   0.000    -3.257171   -1.192354
                               |
                         _cons |  -1.037165   .6538399    -1.59   0.115    -2.329528    .2551992
                  ------------------------------------------------------------------------------
                  
                  . estat vif
                  
                      Variable |       VIF       1/VIF  
                  -------------+----------------------
                            X1 |      4.05    0.247167
                            X2 |     18.70    0.053486
                            id |
                            2  |      2.04    0.491325
                            3  |      2.17    0.461177
                            4  |      2.51    0.398404
                            5  |      2.22    0.451449
                            6  |      2.12    0.471656
                            7  |      2.10    0.476757
                            8  |      2.17    0.461579
                            9  |      1.97    0.506810
                           10  |      2.04    0.489476
                           11  |      1.99    0.503765
                           12  |      1.98    0.504301
                           13  |      1.98    0.506045
                           14  |      1.98    0.503804
                           15  |      1.97    0.506787
                           16  |      2.12    0.471037
                           17  |      1.99    0.501544
                           18  |      2.09    0.477395
                           19  |      1.98    0.506209
                           20  |      1.98    0.504364
                           21  |      1.99    0.502469
                           22  |      2.00    0.499891
                           23  |      1.98    0.505835
                           24  |      1.98    0.505452
                           25  |      1.97    0.506372
                           26  |      1.97    0.506686
                           27  |      3.57    0.279836
                           28  |      2.24    0.446401
                           29  |      2.02    0.494005
                           30  |      2.10    0.476913
                           31  |      2.02    0.494865
                           32  |      1.99    0.503436
                           33  |      1.99    0.503010
                           34  |      2.10    0.477297
                           35  |      2.02    0.494321
                           36  |      2.47    0.404489
                           37  |      2.01    0.497430
                           38  |      2.01    0.497165
                           39  |      2.38    0.421015
                           40  |      2.12    0.471457
                           41  |      3.20    0.312271
                           42  |      2.01    0.496527
                           43  |      3.86    0.259255
                           44  |      2.12    0.472456
                           45  |      2.02    0.495334
                           46  |      2.10    0.475651
                           47  |      4.80    0.208144
                           48  |      3.52    0.284123
                           49  |      2.49    0.402010
                           50  |      1.98    0.505512
                           51  |      2.37    0.421144
                           52  |      2.04    0.490043
                           53  |      2.73    0.366918
                           54  |      2.02    0.494357
                           55  |      2.21    0.452832
                           56  |      1.99    0.503404
                           57  |      1.97    0.506605
                           58  |      2.25    0.444504
                           59  |      1.97    0.506440
                           60  |      2.05    0.487498
                           61  |      2.42    0.413355
                           62  |      2.17    0.461584
                           63  |      2.13    0.469281
                           64  |      1.98    0.505502
                           65  |      2.02    0.495296
                           66  |      5.72    0.174788
                           67  |      1.98    0.506075
                           68  |      2.01    0.498242
                           69  |      2.04    0.489250
                           70  |      6.24    0.160248
                           71  |      1.98    0.505786
                           72  |      3.86    0.259237
                           73  |      2.01    0.497687
                           74  |      3.04    0.329145
                          year |
                         2017  |      1.36    0.737741
                         2018  |      1.39    0.720815
                  -------------+----------------------
                      Mean VIF |      2.56
                  code 2 is really long result, i'm sorry (it made me exceeds word limit)

                  code number 3

                  Code:
                  . xtreg Y X1 X2 i.year, fe vce(robust)
                  
                  Fixed-effects (within) regression               Number of obs     =        222
                  Group variable: id                              Number of groups  =         74
                  
                  R-sq:                                           Obs per group:
                       within  = 0.5916                                         min =          3
                       between = 0.6470                                         avg =        3.0
                       overall = 0.6243                                         max =          3
                  
                                                                  F(4,73)           =     100.72
                  corr(u_i, Xb)  = 0.1511                         Prob > F          =     0.0000
                  
                                                      (Std. Err. adjusted for 74 clusters in id)
                  ------------------------------------------------------------------------------
                               |               Robust
                             Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                            X1 |   .8808422   .1626354     5.42   0.000     .5567103    1.204974
                            X2 |   16.65939   13.84521     1.20   0.233    -10.93408    44.25285
                               |
                          year |
                         2017  |  -.5542752   .3520155    -1.57   0.120    -1.255841    .1472906
                         2018  |  -2.224763    .567658    -3.92   0.000    -3.356104   -1.093422
                               |
                         _cons |  -.1550369   1.315367    -0.12   0.906    -2.776559    2.466485
                  -------------+----------------------------------------------------------------
                       sigma_u |  2.9370361
                       sigma_e |  2.7763652
                           rho |  .52809954   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  
                  . estat vce, corr
                  
                  Correlation matrix of coefficients of xtreg model
                  
                               |                         2017.     2018.          
                          e(V) |       X1        X2      year      year     _cons 
                  -------------+--------------------------------------------------
                            X1 |   1.0000                                         
                            X2 |  -0.8060    1.0000                               
                     2017.year |   0.2298   -0.1837    1.0000                     
                     2018.year |   0.3493    0.0553    0.5206    1.0000           
                         _cons |   0.4471   -0.8797   -0.0472   -0.4620    1.0000
                  what does it tell carlo? and what should i do about it

                  Comment


                  • #10
                    Samuel: A few additional comments.

                    1. Let me just emphasize what Carlo pointed out: vce(robust) works very different with regress and xtreg. In the latter case it is the same as vce(cluster id).
                    2. It is impossible to use standard errors clustered for serial correlation to test u(i) = 0. The test is not well defined. In fact, if you were to try

                    Code:
                    regress Y X1 X2 i.id i.year, vce (cluster id)
                    you will see that the standard errors for the id fixed effects are all over the place. They are not well defined. I won't go into details about why one cannot compute cluster-robust standard errors for the fixed effects, but you can't. And that means the F statistic is meaningless, too.

                    3. I'll disagree with Carlo about using VIFs in this context. The reason for the very high R-squared is because you are putting in all of those fixed effects. Those are doing a lot of work, and you shouldn't get credit for that. As Phil noted, you are using the within variation to estimate the effects of X1 and X2 on y. That's why you shouldn't be using reg to begin with because the goodness-of-fit is very misleading. The within R-squared reported with xtreg is much more telling -- and it's about .60 in your case.

                    So ignore vifs and don't worry about the correlation of the covariates, either. And under no circumstances do you care about the vifs of the fixed effects -- unit or time. Your X1 variance is very significant, X2 is not. The end, unless you have more variables to try, or want to add lags, interactions, and so on.

                    Comment


                    • #11
                      Jeff:

                      Thank you Jeff,
                      1. Yes i got this point and read this idea in stata manual, particulary the point that cluster (id) and robust option works in the same way for xtreg command (so thank you for confirming this point).
                      2. Okay jeff if you say so, i won't bother to use it anymore.
                      3. (Correct me if i'm wrong) When i'm trying to explain the goodness-of-fit for my model, does it mean that i should use within R-square for my model?

                      Okay, i think shouldn't worry about it anymore. I think explain the relationship between my dependent and independent variabel is all i wanted in my research.
                      Thank you jeff, you're really helpful.

                      Best Regards,
                      Samuel.

                      Comment


                      • #12
                        Thanks Jeff Wooldridge for diasagreing with me: this one of the best way for me to learn!
                        Kind regards,
                        Carlo
                        (Stata 19.0)

                        Comment


                        • #13
                          Samuel: In case you are still wondering about the F test, this is an example I use in my courses. You can see the standard errors are essentially zero in some cases, and the F statistic drops all but two of the constraints. The standard errors on ez and the year dummies are fine, subject to small sample (N = 22) concerns. But all standard errors and tests involving the city effects are meaningless.

                          Code:
                          . reg luclms ez i.year c2-c22, vce(cluster city)
                          
                          Linear regression                               Number of obs     =        198
                                                                          F(8, 21)          =          .
                                                                          Prob > F          =          .
                                                                          R-squared         =     0.9332
                                                                          Root MSE          =     .20051
                          
                                                            (Std. Err. adjusted for 22 clusters in city)
                          ------------------------------------------------------------------------------
                                       |               Robust
                                luclms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                    ez |  -.1044148   .0772488    -1.35   0.191    -.2650624    .0562328
                                       |
                                  year |
                                 1981  |  -.3216319   .0500958    -6.42   0.000    -.4258118    -.217452
                                 1982  |   .1354957   .0605516     2.24   0.036     .0095717    .2614197
                                 1983  |  -.2192554   .0898156    -2.44   0.024    -.4060372   -.0324736
                                 1984  |  -.5791517   .1048188    -5.53   0.000    -.7971344   -.3611691
                                 1985  |  -.5917868   .0964101    -6.14   0.000    -.7922827    -.391291
                                 1986  |  -.6212648   .0830494    -7.48   0.000    -.7939754   -.4485541
                                 1987  |  -.8889486    .088801   -10.01   0.000     -1.07362   -.7042769
                                 1988  |  -1.227633   .1017089   -12.07   0.000    -1.439148   -1.016118
                                       |
                                    c2 |   -.193488    .042916    -4.51   0.000    -.2827366   -.1042393
                                    c3 |  -.3789381    .042916    -8.83   0.000    -.4681868   -.2896894
                                    c4 |  -.5411763    .042916   -12.61   0.000     -.630425   -.4519276
                                    c5 |   .0110321   .0085832     1.29   0.213    -.0068176    .0288819
                                    c6 |   .5545758   1.28e-14  4.3e+13   0.000     .5545758    .5545758
                                    c7 |   .7500629   1.28e-14  5.9e+13   0.000     .7500629    .7500629
                                    c8 |  -.0587597   .0085832    -6.85   0.000    -.0766094   -.0409099
                                    c9 |   .3534239   .0085832    41.18   0.000     .3355741    .3712736
                                   c10 |    1.64501    .042916    38.33   0.000     1.555761    1.734259
                                   c11 |  -.1303174    .042916    -3.04   0.006    -.2195661   -.0410687
                                   c12 |  -.0349802    .042916    -0.82   0.424    -.1242289    .0542685
                                   c13 |  -.8325769    .042916   -19.40   0.000    -.9218256   -.7433282
                                   c14 |  -.8736305   .0085832  -101.78   0.000    -.8914802   -.8557808
                                   c15 |  -.2354225    .042916    -5.49   0.000    -.3246712   -.1461738
                                   c16 |   .4357443    .042916    10.15   0.000     .3464957     .524993
                                   c17 |   -.445226   1.27e-14 -3.5e+13   0.000     -.445226    -.445226
                                   c18 |  -.0428939    .042916    -1.00   0.329    -.1321425    .0463548
                                   c19 |   .0934068    .042916     2.18   0.041     .0041582    .1826555
                                   c20 |  -.3509774   1.28e-14 -2.8e+13   0.000    -.3509774   -.3509774
                                   c21 |   .4577897   1.28e-14  3.6e+13   0.000     .4577897    .4577897
                                   c22 |   .2186381    .042916     5.09   0.000     .1293894    .3078867
                                 _cons |   11.67615   .0665544   175.44   0.000     11.53775    11.81456
                          ------------------------------------------------------------------------------
                          
                          . testparm c2-c22
                          
                           ( 1)  c2 = 0
                           ( 2)  c3 = 0
                           ( 3)  c4 = 0
                           ( 4)  c5 = 0
                           ( 5)  c6 = 0
                           ( 6)  c7 = 0
                           ( 7)  c8 = 0
                           ( 8)  c9 = 0
                           ( 9)  c10 = 0
                           (10)  c11 = 0
                           (11)  c12 = 0
                           (12)  c13 = 0
                           (13)  c14 = 0
                           (14)  c15 = 0
                           (15)  c16 = 0
                           (16)  c17 = 0
                           (17)  c18 = 0
                           (18)  c19 = 0
                           (19)  c20 = 0
                           (20)  c21 = 0
                           (21)  c22 = 0
                                 Constraint 1 dropped
                                 Constraint 2 dropped
                                 Constraint 3 dropped
                                 Constraint 4 dropped
                                 Constraint 5 dropped
                                 Constraint 6 dropped
                                 Constraint 7 dropped
                                 Constraint 8 dropped
                                 Constraint 9 dropped
                                 Constraint 11 dropped
                                 Constraint 12 dropped
                                 Constraint 13 dropped
                                 Constraint 14 dropped
                                 Constraint 15 dropped
                                 Constraint 16 dropped
                                 Constraint 17 dropped
                                 Constraint 18 dropped
                                 Constraint 19 dropped
                                 Constraint 20 dropped
                                 Constraint 21 dropped
                          
                                 F(  1,    21) =    9.22
                                      Prob > F =    0.0063

                          Comment


                          • #14
                            Jeff:

                            Thank you Jeff for even providing a good example.
                            Best regards.

                            Comment

                            Working...
                            X