Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: ivreg2 vs. Manual IV


From   Erkal Ersoy <[email protected]>
To   [email protected]
Subject   st: ivreg2 vs. Manual IV
Date   Mon, 7 Mar 2011 03:16:01 +0000

Hello Statalisters,

Apologies in advance if my question has already been answered
somewhere. It feels like the answer should be out there somewhere, but
I spent a lot of time looking for it and couldn't get to it.

The essence of my question is possibly about the inner-workings of the
command "ivreg2." As illustrated below, I keep getting different
estimates on some coefficients when I do a 2SLS estimation manually
rather than using ivreg2 directly.

I am trying to evaluate the effect of education on earnings, so please
pay attention only to the coefficients on educ (education), age and
agesq (age squared). YR* are the years of birth of individuals, and
QTR* are the interaction terms of their years of birth with quarters
of birth--as done in Angrist and Krueger (1991).

In the ivreg2 regression, the coefficients on educ, age, and agesq are
0.0775**, 0.0961, and -0.0011 respectively.
When I go ahead and do the first and second stage regressions by hand,
I get 0.0775** on educ, 0.0694** on age, and -0.0007 on agesq.
Note that I used ** to denote that the coefficient is statistically
significant at the 5% level.
The fact that the coefficient on education stays the same is
comforting, but the 3 percentage-point change in the coefficient of
age is not... It also seems to become statistically significant when
the manual approach is used. I have not been able to figure out why
this is happening. Am I overlooking something simple? or Is ivreg2
doing something inherently that I am not aware of?

Thank you in advance and I look forward to hearing from you!

Best,
Erkal


Here is the output:

. ivreg2 loghrearn age agesq YR* (educ=QTR*), robust
Warning - collinearities detected
Vars dropped:       YR57 YR58

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity

                                                      Number of obs =     1930
                                                      F( 30,  1899) =    10.25
                                                      Prob > F      =   0.0000
Total (centered) SS     =  442.0938306                Centered R2   =   0.2791
Total (uncentered) SS   =  10400.84512                Uncentered R2 =   0.9694
Residual SS             =  318.6885935                Root MSE      =    .4064

------------------------------------------------------------------------------
             |               Robust
   loghrearn |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |   .0775441   .0160336     4.84   0.000     .0461187    .1089695
         age |   .0960978   .1423516     0.68   0.500    -.1829063    .3751018
       agesq |  -.0010697   .0017913    -0.60   0.550    -.0045807    .0024412
        YR30 |   .0729663   .1068284     0.68   0.495    -.1364134    .2823461
        YR31 |     .07704   .1309457     0.59   0.556    -.1796089    .3336889
        YR32 |   .0973292    .163443     0.60   0.552    -.2230131    .4176716
        YR33 |   .1417888   .1929499     0.73   0.462    -.2363861    .5199638
        YR34 |  -.1038325   .2259978    -0.46   0.646      -.54678     .339115
        YR35 |  -.0904907   .2650057    -0.34   0.733    -.6098924     .428911
        YR36 |   .0211021   .2889079     0.07   0.942    -.5451469    .5873512
        YR37 |  -.0095714   .3094713    -0.03   0.975    -.6161241    .5969812
        YR38 |  -.1243342   .3284837    -0.38   0.705    -.7681505     .519482
        YR39 |   .0318703     .33975     0.09   0.925    -.6340275    .6977681
        YR40 |   -.012432   .3502283    -0.04   0.972    -.6988668    .6740027
        YR41 |  -.0104493    .362811    -0.03   0.977    -.7215458    .7006471
        YR42 |  -.0702727   .3685554    -0.19   0.849     -.792628    .6520826
        YR43 |   .0575015   .3747713     0.15   0.878    -.6770368    .7920399
        YR44 |   .0096079    .370298     0.03   0.979    -.7161628    .7353786
        YR45 |    .002713   .3662465     0.01   0.994     -.715117     .720543
        YR46 |  -.0635162   .3581167    -0.18   0.859     -.765412    .6383797
        YR47 |  -.0433715    .343595    -0.13   0.900    -.7168054    .6300624
        YR48 |   .0054387   .3286098     0.02   0.987    -.6386247    .6495021
        YR49 |   -.099746   .3100412    -0.32   0.748    -.7074155    .5079235
        YR50 |  -.0773254   .2898625    -0.27   0.790    -.6454454    .4907946
        YR51 |   .0145518   .2642092     0.06   0.956    -.5032888    .5323923
        YR52 |  -.0292709   .2321661    -0.13   0.900    -.4843081    .4257663
        YR53 |   .0184112   .1987312     0.09   0.926    -.3710947    .4079172
        YR54 |  -.0401541   .1639762    -0.24   0.807    -.3615416    .2812333
        YR55 |  -.0174335   .1241698    -0.14   0.888    -.2608018    .2259348
        YR56 |  -.0569723   .0847047    -0.67   0.501    -.2229904    .1090458
       _cons |  -.7115404   2.495252    -0.29   0.776    -5.602144    4.179063
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             87.887
                                                   Chi-sq(87) P-val =   0.4532
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                1.147
                         (Kleibergen-Paap rk Wald F statistic):          1.139
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    21.12
                                         10% maximal IV relative bias    10.91
                                         20% maximal IV relative bias     5.69
                                         30% maximal IV relative bias     3.92
                                         10% maximal IV size            222.24
                                         15% maximal IV size            113.33
                                         20% maximal IV size             76.67
                                         25% maximal IV size             58.36
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):        82.395
                                                   Chi-sq(86) P-val =   0.5901
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: age agesq YR30 YR31 YR32 YR33 YR34 YR35 YR36 YR37 YR38
                      YR39 YR40 YR41 YR42 YR43 YR44 YR45 YR46 YR47 YR48 YR49
                      YR50 YR51 YR52 YR53 YR54 YR55 YR56
