EC771: example of collinearity

-------------------------------------------------------------------------------
       log:  :Keewaydin:Rumelihisari:Stata:coldiag.smcl
  log type:  smcl
 opened on:  21 Feb 2001, 08:50:52

. * makes use of hacked version of Joe Harkness' coldiag that works from . * regressorlist, available on fmrisc . clear

. set matsize 800

. use ":Keewaydin:Rumelihisari:Stata:auto.dta" (1978 Automobile Data)

. gen pr=price/1000

. regress pr displ mpg

Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 2, 71) = 13.35 Model | 173.587101 2 86.7935503 Prob > F = 0.0000 Residual | 461.478281 71 6.4996941 R-squared = 0.2733 -------------+------------------------------ Adj R-squared = 0.2529 Total | 635.065382 73 8.69952578 Root MSE = 2.5494

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- displacement | .0105088 .0045855 2.29 0.025 .0013657 .019652 mpg | -.1211832 .0727884 -1.66 0.100 -.2663193 .0239528 _cons | 6.672765 2.29972 2.90 0.005 2.087254 11.25828 ------------------------------------------------------------------------------

. gen e = 100*invnorm(uniform())

. gen mpga=mpg+e

. corr mpg mpga (obs=74)

| mpg mpga -------------+------------------ mpg | 1.0000 mpga | -0.0311 1.0000

. . regress pr displ mpg mpga

Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 3, 70) = 8.78 Model | 173.701057 3 57.9003525 Prob > F = 0.0000 Residual | 461.364324 70 6.59091892 R-squared = 0.2735 -------------+------------------------------ Adj R-squared = 0.2424 Total | 635.065382 73 8.69952578 Root MSE = 2.5673

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- displacement | .0105185 .0046181 2.28 0.026 .0013079 .0197291 mpg | -.1212874 .0733017 -1.65 0.102 -.2674831 .0249083 mpga | -.0004207 .0031998 -0.13 0.896 -.0068025 .005961 _cons | 6.679027 2.316292 2.88 0.005 2.059328 11.29873 ------------------------------------------------------------------------------

. vif

Variable | VIF 1/VIF -------------+---------------------- displacement | 1.99 0.501941 mpg | 1.99 0.502010 mpga | 1.00 0.998780 -------------+---------------------- Mean VIF | 1.66

. lincom mpg+mpga

( 1) mpg + mpga = 0.0

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1217081 .0734061 -1.66 0.102 -.2681119 .0246957 ------------------------------------------------------------------------------

. coldiag2,f Condition number = 3.03 Condition indices and variance decomposition proportions

CI displacement mpg mpga r1 1.000 0.092 0.092 0.029 r2 3.030 0.899 0.897 0.001 r3 1.390 0.009 0.011 0.971

. gen mpgb=mpg+e/10

. corr mpg mpgb (obs=74)

| mpg mpgb -------------+------------------ mpg | 1.0000 mpgb | 0.4637 1.0000

. regress pr displ mpg mpgb

Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 3, 70) = 8.78 Model | 173.701057 3 57.9003525 Prob > F = 0.0000 Residual | 461.364324 70 6.59091892 R-squared = 0.2735 -------------+------------------------------ Adj R-squared = 0.2424 Total | 635.065382 73 8.69952578 Root MSE = 2.5673

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- displacement | .0105185 .0046181 2.28 0.026 .0013079 .0197291 mpg | -.1175007 .0784657 -1.50 0.139 -.2739956 .0389942 mpgb | -.0042074 .0319979 -0.13 0.896 -.0680252 .0596103 _cons | 6.679027 2.316292 2.88 0.005 2.059328 11.29873 ------------------------------------------------------------------------------

. vif

Variable | VIF 1/VIF -------------+---------------------- mpg | 2.28 0.438108 displacement | 1.99 0.501941 mpgb | 1.27 0.784819 -------------+---------------------- Mean VIF | 1.85

. lincom mpg+mpgb

( 1) mpg + mpgb = 0.0

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1217081 .0734061 -1.66 0.102 -.2681119 .0246957 ------------------------------------------------------------------------------

. coldiag2,f Condition number = 5.73 Condition indices and variance decomposition proportions

CI displacement mpg mpgb r1 1.000 0.042 0.018 0.021 r2 3.090 0.877 0.037 0.146 r3 5.730 0.082 0.945 0.833

. gen mpgc=mpg+e/100

. corr mpg mpgc (obs=74)

| mpg mpgc -------------+------------------ mpg | 1.0000 mpgc | 0.9867 1.0000

