Announcement

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

  • How to find VIF after xtreg command.

    Hi
    i tried to find out the vif after "xtreg" but an error occured that is written below

    .vif
    not appropriate after regress, nocons;
    use option uncentered to get uncentered VIFs
    r(301);

    how i can solve this issue?

  • #2
    If you're doing fixed effects, run regress ... i.panel . This is the same as xtreg ..., fe . Then you have all the regress diagnostics available.

    Comment


    • #3
      Dear all, I just wanted to ask you. I've been having the same problem as creator of this topic. So I've followed the recommendation of Phil and used standard OLS with i.panel, but the results weren't same. Size effects of variables stayed constant, the robust S.E. were slighty different, but changes in R-sq and adj. R-sq were actually really big (model with fixed effect had 18 adj. R-sq, but classic OLS had 43 adj. R-sq.), so in context of testing assumption is that really correct way to test them?

      Comment


      • #4
        You don't show the exact code you ran, nor the outputs, so the best you can get is an educated guess here.

        The R2 from the OLS with i.panel includes the variance explained by the panel effects, whereas the R2-within from -xtreg, fe- does not. So you can't expect them to be the same. If they were, it would imply that there is no panel level variation in your data: possible, but very rare in real life.

        As for the robust standard error, this is a very confusing situation that StataCorp has created and you have been bitten by it. In OLS regression, -vce(robust)- refers to the non-clustered Huber-White (aka Sandwich) variance estimator. That variance estimator is not valid for fixed effects regression. Until, I think it was, version 13, Stata would calculate that non-valid variance estimator anyway. But from version 13 onward they decided to banish it. For reasons I do not understand, instead of having Stata throw an error message and halt calculation when -vce(robust)- is used with -xtreg, fe-, they decided instead to just automatically substitute -vce(cluster panel)-, without even telling you that they've done that. -vce(cluster panel)- gives you the clustered robust variance estimator. Consequently it is different. If you want to replicate -xtreg, fe- in OLS with robust standard error estimation, you have to use -vce(cluster panel)- in your -regress- command. If you do that, they will match.

        Comment


        • #5
          Oh, Thank you very much, wouldn't really thought of that possibilty with Stata rewriting commands. I'll definitely try the command with clustered robust variance in both models.

          Comment


          • #6
            Dear Clyde, I am aware of what you have said here (R^2, and clustered standard errors). However, I also notice that there is always a minor difference in standard errors.
            Code:
            webuse grunfeld, clear
            
            xtset company year
            
            xtreg invest mvalue kstock, fe vce(robust)
            reg invest mvalue kstock i.company, vce(cl company)
            The results are:
            Code:
            . xtreg invest mvalue kstock, fe vce(robust)
            
            Fixed-effects (within) regression               Number of obs     =        200
            Group variable: company                         Number of groups  =         10
            
            R-sq:                                           Obs per group:
                 within  = 0.7668                                         min =         20
                 between = 0.8194                                         avg =       20.0
                 overall = 0.8060                                         max =         20
            
                                                            F(2,9)            =      28.31
            corr(u_i, Xb)  = -0.1517                        Prob > F          =     0.0001
            
                                           (Std. Err. adjusted for 10 clusters in company)
            ------------------------------------------------------------------------------
                         |               Robust
                  invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  mvalue |   .1101238   .0151945     7.25   0.000     .0757515    .1444961
                  kstock |   .3100653   .0527518     5.88   0.000     .1907325    .4293981
                   _cons |  -58.74393   27.60286    -2.13   0.062    -121.1859    3.698079
            -------------+----------------------------------------------------------------
                 sigma_u |  85.732501
                 sigma_e |  52.767964
                     rho |  .72525012   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            . reg invest mvalue kstock i.company, vce(cl company)
            
            Linear regression                               Number of obs     =        200
                                                            F(1, 9)           =          .
                                                            Prob > F          =          .
                                                            R-squared         =     0.9441
                                                            Root MSE          =     52.768
            
                                           (Std. Err. adjusted for 10 clusters in company)
            ------------------------------------------------------------------------------
                         |               Robust
                  invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  mvalue |   .1101238   .0155539     7.08   0.000     .0749383    .1453092
                  kstock |   .3100653   .0539997     5.74   0.000     .1879096    .4322211
                         |
                 company |
                      2  |   172.2025   50.34267     3.42   0.008     58.31947    286.0856
                      3  |  -165.2751   46.34487    -3.57   0.006    -270.1145   -60.43576
                      4  |    42.4874   76.82221     0.55   0.594    -131.2965    216.2713
                      5  |  -44.32013    69.2745    -0.64   0.538    -201.0299    112.3897
                      6  |   47.13539   81.61436     0.58   0.578    -137.4891    231.7599
                      7  |   3.743212   77.00449     0.05   0.962    -170.4531    177.9395
                      8  |   12.75103    78.7009     0.16   0.875    -165.2828    190.7848
                      9  |  -16.92558   74.87587    -0.23   0.826    -186.3066    152.4554
                     10  |   63.72884   91.04723     0.70   0.502    -142.2343     269.692
                         |
                   _cons |  -70.29669   92.35525    -0.76   0.466    -279.2188    138.6254
            ------------------------------------------------------------------------------
            Any idea? (I guess it is related to degrees of freedom) Thanks.
            Ho-Chuan (River) Huang
            Stata 17.0, MP(4)

            Comment


            • #7
              River:
              it may also be due to the machinery of -fe- estimator, which uses within-unit variation only.
              Kind regards,
              Carlo
              (Stata 18.0 SE)

              Comment


              • #8
                Hi, I've looked to this topic once more.

                I tried to compare the results from different models (OLS; OLS robust; OLS clustered; fixed effect model; fixed effect model robust; fixed effect model cluster).

                The effect size of independent variables was actually same, but S.E. were different. Results are from Stata 12:

                Click image for larger version