Excluded instruments: QTR230 QTR231 QTR232 QTR233 QTR234 QTR235 QTR236 QTR237
                      QTR238 QTR239 QTR240 QTR241 QTR242 QTR243 QTR244 QTR245
                      QTR246 QTR247 QTR248 QTR249 QTR250 QTR251 QTR252 QTR253
                      QTR254 QTR255 QTR256 QTR257 QTR258 QTR330 QTR331 QTR332
                      QTR333 QTR334 QTR335 QTR336 QTR337 QTR338 QTR339 QTR340
                      QTR341 QTR342 QTR343 QTR344 QTR345 QTR346 QTR347 QTR348
                      QTR349 QTR350 QTR351 QTR352 QTR353 QTR354 QTR355 QTR356
                      QTR357 QTR358 QTR430 QTR431 QTR432 QTR433 QTR434 QTR435
                      QTR436 QTR437 QTR438 QTR439 QTR440 QTR441 QTR442 QTR443
                      QTR444 QTR445 QTR446 QTR447 QTR448 QTR449 QTR450 QTR451
                      QTR452 QTR453 QTR454 QTR455 QTR456 QTR457 QTR458
Dropped collinear:    YR57 YR58
------------------------------------------------------------------------------

. reg educ age agesq YR* QTR*
note: YR42 omitted because of collinearity
note: YR58 omitted because of collinearity

      Source |       SS       df       MS              Number of obs =    1930
-------------+------------------------------           F(116,  1813) =    1.72
       Model |  1172.63491   116  10.1089217           Prob > F      =  0.0000
    Residual |  10684.3231  1813  5.89317326           R-squared     =  0.0989
-------------+------------------------------           Adj R-squared =  0.0412
       Total |   11856.958  1929  6.14668638           Root MSE      =  2.4276