. regress pr displ mpg mpgc

Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 3, 70) = 8.78 Model | 173.701057 3 57.9003524 Prob > F = 0.0000 Residual | 461.364325 70 6.59091892 R-squared = 0.2735 -------------+------------------------------ Adj R-squared = 0.2424 Total | 635.065382 73 8.69952578 Root MSE = 2.5673

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- displacement | .0105185 .0046181 2.28 0.026 .0013079 .0197291 mpg | -.0796337 .324377 -0.25 0.807 -.7265832 .5673158 mpgc | -.0420744 .3199789 -0.13 0.896 -.6802521 .5961033 _cons | 6.679027 2.316292 2.88 0.005 2.059328 11.29873 ------------------------------------------------------------------------------

. vif

Variable | VIF 1/VIF -------------+---------------------- mpg | 39.01 0.025635 mpgc | 37.82 0.026438 displacement | 1.99 0.501941 -------------+---------------------- Mean VIF | 26.27

. lincom mpg+mpgc

( 1) mpg + mpgc = 0.0

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1217081 .0734061 -1.66 0.102 -.2681119 .0246957 ------------------------------------------------------------------------------

. coldiag2,f Condition number = 55.04 Condition indices and variance decomposition proportions

CI displacement mpg mpgc r1 1.000 0.039 0.000 0.000 r2 3.220 0.959 0.001 0.001 r3 55.040 0.002 0.999 0.999

. gen mpgd=mpg+e/1000

. corr mpg mpgd (obs=74)

| mpg mpgd -------------+------------------ mpg | 1.0000 mpgd | 0.9999 1.0000

. regress pr displ mpg mpgd

Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 3, 70) = 8.78 Model | 173.701058 3 57.9003528 Prob > F = 0.0000 Residual | 461.364323 70 6.5909189 R-squared = 0.2735 -------------+------------------------------ Adj R-squared = 0.2424 Total | 635.065382 73 8.69952578 Root MSE = 2.5673

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- displacement | .0105185 .0046181 2.28 0.026 .0013079 .0197291 mpg | .2990384 3.196639 0.09 0.926 -6.076457 6.674534 mpgd | -.4207465 3.19979 -0.13 0.896 -6.802527 5.961033 _cons | 6.679027 2.316292 2.88 0.005 2.059328 11.29873 ------------------------------------------------------------------------------

. vif

Variable | VIF 1/VIF -------------+---------------------- mpg | 3788.32 0.000264 mpgd | 3785.37 0.000264 displacement | 1.99 0.501941 -------------+---------------------- Mean VIF | 2525.23

. lincom mpg+mpgd

( 1) mpg + mpgd = 0.0

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1217081 .0734061 -1.66 0.102 -.2681119 .0246957 ------------------------------------------------------------------------------

. coldiag2,f Condition number = 552.80 Condition indices and variance decomposition proportions

CI displacement mpg mpgd r1 1.000 0.039 0.000 0.000 r2 3.220 0.957 0.000 0.000 r3 552.800 0.004 1.000 1.000

. gen mpge=mpg+e/10000

. corr mpg mpge (obs=74)

| mpg mpge -------------+------------------ mpg | 1.0000 mpge | 1.0000 1.0000

. regress pr displ mpg mpge

Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 3, 70) = 8.78 Model | 173.70096 3 57.9003201 Prob > F = 0.0000 Residual | 461.364421 70 6.59092031 R-squared = 0.2735 -------------+------------------------------ Adj R-squared = 0.2424 Total | 635.065382 73 8.69952578 Root MSE = 2.5673

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- displacement | .0105185 .0046181 2.28 0.026 .0013079 .0197291 mpg | 4.083918 31.99379 0.13 0.899 -59.72568 67.89352 mpge | -4.205626 31.9977 -0.13 0.896 -68.02302 59.61177 _cons | 6.679022 2.316292 2.88 0.005 2.059324 11.29872 ------------------------------------------------------------------------------

. vif

Variable | VIF 1/VIF -------------+---------------------- mpg | 379481.34 0.000003 mpge | 379460.81 0.000003 displacement | 1.99 0.501941 -------------+---------------------- Mean VIF | 252981.38

. lincom mpg+mpge

( 1) mpg + mpge = 0.0

------------------------------------------------------------------------------ pr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1217079 .0734061 -1.66 0.102 -.2681116 .0246959 ------------------------------------------------------------------------------

. coldiag2,f Condition number = 5530.88 Condition indices and variance decomposition proportions

CI displacement mpg mpge r1 1.000 0.039 0.000 0.000 r2 3.220 0.956 0.000 0.000 r3 5530.880 0.005 1.000 1.000

. end of do-file

. log close log: :Keewaydin:Rumelihisari:Stata:coldiag.smcl log type: smcl closed on: 21 Feb 2001, 08:51:27 -------------------------------------------------------------------------------