Announcement

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

  • VIF for selected variables

    I want to estimate the variance inflation factor after OLS regression. My model has a lot of fixed effects, and I want the VIF only for the key variables of interest. Is there a way to do this?

  • #2
    Parul:
    you can calcuate the VIF you're interested in by hand following the formula reported in the -regress postestimation- entry, Stata .pdf manual:
    Code:
    . sysuse auto.dta
    (1978 automobile data)
    
    . regress price trunk weight
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     14.80
           Model |   186872936         2  93436468.2   Prob > F        =    0.0000
        Residual |   448192460        71  6312569.86   R-squared       =    0.2943
    -------------+----------------------------------   Adj R-squared   =    0.2744
           Total |   635065396        73  8699525.97   Root MSE        =    2512.5
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           trunk |  -60.03885   92.85726    -0.65   0.520     -245.191    125.1133
          weight |   2.266182   .5110542     4.43   0.000     1.247169    3.285195
           _cons |   148.5533   1203.406     0.12   0.902     -2250.97    2548.077
    ------------------------------------------------------------------------------
    
    . estat vif
    
        Variable |       VIF       1/VIF  
    -------------+----------------------
           trunk |      1.82    0.548139
          weight |      1.82    0.548139
    -------------+----------------------
        Mean VIF |      1.82
    
    . help regress
    
    . regress trunk weight
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     59.35
           Model |  603.514706         1  603.514706   Prob > F        =    0.0000
        Residual |  732.106916        72  10.1681516   R-squared       =    0.4519
    -------------+----------------------------------   Adj R-squared   =    0.4442
           Total |  1335.62162        73  18.2961866   Root MSE        =    3.1888
    
    ------------------------------------------------------------------------------
           trunk | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |   .0036996   .0004802     7.70   0.000     .0027423    .0046569
           _cons |   2.586002   1.496605     1.73   0.088    -.3974248    5.569429
    ------------------------------------------------------------------------------
    
    . di 1/(1-0.4519)
    1.8244846
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you Carlo. Should I use pwcorr if I have more than two variables?

      Comment


      • #4
        Parul:
        no, you have to repeat the previous approach changing the dependent variable:
        Code:
        . sysuse auto.dta
        (1978 automobile data)
        
        . regress price trunk weight mpg
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(3, 70)        =      9.92
               Model |   189420421         3  63140140.2   Prob > F        =    0.0000
            Residual |   445644976        70  6366356.79   R-squared       =    0.2983
        -------------+----------------------------------   Adj R-squared   =    0.2682
               Total |   635065396        73  8699525.97   Root MSE        =    2523.2
        
        ------------------------------------------------------------------------------
               price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
               trunk |  -65.32347   93.62548    -0.70   0.488    -252.0536    121.4067
              weight |   1.955753   .7100895     2.75   0.007     .5395243    3.371982
                 mpg |  -54.91704   86.81541    -0.63   0.529    -228.0649    118.2308
               _cons |   2328.163   3651.422     0.64   0.526    -4954.368    9610.694
        ------------------------------------------------------------------------------
        
        . estat vif
        
            Variable |       VIF       1/VIF  
        -------------+----------------------
              weight |      3.49    0.286341
                 mpg |      2.89    0.345694
               trunk |      1.84    0.543775
        -------------+----------------------
            Mean VIF |      2.74
        
        . regress trunk mpg weight
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(2, 71)        =     29.78
               Model |  609.343683         2  304.671841   Prob > F        =    0.0000
            Residual |  726.277939        71  10.2292667   R-squared       =    0.4562
        -------------+----------------------------------   Adj R-squared   =    0.4409
               Total |  1335.62162        73  18.2961866   Root MSE        =    3.1983
        
        ------------------------------------------------------------------------------
               trunk | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 mpg |  -.0827393   .1096069    -0.75   0.453    -.3012892    .1358106
              weight |   .0032024   .0008159     3.92   0.000     .0015755    .0048293
               _cons |   5.849263   4.576131     1.28   0.205    -3.275284    14.97381
        ------------------------------------------------------------------------------
        
        . di 1/(1-0.4562)
        1.8389114
        
        . regress mpg trunk weight
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(2, 71)        =     67.19
               Model |  1598.76953         2  799.384767   Prob > F        =    0.0000
            Residual |  844.689926        71  11.8970412   R-squared       =    0.6543
        -------------+----------------------------------   Adj R-squared   =    0.6446
               Total |  2443.45946        73  33.4720474   Root MSE        =    3.4492
        
        ------------------------------------------------------------------------------
                 mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
               trunk |   -.096229   .1274771    -0.75   0.453    -.3504112    .1579531
              weight |  -.0056527   .0007016    -8.06   0.000    -.0070516   -.0042537
               _cons |   39.68913    1.65207    24.02   0.000       36.395    42.98327
        ------------------------------------------------------------------------------
        
        . di 1/(1-.6543)
        2.8926815
        
        . regress weight mpg trunk
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(2, 71)        =     88.48
               Model |  31468208.8         2  15734104.4   Prob > F        =    0.0000
            Residual |  12625969.6        71  177830.557   R-squared       =    0.7137
        -------------+----------------------------------   Adj R-squared   =    0.7056
               Total |  44094178.4        73  604029.841   Root MSE        =     421.7
        
        ------------------------------------------------------------------------------
              weight | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 mpg |   -84.4932   10.48699    -8.06   0.000    -105.4037   -63.58274
               trunk |   55.67266   14.18442     3.92   0.000     27.38973    83.95559
               _cons |   4053.061   375.5729    10.79   0.000      3304.19    4801.932
        ------------------------------------------------------------------------------
        
        . di 1/(1-0.7137)
        3.4928397
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you!

          Comment

          Working...
          X