------------------------------------------------------------------------------
        educ |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .4445861   .4307161     1.03   0.302    -.4001659    1.289338
       agesq |  -.0060692   .0054336    -1.12   0.264    -.0167259    .0045876
        YR30 |  -.8890242   .9932762    -0.90   0.371     -2.83711    1.059062
        YR31 |   .6960782   .9116261     0.76   0.445     -1.09187    2.484026
        YR32 |   .6377634   .9109859     0.70   0.484    -1.148929    2.424456
        YR33 |   1.800134   .8846079     2.03   0.042     .0651759    3.535092
        YR34 |   .5381042   1.082161     0.50   0.619    -1.584309    2.660517
        YR35 |  -2.185563   1.041604    -2.10   0.036    -4.228433   -.1426933
        YR36 |  -.4344303   1.228448    -0.35   0.724    -2.843753    1.974892
        YR37 |   .6838194   1.199013     0.57   0.569    -1.667774    3.035413
        YR38 |  -1.465554   1.275869    -1.15   0.251    -3.967881    1.036773
        YR39 |  -.1861233   1.234434    -0.15   0.880    -2.607185    2.234938
        YR40 |  -1.394554   1.344123    -1.04   0.300    -4.030746    1.241638
        YR41 |    1.02279   1.292272     0.79   0.429    -1.511709     3.55729
        YR42 |  (omitted)
        YR43 |  -.1970156   1.392313    -0.14   0.887    -2.927722     2.53369
        YR44 |   1.018107   1.274471     0.80   0.424     -1.48148    3.517694
        YR45 |  -1.504632   1.385526    -1.09   0.278    -4.222028    1.212764
        YR46 |    .556196   1.250079     0.44   0.656     -1.89555    3.007942
        YR47 |  -.7041711   1.166875    -0.60   0.546    -2.992731    1.584389
        YR48 |   .2142667   1.132912     0.19   0.850    -2.007683    2.436216
        YR49 |  -.6242047   1.097718    -0.57   0.570    -2.777129    1.528719
        YR50 |  -.1981569   1.042875    -0.19   0.849     -2.24352    1.847206
        YR51 |   .9638388   .9958603     0.97   0.333    -.9893155    2.916993
        YR52 |   -.823932   .9013091    -0.91   0.361    -2.591645    .9437814
        YR53 |  -.2495645   .8451451    -0.30   0.768    -1.907125    1.407996
        YR54 |   .4278504   .8061783     0.53   0.596    -1.153286    2.008986
        YR55 |   .2133633   .7942078     0.27   0.788    -1.344295    1.771022
        YR56 |   .4657228   .6636603     0.70   0.483    -.8358964    1.767342
        YR57 |   -.360123   .6362917    -0.57   0.571    -1.608065    .8878189
        YR58 |  (omitted)
      QTR230 |          1    1.13807     0.88   0.380    -1.232066    3.232066
      QTR231 |  -1.492063   1.223388    -1.22   0.223    -3.891462    .9073353
      QTR232 |         .6     1.2536     0.48   0.632    -1.858652    3.058652
      QTR233 |  -2.897436    1.19813    -2.42   0.016    -5.247297   -.5475746
      QTR234 |  -.6805556   1.179595    -0.58   0.564    -2.994063    1.632952
      QTR235 |   2.121212   1.581181     1.34   0.180    -.9799165    5.222341
      QTR236 |   .8214286   1.256395     0.65   0.513    -1.642706    3.285563
      QTR237 |   .1666667    1.27945     0.13   0.896    -2.342685    2.676018
      QTR238 |      2.375   1.128003     2.11   0.035     .1626788    4.587321
      QTR239 |  -.1666667   1.232046    -0.14   0.892    -2.583047    2.249713
      QTR240 |  -.2083333   1.108036    -0.19   0.851    -2.381495    1.964829
      QTR241 |  -2.763636   1.060689    -2.61   0.009    -4.843937   -.6833361
      QTR242 |  -.6941176   1.235027    -0.56   0.574    -3.116343    1.728108
      QTR243 |       -.05   1.062791    -0.05   0.962    -2.134424    2.034424
      QTR244 |       -1.3   1.005116    -1.29   0.196    -3.271307    .6713073
      QTR245 |   .4444444   1.179595     0.38   0.706    -1.869063    2.757952
      QTR246 |  -1.365546   .8761268    -1.56   0.119     -3.08387    .3527779
      QTR247 |   .8033794   .6860974     1.17   0.242    -.5422451    2.149004
      QTR248 |  -.2731092   .6737625    -0.41   0.685    -1.594542    1.048323
      QTR249 |   1.271212   .6879242     1.85   0.065    -.0779952    2.620419
      QTR250 |   1.114846    .792013     1.41   0.159     -.438508      2.6682
      QTR251 |  -1.213636   .7500201    -1.62   0.106    -2.684631    .2573581
      QTR252 |   .7857143   .6611588     1.19   0.235    -.5109989    2.082427
      QTR253 |  -2.58e-14   .6799908    -0.00   1.000    -1.333648    1.333648
      QTR254 |  -.8030303    .668171    -1.20   0.230    -2.113496    .5074357
      QTR255 |  -.5035842   .7193753    -0.70   0.484    -1.914476    .9073074
      QTR256 |  -.3017078   .6028524    -0.50   0.617    -1.484066    .8806505
      QTR257 |   .3812636    .625775     0.61   0.542    -.8460521    1.608579
      QTR258 |  -.2581522   .7902837    -0.33   0.744    -1.808114     1.29181
      QTR330 |        .75   1.154547     0.65   0.516    -1.514383    3.014383
      QTR331 |  -1.414141   1.091119    -1.30   0.195    -3.554123    .7258406
      QTR332 |        -.8   1.085649    -0.74   0.461    -2.929255    1.329255
      QTR333 |  -.8307692   1.021097    -0.81   0.416    -2.833419     1.17188
      QTR334 |      -.325   1.383937    -0.23   0.814    -3.039278    2.389278
      QTR335 |   .4545455   1.173723     0.39   0.699    -1.847446    2.756536
      QTR336 |   .0714286   1.350584     0.05   0.958    -2.577436    2.720293
      QTR337 |  -1.444444   1.144375    -1.26   0.207    -3.688877    .7999876
      QTR338 |   7.06e-15   1.213793     0.00   1.000     -2.38058     2.38058
      QTR339 |  -.5714286   1.173723    -0.49   0.626     -2.87342    1.730562
      QTR340 |   1.432692   1.090856     1.31   0.189    -.7067752     3.57216
      QTR341 |   -1.69697   1.232046    -1.38   0.169     -4.11335    .7194102
      QTR342 |      -.025   1.383937    -0.02   0.986    -2.739278    2.689278
      QTR343 |       -.35   1.151505    -0.30   0.761    -2.608416    1.908416
      QTR344 |       -1.5   .9175412    -1.63   0.102    -3.299549    .2995491
      QTR345 |       1.25   1.051176     1.19   0.235    -.8116425    3.311643
      QTR346 |   .6558442   .9781022     0.67   0.503    -1.262482     2.57417
      QTR347 |   1.238095   .7491693     1.65   0.099    -.2312305    2.707421
      QTR348 |  -.3928571   .7007837    -0.56   0.575    -1.767285    .9815712
      QTR349 |   .9431034   .7056001     1.34   0.182    -.4407712    2.326978
      QTR350 |   .1829574   .7686315     0.24   0.812    -1.324539    1.690454
      QTR351 |  -.5772727   .7500201    -0.77   0.442    -2.048267    .8937217
      QTR352 |   .5833333   .6871749     0.85   0.396    -.7644045    1.931071
      QTR353 |  -.1785714   .6679801    -0.27   0.789    -1.488663     1.13152
      QTR354 |  -.3909091   .6443608    -0.61   0.544    -1.654677    .8728586
      QTR355 |  -.8377778   .7504168    -1.12   0.264     -2.30955    .6339948
      QTR356 |  -.6129032   .6166074    -0.99   0.320    -1.822239    .5964325
      QTR357 |   .0946292   .6554033     0.14   0.885    -1.190796    1.380054
      QTR358 |   .5624123   .6680773     0.84   0.400    -.7478699    1.872695
      QTR430 |        1.6   1.421449     1.13   0.260     -1.18785     4.38785
      QTR431 |   .0555556    1.27945     0.04   0.965    -2.453796    2.564907
      QTR432 |   .5444444   1.115399     0.49   0.626    -1.643157    2.732046
      QTR433 |  -3.321678    .994517    -3.34   0.001    -5.272198   -1.371159
      QTR434 |  -3.267857   1.256395    -2.60   0.009    -5.731991    -.803723
      QTR435 |   1.025974   1.173723     0.87   0.382    -1.276017    3.327965
      QTR436 |  -1.678571    1.52157    -1.10   0.270    -4.662786    1.305643
      QTR437 |  -.8888889   1.144375    -0.78   0.437    -3.133321    1.355543
      QTR438 |   1.041667   1.311046     0.79   0.427    -1.529653    3.612987
      QTR439 |         -1   1.232046    -0.81   0.417     -3.41638     1.41638
      QTR440 |      1.375   1.486587     0.92   0.355    -1.540603    4.290603
      QTR441 |  -1.205742   .9197337    -1.31   0.190    -3.009591    .5981075
      QTR442 |   .3777778   1.354043     0.28   0.780     -2.27787    3.033426
      QTR443 |  -1.138889   1.179595    -0.97   0.334    -3.452397    1.174619
      QTR444 |    -1.3125   .8884055    -1.48   0.140    -3.054906    .4299059
      QTR445 |   1.833333   1.031526     1.78   0.076    -.1897704    3.856437
      QTR446 |   .3035714   .8163883     0.37   0.710    -1.297589    1.904732
      QTR447 |   .8154762   .8055747     1.01   0.312     -.764476    2.395428
      QTR448 |   .4596273    .732702     0.63   0.531    -.9774016    1.896656
      QTR449 |        .51   .7282758     0.70   0.484    -.9183478    1.938348
      QTR450 |   .0662526    .732702     0.09   0.928    -1.370776    1.503281
      QTR451 |     -1.475   .8142371    -1.81   0.070    -3.071941    .1219414
      QTR452 |   1.595238   .7122414     2.24   0.025      .198338    2.992138
      QTR453 |  -.2916667   .6937405    -0.42   0.674    -1.652281    1.068948
      QTR454 |  -.6909091   .6814034    -1.01   0.311    -2.027327    .6455093
      QTR455 |  -1.305556   .7007837    -1.86   0.063    -2.679984    .0688728
      QTR456 |  -.7050691   .6329082    -1.11   0.265    -1.946375    .5362369
      QTR457 |   .0455408   .6028524     0.08   0.940    -1.136817    1.227899
      QTR458 |   .5735786   .6948996     0.83   0.409    -.7893094    1.936467
       _cons |   5.374223     7.5253     0.71   0.475    -9.384946    20.13339
