Announcement

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

  • Does vif command run all possible regressions?

    Variance inflation factor is calculated using each independent var as the dependent var, regressed against the rest of the vars. Does Stata actually run all of those regressions under the hood or is something quicker done?

    Thanks,
    Alex

  • #2
    Alex:
    I would say that Stata run all those regressions under the hood:
    Code:
    . sysuse auto.dta
    (1978 Automobile Data)
    
    . regress price mpg turn
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     10.08
           Model |   140436412         2  70218206.1   Prob > F        =    0.0001
        Residual |   494628984        71  6966605.41   R-squared       =    0.2211
    -------------+----------------------------------   Adj R-squared   =    0.1992
           Total |   635065396        73  8699525.97   Root MSE        =    2639.4
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -259.6967   76.84886    -3.38   0.001     -412.929   -106.4645
            turn |  -38.03857   101.0624    -0.38   0.708    -239.5513    163.4742
           _cons |   13204.27   5316.186     2.48   0.015       2604.1    23804.45
    ------------------------------------------------------------------------------
    
    . estat vif
    
        Variable |       VIF       1/VIF 
    -------------+----------------------
             mpg |      2.07    0.482771
            turn |      2.07    0.482771
    -------------+----------------------
        Mean VIF |      2.07
    
    . regress mpg turn
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     77.14
           Model |  1263.82804         1  1263.82804   Prob > F        =    0.0000
        Residual |  1179.63142        72  16.3837697   R-squared       =    0.5172
    -------------+----------------------------------   Adj R-squared   =    0.5105
           Total |  2443.45946        73  33.4720474   Root MSE        =    4.0477
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            turn |  -.9457877   .1076853    -8.78   0.000    -1.160455   -.7311209
           _cons |    58.7965   4.295428    13.69   0.000     50.23372    67.35928
    ------------------------------------------------------------------------------
    
    . di 1/(1-0.5172)
    2.071251
    
    . regress turn mpg
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     77.14
           Model |  730.774652         1  730.774652   Prob > F        =    0.0000
        Residual |  682.090213        72  9.47347518   R-squared       =    0.5172
    -------------+----------------------------------   Adj R-squared   =    0.5105
           Total |  1412.86486        73  19.3543132   Root MSE        =    3.0779
    
    ------------------------------------------------------------------------------
            turn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -.5468764   .0622662    -8.78   0.000    -.6710017   -.4227511
           _cons |   51.29564   1.373522    37.35   0.000     48.55757     54.0337
    ------------------------------------------------------------------------------
    
    . di 1/(1-0.5172)
    2.071251
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks Carlo. The reason I asked is because I have a model with ~80 covariates, which means Stata has to run 80 regressions in order to report VIF for each variable. Wasn't sure if there was either a closed form solution or quicker way to approximate VIF, but it appears based on your test that Stata is giving the exact VIF based on the X1 ~ X2 + ... Xk regressions.

      p.s. it's taking VIF about 15 minutes per regression, which is obviously dependent on the specifics of my regressions, but is reasonable for a diagnostic step.

      Comment


      • #4
        You can look at the code!

        Code:
        viewsource vif.ado

        Comment

        Working...
        X