Name:	ss1.png
Views:	1
Size:	8.2 KB
ID:	1465457

                (not all Panels are included)
                Click image for larger version

Name:	ss2.png
Views:	1
Size:	10.9 KB
ID:	1465458



                Command:

                Code:
                xtset Panel date, daily
                
                reg DV IV1 IV2 i.Panel
                estimates store none
                reg DV IV1 IV2 i.Panel, vce(robust)
                estimates store robust
                reg DV IV1 IV2 i.Panel, vce(cluster Panel)
                estimates store cluster
                xtreg DV IV1 IV2, fe
                estimates store fe_none
                xtreg DV IV1 IV2, fe vce(robust)
                estimates store fe_robust
                xtreg DV IV1 IV2, fe vce(cluster Panel)
                estimates store fe_cluster
                
                estout none robust cluster fe_none fe_robust fe_cluster, cells(b(star fmt(2)) se(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) stats(N N_g p r2 r2_a rmse aic bic, labels ("N-level 1" "N-level 2" "p-value" "R-sqr" "Adj. R-sqr" "Root-MSE" "AIC" "BIC")) varwidth(20) legend label collabels(none) varlabels(_cons Constant)
                Attached Files

                Comment


                • #9
                  Karel Novak Thanks for your thorough exploration of this. I have to say I am surprised by some of these results and I do not know the explanation.

                  The coefficients are the same in all of these models, as expected.

                  As I expected, fe_robust and fe_cluster models produce the same results: Stata has made that happen by substituting the clustered standard error for the unclustered robust standard error when used with -xtreg, fe-. By contrast, in OLS, robust and cluster produce different results, again as I expected. And of course, both the robust and clustered standard errors differ from "none."

                  But OLS with clustered standard errors is producing a different result from -xtreg, fe- with clustered standard errors. And I do not understand why. I'm hoping somebody who knows this better will jump in and explain it.

                  Comment


                  • #10
                    But OLS with clustered standard errors is producing a different result from -xtreg, fe- with clustered standard errors. And I do not understand why. I'm hoping somebody who knows this better will jump in and explain it.
                    The discrepancy is due to degrees of freedom adjustment. See the manual for the exact computation of the cluster-robust variance matrix in fixed effects. The option -dfadj- will give you the equivalent regress standard errors in xtreg


                    Code:
                    reg DV IV1 IV2 i.Panel, vce(cluster Panel)
                    xtreg DV IV1 IV2, fe vce(cluster Panel)
                    xtreg DV IV1 IV2, fe vce(cluster Panel) dfadj

                    Comment


                    • #11
                      Thank you, Andrew.

                      Comment


                      • #12
                        But if we go back to the very first question. If you want to test regression assumptions while using -xtreg, fe vce (cluster panel)- is the usage of -reg i.panel, vce(cluster panel)- reliable?

                        Comment


                        • #13
                          If you are talking about things like -estat hettest- for heteroscedasiticity, it is not valid with robust or clustered standard errors, and, in any case testing for heteroscedasticity is unnecessary with robust or clustered standard errors. If you are talking about VIF, that, is available to you, although, as I have often ranted elsewhere on Statalist, I think VIF is one of the biggest wastes of time around in any case. dfbeta and leverage and standardized residuals are not appropriate with robust or clustered standard errors and are also unavailable.

                          Comment


                          • #14
                            Dear Clyde Schechter ,

                            What would you recommend for us to test for the mulilcollinearity problem rather than vif? Would the mutual correlation coefficient between the variables be sufficient?

                            Comment


                            • #15
                              Sarah:
                              to have an idea about coefficients correlation, you may want to consider:
                              Code:
                              estat vce, corr
                              Kind regards,
                              Carlo
                              (Stata 18.0 SE)

                              Comment

                              Working...
                              X