------------------------------------------------------------------------------

. predict double yhat, xb

. reg loghrearn yhat age agesq YR*, robust
note: YR42 omitted because of collinearity
note: YR58 omitted because of collinearity

Linear regression                                      Number of obs =    1930
                                                       F( 30,  1899) =    8.18
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.1052
                                                       Root MSE      =  .45641

------------------------------------------------------------------------------
             |               Robust
   loghrearn |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        yhat |   .0775439   .0191366     4.05   0.000      .040013    .1150748
         age |   .0694072   .0339128     2.05   0.041     .0028969    .1359176
       agesq |  -.0007319   .0004448    -1.65   0.100    -.0016041    .0001404
        YR30 |   .0824261   .1079102     0.76   0.445    -.1292089    .2940611
        YR31 |   .0952839   .1039415     0.92   0.359    -.1085676    .2991354
        YR32 |   .1236817   .1023798     1.21   0.227     -.077107    .3244704
        YR33 |    .175574   .0965876     1.82   0.069     -.013855    .3650029
        YR34 |  -.0632905   .0979068    -0.65   0.518    -.2553067    .1287257
        YR35 |  -.0438676   .1320984    -0.33   0.740    -.3029407    .2152056
        YR36 |   .0731311    .119703     0.61   0.541    -.1616321    .3078943
        YR37 |   .0471875   .1099594     0.43   0.668    -.1684665    .2628415
        YR38 |  -.0635212    .119788    -0.53   0.596     -.298451    .1714086
        YR39 |   .0960618   .1044298     0.92   0.358    -.1087474     .300871
        YR40 |   .0544622   .1014802     0.54   0.592    -.1445622    .2534866
        YR41 |    .058472   .1090039     0.54   0.592     -.155308    .2722521
        YR42 |  (omitted)
        YR43 |   .1284498   .1235006     1.04   0.298    -.1137613     .370661
        YR44 |   .0805562   .1001809     0.80   0.421    -.1159199    .2770324
        YR45 |   .0729855   .1031693     0.71   0.479    -.1293516    .2753226
        YR46 |    .005405   .0995799     0.05   0.957    -.1898925    .2007024
        YR47 |   .0235223   .0874715     0.27   0.788    -.1480281    .1950727
        YR48 |   .0696297   .0827435     0.84   0.400    -.0926481    .2319075
        YR49 |  -.0389337   .0825409    -0.47   0.637    -.2008141    .1229468
        YR50 |  -.0205674   .0861564    -0.24   0.811    -.1895386    .1484038
        YR51 |   .0665797     .08236     0.81   0.419    -.0949458    .2281053
        YR52 |   .0173513   .0697737     0.25   0.804    -.1194899    .1541924
        YR53 |   .0589519   .0642448     0.92   0.359    -.0670459    .1849496
        YR54 |  -.0063706   .0611902    -0.10   0.917    -.1263777    .1136365
        YR55 |    .008917    .057011     0.16   0.876    -.1028937    .1207278
        YR56 |  -.0387302   .0522458    -0.74   0.459    -.1411954    .0637349
        YR57 |   .0094559   .0524493     0.18   0.857    -.0934085    .1123202
        YR58 |  (omitted)
       _cons |   -.255431   .5957228    -0.43   0.668    -1.423771    .9129089
------------------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index