-------------
      name:  <unnamed>
       log:  /Users/baum/doc/Stata devel/ Cert scripts/cs_ivreg2.smcl
  log type:  smcl
 opened on:  14 Aug 2009, 20:12:06
r; t=0.00 20:12:06

. di c(version)
11
r; t=0.00 20:12:06

. query born
13 Jul 2009
r; t=0.01 20:12:06

. which ivreg2
/Users/baum/library/application support/stata/ado/plus/i/ivreg2.ado
*! ivreg2 2.2.09  17jul2008
*! authors cfb & mes
*! see end of file for version comments
r; t=0.01 20:12:06

. which ranktest
/Users/baum/library/application support/stata/ado/plus/r/ranktest.ado
*! ranktest 1.1.03  4May2008
*! author mes, based on code by fk
r; t=0.03 20:12:06

. ivreg2, version
02.2.09
r; t=0.02 20:12:06

. assert "`e(version)'" == "02.2.09"
r; t=0.00 20:12:06

. use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta,clear
(Wages of Very Young Men, Zvi Griliches, J.Pol.Ec. 1976)
r; t=0.36 20:12:06

. * Hayashi Table 3.3 p.255 uses Blackburn-Neumark sample
. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
         rns |       758    .2691293    .4438001          0          1
       rns80 |       758     .292876    .4553825          0          1
         mrt |       758    .5145119    .5001194          0          1
       mrt80 |       758    .8984169    .3022988          0          1
        smsa |       758    .7044855     .456575          0          1
-------------+--------------------------------------------------------
      smsa80 |       758    .7124011     .452942          0          1
         med |       758    10.91029     2.74112          0         18
          iq |       758    103.8562    13.61867         54        145
         kww |       758    36.57388    7.302247         12         56
        year |       758    69.03166    2.631794         66         73
-------------+--------------------------------------------------------
         age |       758    21.83509    2.981756         16         30
       age80 |       758    33.01187    3.085504         28         38
           s |       758    13.40501    2.231828          9         18
         s80 |       758    13.70712    2.214693          9         18
        expr |       758    1.735429    2.105542          0     11.444
-------------+--------------------------------------------------------
      expr80 |       758    11.39426    4.210745       .692     22.045
      tenure |       758    1.831135     1.67363          0         10
    tenure80 |       758    7.362797     5.05024          0         22
          lw |       758    5.686739    .4289494      4.605      7.051
        lw80 |       758    6.826555    .4099268      4.749      8.032
r; t=0.02 20:12:06

. assert _N == 758
r; t=0.00 20:12:06

. xi  i.year
i.year            _Iyear_66-73        (naturally coded; _Iyear_66 omitted)
r; t=0.37 20:12:07

. * line 4 of table via ivreg
. which ivreg
/Applications/Stata/ado/base/i/ivreg.ado
*! version 5.4.0  17mar2009
r; t=0.01 20:12:07

. ivreg lw expr tenure rns smsa _I* (iq s = med kww mrt age)

Instrumental variables (2SLS) regression

      Source |       SS       df       MS              Number of obs =     758
-------------+------------------------------           F( 12,   745) =   37.64
       Model |  31.7548087    12  2.64623406           Prob > F      =  0.0000
    Residual |  107.531341   745  .144337371           R-squared     =  0.2280
-------------+------------------------------           Adj R-squared =  0.2155
       Total |   139.28615   757  .183997556           Root MSE      =  .37992

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0047453     -1.92    0.056    -.0184145     .0002169
           s |    .1724253    .0209182      8.24    0.000     .1313596      .213491
        expr |    .0492895    .0082254      5.99    0.000     .0331417     .0654373
      tenure |    .0422171    .0089197      4.73    0.000     .0247064     .0597278
         rns |   -.1017935    .0344734     -2.95    0.003      -.16947    -.0341169
        smsa |    .1261109    .0311961      4.04    0.000     .0648681     .1873538
   _Iyear_67 |   -.0596171    .0557758     -1.07    0.285    -.1691136     .0498794
   _Iyear_68 |    .0486796     .052468      0.93    0.354    -.0543231     .1516822
   _Iyear_69 |    .1528176    .0520109      2.94    0.003     .0507122     .2549231
   _Iyear_70 |    .1744361    .0602767      2.89    0.004     .0561036     .2927685
   _Iyear_71 |     .091666    .0546144      1.68    0.094    -.0155504     .1988823
   _Iyear_73 |    .0932398    .0576787      1.62    0.106    -.0199923     .2064718
       _cons |     4.03351    .3181616     12.68    0.000      3.40891      4.65811
 -------------+----------------------------------------------------------------


Instrumented:  iq s


Instruments:   expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 med kww mrt age


------------------------------------------------------------------------------
r; t=0.69 20:12:07

. assert reldif(_b[s],0.172)< 1e-3
r; t=0.00 20:12:07

. assert reldif(_se[s],0.021)< 1e-3
r; t=0.00 20:12:07

. assert reldif(e(rmse),0.380)< 1e-3
r; t=0.00 20:12:07

. savedresults save iv e()
r; t=0.03 20:12:07

.
. * line 4 of table via ivreg2, small
. ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , small

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 12,   745) =    37.64
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2280
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  107.5313411                Root MSE      =    .3799

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0047453     -1.92    0.056    -.0184145     .0002169
           s |    .1724253    .0209182      8.24    0.000     .1313596      .213491
        expr |    .0492895    .0082254      5.99    0.000     .0331417     .0654373
      tenure |    .0422171    .0089197      4.73    0.000     .0247064     .0597278
         rns |   -.1017935    .0344734     -2.95    0.003      -.16947    -.0341169
        smsa |    .1261109    .0311961      4.04    0.000     .0648681     .1873538
   _Iyear_67 |   -.0596171    .0557758     -1.07    0.285    -.1691136     .0498794
   _Iyear_68 |    .0486796     .052468      0.93    0.354    -.0543231     .1516822
   _Iyear_69 |    .1528176    .0520109      2.94    0.003     .0507122     .2549231
   _Iyear_70 |    .1744361    .0602767      2.89    0.004     .0561036     .2927685
   _Iyear_71 |     .091666    .0546144      1.68    0.094    -.0155504     .1988823
   _Iyear_73 |    .0932398    .0576787      1.62    0.106    -.0199923     .2064718
       _cons |     4.03351    .3181616     12.68    0.000      3.40891      4.65811
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          47.978
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               12.552
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):          13.268
                                                   Chi-sq(2) P-val =    0.0013
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.80 20:12:08

. assert reldif(_b[s],0.172)<1e-3
r; t=0.00 20:12:08

. assert reldif(_se[s],0.021)<1e-3
r; t=0.00 20:12:08

. assert reldif(_b[iq],-0.009)<1e-3
r; t=0.00 20:12:08

. assert reldif(_se[iq],0.0047)<1e-3
r; t=0.00 20:12:08

. assert reldif(_b[expr],0.049)<1e-3
r; t=0.00 20:12:08

. assert reldif(_se[expr],0.0082)<1e-3
r; t=0.00 20:12:08

. assert reldif(_b[tenure],0.042)<1e-3
r; t=0.00 20:12:08

. assert reldif(_se[tenure],0.0095)<1e-3
r; t=0.00 20:12:08

. assert reldif(e(rmse),0.379)<1e-3
r; t=0.00 20:12:08

. * 1.0.6: insts order now differs between ivreg, ivreg2
. * savedresults comp iv e(), include(macros: insts instd depvar scalar: rmse matrix: b V) tol(1e-7) verbose
. savedresults comp iv e(), include(macros: instd depvar scalar: rmse matrix: b V) tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(rmse)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:08

.
. * 1.0.21: perform same comparison with [aw]
. g wt = 1/age
r; t=0.00 20:12:08

. ivreg lw expr tenure rns smsa _I* (iq s = med kww mrt age) [aw=wt], robust
(sum of wgt is   3.5357e+01)

Instrumental variables (2SLS) regression               Number of obs =     758
                                                       F( 12,   745) =   41.70
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.2559
                                                       Root MSE      =  .36861

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0074948    .0045845     -1.63    0.103    -.0164949     .0015054
           s |    .1649811    .0194354      8.49    0.000     .1268264     .2031357
        expr |    .0478406    .0078976      6.06    0.000     .0323364     .0633449
      tenure |     .037868    .0093315      4.06    0.000     .0195488     .0561872
         rns |   -.0984184    .0332218     -2.96    0.003    -.1636379    -.0331989
        smsa |    .1300172    .0302039      4.30    0.000     .0707223     .1893121
   _Iyear_67 |   -.0662887    .0516902     -1.28    0.200    -.1677645     .0351871
   _Iyear_68 |    .0472949    .0485352      0.97    0.330    -.0479872      .142577
   _Iyear_69 |    .1459345    .0460964      3.17    0.002     .0554403     .2364288
   _Iyear_70 |    .1619464    .0604136      2.68    0.008     .0433453     .2805476
   _Iyear_71 |     .083768    .0542397      1.54    0.123    -.0227128     .1902489
   _Iyear_73 |     .090334    .0600688      1.50    0.133    -.0275903     .2082583
       _cons |    3.977557    .3195744     12.45    0.000     3.350183      4.60493
 -------------+----------------------------------------------------------------


Instrumented:  iq s


Instruments:   expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 med kww mrt age


------------------------------------------------------------------------------
r; t=0.25 20:12:09

. savedresults save ivaw e()
r; t=0.00 20:12:09

. ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) [aw=wt], small robust
(sum of wgt is     3.5357e+01)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity

                                                      Number of obs =      758
                                                      F( 12,   745) =    41.70
                                                      Prob > F      =   0.0000
Total (centered) SS     =  136.0434966                Centered R2   =   0.2559
Total (uncentered) SS   =  24388.57213                Uncentered R2 =   0.9958
Residual SS             =  101.2247036                Root MSE      =    .3686

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0074948    .0045845     -1.63    0.103    -.0164949     .0015054
           s |    .1649811    .0194354      8.49    0.000     .1268264     .2031357
        expr |    .0478406    .0078976      6.06    0.000     .0323364     .0633449
      tenure |     .037868    .0093315      4.06    0.000     .0195488     .0561872
         rns |   -.0984184    .0332218     -2.96    0.003    -.1636379    -.0331989
        smsa |    .1300172    .0302039      4.30    0.000     .0707223     .1893121
   _Iyear_67 |   -.0662887    .0516902     -1.28    0.200    -.1677645     .0351871
   _Iyear_68 |    .0472949    .0485352      0.97    0.330    -.0479872      .142577
   _Iyear_69 |    .1459345    .0460964      3.17    0.002     .0554403     .2364288
   _Iyear_70 |    .1619464    .0604136      2.68    0.008     .0433453     .2805476
   _Iyear_71 |     .083768    .0542397      1.54    0.123    -.0227128     .1902489
   _Iyear_73 |     .090334    .0600688      1.50    0.133    -.0275903     .2082583
       _cons |    3.977557    .3195744     12.45    0.000     3.350183      4.60493
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             44.038
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         12.641
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):        11.636
                                                   Chi-sq(2) P-val =    0.0030
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.40 20:12:09

. savedresults comp ivaw e(), include(macros: instd depvar scalar: rmse matrix: b V) tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(rmse)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:09

.
.
. * line 4 of table to match sargan (large sample stat)
. ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 12,   745) =    37.64
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2280
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  107.5313411                Root MSE      =    .3766

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0047044     -1.93    0.053    -.0183193     .0001216
           s |    .1724253    .0207381      8.31    0.000     .1317794     .2130712
        expr |    .0492895    .0081546      6.04    0.000     .0333068     .0652722
      tenure |    .0422171    .0088429      4.77    0.000     .0248854     .0595488
         rns |   -.1017935    .0341765     -2.98    0.003    -.1687781    -.0348088
        smsa |    .1261109    .0309275      4.08    0.000     .0654942     .1867277
   _Iyear_67 |   -.0596171    .0552955     -1.08    0.281    -.1679942       .04876
   _Iyear_68 |    .0486796    .0520161      0.94    0.349    -.0532701     .1506292
   _Iyear_69 |    .1528176     .051563      2.96    0.003      .051756     .2538792
   _Iyear_70 |    .1744361    .0597576      2.92    0.004     .0573133     .2915588
   _Iyear_71 |     .091666     .054144      1.69    0.090    -.0144543     .1977863
   _Iyear_73 |    .0932398    .0571819      1.63    0.103    -.0188347     .2053142
       _cons |     4.03351    .3154215     12.79    0.000     3.415295     4.651725
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          47.978
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               12.552
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):          13.268
                                                   Chi-sq(2) P-val =    0.0013
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.30 20:12:09

. assert reldif(e(sargan),13.3)<1e-2
r; t=0.00 20:12:09

. assert e(sargandf)==2
r; t=0.00 20:12:09

. assert reldif(e(sarganp),0.00131)<1e-3
r; t=0.00 20:12:09

. rcof "noi ivreg2 lw expr tenure rns smsa _I* (iq s med kww = mrt age)" == 481
equation not identified; must have at least as many instruments not in
the regression as there are instrumented variables
r; t=0.04 20:12:09

.
. * OLS option
. ivreg2 lw expr tenure rns smsa _I*, small

OLS estimation
--------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 10,   747) =    38.68
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.3412
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9963
Residual SS             =  91.76828166                Root MSE      =    .3505

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        expr |    .0089665    .0066419      1.35    0.177    -.0040724     .0220055
      tenure |    .0479877    .0080046      6.00    0.000     .0322736     .0637019
         rns |   -.1298922    .0292884     -4.43    0.000    -.1873896    -.0723947
        smsa |    .1507694    .0284765      5.29    0.000     .0948658     .2066729
   _Iyear_67 |   -.0407856    .0513652     -0.79    0.427    -.1416229     .0600518
   _Iyear_68 |    .1036177    .0481421      2.15    0.032     .0091079     .1981276
   _Iyear_69 |    .2747202    .0466208      5.89    0.000     .1831968     .3662435
   _Iyear_70 |    .3320339    .0513295      6.47    0.000     .2312666     .4328012
   _Iyear_71 |    .3719771    .0438097      8.49    0.000     .2859724     .4579818
   _Iyear_73 |    .5470091    .0372837     14.67    0.000     .4738157     .6202025
       _cons |    5.286631    .0399539    132.32    0.000     5.208195     5.365066
 -------------+----------------------------------------------------------------
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
------------------------------------------------------------------------------
r; t=0.19 20:12:09

. savedresults save ols e()
r; t=0.00 20:12:09

. regress lw expr tenure rns smsa _I*

      Source |       SS       df       MS              Number of obs =     758
-------------+------------------------------           F( 10,   747) =   38.68
       Model |  47.5178682    10  4.75178682           Prob > F      =  0.0000
    Residual |  91.7682817   747  .122849105           R-squared     =  0.3412
-------------+------------------------------           Adj R-squared =  0.3323
       Total |   139.28615   757  .183997556           Root MSE      =   .3505

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        expr |    .0089665    .0066419      1.35    0.177    -.0040724     .0220055
      tenure |    .0479877    .0080046      6.00    0.000     .0322736     .0637019
         rns |   -.1298922    .0292884     -4.43    0.000    -.1873896    -.0723947
        smsa |    .1507694    .0284765      5.29    0.000     .0948658     .2066729
   _Iyear_67 |   -.0407856    .0513652     -0.79    0.427    -.1416229     .0600518
   _Iyear_68 |    .1036177    .0481421      2.15    0.032     .0091079     .1981276
   _Iyear_69 |    .2747202    .0466208      5.89    0.000     .1831968     .3662435
   _Iyear_70 |    .3320339    .0513295      6.47    0.000     .2312666     .4328012
   _Iyear_71 |    .3719771    .0438097      8.49    0.000     .2859724     .4579818
   _Iyear_73 |    .5470091    .0372837     14.67    0.000     .4738157     .6202025
       _cons |    5.286631    .0399539    132.32    0.000     5.208195     5.365066
 -------------+----------------------------------------------------------------
r; t=0.25 20:12:10

. savedresults comp ols e(), include(macros: depvar scalar: rmse matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(rmse)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:10

.
. ivreg lw expr tenure rns smsa _I* (iq =  age) in 1/8

Instrumental variables (2SLS) regression

      Source |       SS       df       MS              Number of obs =       8
-------------+------------------------------           F(  7,     0) =       .
       Model |  1.68200831     7  .240286902           Prob > F      =       .
    Residual |  5.4603e-21     0           .           R-squared     =  1.0000
-------------+------------------------------           Adj R-squared =       .
       Total |  1.68200831     7  .240286902           Root MSE      =       0

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |       .1354           .         .        .            .            .
        expr |   -.6815391           .         .        .            .            .
      tenure |   -3.384152           .         .        .            .            .
         rns |   (omitted)
        smsa |   -.2554329           .         .        .            .            .
   _Iyear_67 |   -1.334461           .         .        .            .            .
   _Iyear_68 |   -2.471034           .         .        .            .            .
   _Iyear_69 |   (omitted)
   _Iyear_70 |   (omitted)
   _Iyear_71 |   (omitted)
   _Iyear_73 |    16.10886           .         .        .            .            .
       _cons |   -3.650863           .         .        .            .            .
 -------------+----------------------------------------------------------------


Instrumented:  iq


Instruments:   expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 age


------------------------------------------------------------------------------
r; t=0.17 20:12:10

. * insuff observations
. rcof "noi ivreg2 lw expr tenure rns smsa _I* (iq =  age) in 1/8" == 2001
Warning - endogenous variable(s) collinear with instruments
Vars now exogenous: iq
Warning - collinearities detected
Vars dropped:       rns _Iyear_69 _Iyear_70 _Iyear_71 age
Error: number of observations must be greater than number of instruments
       including constant.
insufficient observations
r; t=0.14 20:12:10

. * ivreg2 lw expr tenure rns smsa _I* (iq=age) in 1/8
. * assert "`e(collin)'" == "rns _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73"
.
. * exact id
. ivreg2 lw expr tenure rns smsa _I* (iq =  age)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 11,   746) =     5.81
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =  -4.2804
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9702
Residual SS             =  735.4927869                Root MSE      =     .985

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0798825    .0199793      4.00    0.000     .0407237     .1190412
        expr |    .1075846    .0309323      3.48    0.001     .0469584     .1682108
      tenure |   -.0021097    .0257502     -0.08    0.935    -.0525792     .0483597
         rns |    .1839836    .1137456      1.62    0.106    -.0389537     .4069208
        smsa |    .0304411    .0855021      0.36    0.722    -.1371399     .1980221
   _Iyear_67 |   -.1296965    .1460597     -0.89    0.375    -.4159682     .1565752
   _Iyear_68 |    .0595883    .1357461      0.44    0.661    -.2064691     .3256457
   _Iyear_69 |   -.0368177    .1524413     -0.24    0.809    -.3355971     .2619618
   _Iyear_70 |   -.2980978    .2136546     -1.40    0.163     -.716853     .1206574
   _Iyear_71 |   -.2766231    .2036536     -1.36    0.174    -.6757769     .1225307
   _Iyear_73 |   -.2688341     .229381     -1.17    0.241    -.7184127     .1807444
       _cons |   -2.739876     2.01064     -1.36    0.173    -6.680658     1.200906
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          15.406
                                                   Chi-sq(1) P-val =    0.0001
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               15.476
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: age
------------------------------------------------------------------------------
r; t=0.23 20:12:10

. assert reldif(e(sargan),0.0)<1e-3
r; t=0.00 20:12:10

.
. * robust option
. ivreg  lw expr tenure rns smsa _I* (iq s = med kww mrt age) , robust

Instrumental variables (2SLS) regression               Number of obs =     758
                                                       F( 12,   745) =   40.09
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.2280
                                                       Root MSE      =  .37992

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0049287     -1.85    0.065    -.0187746     .0005769
           s |    .1724253    .0209196      8.24    0.000     .1313569     .2134938
        expr |    .0492895    .0081197      6.07    0.000     .0333492     .0652298
      tenure |    .0422171    .0095458      4.42    0.000     .0234771     .0609571
         rns |   -.1017935    .0340034     -2.99    0.003    -.1685473    -.0350396
        smsa |    .1261109     .031079      4.06    0.000      .065098     .1871239
   _Iyear_67 |   -.0596171     .052163     -1.14    0.253     -.162021     .0427868
   _Iyear_68 |    .0486796     .050246      0.97    0.333     -.049961     .1473201
   _Iyear_69 |    .1528176    .0483449      3.16    0.002     .0579093      .247726
   _Iyear_70 |    .1744361    .0616561      2.83    0.005     .0533956     .2954765
   _Iyear_71 |     .091666    .0559436      1.64    0.102    -.0181599     .2014918
   _Iyear_73 |    .0932398    .0613776      1.52    0.129    -.0272539     .2137334
       _cons |     4.03351    .3379434     11.94    0.000     3.370075     4.696945
 -------------+----------------------------------------------------------------


Instrumented:  iq s


Instruments:   expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 med kww mrt age


------------------------------------------------------------------------------
r; t=0.26 20:12:11

. savedresults save ivrob e()
r; t=0.00 20:12:11

. ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , robust small

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity

                                                      Number of obs =      758
                                                      F( 12,   745) =    40.09
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2280
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  107.5313411                Root MSE      =    .3799

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0049287     -1.85    0.065    -.0187746     .0005769
           s |    .1724253    .0209196      8.24    0.000     .1313569     .2134938
        expr |    .0492895    .0081197      6.07    0.000     .0333492     .0652298
      tenure |    .0422171    .0095458      4.42    0.000     .0234771     .0609571
         rns |   -.1017935    .0340034     -2.99    0.003    -.1685473    -.0350396
        smsa |    .1261109     .031079      4.06    0.000      .065098     .1871239
   _Iyear_67 |   -.0596171     .052163     -1.14    0.253     -.162021     .0427868
   _Iyear_68 |    .0486796     .050246      0.97    0.333     -.049961     .1473201
   _Iyear_69 |    .1528176    .0483449      3.16    0.002     .0579093      .247726
   _Iyear_70 |    .1744361    .0616561      2.83    0.005     .0533956     .2954765
   _Iyear_71 |     .091666    .0559436      1.64    0.102    -.0181599     .2014918
   _Iyear_73 |    .0932398    .0613776      1.52    0.129    -.0272539     .2137334
       _cons |     4.03351    .3379434     11.94    0.000     3.370075     4.696945
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             40.927
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         11.461
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):        11.601
                                                   Chi-sq(2) P-val =    0.0030
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.48 20:12:11

. * 1.0.6: same as above
. *savedresults comp ivrob e(), include(macros: insts instd depvar vcetype scalar: rmse matrix: b V) tol(1e-7) verbose
. savedresults comp ivrob e(), include(macros: instd depvar vcetype scalar: rmse matrix: b V) tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing macro  e(vcetype)
comparing scalar e(rmse)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:11

.
.
. * GMM2S option
. which ivgmm0
/Users/baum/library/application support/stata/ado/plus/i/ivgmm0.ado
*! ivgmm0 v1.1.11   C F Baum and David Drukker  16Mar2004
r; t=0.02 20:12:11

. ivgmm0 lw expr tenure rns smsa _I* (iq s = med kww mrt age)

Instrumental Variables Estimation via GMM           Number of obs  =       758
                                                    Root MSE       =    0.3794
                                                    Hansen J       =   11.6015
                                                    Chi-sq( 2) P-val = 0.00303
 -------------+----------------------------------------------------------------
             |                  GMM
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0092862    .0048824     -1.90    0.057    -.0188555     .0002832
           s |    .1757958    .0206766      8.50    0.000     .1352703     .2163212
        expr |    .0502828    .0080438      6.25    0.000     .0345171     .0660484
      tenure |    .0425214    .0094549      4.50    0.000     .0239901     .0610526
         rns |   -.1040931    .0335239     -3.11    0.002    -.1697986    -.0383875
        smsa |    .1247512    .0307747      4.05    0.000     .0644338     .1850686
   _Iyear_67 |   -.0530432    .0514609     -1.03    0.303    -.1539047     .0478184
   _Iyear_68 |    .0459546    .0495735      0.93    0.354    -.0512077     .1431169
   _Iyear_69 |    .1554801    .0476311      3.26    0.001     .0621249     .2488352
   _Iyear_70 |    .1669875    .0610006      2.74    0.006     .0474285     .2865464
   _Iyear_71 |    .0846485    .0554035      1.53    0.127    -.0239404     .1932373
   _Iyear_73 |    .0996068    .0607034      1.64    0.101    -.0193696     .2185833
       _cons |    4.003924    .3348423     11.96    0.000     3.347645     4.660203
 -------------+----------------------------------------------------------------
Instrumented:  iq s
Instruments:   expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70
               _Iyear_71 _Iyear_73 med kww mrt age
------------------------------------------------------------------------------
r; t=0.29 20:12:11

. savedresults save ivgmm e()
r; t=0.00 20:12:11

. ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age), gmm2s robust

2-Step GMM estimation
---------------------

Estimates efficient for arbitrary heteroskedasticity
Statistics robust to heteroskedasticity

                                                      Number of obs =      758
                                                      F( 12,   745) =    41.98
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2168
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  109.0846511                Root MSE      =    .3794

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0092862    .0048824     -1.90    0.057    -.0188555     .0002832
           s |    .1757958    .0206766      8.50    0.000     .1352703     .2163212
        expr |    .0502828    .0080438      6.25    0.000     .0345171     .0660484
      tenure |    .0425214    .0094549      4.50    0.000     .0239901     .0610526
         rns |   -.1040931    .0335239     -3.11    0.002    -.1697986    -.0383875
        smsa |    .1247512    .0307747      4.05    0.000     .0644338     .1850686
   _Iyear_67 |   -.0530432    .0514609     -1.03    0.303    -.1539047     .0478184
   _Iyear_68 |    .0459546    .0495735      0.93    0.354    -.0512077     .1431169
   _Iyear_69 |    .1554801    .0476311      3.26    0.001     .0621249     .2488352
   _Iyear_70 |    .1669875    .0610006      2.74    0.006     .0474285     .2865464
   _Iyear_71 |    .0846485    .0554035      1.53    0.127    -.0239404     .1932373
   _Iyear_73 |    .0996068    .0607034      1.64    0.101    -.0193696     .2185833
       _cons |    4.003924    .3348423     11.96    0.000     3.347645     4.660203
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             40.927
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         11.461
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):        11.601
                                                   Chi-sq(2) P-val =    0.0030
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.40 20:12:12

. * 1.0.6: same as above; cannot compare W
. * savedresults comp ivgmm e(), include(macros: insts instd depvar scalar: N rmse j matrix: b V W) tol(1e-7) verbose
. * savedresults comp ivgmm e(), include(macros: instd depvar scalar: N rmse j matrix: b V W) tol(1e-7) verbose
. savedresults comp ivgmm e(), include(macros: instd depvar scalar: N rmse j matrix: b V ) tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing scalar e(rmse)
comparing scalar e(j)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:12

.
.
. * orthog option
. rcof "noi ivreg2  lw expr tenure rns smsa _I* (iq = med kww mrt ), orthog(s)" == 198
Error: s listed in orthog() but does not appear as exogenous.
invalid syntax
r; t=0.03 20:12:12

. ivreg2  lw expr tenure rns smsa _I* (iq = med kww mrt ), orthog(expr)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 11,   746) =    31.71
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.1352
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9951
Residual SS             =  120.4602539                Root MSE      =    .3986

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0229555     .003084      7.44    0.000     .0169109     .0290002
        expr |    .0373061    .0084595      4.41    0.000     .0207258     .0538864
      tenure |    .0335914    .0093074      3.61    0.000     .0153493     .0518335
         rns |   -.0396948    .0354474     -1.12    0.263    -.1091704     .0297808
        smsa |     .116191    .0327198      3.55    0.000     .0520614     .1803206
   _Iyear_67 |   -.0663356    .0585219     -1.13    0.257    -.1810365     .0483653
   _Iyear_68 |    .0909651    .0547817      1.66    0.097     -.016405     .1983353
   _Iyear_69 |    .1851946     .054372      3.41    0.001     .0786274     .2917618
   _Iyear_70 |    .1509552    .0632466      2.39    0.017     .0269941     .2749162
   _Iyear_71 |    .1855911    .0557659      3.33    0.001     .0762919     .2948904
   _Iyear_73 |    .3125631    .0528234      5.92    0.000     .2090312      .416095
       _cons |    2.980081    .3131961      9.52    0.000     2.366228     3.593934
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         105.893
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               40.272
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    13.91
                                         10% maximal IV relative bias     9.08
                                         20% maximal IV relative bias     6.46
                                         30% maximal IV relative bias     5.39
                                         10% maximal IV size             22.30
                                         15% maximal IV size             12.83
                                         20% maximal IV size              9.54
                                         25% maximal IV size              7.80
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):          33.392
                                                   Chi-sq(2) P-val =    0.0000
-orthog- option:
Sargan statistic (eqn. excluding suspect orthogonality conditions):      8.636
                                                   Chi-sq(1) P-val =    0.0033
C statistic (exogeneity/orthogonality of suspect instruments):          24.756
                                                   Chi-sq(1) P-val =    0.0000
Instruments tested:   expr
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt
------------------------------------------------------------------------------
r; t=0.36 20:12:12

. ivreg2  lw expr tenure rns smsa _I* (iq = med kww ), orthog(expr)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 11,   746) =    30.77
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.0915
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9949
Residual SS             =  126.5404315                Root MSE      =    .4086

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0244137    .0031717      7.70    0.000     .0181973     .0306301
        expr |    .0391062    .0086764      4.51    0.000     .0221009     .0561116
      tenure |    .0326769    .0095408      3.42    0.001     .0139774     .0513765
         rns |   -.0339654    .0363455     -0.93    0.350    -.1052012     .0372704
        smsa |    .1139946    .0335377      3.40    0.001     .0482619     .1797272
   _Iyear_67 |   -.0679585    .0599814     -1.13    0.257    -.1855199     .0496028
   _Iyear_68 |    .0901614    .0561474      1.61    0.108    -.0198854     .2002083
   _Iyear_69 |    .1795079    .0557366      3.22    0.001     .0702661     .2887497
   _Iyear_70 |    .1394529    .0648559      2.15    0.032     .0123377     .2665682
   _Iyear_71 |    .1737518    .0571954      3.04    0.002     .0616509     .2858527
   _Iyear_73 |    .2976709    .0542058      5.49    0.000     .1914294     .4039124
       _cons |    2.833568    .3220753      8.80    0.000     2.202312     3.464824
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         105.174
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               60.012
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.656
                                                   Chi-sq(1) P-val =    0.4181
-orthog- option:
Sargan statistic (eqn. excluding suspect orthogonality conditions):      0.000
                                                   Chi-sq(0) P-val =         .
C statistic (exogeneity/orthogonality of suspect instruments):           0.656
                                                   Chi-sq(1) P-val =    0.4181
Instruments tested:   expr
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww
------------------------------------------------------------------------------
r; t=0.32 20:12:12

. ivreg2  lw expr tenure rns smsa _I* (iq = med kww ), orthog(med)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 11,   746) =    30.77
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.0915
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9949
Residual SS             =  126.5404315                Root MSE      =    .4086

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0244137    .0031717      7.70    0.000     .0181973     .0306301
        expr |    .0391062    .0086764      4.51    0.000     .0221009     .0561116
      tenure |    .0326769    .0095408      3.42    0.001     .0139774     .0513765
         rns |   -.0339654    .0363455     -0.93    0.350    -.1052012     .0372704
        smsa |    .1139946    .0335377      3.40    0.001     .0482619     .1797272
   _Iyear_67 |   -.0679585    .0599814     -1.13    0.257    -.1855199     .0496028
   _Iyear_68 |    .0901614    .0561474      1.61    0.108    -.0198854     .2002083
   _Iyear_69 |    .1795079    .0557366      3.22    0.001     .0702661     .2887497
   _Iyear_70 |    .1394529    .0648559      2.15    0.032     .0123377     .2665682
   _Iyear_71 |    .1737518    .0571954      3.04    0.002     .0616509     .2858527
   _Iyear_73 |    .2976709    .0542058      5.49    0.000     .1914294     .4039124
       _cons |    2.833568    .3220753      8.80    0.000     2.202312     3.464824
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         105.174
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               60.012
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.656
                                                   Chi-sq(1) P-val =    0.4181
-orthog- option:
Sargan statistic (eqn. excluding suspect orthogonality conditions):      0.000
                                                   Chi-sq(0) P-val =         .
C statistic (exogeneity/orthogonality of suspect instruments):           0.656
                                                   Chi-sq(1) P-val =    0.4181
Instruments tested:   med
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww
------------------------------------------------------------------------------
r; t=0.28 20:12:13

. ivreg2  lw expr tenure rns smsa _I* (iq = med kww ), orthog(med kww)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F( 11,   746) =    30.77
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.0915
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9949
Residual SS             =  126.5404315                Root MSE      =    .4086

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0244137    .0031717      7.70    0.000     .0181973     .0306301
        expr |    .0391062    .0086764      4.51    0.000     .0221009     .0561116
      tenure |    .0326769    .0095408      3.42    0.001     .0139774     .0513765
         rns |   -.0339654    .0363455     -0.93    0.350    -.1052012     .0372704
        smsa |    .1139946    .0335377      3.40    0.001     .0482619     .1797272
   _Iyear_67 |   -.0679585    .0599814     -1.13    0.257    -.1855199     .0496028
   _Iyear_68 |    .0901614    .0561474      1.61    0.108    -.0198854     .2002083
   _Iyear_69 |    .1795079    .0557366      3.22    0.001     .0702661     .2887497
   _Iyear_70 |    .1394529    .0648559      2.15    0.032     .0123377     .2665682
   _Iyear_71 |    .1737518    .0571954      3.04    0.002     .0616509     .2858527
   _Iyear_73 |    .2976709    .0542058      5.49    0.000     .1914294     .4039124
       _cons |    2.833568    .3220753      8.80    0.000     2.202312     3.464824
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         105.174
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               60.012
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.656
                                                   Chi-sq(1) P-val =    0.4181

Collinearity/identification problems in eqn. excl. suspect orthog. conditions:
  C statistic not calculated for -orthog- option
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww
------------------------------------------------------------------------------
r; t=0.29 20:12:13

.
. * cluster option
. ivreg lw expr tenure rns smsa _I* (iq s = med kww mrt age) , robust cluster(age)

Instrumental variables (2SLS) regression               Number of obs =     758
                                                       F( 12,    14) =  344.91
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.2280
                                                       Root MSE      =  .37992

(Std. Err. adjusted for 15 clusters in age)
 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0056701     -1.60    0.131    -.0212599     .0030623
           s |    .1724253    .0241501      7.14    0.000     .1206284     .2242222
        expr |    .0492895    .0078771      6.26    0.000     .0323948     .0661842
      tenure |    .0422171    .0101291      4.17    0.001     .0204922      .063942
         rns |   -.1017935    .0365854     -2.78    0.015    -.1802613    -.0233256
        smsa |    .1261109    .0275528      4.58    0.000     .0670161     .1852058
   _Iyear_67 |   -.0596171    .0730196     -0.82    0.428    -.2162287     .0969945
   _Iyear_68 |    .0486796    .0559102      0.87    0.399    -.0712359     .1685951
   _Iyear_69 |    .1528176    .0394489      3.87    0.002     .0682082     .2374271
   _Iyear_70 |    .1744361    .0548233      3.18    0.007     .0568517     .2920204
   _Iyear_71 |     .091666    .0603488      1.52    0.151    -.0377694     .2211014
   _Iyear_73 |    .0932398    .0609199      1.53    0.148    -.0374204     .2238999
       _cons |     4.03351    .3123382     12.91    0.000     3.363611     4.703409
 -------------+----------------------------------------------------------------


Instrumented:  iq s


Instruments:   expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71 _Iyear_73 med kww mrt age


------------------------------------------------------------------------------
r; t=0.30 20:12:13

. savedresults save ivclu e()
r; t=0.00 20:12:13

. * 1.0.6: should yield 498? If so cannot execute following line
. * rcof "ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , small robust cluster(age)" == 498
. ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , small robust cluster(age)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on age

Number of clusters (age) = 15                         Number of obs =      758
                                                      F( 12,    14) =   344.91
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2280
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  107.5313411                Root MSE      =    .3799

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0056701     -1.60    0.131    -.0212599     .0030623
           s |    .1724253    .0241501      7.14    0.000     .1206284     .2242222
        expr |    .0492895    .0078771      6.26    0.000     .0323948     .0661842
      tenure |    .0422171    .0101291      4.17    0.001     .0204922      .063942
         rns |   -.1017935    .0365854     -2.78    0.015    -.1802613    -.0233256
        smsa |    .1261109    .0275528      4.58    0.000     .0670161     .1852058
   _Iyear_67 |   -.0596171    .0730196     -0.82    0.428    -.2162287     .0969945
   _Iyear_68 |    .0486796    .0559102      0.87    0.399    -.0712359     .1685951
   _Iyear_69 |    .1528176    .0394489      3.87    0.002     .0682082     .2374271
   _Iyear_70 |    .1744361    .0548233      3.18    0.007     .0568517     .2920204
   _Iyear_71 |     .091666    .0603488      1.52    0.151    -.0377694     .2211014
   _Iyear_73 |    .0932398    .0609199      1.53    0.148    -.0374204     .2238999
       _cons |     4.03351    .3123382     12.91    0.000     3.363611     4.703409
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              8.395
                                                   Chi-sq(3) P-val =    0.0385
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         13.162
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):         5.340
                                                   Chi-sq(2) P-val =    0.0693
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.42 20:12:14

. * do not compare insts
. savedresults comp ivclu e(), include(macros:  instd depvar scalar: N rmse  matrix: b) verbose tol(1e-7)
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing scalar e(rmse)
comparing matrix e(b)
r; t=0.00 20:12:14

. ivreg lw expr tenure rns smsa (iq s = med kww mrt age) , robust cluster(age)

Instrumental variables (2SLS) regression               Number of obs =     758
                                                       F(  6,    14) =   53.69
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.0622
                                                       Root MSE      =  .41705

(Std. Err. adjusted for 15 clusters in age)
 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0144337    .0065265     -2.21    0.044    -.0284316    -.0004358
           s |    .1986398    .0253661      7.83    0.000      .144235     .2530446
        expr |    .0460456    .0101647      4.53    0.000     .0242444     .0678468
      tenure |      .04174    .0110597      3.77    0.002     .0180192     .0654608
         rns |   -.1129929    .0363809     -3.11    0.008    -.1910222    -.0349635
        smsa |     .130412    .0318716      4.09    0.001     .0620542     .1987699
       _cons |    4.305194    .4092365     10.52    0.000     3.427469     5.182919
 -------------+----------------------------------------------------------------


Instrumented:  iq s


Instruments:   expr tenure rns smsa med kww mrt age


------------------------------------------------------------------------------
r; t=0.12 20:12:14

. savedresults save ivclu2 e()
r; t=0.00 20:12:14

. ivreg2 lw expr tenure rns smsa (iq s = med kww mrt age) , small robust cluster(age)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on age

Number of clusters (age) = 15                         Number of obs =      758
                                                      F(  6,    14) =    53.69
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.0622
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9947
Residual SS             =  130.6189516                Root MSE      =     .417

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0144337    .0065265     -2.21    0.044    -.0284316    -.0004358
           s |    .1986398    .0253661      7.83    0.000      .144235     .2530446
        expr |    .0460456    .0101647      4.53    0.000     .0242444     .0678468
      tenure |      .04174    .0110597      3.77    0.002     .0180192     .0654608
         rns |   -.1129929    .0363809     -3.11    0.008    -.1910222    -.0349635
        smsa |     .130412    .0318716      4.09    0.001     .0620542     .1987699
       _cons |    4.305194    .4092365     10.52    0.000     3.427469     5.182919
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              7.594
                                                   Chi-sq(3) P-val =    0.0552
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         10.754
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):         4.011
                                                   Chi-sq(2) P-val =    0.1346
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.25 20:12:14

. * 1.0.6: similar to above
. * savedresults comp ivclu2 e(), include(macros: insts instd depvar scalar: N matrix: b V)  tol(1e-7) verbose
. savedresults comp ivclu2 e(), include(macros: instd depvar scalar: N matrix: b V)  tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:14

.
. * rcof "noi ivreg2 lw expr tenure rns smsa _I* (iq s = med kww mrt age) , gmm2s robust cluster(age)" == 498
.
. * replay
. ivreg2  lw expr tenure rns smsa _I* (iq s = med kww mrt age) , robust

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity

                                                      Number of obs =      758
                                                      F( 12,   745) =    40.09
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2280
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  107.5313411                Root MSE      =    .3766

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0048862     -1.86    0.063    -.0186757      .000478
           s |    .1724253    .0207395      8.31    0.000     .1317767     .2130739
        expr |    .0492895    .0080498      6.12    0.000     .0335122     .0650668
      tenure |    .0422171    .0094636      4.46    0.000     .0236687     .0607655
         rns |   -.1017935    .0337105     -3.02    0.003    -.1678649     -.035722
        smsa |    .1261109    .0308114      4.09    0.000     .0657218     .1865001
   _Iyear_67 |   -.0596171    .0517137     -1.15    0.249    -.1609741     .0417399
   _Iyear_68 |    .0486796    .0498132      0.98    0.328    -.0489526     .1463117
   _Iyear_69 |    .1528176    .0479285      3.19    0.001     .0588795     .2467558
   _Iyear_70 |    .1744361    .0611251      2.85    0.004      .054633     .2942391
   _Iyear_71 |     .091666    .0554618      1.65    0.098    -.0170372     .2003691
   _Iyear_73 |    .0932398     .060849      1.53    0.125    -.0260221     .2125016
       _cons |     4.03351    .3350329     12.04    0.000     3.376857     4.690162
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             40.927
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         11.461
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):        11.601
                                                   Chi-sq(2) P-val =    0.0030
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.29 20:12:14

. savedresults save replay e()
r; t=0.06 20:12:15

. ivreg2

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity

                                                      Number of obs =      758
                                                      F( 12,   745) =    40.09
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.2280
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9956
Residual SS             =  107.5313411                Root MSE      =    .3766

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |   -.0090988    .0048862     -1.86    0.063    -.0186757      .000478
           s |    .1724253    .0207395      8.31    0.000     .1317767     .2130739
        expr |    .0492895    .0080498      6.12    0.000     .0335122     .0650668
      tenure |    .0422171    .0094636      4.46    0.000     .0236687     .0607655
         rns |   -.1017935    .0337105     -3.02    0.003    -.1678649     -.035722
        smsa |    .1261109    .0308114      4.09    0.000     .0657218     .1865001
   _Iyear_67 |   -.0596171    .0517137     -1.15    0.249    -.1609741     .0417399
   _Iyear_68 |    .0486796    .0498132      0.98    0.328    -.0489526     .1463117
   _Iyear_69 |    .1528176    .0479285      3.19    0.001     .0588795     .2467558
   _Iyear_70 |    .1744361    .0611251      2.85    0.004      .054633     .2942391
   _Iyear_71 |     .091666    .0554618      1.65    0.098    -.0170372     .2003691
   _Iyear_73 |    .0932398     .060849      1.53    0.125    -.0260221     .2125016
       _cons |     4.03351    .3350329     12.04    0.000     3.376857     4.690162
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             40.927
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         11.461
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    11.04
                                         10% maximal IV relative bias     7.56
                                         20% maximal IV relative bias     5.57
                                         30% maximal IV relative bias     4.73
                                         10% maximal IV size             16.87
                                         15% maximal IV size              9.93
                                         20% maximal IV size              7.54
                                         25% maximal IV size              6.28
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):        11.601
                                                   Chi-sq(2) P-val =    0.0030
------------------------------------------------------------------------------
Instrumented:         iq s
Included instruments: expr tenure rns smsa _Iyear_67 _Iyear_68 _Iyear_69
                      _Iyear_70 _Iyear_71 _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.20 20:12:15

. savedresults comp replay e(), include(macros: insts instd depvar scalar: N matrix: b)  tol(1e-7) verbose
comparing macro  e(insts)
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
r; t=0.00 20:12:15

.
. * 1.0.10 test exog regressors
. ivreg2  lw  (iq = med kww mrt age) , nocons

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F(  1,   757) = 47152.39
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =  -1.8086
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9841
Residual SS             =  391.2024131                Root MSE      =    .7184

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0546741    .0002516    217.29    0.000     .0541809     .0551673
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         742.997
                                                   Chi-sq(4) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             9334.857
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                         10% maximal IV relative bias    10.27
                                         20% maximal IV relative bias     6.71
                                         30% maximal IV relative bias     5.34
                                         10% maximal IV size             24.58
                                         15% maximal IV size             13.96
                                         20% maximal IV size             10.26
                                         25% maximal IV size              8.31
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):          80.149
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Instrumented:         iq
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.09 20:12:15

.
. * 1.0.12 test smatrix, wmatrix
. qui ivreg2  lw  (iq = med kww mrt age), gmm2s
r; t=0.10 20:12:15

. savedresults save ivs e()
r; t=0.00 20:12:15

. mat S=e(S)
r; t=0.00 20:12:15

. mat W=e(W)
r; t=0.00 20:12:15

. mat check = trace(W - syminv(S))
r; t=0.00 20:12:15

. assert check[1,1] == 0
r; t=0.00 20:12:15

. ivreg2  lw  (iq = med kww mrt age) , gmm2s smatrix(S)

2-Step GMM estimation
---------------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F(  1,   756) =    84.07
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =  -0.1923
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9933
Residual SS             =  166.0674253                Root MSE      =    .4681

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0285457    .0031091      9.18    0.000     .0224519     .0346395
       _cons |    2.722091    .3233508      8.42    0.000     2.088335     3.355847
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         122.360
                                                   Chi-sq(4) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               36.238
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                         10% maximal IV relative bias    10.27
                                         20% maximal IV relative bias     6.71
                                         30% maximal IV relative bias     5.34
                                         10% maximal IV size             24.58
                                         15% maximal IV size             13.96
                                         20% maximal IV size             10.26
                                         25% maximal IV size              8.31
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):         118.504
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Instrumented:         iq
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.11 20:12:15

. savedresults save ivss e()
r; t=0.00 20:12:15

. savedresults comp ivs e(),  include(macros: instd depvar scalar: N matrix: b V) verbose tol(1e-7)
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:15

.
. ivreg2  lw  (iq = med kww mrt age) ,  wmatrix(W)

GMM estimation with user-supplied weighting matrix
--------------------------------------------------

Efficiency of estimates dependent on weighting matrix
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F(  1,   756) =    84.07
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =  -0.1923
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9933
Residual SS             =  166.0674253                Root MSE      =    .4681

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0285457    .0031091      9.18    0.000     .0224519     .0346395
       _cons |    2.722091    .3233508      8.42    0.000     2.088335     3.355847
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         122.360
                                                   Chi-sq(4) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               36.238
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                         10% maximal IV relative bias    10.27
                                         20% maximal IV relative bias     6.71
                                         30% maximal IV relative bias     5.34
                                         10% maximal IV size             24.58
                                         15% maximal IV size             13.96
                                         20% maximal IV size             10.26
                                         25% maximal IV size              8.31
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments):       118.504
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Instrumented:         iq
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.11 20:12:15

. savedresults comp ivs e(),  include(macros: instd depvar scalar: N matrix: b V) verbose tol(1e-7)
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:15

. assert "`e(model)'"=="gmmw"
r; t=0.00 20:12:15

. savedresults comp ivss e(),  include(macros: instd depvar scalar: N matrix: b V) verbose tol(1e-7)
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:15

.
. ivreg2 lw (iq=med kww age), gmm2s

2-Step GMM estimation
---------------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F(  1,   756) =    87.15
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =  -0.2613
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9929
Residual SS             =  175.6824998                Root MSE      =    .4814

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0303929    .0032513      9.35    0.000     .0240205     .0367652
       _cons |    2.530252    .3381172      7.48    0.000     1.867555      3.19295
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         118.374
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               46.514
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    13.91
                                         10% maximal IV relative bias     9.08
                                         20% maximal IV relative bias     6.46
                                         30% maximal IV relative bias     5.39
                                         10% maximal IV size             22.30
                                         15% maximal IV size             12.83
                                         20% maximal IV size              9.54
                                         25% maximal IV size              7.80
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):         102.109
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Instrumented:         iq
Excluded instruments: med kww age
------------------------------------------------------------------------------
r; t=0.18 20:12:15

. scalar J0 = e(j)
r; t=0.00 20:12:15

. mat S0 = e(S)
r; t=0.00 20:12:15

. qui ivreg2 lw (iq=kww) med age, gmm2s smatrix(S0)
r; t=0.05 20:12:15

. test med age


 ( 1)  med = 0


 ( 2)  age = 0


           chi2(  2) =  102.11
         Prob > chi2 =    0.0000
r; t=0.00 20:12:15

. di J0
102.10909
r; t=0.00 20:12:15

. assert reldif(r(chi2),J0)<1.0e-7
r; t=0.00 20:12:15

. qui ivreg2 lw (iq=med) kww age, gmm2s smatrix(S0)
r; t=0.05 20:12:15

. test kww age


 ( 1)  kww = 0


 ( 2)  age = 0


           chi2(  2) =  102.11
         Prob > chi2 =    0.0000
r; t=0.00 20:12:15

. assert reldif(r(chi2),J0)<1.0e-7
r; t=0.00 20:12:15

. qui ivreg2 lw (iq=age) med kww, gmm2s smatrix(S0)
r; t=0.05 20:12:15

. test med kww


 ( 1)  med = 0


 ( 2)  kww = 0


           chi2(  2) =  102.11
         Prob > chi2 =    0.0000
r; t=0.00 20:12:15

. assert reldif(r(chi2),J0)<1.0e-7
r; t=0.00 20:12:15

.
. * 1.0.10 test xi
. xi: ivreg2  lw  (iq = med kww mrt age) i.year
i.year            _Iyear_66-73        (naturally coded; _Iyear_66 omitted)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F(  7,   750) =    38.39
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.1319
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9951
Residual SS             =  120.9175948                Root MSE      =    .3994

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0203995    .0027783      7.34    0.000     .0149542     .0258448
   _Iyear_67 |    -.127136    .0576377     -2.21    0.027    -.2401039    -.0141682
   _Iyear_68 |   -.0049702    .0528723     -0.09    0.925    -.1085981     .0986577
   _Iyear_69 |    .0994354    .0532092      1.87    0.062    -.0048528     .2037235
   _Iyear_70 |    .1098624    .0635139      1.73    0.084    -.0146226     .2343473
   _Iyear_71 |    .2062518    .0539419      3.82    0.000     .1005276      .311976
   _Iyear_73 |     .308092    .0507236      6.07    0.000     .2086755     .4075085
       _cons |    3.469529    .2759853     12.57    0.000     2.928608      4.01045
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         123.188
                                                   Chi-sq(4) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               36.240
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                         10% maximal IV relative bias    10.27
                                         20% maximal IV relative bias     6.71
                                         30% maximal IV relative bias     5.34
                                         10% maximal IV size             24.58
                                         15% maximal IV size             13.96
                                         20% maximal IV size             10.26
                                         25% maximal IV size              8.31
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):         112.936
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71
                      _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.25 20:12:16

. savedresults save ivxi e()
r; t=0.00 20:12:16

. ivreg2  lw  (iq = med kww mrt age) _I*

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      758
                                                      F(  7,   750) =    38.39
                                                      Prob > F      =   0.0000
Total (centered) SS     =  139.2861498                Centered R2   =   0.1319
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9951
Residual SS             =  120.9175948                Root MSE      =    .3994

 -------------+----------------------------------------------------------------
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0203995    .0027783      7.34    0.000     .0149542     .0258448
   _Iyear_67 |    -.127136    .0576377     -2.21    0.027    -.2401039    -.0141682
   _Iyear_68 |   -.0049702    .0528723     -0.09    0.925    -.1085981     .0986577
   _Iyear_69 |    .0994354    .0532092      1.87    0.062    -.0048528     .2037235
   _Iyear_70 |    .1098624    .0635139      1.73    0.084    -.0146226     .2343473
   _Iyear_71 |    .2062518    .0539419      3.82    0.000     .1005276      .311976
   _Iyear_73 |     .308092    .0507236      6.07    0.000     .2086755     .4075085
       _cons |    3.469529    .2759853     12.57    0.000     2.928608      4.01045
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         123.188
                                                   Chi-sq(4) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               36.240
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                         10% maximal IV relative bias    10.27
                                         20% maximal IV relative bias     6.71
                                         30% maximal IV relative bias     5.34
                                         10% maximal IV size             24.58
                                         15% maximal IV size             13.96
                                         20% maximal IV size             10.26
                                         25% maximal IV size              8.31
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):         112.936
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71
                      _Iyear_73
Excluded instruments: med kww mrt age
------------------------------------------------------------------------------
r; t=0.18 20:12:16

. savedresults comp ivxi e(), include(macros: instd depvar scalar: N matrix: b V)  tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:16

.
. * 1.0.14 test HAC with auto bw selection (vs Stata 10 ivregress)
. if c(version)>=10 {
. webuse lutkepohl, clear
(Quarterly SA West German macro data, Bil DM, from Lutkepohl 1993 Table E.1)
r; t=0.37 20:12:16
. ivregress 2sls consumption (income=L(1/2).income) qtr L.consumption, vce(hac bartlett opt)

 Instrumental variables (2SLS) regression              Number of obs =      90
                                                       Wald chi2(3)  = 1.9e+05
                                                       Prob > chi2   =  0.0000
                                                       R-squared     =  0.9997
                                                       Root MSE      =  10.769

 -------------+----------------------------------------------------------------
             |                  HAC
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137    .0667156      3.53    0.000     .1048534     .3663739
         qtr |     .181519    .2648363      0.69    0.493    -.3375506     .7005887
             |
 consumption |
         L1. |    .7210226    .0717118     10.05    0.000     .5804701     .8615752
             |
       _cons |    12.52337    3.015162      4.15    0.000     6.613766     18.43298
 -------------+----------------------------------------------------------------


Instrumented:  income


Instruments:   qtr L.consumption L.income L2.income


HAC VCE:       Bartlett kernel with 19 lags
HAC Lags:      Chosen by Newey-West method
r; t=0.49 20:12:17
. savedresults save ivhacau1 e()
r; t=0.00 20:12:17
. local ivregressopt `e(vcelagopt)'
r; t=0.00 20:12:17
. ivreg2 consumption (income=L(1/2).income) qtr L.consumption, bw(auto) robust

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=    20
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  qtr

                                                      Number of obs =       90
                                                      F(  3,    86) = 61576.19
                                                      Prob > F      =   0.0000
Total (centered) SS     =  30630397.29                Centered R2   =   0.9997
Total (uncentered) SS   =    156650664                Uncentered R2 =   0.9999
Residual SS             =  10437.12201                Root MSE      =    10.77

 -------------+----------------------------------------------------------------
             |                Robust
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137    .0667156      3.53    0.000     .1048534     .3663739
         qtr |     .181519    .2648363      0.69    0.493    -.3375506     .7005886
             |
 consumption |
         L1. |    .7210226    .0717118     10.05    0.000     .5804701     .8615752
             |
       _cons |    12.52337    3.015162      4.15    0.000     6.613766     18.43298
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              3.259
                                                   Chi-sq(2) P-val =    0.1961
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         51.413
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         0.777
                                                   Chi-sq(1) P-val =    0.3781
------------------------------------------------------------------------------
Instrumented:         income
Included instruments: qtr L.consumption
Excluded instruments: L.income L2.income
------------------------------------------------------------------------------
r; t=6.83 20:12:24
. savedresults compare ivhacau1 e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:24
. assert `ivregressopt' + 1 == `e(bw)'
r; t=0.00 20:12:24
.
. ivreg2 consumption (income=L(1/2).income) qtr L.consumption, bw(auto) robust kernel(bartlett)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=    20
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  qtr

                                                      Number of obs =       90
                                                      F(  3,    86) = 61576.19
                                                      Prob > F      =   0.0000
Total (centered) SS     =  30630397.29                Centered R2   =   0.9997
Total (uncentered) SS   =    156650664                Uncentered R2 =   0.9999
Residual SS             =  10437.12201                Root MSE      =    10.77

 -------------+----------------------------------------------------------------
             |                Robust
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137    .0667156      3.53    0.000     .1048534     .3663739
         qtr |     .181519    .2648363      0.69    0.493    -.3375506     .7005886
             |
 consumption |
         L1. |    .7210226    .0717118     10.05    0.000     .5804701     .8615752
             |
       _cons |    12.52337    3.015162      4.15    0.000     6.613766     18.43298
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              3.259
                                                   Chi-sq(2) P-val =    0.1961
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         51.413
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         0.777
                                                   Chi-sq(1) P-val =    0.3781
------------------------------------------------------------------------------
Instrumented:         income
Included instruments: qtr L.consumption
Excluded instruments: L.income L2.income
------------------------------------------------------------------------------
r; t=6.92 20:12:31
. savedresults compare ivhacau1 e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:31
. assert `ivregressopt' + 1 == `e(bw)'
r; t=0.00 20:12:31
.
. ivregress 2sls consumption (income=L(1/2).income) qtr L.consumption, vce(hac parzen opt)

 Instrumental variables (2SLS) regression              Number of obs =      90
                                                       Wald chi2(3)  = 1.5e+05
                                                       Prob > chi2   =  0.0000
                                                       R-squared     =  0.9997
                                                       Root MSE      =  10.769

 -------------+----------------------------------------------------------------
             |                  HAC
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137    .0700729      3.36    0.001     .0982733      .372954
         qtr |     .181519    .2788468      0.65    0.515    -.3650106     .7280486
             |
 consumption |
         L1. |    .7210226    .0750828      9.60    0.000      .573863     .8681822
             |
       _cons |    12.52337    3.319315      3.77    0.000     6.017636     19.02911
 -------------+----------------------------------------------------------------


Instrumented:  income


Instruments:   qtr L.consumption L.income L2.income


HAC VCE:       Parzen kernel with 19 lags
HAC Lags:      Chosen by Newey-West method
r; t=0.16 20:12:31
. savedresults save ivhacau2 e()
r; t=0.00 20:12:31
. local ivregressopt `e(vcelagopt)'
r; t=0.00 20:12:31
. ivreg2 consumption (income=L(1/2).income) qtr L.consumption, bw(auto) robust kernel(parzen)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Parzen; bandwidth=    20
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  qtr

                                                      Number of obs =       90
                                                      F(  3,    86) = 49349.73
                                                      Prob > F      =   0.0000
Total (centered) SS     =  30630397.29                Centered R2   =   0.9997
Total (uncentered) SS   =    156650664                Uncentered R2 =   0.9999
Residual SS             =  10437.12201                Root MSE      =    10.77

 -------------+----------------------------------------------------------------
             |                Robust
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137    .0700729      3.36    0.001     .0982733      .372954
         qtr |     .181519    .2788468      0.65    0.515    -.3650106     .7280486
             |
 consumption |
         L1. |    .7210226    .0750828      9.60    0.000      .573863     .8681822
             |
       _cons |    12.52337    3.319315      3.77    0.000     6.017636     19.02911
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              3.590
                                                   Chi-sq(2) P-val =    0.1661
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         52.508
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         0.760
                                                   Chi-sq(1) P-val =    0.3832
------------------------------------------------------------------------------
Instrumented:         income
Included instruments: qtr L.consumption
Excluded instruments: L.income L2.income
------------------------------------------------------------------------------
r; t=6.71 20:12:37
. savedresults compare ivhacau2 e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:37
. assert `ivregressopt' + 1 == `e(bw)'
r; t=0.00 20:12:37
.
. ivregress 2sls consumption (income=L(1/2).income) qtr L.consumption, vce(hac qua opt)

 Instrumental variables (2SLS) regression              Number of obs =      90
                                                       Wald chi2(3)  = 2.6e+05
                                                       Prob > chi2   =  0.0000
                                                       R-squared     =  0.9997
                                                       Root MSE      =  10.769

 -------------+----------------------------------------------------------------
             |                  HAC
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137    .0588592      4.00    0.000     .1202518     .3509756
         qtr |     .181519    .2614402      0.69    0.487    -.3308944     .6939324
             |
 consumption |
         L1. |    .7210226    .0629648     11.45    0.000      .597614     .8444313
             |
       _cons |    12.52337    2.986652      4.19    0.000     6.669644      18.3771
 -------------+----------------------------------------------------------------


Instrumented:  income


Instruments:   qtr L.consumption L.income L2.income


HAC VCE:       Quadratic spectral kernel with 19 lags
HAC Lags:      Chosen by Newey-West method
r; t=0.19 20:12:38
. savedresults save ivhacau3 e()
r; t=0.00 20:12:38
. local ivregressopt `e(vcelagopt)'
r; t=0.00 20:12:38
. ivreg2 consumption (income=L(1/2).income) qtr L.consumption, bw(auto) robust kernel(qua)
Computing kernel ...

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Quadratic spectral; bandwidth=    20
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  qtr

                                                      Number of obs =       90
                                                      F(  3,    86) = 81360.41
                                                      Prob > F      =   0.0000
Total (centered) SS     =  30630397.29                Centered R2   =   0.9997
Total (uncentered) SS   =    156650664                Uncentered R2 =   0.9999
Residual SS             =  10437.12201                Root MSE      =    10.77

 -------------+----------------------------------------------------------------
             |                Robust
  consumption |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      income |    .2356137     .058859      4.00    0.000     .1202521     .3509752
         qtr |     .181519    .2614413      0.69    0.487    -.3308966     .6939346
             |
 consumption |
         L1. |    .7210226    .0629646     11.45    0.000     .5976143     .8444309
             |
       _cons |    12.52337    2.986636      4.19    0.000     6.669676     18.37707
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              2.889
                                                   Chi-sq(2) P-val =    0.2358
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         64.365
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         0.934
                                                   Chi-sq(1) P-val =    0.3338
------------------------------------------------------------------------------
Instrumented:         income
Included instruments: qtr L.consumption
Excluded instruments: L.income L2.income
------------------------------------------------------------------------------
r; t=17.35 20:12:55
. // note lowered tolerance
. savedresults compare ivhacau3 e(), include(macros: depvar scalar: N matrix: b V) tol(1e-4) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:55
. di "`ivregressopt'  `e(bw)'"
19  20
r; t=0.00 20:12:55
. assert `ivregressopt' + 1 == `e(bw)'
r; t=0.00 20:12:55
. }
r; t=39.04 20:12:55

.
. * 1.0.10 test by
. webuse grunfeld, clear
r; t=0.32 20:12:55

. tsset company year
       panel variable:  company (strongly balanced)
        time variable:   year, 1935 to 1954
                delta:  1 year
r; t=0.00 20:12:55

. ivreg2 invest (mvalue= kstock)  if company==10

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     0.41
                                                      Prob > F      =   0.5320
Total (centered) SS     =  56.12209548                Centered R2   = -27.4772
Total (uncentered) SS   =  246.4049012                Uncentered R2 =  -5.4861
Residual SS             =  1598.199674                Root MSE      =    8.939

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |   -.9895471    1.473032     -0.67    0.502    -3.876638     1.897543
       _cons |    73.26417    104.4881      0.70    0.483    -131.5287      278.057
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           0.451
                                                   Chi-sq(1) P-val =    0.5019
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                0.415
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------
r; t=0.10 20:12:55

. savedresults save ivby e()
r; t=0.00 20:12:55

. by company: ivreg2 invest (mvalue= kstock)

-------------
-> company = 1

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     5.80
                                                      Prob > F      =   0.0270
Total (centered) SS     =  1820892.502                Centered R2   =  -1.5535
Total (uncentered) SS   =  9214658.977                Uncentered R2 =   0.4954
Residual SS             =  4649560.988                Root MSE      =    482.2

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .7167992    .2823693      2.54    0.011     .1633655     1.270233
       _cons |   -2498.476    1228.485     -2.03    0.042    -4906.263     -90.6903
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           3.753
                                                   Chi-sq(1) P-val =    0.0527
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                4.158
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 2

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     0.43
                                                      Prob > F      =   0.5226
Total (centered) SS     =    298775.32                Centered R2   = -11.6139
Total (uncentered) SS   =  3668569.807                Uncentered R2 =  -0.0273
Residual SS             =  3768731.669                Root MSE      =    434.1

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    1.636872    2.381309      0.69    0.492    -3.030406     6.304151
       _cons |   -2817.151    4696.527     -0.60    0.549    -12022.17     6387.872
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           0.386
                                                   Chi-sq(1) P-val =    0.5345
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                0.354
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 3

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     0.27
                                                      Prob > F      =   0.6089
Total (centered) SS     =  44848.61921                Centered R2   = -42.4768
Total (uncentered) SS   =  254113.5003                Uncentered R2 =  -6.6732
Residual SS             =  1949873.616                Root MSE      =    312.2

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .8034618    1.463864      0.55    0.583    -2.065659     3.672583
       _cons |   -1457.491    2842.693     -0.51    0.608    -7029.067     4114.086
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           0.280
                                                   Chi-sq(1) P-val =    0.5969
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                0.255
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 4

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     2.39
                                                      Prob > F      =   0.1398
Total (centered) SS     =  34683.98673                Centered R2   =  -5.3087
Total (uncentered) SS   =  183029.1333                Uncentered R2 =  -0.1955
Residual SS             =   218811.669                Root MSE      =    104.6

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .7767249    .4770677      1.63    0.103    -.1583106      1.71176
       _cons |     -452.31    331.5341     -1.36    0.172    -1102.105     197.4849
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           1.962
                                                   Chi-sq(1) P-val =    0.1613
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                1.958
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 5

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =    29.69
                                                      Prob > F      =   0.0000
Total (centered) SS     =  4370.680773                Centered R2   =   0.6799
Total (uncentered) SS   =   80761.6608                Uncentered R2 =   0.9827
Residual SS             =  1399.002862                Root MSE      =    8.364

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .1716397    .0298816      5.74    0.000     .1130727     .2302066
       _cons |    22.07306    7.165074      3.08    0.002     8.029776     36.11635
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          15.124
                                                   Chi-sq(1) P-val =    0.0001
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               55.829
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 6

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =   324.34
                                                      Prob > F      =   0.0000
Total (centered) SS     =   23204.8504                Centered R2   =   0.9499
Total (uncentered) SS   =  84612.42832                Uncentered R2 =   0.9863
Residual SS             =  1161.701656                Root MSE      =    7.621

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .1590435    .0083779     18.98    0.000      .142623     .1754639
       _cons |   -11.36578    3.908676     -2.91    0.004    -19.02665     -3.70492
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          18.497
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):              221.575
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 7

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     0.01
                                                      Prob > F      =   0.9208
Total (centered) SS     =  6373.822477                Centered R2   = -1.3e+03
Total (uncentered) SS   =  51680.45432                Uncentered R2 = -1.6e+02
Residual SS             =  8340984.543                Root MSE      =    645.8

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    20.21339    190.2317      0.11    0.915    -352.6339     393.0607
       _cons |   -2980.169    28495.17     -0.10    0.917    -58829.68     52869.35
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           0.011
                                                   Chi-sq(1) P-val =    0.9158
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                0.010
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 8

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =    31.33
                                                      Prob > F      =   0.0000
Total (centered) SS     =  6938.786873                Centered R2   =   0.6703
Total (uncentered) SS   =  43732.40264                Uncentered R2 =   0.9477
Residual SS             =  2287.765808                Root MSE      =     10.7

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .0877782    .0148763      5.90    0.000     .0586212     .1169352
       _cons |   -15.99976    10.26318     -1.56    0.119    -36.11522     4.115711
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          11.001
                                                   Chi-sq(1) P-val =    0.0009
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               22.004
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 9

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =    12.85
                                                      Prob > F      =   0.0021
Total (centered) SS     =  4207.536721                Centered R2   =   0.2039
Total (uncentered) SS   =  39301.30352                Uncentered R2 =   0.9148
Residual SS             =  3349.675955                Root MSE      =    12.94

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |    .2398443    .0634648      3.78    0.000     .1154555      .364233
       _cons |   -38.13504    21.37186     -1.78    0.074    -80.02311     3.753025
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           7.334
                                                   Chi-sq(1) P-val =    0.0068
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               10.422
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------

-------------
-> company = 10

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       20
                                                      F(  1,    18) =     0.41
                                                      Prob > F      =   0.5320
Total (centered) SS     =  56.12209548                Centered R2   = -27.4772
Total (uncentered) SS   =  246.4049012                Uncentered R2 =  -5.4861
Residual SS             =  1598.199674                Root MSE      =    8.939

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |   -.9895471    1.473032     -0.67    0.502    -3.876638     1.897543
       _cons |    73.26417    104.4881      0.70    0.483    -131.5287      278.057
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           0.451
                                                   Chi-sq(1) P-val =    0.5019
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                0.415
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------
r; t=1.41 20:12:57

. savedresults comp ivby e(), include(macros: instd depvar scalar: N matrix: b V)  tol(1e-7) verbose
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:12:57

.
. * 1.0.10 test bootstrap
. set seed 20070203
r; t=0.00 20:12:57

. bootstrap, reps(100) saving(ivbs,replace): ivreg invest (mvalue= kstock)
(running ivreg on estimation sample)

Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..................................................   100

Instrumental variables (2SLS) regression        Number of obs      =       200
                                                Replications       =       100
                                                Wald chi2(1)       =     93.13
                                                Prob > chi2        =    0.0000
                                                R-squared          =    0.4855
                                                Adj R-squared      =    0.4829
                                                Root MSE           =  155.9525

 -------------+----------------------------------------------------------------
             |   Observed    Bootstrap                        Normal-based
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |     .223687    .0231794      9.65    0.000     .1782562     .2691178
       _cons |   -95.99972     25.9316     -3.70    0.000    -146.8247    -45.17473
 -------------+----------------------------------------------------------------


Instrumented:  mvalue


Instruments:   kstock


------------------------------------------------------------------------------
r; t=1.32 20:12:58

. set seed 20070203
r; t=0.00 20:12:58

. bootstrap, reps(100) saving(iv2bs,replace): ivreg2 invest (mvalue= kstock)
(running ivreg2 on estimation sample)

Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..................................................   100

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      200
                                                      F(  1,   198) =        .
                                                      Prob > F      =   0.0000
Total (centered) SS     =  9359943.917                Centered R2   =   0.4855
Total (uncentered) SS   =  13620706.07                Uncentered R2 =   0.6465
Residual SS             =  4815592.122                Root MSE      =    155.2

 -------------+----------------------------------------------------------------
             |   Observed    Bootstrap                        Normal-based
       invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
      mvalue |     .223687    .0231794      9.65    0.000     .1782562     .2691178
       _cons |   -95.99972     25.9316     -3.70    0.000    -146.8247    -45.17473
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             47.767
                                                   Chi-sq(1) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         62.127
Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                         15% maximal IV size              8.96
                                         20% maximal IV size              6.66
                                         25% maximal IV size              5.53
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.000
                                                 (equation exactly identified)
------------------------------------------------------------------------------
Instrumented:         mvalue
Excluded instruments: kstock
------------------------------------------------------------------------------
r; t=5.32 20:13:03

. use iv2bs,clear
(bootstrap: ivreg2)
r; t=0.00 20:13:03

. cf _all using ivbs
r; t=0.21 20:13:04

.
. * 1.0.10 test jackknife
. webuse grunfeld, clear
r; t=0.29 20:13:04

. set seed 20070203
r; t=0.00 20:13:04

. jackknife _b _se, eclass: ivreg invest (mvalue= kstock)
(running ivreg on estimation sample)

Jackknife replications (200)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..................................................   100
..................................................   150
..................................................   200

Jackknife results                               Number of obs      =       200
                                                Replications       =       200

 -------------+----------------------------------------------------------------
             |               Jackknife
             |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
b            |
      mvalue |     .223687     .025994      8.61    0.000      .172428      .274946
       _cons |   -95.99972    28.05725     -3.42    0.001    -151.3274    -40.67205
 -------------+----------------------------------------------------------------
se           |
      mvalue |    .0172095      .00521      3.30    0.001     .0069356     .0274833
       _cons |    21.63632    5.514405      3.92    0.000     10.76215     32.51048
 -------------+----------------------------------------------------------------
r; t=1.57 20:13:06

. savedresults save ivjk e()
r; t=0.00 20:13:06

. set seed 20070203
r; t=0.00 20:13:06

. jackknife _b _se, eclass: ivreg2 invest (mvalue= kstock), small
(running ivreg2 on estimation sample)

Jackknife replications (200)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..................................................   100
..................................................   150
..................................................   200

Jackknife results                               Number of obs      =       200
                                                Replications       =       200

 -------------+----------------------------------------------------------------
             |               Jackknife
             |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
b            |
      mvalue |     .223687     .025994      8.61    0.000      .172428      .274946
       _cons |   -95.99972    28.05725     -3.42    0.001    -151.3274    -40.67205
 -------------+----------------------------------------------------------------
se           |
      mvalue |    .0172095      .00521      3.30    0.001     .0069356     .0274833
       _cons |    21.63632    5.514405      3.92    0.000     10.76215     32.51048
 -------------+----------------------------------------------------------------
r; t=10.00 20:13:16

. savedresults compare ivjk e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:13:16

.
. * 1.0.10 test svy (jackknife) FAILS
. // use http://www.stata-press.com/data/r9/hsng2.dta, clear
. // svyset _n
. // set seed 20070203
. // svy: ivreg rent pcturban (hsngval = faminc reg2-reg4), vce(jackknife)
. // savedresults save ivsj e()
. // set seed 20070203
. // svy: ivreg2 rent pcturban (hsngval = faminc reg2-reg4) // , vce(jackknife)
. // savedresults compare ivsj e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
.
. * 1.0.13 test HAC with aw (vs Stata 10 ivregress)
. if c(version) >= 10 {
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta, clear
r; t=0.04 20:13:16
. tsset year,yearly
        time variable:   year, 1948 to 1996
                delta:  1 year
r; t=0.00 20:13:16
. ivregress 2sls cinf unem [aw=year], vce(hac bartlett 2)  small
(sum of wgt is   9.4680e+04)

 Instrumental variables (2SLS) regression              Number of obs =      48
                                                       F(  1,    46) =    6.08
                                                       Prob > F      =  0.0174
                                                       R-squared     =  0.1089
                                                       Adj R-squared =  0.0895
                                                       Root MSE      =  2.4426

 -------------+----------------------------------------------------------------
             |                  HAC
         cinf |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.5439774    .2205366     -2.47    0.017    -.9878946    -.1000602
       _cons |    3.042442    1.384731      2.20    0.033      .255123     5.829762
 -------------+----------------------------------------------------------------
(no endogenous regressors)
HAC VCE:       Bartlett kernel with 2 lags
r; t=0.10 20:13:16
. savedresults save ivhacaw1 e()
r; t=0.00 20:13:16
. ivreg2 cinf unem [aw=year], bw(3)  robust small
(sum of wgt is     9.4680e+04)

OLS estimation
--------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=     3
  time variable (t):  year

                                                      Number of obs =       48
                                                      F(  1,    46) =     6.08
                                                      Prob > F      =   0.0174
Total (centered) SS     =  307.9870366                Centered R2   =   0.1089
Total (uncentered) SS   =  308.5213273                Uncentered R2 =   0.1104
Residual SS             =  274.4525197                Root MSE      =    2.443

 -------------+----------------------------------------------------------------
             |                Robust
         cinf |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.5439774    .2205366     -2.47    0.017    -.9878946    -.1000602
       _cons |    3.042442    1.384731      2.20    0.033      .255123     5.829762
 -------------+----------------------------------------------------------------
Included instruments: unem
------------------------------------------------------------------------------
r; t=0.12 20:13:16
. savedresults compare ivhacaw1 e(), include(macros: depvar scalar: N matrix: b V) tol(1e-6) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:13:16
.
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta, clear
r; t=0.04 20:13:16
. tsset year,yearly
        time variable:   year, 1948 to 1996
                delta:  1 year
r; t=0.00 20:13:16
. ivregress 2sls cinf (unem=L(1/2).unem) [aw=year], vce(hac bartlett 2)  small
(sum of wgt is   9.2731e+04)

 Instrumental variables (2SLS) regression              Number of obs =      47
                                                       F(  1,    45) =    1.59
                                                       Prob > F      =  0.2142
                                                       R-squared     =  0.1378
                                                       Adj R-squared =  0.1186
                                                       Root MSE      =  2.0654

 -------------+----------------------------------------------------------------
             |                  HAC
         cinf |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.4114151    .3265695     -1.26    0.214     -1.06916     .2463295
       _cons |    2.467587    1.983225      1.24    0.220    -1.526833     6.462007
 -------------+----------------------------------------------------------------


Instrumented:  unem


Instruments:   L.unem L2.unem


HAC VCE:       Bartlett kernel with 2 lags
r; t=0.12 20:13:16
. savedresults save ivhacaw2 e()
r; t=0.00 20:13:16
. ivreg2 cinf (unem=L(1/2).unem) [aw=year], bw(3)  robust small
(sum of wgt is     9.2731e+04)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=     3
  time variable (t):  year

                                                      Number of obs =       47
                                                      F(  1,    45) =     1.59
                                                      Prob > F      =   0.2142
Total (centered) SS     =  222.6433667                Centered R2   =   0.1378
Total (uncentered) SS   =   223.005221                Uncentered R2 =   0.1392
Residual SS             =  191.9690814                Root MSE      =    2.065

 -------------+----------------------------------------------------------------
             |                Robust
         cinf |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.4114151    .3265695     -1.26    0.214     -1.06916     .2463295
       _cons |    2.467587    1.983225      1.24    0.220    -1.526833     6.462007
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              6.058
                                                   Chi-sq(2) P-val =    0.0484
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         38.172
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         2.899
                                                   Chi-sq(1) P-val =    0.0886
------------------------------------------------------------------------------
Instrumented:         unem
Excluded instruments: L.unem L2.unem
------------------------------------------------------------------------------
r; t=0.78 20:13:17
. savedresults compare ivhacaw2 e(), include(macros: depvar scalar: N matrix: b V) tol(1e-6) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:13:17
. }
r; t=1.25 20:13:17

.
. * test partial() with TS ops
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta, clear
r; t=0.04 20:13:17

. tsset year,yearly
        time variable:   year, 1948 to 1996
                delta:  1 year
r; t=0.00 20:13:17

. rcof "noi ivreg2 cinf (unem=L(1/2).unem) L.year, partial(L.year)" == 101
factor variables and time-series operators not allowed
r; t=0.03 20:13:17

.
. * test absence of ranktest (specific to Mac OS X file location)
. if "$S_OS" == "MacOSX" & c(version)>=10 {
.     findfile ranktest.ado
~/library/application support/stata/ado/plus/r/ranktest.ado
r; t=0.00 20:13:17
.     cd ~
/Users/baum/
r; t=0.00 20:13:17
.     cd "library/application support/stata/ado/plus/r"
/Users/baum/Library/Application Support/Stata/ado/plus/r/
r; t=0.00 20:13:17
.     !mv ranktest.ado ranktest.ado.disabled

r; t=0.05 20:13:17
.     program drop _all
r; t=0.00 20:13:17
.     rcof "noi ivreg2 cinf (unem=L(1/2).unem) [aw=year], bw(3)  robust small" == 601
Error: must have ranktest version 01.1.03 or greater installed
To install, from within Stata type ssc install ranktest
r; t=0.03 20:13:17
.     !mv ranktest.ado.disabled ranktest.ado

r; t=0.01 20:13:17
. }
r; t=0.11 20:13:17

.
. * 1.0.10 test statsby
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta, clear
r; t=0.04 20:13:17

. tsset year,yearly
        time variable:   year, 1948 to 1996
                delta:  1 year
r; t=0.05 20:13:17

. egen quin = cut(year),group(7)
r; t=0.07 20:13:17

. statsby _b _se, by(quin) saving(quin,replace): ivreg unem (inf=L.inf L2.inf)
(running ivreg on estimation sample)


command:  ivreg unem (inf=L.inf L2.inf)


           by:  quin

Statsby groups
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.......
r; t=0.12 20:13:17

. statsby _b _se, by(quin) saving(quin2,replace): ivreg2 unem (inf=L.inf L2.inf), small
(running ivreg2 on estimation sample)


command:  ivreg2 unem (inf=L.inf L2.inf), small


           by:  quin

Statsby groups
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.......
r; t=0.67 20:13:18

. use quin2,clear
(statsby: ivreg2)
r; t=0.00 20:13:18

. cf _all using quin
r; t=0.01 20:13:18

.
. * 1.0.10 test rolling
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta, clear
r; t=0.05 20:13:18

. tsset year,yearly
        time variable:   year, 1948 to 1996
                delta:  1 year
r; t=0.00 20:13:18

. rolling, window(10) saving(rolliv,replace): ivreg unem (inf=L.inf L2.inf)
(running ivreg on estimation sample)

Rolling replications (40)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
........................................
file rolliv.dta saved
r; t=0.33 20:13:18

. rolling, window(10) saving(rolliv2,replace): ivreg2 unem (inf=L.inf L2.inf), small
(running ivreg2 on estimation sample)

Rolling replications (40)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
........................................
file rolliv2.dta saved
r; t=1.97 20:13:20

. use rolliv2
(rolling: ivreg2)
r; t=0.00 20:13:20

. cf _all using rolliv
r; t=0.00 20:13:20

.
. * 1.0.7 test fweights
. use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta,clear
(Wages of Very Young Men, Zvi Griliches, J.Pol.Ec. 1976)
r; t=0.14 20:13:20

. ivreg2 lw80 expr80 tenure80 rns80 smsa80 (s80 = med kww) [fw=age], ffirst gmm2s
(sum of wgt is     1.6551e+04)


Summary results for first-stage regressions
-------------------------------------------

Variable    | Shea Partial R2 |   Partial R2    |  F (   2, 16544)    P-value
s80          |    0.2305      |     0.2305      |     2477.47       0.0000

Underidentification tests
Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
Ha: matrix has rank=K1 (identified)
Anderson canon. corr. N*CCEV LM statistic   Chi-sq(2)=3814.57  P-val=0.0000
Cragg-Donald N*CDEV Wald statistic          Chi-sq(2)=4957.04  P-val=0.0000

Weak identification test
Ho: equation is weakly identified
Cragg-Donald Wald F-statistic                    2477.47
See main output for Cragg-Donald weak id test critical values

Weak-instrument-robust inference
Tests of joint significance of endogenous regressors B1 in main equation
Ho: B1=0 and overidentifying restrictions are valid
Anderson-Rubin Wald test     F(2,16544)= 936.55  P-val=0.0000
Anderson-Rubin Wald test     Chi-sq(2)= 1873.89  P-val=0.0000
Stock-Wright LM S statistic  Chi-sq(2)= 1683.31  P-val=0.0000

Number of observations               N  =      16551
Number of regressors                 K  =          6
Number of instruments                L  =          7
Number of excluded instruments       L1 =          2

2-Step GMM estimation
---------------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =    16551
                                                      F(  5, 16545) =   675.08
                                                      Prob > F      =   0.0000
Total (centered) SS     =  2762.975861                Centered R2   =   0.1278
Total (uncentered) SS   =   776929.016                Uncentered R2 =   0.9969
Residual SS             =  2409.991856                Root MSE      =    .3816

 -------------+----------------------------------------------------------------
         lw80 |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
         s80 |    .1306858    .0031105     42.01    0.000     .1245894     .1367822
      expr80 |    .0358413    .0010795     33.20    0.000     .0337256     .0379571
    tenure80 |    .0049926    .0006208      8.04    0.000     .0037758     .0062094
       rns80 |   -.0465008    .0066264     -7.02    0.000    -.0594883    -.0335134
      smsa80 |    .1738141    .0066705     26.06    0.000     .1607403      .186888
       _cons |    4.473525    .0520023     86.03    0.000     4.371602     4.575447
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):        3814.574
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             2477.473
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.731
                                                   Chi-sq(1) P-val =    0.3926
------------------------------------------------------------------------------
Instrumented:         s80
Included instruments: expr80 tenure80 rns80 smsa80
Excluded instruments: med kww
------------------------------------------------------------------------------
r; t=0.29 20:13:21

. savedresults save fw e()
r; t=0.00 20:13:21

. expand age
(15793 observations created)
r; t=7.22 20:13:28

. ivreg2 lw80 expr80 tenure80 rns80 smsa80 (s80 = med kww), ffirst gmm2s


Summary results for first-stage regressions
-------------------------------------------

Variable    | Shea Partial R2 |   Partial R2    |  F (   2, 16544)    P-value
s80          |    0.2305      |     0.2305      |     2477.47       0.0000

Underidentification tests
Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
Ha: matrix has rank=K1 (identified)
Anderson canon. corr. N*CCEV LM statistic   Chi-sq(2)=3814.57  P-val=0.0000
Cragg-Donald N*CDEV Wald statistic          Chi-sq(2)=4957.04  P-val=0.0000

Weak identification test
Ho: equation is weakly identified
Cragg-Donald Wald F-statistic                    2477.47
See main output for Cragg-Donald weak id test critical values

Weak-instrument-robust inference
Tests of joint significance of endogenous regressors B1 in main equation
Ho: B1=0 and overidentifying restrictions are valid
Anderson-Rubin Wald test     F(2,16544)= 936.55  P-val=0.0000
Anderson-Rubin Wald test     Chi-sq(2)= 1873.89  P-val=0.0000
Stock-Wright LM S statistic  Chi-sq(2)= 1683.31  P-val=0.0000

Number of observations               N  =      16551
Number of regressors                 K  =          6
Number of instruments                L  =          7
Number of excluded instruments       L1 =          2

2-Step GMM estimation
---------------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =    16551
                                                      F(  5, 16545) =   675.08
                                                      Prob > F      =   0.0000
Total (centered) SS     =  2762.975861                Centered R2   =   0.1278
Total (uncentered) SS   =   776929.016                Uncentered R2 =   0.9969
Residual SS             =  2409.991856                Root MSE      =    .3816

 -------------+----------------------------------------------------------------
         lw80 |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
         s80 |    .1306858    .0031105     42.01    0.000     .1245894     .1367822
      expr80 |    .0358413    .0010795     33.20    0.000     .0337256     .0379571
    tenure80 |    .0049926    .0006208      8.04    0.000     .0037758     .0062094
       rns80 |   -.0465008    .0066264     -7.02    0.000    -.0594883    -.0335134
      smsa80 |    .1738141    .0066705     26.06    0.000     .1607403      .186888
       _cons |    4.473525    .0520023     86.03    0.000     4.371602     4.575447
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):        3814.574
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):             2477.473
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.731
                                                   Chi-sq(1) P-val =    0.3926
------------------------------------------------------------------------------
Instrumented:         s80
Included instruments: expr80 tenure80 rns80 smsa80
Excluded instruments: med kww
------------------------------------------------------------------------------
r; t=0.93 20:13:29

. savedresults comp fw e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:13:29

. qui duplicates drop
r; t=0.37 20:13:29

.
. * sw option for within estimator
. webuse grunfeld, clear
r; t=0.31 20:13:30

. center invest mvalue kstock time, casewise double
r; t=0.07 20:13:30

. ivreg2  c_invest (c_mvalue=c_kstock c_time) , robust sw i(company) nocons dofminus(10)

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

Estimates efficient for homoskedasticity only
Stock-Watson heteroskedastic-robust statistics (BETA VERSION)

                                                      Number of obs =      200
                                                      F(  1,   189) =    79.16
                                                      Prob > F      =   0.0000
Total (centered) SS     =  9359943.917                Centered R2   =   0.5883
Total (uncentered) SS   =  9359943.917                Uncentered R2 =   0.5883
Residual SS             =  3853579.492                Root MSE      =    142.4

 -------------+----------------------------------------------------------------
             |                Robust
     c_invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
    c_mvalue |    .2044383    .0229166      8.92    0.000     .1595225     .2493541
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             10.398
                                                   Chi-sq(2) P-val =    0.0055
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         53.782
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         8.089
                                                   Chi-sq(1) P-val =    0.0045
------------------------------------------------------------------------------
Instrumented:         c_mvalue
Excluded instruments: c_kstock c_time
------------------------------------------------------------------------------
r; t=0.10 20:13:30

. ivreg2  c_invest (c_mvalue=c_kstock c_time) , robust gmm2s sw i(company) nocons dofminus(10)

2-Step GMM estimation
---------------------

Estimates efficient for arbitrary heteroskedasticity
Stock-Watson heteroskedastic-robust statistics (BETA VERSION)

                                                      Number of obs =      200
                                                      F(  1,   189) =    71.84
                                                      Prob > F      =   0.0000
Total (centered) SS     =  9359943.917                Centered R2   =   0.6484
Total (uncentered) SS   =  9359943.917                Uncentered R2 =   0.6484
Residual SS             =  3290546.276                Root MSE      =    131.6

 -------------+----------------------------------------------------------------
             |                Robust
     c_invest |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
    c_mvalue |    .1897398    .0223263      8.50    0.000     .1459811     .2334986
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             10.398
                                                   Chi-sq(2) P-val =    0.0055
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         53.782
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         8.089
                                                   Chi-sq(1) P-val =    0.0045
------------------------------------------------------------------------------
Instrumented:         c_mvalue
Excluded instruments: c_kstock c_time
------------------------------------------------------------------------------
r; t=0.10 20:13:30

.
. * ensure no inappropriate dropping of endog. regressors
.
. qui {
r; t=0.00 20:13:30

. ivreg invest li2 (li1 lk1 dlk1 = lk2 lk3 lk4 lk5)

Instrumental variables (2SLS) regression

      Source |       SS       df       MS              Number of obs =     150
-------------+------------------------------           F(  4,   145) =  553.62
       Model |  7901710.45     4  1975427.61           Prob > F      =  0.0000
    Residual |  500872.864   145  3454.29561           R-squared     =  0.9404
-------------+------------------------------           Adj R-squared =  0.9387
       Total |  8402583.31   149  56393.1766           Root MSE      =  58.773

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
         li1 |    .8137191    .4644613      1.75    0.082    -.1042699     1.731708
         lk1 |    .1494245    .0507281      2.95    0.004     .0491625     .2496866
        dlk1 |   -1.004987    .3609646     -2.78    0.006    -1.718419    -.2915551
         li2 |     .349771     .525725      0.67    0.507    -.6893033     1.388845
       _cons |   -23.53724    10.45931     -2.25    0.026    -44.20965    -2.864832
 -------------+----------------------------------------------------------------


Instrumented:  li1 lk1 dlk1


Instruments:   li2 lk2 lk3 lk4 lk5


------------------------------------------------------------------------------
r; t=0.09 20:13:30

. overid

Tests of overidentifying restrictions:
Sargan N*R-sq test        4.065  Chi-sq(1)    P-value = 0.0438
Basmann test              4.011  Chi-sq(1)    P-value = 0.0452
r; t=0.13 20:13:30

. savedresults save fabio1 e()
r; t=0.00 20:13:30

. ivreg2 invest li2 (li1 lk1 dlk1 = lk2 lk3 lk4 lk5), small

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      150
                                                      F(  4,   145) =   553.62
                                                      Prob > F      =   0.0000
Total (centered) SS     =   8402583.31                Centered R2   =   0.9404
Total (uncentered) SS   =  12450935.38                Uncentered R2 =   0.9598
Residual SS             =  500872.8636                Root MSE      =    58.77

 -------------+----------------------------------------------------------------
       invest |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
         li1 |    .8137191    .4644613      1.75    0.082    -.1042699     1.731708
         lk1 |    .1494245    .0507281      2.95    0.004     .0491625     .2496866
        dlk1 |   -1.004987    .3609646     -2.78    0.006    -1.718419    -.2915551
         li2 |     .349771     .525725      0.67    0.507    -.6893033     1.388845
       _cons |   -23.53724    10.45931     -2.25    0.026    -44.20965    -2.864832
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):           6.945
                                                   Chi-sq(2) P-val =    0.0310
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                1.748
Stock-Yogo weak ID test critical values:                       <not available>
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           4.065
                                                   Chi-sq(1) P-val =    0.0438
------------------------------------------------------------------------------
Instrumented:         li1 lk1 dlk1
Included instruments: li2
Excluded instruments: lk2 lk3 lk4 lk5
------------------------------------------------------------------------------
r; t=0.15 20:13:30

. assert "`e(collin)'" == ""
r; t=0.00 20:13:30

. savedresults compare fabio1 e(), include(macros: inst instd depvar scalar:N matrix: b) tol(1e-7)
r; t=0.00 20:13:30

.
. * HAC option, with explicit and auto bw
.
. use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips.dta, clear
r; t=0.21 20:13:31

. tsset year, yearly
        time variable:   year, 1948 to 1996
                delta:  1 year
r; t=0.05 20:13:31

. which newey
/Applications/Stata/ado/base/n/newey.ado
*! version 1.5.5  22jun2009
r; t=0.06 20:13:31

. newey cinf unem, lag(2)

Regression with Newey-West standard errors          Number of obs  =        48
maximum lag: 2                                      F(  1,    46)  =      6.00
                                                    Prob > F       =    0.0182

 -------------+----------------------------------------------------------------
             |              Newey-West
         cinf |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.5425869    .2214815     -2.45    0.018     -.988406    -.0967679
       _cons |    3.030581    1.389486      2.18    0.034     .2336905     5.827471
 -------------+----------------------------------------------------------------
r; t=0.09 20:13:31

. savedresults save newey e()
r; t=0.00 20:13:31

. ivreg2 cinf unem, bw(3) kernel(bartlett) robust small

OLS estimation
--------------

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=     3
  time variable (t):  year

                                                      Number of obs =       48
                                                      F(  1,    46) =     6.00
                                                      Prob > F      =   0.0182
Total (centered) SS     =  309.6881289                Centered R2   =   0.1078
Total (uncentered) SS   =  310.2300041                Uncentered R2 =   0.1094
Residual SS             =  276.3051302                Root MSE      =    2.451

 -------------+----------------------------------------------------------------
             |                Robust
         cinf |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.5425869    .2214815     -2.45    0.018     -.988406    -.0967679
       _cons |    3.030581    1.389486      2.18    0.034     .2336905     5.827471
 -------------+----------------------------------------------------------------
Included instruments: unem
------------------------------------------------------------------------------
r; t=0.09 20:13:31

. savedresults comp newey e(), include(macros: depvar scalar: N matrix: b V) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:13:31

.
. ivreg2 cinf (unem=L(1/2).unem), bw(auto)

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

Estimates efficient for homoskedasticity only
Statistics robust to autocorrelation
  kernel=Bartlett; bandwidth=    17
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  year

                                                      Number of obs =       47
                                                      F(  1,    45) =     3.49
                                                      Prob > F      =   0.0683
Total (centered) SS     =  223.3646815                Centered R2   =   0.1362
Total (uncentered) SS   =  223.7400005                Uncentered R2 =   0.1376
Residual SS             =  192.9432814                Root MSE      =    2.026

 -------------+----------------------------------------------------------------
         cinf |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.4079928    .2137385     -1.91    0.056    -.8269125      .010927
       _cons |    2.447039    1.248642      1.96    0.050    -.0002538     4.894332
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             15.269
                                                   Chi-sq(2) P-val =    0.0005
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         29.145
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           3.445
                                                   Chi-sq(1) P-val =    0.0635
------------------------------------------------------------------------------
Instrumented:         unem
Excluded instruments: L.unem L2.unem
------------------------------------------------------------------------------
r; t=3.08 20:13:34

. ivreg2 cinf (unem=L(1/2).unem), bw(auto) kernel(par)

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

Estimates efficient for homoskedasticity only
Statistics robust to autocorrelation
  kernel=Parzen; bandwidth=    18
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  year

                                                      Number of obs =       47
                                                      F(  1,    45) =     3.60
                                                      Prob > F      =   0.0642
Total (centered) SS     =  223.3646815                Centered R2   =   0.1362
Total (uncentered) SS   =  223.7400005                Uncentered R2 =   0.1376
Residual SS             =  192.9432814                Root MSE      =    2.026

 -------------+----------------------------------------------------------------
         cinf |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.4079928     .210372     -1.94    0.052    -.8203143     .0043287
       _cons |    2.447039    1.227558      1.99    0.046     .0410701     4.853008
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             15.415
                                                   Chi-sq(2) P-val =    0.0004
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         29.356
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           3.438
                                                   Chi-sq(1) P-val =    0.0637
------------------------------------------------------------------------------
Instrumented:         unem
Excluded instruments: L.unem L2.unem
------------------------------------------------------------------------------
r; t=3.25 20:13:37

. ivreg2 cinf unem, bw(auto) kernel(qua)
Computing kernel ...

OLS estimation
--------------

Estimates efficient for homoskedasticity only
Statistics robust to autocorrelation
  kernel=Quadratic spectral; bandwidth=    16
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  year

                                                      Number of obs =       48
                                                      F(  1,    46) =     7.20
                                                      Prob > F      =   0.0101
Total (centered) SS     =  309.6881289                Centered R2   =   0.1078
Total (uncentered) SS   =  310.2300041                Uncentered R2 =   0.1094
Residual SS             =  276.3051302                Root MSE      =    2.399

 -------------+----------------------------------------------------------------
         cinf |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.5425869    .1980143     -2.74    0.006    -.9306879     -.154486
       _cons |    3.030581    1.187293      2.55    0.011     .7035291     5.357632
 -------------+----------------------------------------------------------------
Included instruments: unem
------------------------------------------------------------------------------
r; t=0.22 20:13:37

. ivreg2 cinf (unem=L(1/2).unem), bw(auto) kernel(qua)
Computing kernel ...

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

Estimates efficient for homoskedasticity only
Statistics robust to autocorrelation
  kernel=Quadratic spectral; bandwidth=   9.1
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  year

                                                      Number of obs =       47
                                                      F(  1,    45) =     3.61
                                                      Prob > F      =   0.0637
Total (centered) SS     =  223.3646815                Centered R2   =   0.1362
Total (uncentered) SS   =  223.7400005                Uncentered R2 =   0.1376
Residual SS             =  192.9432814                Root MSE      =    2.026

 -------------+----------------------------------------------------------------
         cinf |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        unem |   -.4079928    .2099958     -1.94    0.052     -.819577     .0035914
       _cons |    2.447039    1.224977      2.00    0.046     .0461277     4.847951
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):             15.471
                                                   Chi-sq(2) P-val =    0.0004
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         29.505
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           3.457
                                                   Chi-sq(1) P-val =    0.0630
------------------------------------------------------------------------------
Instrumented:         unem
Excluded instruments: L.unem L2.unem
------------------------------------------------------------------------------
r; t=5.06 20:13:42

.
. * equivalence of ivendog and orthog option (Wooldridge 2002, pp.59, 61)
.
. use http://fmwww.bc.edu/ec-p/data/wooldridge/mroz.dta
r; t=0.16 20:13:43

.  ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =     7.49
                                                      Prob > F      =   0.0001
Total (centered) SS     =  223.3274513                Centered R2   =   0.1556
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7727
Residual SS             =  188.5780571                Root MSE      =    .6638

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0964002    .0814278      1.18    0.236    -.0631952     .2559957
       exper |     .042193    .0138831      3.04    0.002     .0149827     .0694033
     expersq |   -.0008323    .0004204     -1.98    0.048    -.0016563    -8.33e-06
       _cons |   -.3848718    1.011551     -0.38    0.704    -2.367476     1.597732
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          12.816
                                                   Chi-sq(3) P-val =    0.0051
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                4.342
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    13.91
                                         10% maximal IV relative bias     9.08
                                         20% maximal IV relative bias     6.46
                                         30% maximal IV relative bias     5.39
                                         10% maximal IV size             22.30
                                         15% maximal IV size             12.83
                                         20% maximal IV size              9.54
                                         25% maximal IV size              7.80
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.702
                                                   Chi-sq(2) P-val =    0.7042
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: exper expersq
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=0.21 20:13:43

. // CANNOT EXEC WITH ivreg2--NOT SET UP TO RUN > ivreg2
. /*
>  which ivendog
>  ivendog educ
>  local rdf = r(df)
>  local dwh = r(DWH)
>  local dwhp = r(DWHp)
>  ivreg2 lwage exper expersq educ (=age kidslt6 kidsge6), orthog(educ)
>  assert `rdf' == e(cstatdf)
>  assert reldif(`dwh',e(cstat)) < 1.0e-5
>  assert reldif(`dwhp',e(cstatp)) < 1.0e-5
> */
.
. * equivalence of coviv+liml and cue options
.  ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), liml coviv

LIML estimation
---------------
k               =1.00164
lambda          =1.00164

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =     7.49
                                                      Prob > F      =   0.0001
Total (centered) SS     =  223.3274513                Centered R2   =   0.1555
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7726
Residual SS             =  188.6105763                Root MSE      =    .6638

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0957581    .0814348      1.18    0.240    -.0638511     .2553674
       exper |    .0422292    .0138843      3.04    0.002     .0150166     .0694419
     expersq |   -.0008335    .0004204     -1.98    0.047    -.0016576    -9.48e-06
       _cons |   -.3769294    1.011638     -0.37    0.709    -2.359704     1.605845
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          12.816
                                                   Chi-sq(3) P-val =    0.0051
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                4.342
Stock-Yogo weak ID test critical values: 10% maximal LIML size            6.46
                                         15% maximal LIML size            4.36
                                         20% maximal LIML size            3.69
                                         25% maximal LIML size            3.32
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.701
                                                   Chi-sq(2) P-val =    0.7042
------------------------------------------------------------------------------
Anderson-Rubin statistic (overidentification test of all instruments):   0.702
                                                   Chi-sq(2) P-val =    0.7040
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: exper expersq
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=0.13 20:13:43

.  savedresults save limlcov e()
r; t=0.00 20:13:43

.  ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), cue

initial:       neg GMM obj function -J = -.70151243
rescale:       neg GMM obj function -J = -.70151243
Iteration 0:   neg GMM obj function -J = -.70151243
Iteration 1:   neg GMM obj function -J = -.70145365
Iteration 2:   neg GMM obj function -J = -.70145365

CUE estimation
--------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =     7.49
                                                      Prob > F      =   0.0001
Total (centered) SS     =  223.3274513                Centered R2   =   0.1555
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7726
Residual SS             =  188.6105763                Root MSE      =    .6638

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0957581    .0814348      1.18    0.240    -.0638511     .2553674
       exper |    .0422292    .0138843      3.04    0.002     .0150166     .0694419
     expersq |   -.0008335    .0004204     -1.98    0.047    -.0016576    -9.48e-06
       _cons |   -.3769294    1.011638     -0.37    0.709    -2.359704     1.605845
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          12.816
                                                   Chi-sq(3) P-val =    0.0051
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                4.342
Stock-Yogo weak ID test critical values: 10% maximal LIML size            6.46
                                         15% maximal LIML size            4.36
                                         20% maximal LIML size            3.69
                                         25% maximal LIML size            3.32
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.701
                                                   Chi-sq(2) P-val =    0.7042
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: exper expersq
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=2.85 20:13:46

.  savedresults comp limlcov e(), include(macros: inst instd depvar scalar: N rmse matrix: b V)  tol(1e-7) verbose
comparing macro  e(inst)
comparing macro  e(instd)
comparing macro  e(depvar)
comparing scalar e(N)
comparing scalar e(rmse)
comparing matrix e(b)
comparing matrix e(V)
r; t=0.00 20:13:46

. * savedresults save ols e()
. ivreg2 lwage exper expersq educ (=age kidslt6 kidsge6),small

OLS estimation
--------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =    26.29
                                                      Prob > F      =   0.0000
Total (centered) SS     =  223.3274513                Centered R2   =   0.1568
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7730
Residual SS             =  188.3051489                Root MSE      =    .6664

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
       exper |    .0415665    .0131752      3.15    0.002     .0156697     .0674633
     expersq |   -.0008112    .0003932     -2.06    0.040    -.0015841    -.0000382
        educ |    .1074896    .0141465      7.60    0.000     .0796837     .1352956
       _cons |   -.5220407    .1986321     -2.63    0.009    -.9124668    -.1316145
 -------------+----------------------------------------------------------------
Sargan statistic (Lagrange multiplier test of excluded instruments):     0.722
                                                   Chi-sq(3) P-val =    0.8681
------------------------------------------------------------------------------
Included instruments: exper expersq educ
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=0.11 20:13:46

. * savedresults comp ols e(), include(macros: depvar scalar: N df_r matrix: b V) tol(1e-7) verbose
.
. * 1.0.13 cue with nocons
.  ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), cue nocons

initial:       neg GMM obj function -J =  -.5040751
rescale:       neg GMM obj function -J =  -.5040751
Iteration 0:   neg GMM obj function -J =  -.5040751
Iteration 1:   neg GMM obj function -J = -.50406949
Iteration 2:   neg GMM obj function -J = -.50406949

CUE estimation
--------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   425) =   448.37
                                                      Prob > F      =   0.0000
Total (centered) SS     =  223.3274513                Centered R2   =   0.1377
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7679
Residual SS             =  192.5827982                Root MSE      =    .6708

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0636867    .0082765      7.69    0.000     .0474652     .0799083
       exper |    .0465055    .0145299      3.20    0.001     .0180274     .0749835
     expersq |   -.0009571    .0004262     -2.25    0.025    -.0017926    -.0001217
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):         283.708
                                                   Chi-sq(3) P-val =    0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):              277.235
Stock-Yogo weak ID test critical values: 10% maximal LIML size            6.46
                                         15% maximal LIML size            4.36
                                         20% maximal LIML size            3.69
                                         25% maximal LIML size            3.32
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.504
                                                   Chi-sq(2) P-val =    0.7772
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: exper expersq
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=1.98 20:13:48

.
. * 1.0.13 b0 option
. ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6)

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

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =     7.49
                                                      Prob > F      =   0.0001
Total (centered) SS     =  223.3274513                Centered R2   =   0.1556
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7727
Residual SS             =  188.5780571                Root MSE      =    .6638

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0964002    .0814278      1.18    0.236    -.0631952     .2559957
       exper |     .042193    .0138831      3.04    0.002     .0149827     .0694033
     expersq |   -.0008323    .0004204     -1.98    0.048    -.0016563    -8.33e-06
       _cons |   -.3848718    1.011551     -0.38    0.704    -2.367476     1.597732
 -------------+----------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          12.816
                                                   Chi-sq(3) P-val =    0.0051
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                4.342
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    13.91
                                         10% maximal IV relative bias     9.08
                                         20% maximal IV relative bias     6.46
                                         30% maximal IV relative bias     5.39
                                         10% maximal IV size             22.30
                                         15% maximal IV size             12.83
                                         20% maximal IV size              9.54
                                         25% maximal IV size              7.80
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.702
                                                   Chi-sq(2) P-val =    0.7042
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: exper expersq
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=0.15 20:13:48

. mat b=e(b)
r; t=0.00 20:13:48

. savedresults save b0 e()
r; t=0.00 20:13:48

. ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), b0(b)

CUE evaluated at user-supplied parameter vector
-----------------------------------------------

Estimates based on supplied parameter vector
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =     7.49
                                                      Prob > F      =   0.0001
Total (centered) SS     =  223.3274513                Centered R2   =   0.1556
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7727
Residual SS             =  188.5780571                Root MSE      =    .6638

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0964002    .0814278      1.18    0.236    -.0631952     .2559957
       exper |     .042193    .0138831      3.04    0.002     .0149827     .0694033
     expersq |   -.0008323    .0004204     -1.98    0.048    -.0016563    -8.33e-06
       _cons |   -.3848718    1.011551     -0.38    0.704    -2.367476     1.597732
 -------------+----------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           0.702
                                                   Chi-sq(2) P-val =    0.7042
------------------------------------------------------------------------------
Instrumented:         educ
Included instruments: exper expersq
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=0.21 20:13:48

. savedresults comp b0 e(), include(scalar: j) tol(1e-7) verbose
comparing scalar e(j)
r; t=0.00 20:13:48

. rcof "noi ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6), b0(b) liml" == 198
incompatible options: -b0- and liml
r; t=0.00 20:13:48

.
. * ivendog cstat versus ivreg2 cstat
. ivreg lwage exper expersq (educ=age kidslt6 kidsge6)

Instrumental variables (2SLS) regression

      Source |       SS       df       MS              Number of obs =     428
-------------+------------------------------           F(  3,   424) =    7.49
       Model |  34.7493942     3  11.5831314           Prob > F      =  0.0001
    Residual |  188.578057   424  .444759569           R-squared     =  0.1556
-------------+------------------------------           Adj R-squared =  0.1496
       Total |  223.327451   427  .523015108           Root MSE      =   .6669

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       t    P>|t|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
        educ |    .0964002     .081811      1.18    0.239    -.0644053     .2572058
       exper |     .042193    .0139484      3.02    0.003     .0147764     .0696096
     expersq |   -.0008323    .0004224     -1.97    0.049    -.0016625    -2.08e-06
       _cons |   -.3848718    1.016311     -0.38    0.705    -2.382508     1.612764
 -------------+----------------------------------------------------------------


Instrumented:  educ


Instruments:   exper expersq age kidslt6 kidsge6


------------------------------------------------------------------------------
r; t=0.09 20:13:48

. savedresults save ivendog e()
r; t=0.00 20:13:48

. ivendog educ

Tests of endogeneity of: educ
H0: Regressor is exogenous
    Wu-Hausman F test:                  0.01892  F(1,423)    P-value = 0.89065
    Durbin-Wu-Hausman chi-sq test:      0.01915  Chi-sq(1)   P-value = 0.88995
r; t=0.04 20:13:48

. scalar cstat = r(DWH)
r; t=0.00 20:13:48

. scalar cstatp = r(DWHp)
r; t=0.00 20:13:48

. scalar cstatdf = r(df)
r; t=0.00 20:13:48

. ivreg2 lwage exper expersq educ (=age kidslt6 kidsge6), orthog(educ)

OLS estimation
--------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =      428
                                                      F(  3,   424) =    26.29
                                                      Prob > F      =   0.0000
Total (centered) SS     =  223.3274513                Centered R2   =   0.1568
Total (uncentered) SS   =   829.594813                Uncentered R2 =   0.7730
Residual SS             =  188.3051489                Root MSE      =    .6633

 -------------+----------------------------------------------------------------
        lwage |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
       exper |    .0415665    .0131135      3.17    0.002     .0158645     .0672685
     expersq |   -.0008112    .0003914     -2.07    0.038    -.0015783    -.0000441
        educ |    .1074896    .0140802      7.63    0.000     .0798929     .1350864
       _cons |   -.5220407    .1977017     -2.64    0.008    -.9095289    -.1345525
 -------------+----------------------------------------------------------------
Sargan statistic (Lagrange multiplier test of excluded instruments):     0.722
                                                   Chi-sq(3) P-val =    0.8681
-orthog- option:
Sargan statistic (eqn. excluding suspect orthogonality conditions):      0.703
                                                   Chi-sq(2) P-val =    0.7038
C statistic (exogeneity/orthogonality of suspect instruments):           0.019
                                                   Chi-sq(1) P-val =    0.8899
Instruments tested:   educ
------------------------------------------------------------------------------
Included instruments: exper expersq educ
Excluded instruments: age kidslt6 kidsge6
------------------------------------------------------------------------------
r; t=0.15 20:13:49

. savedresults compare ivendog e(), include(macros: depvar scalar: N df_m) tol(1e-7) verbose
comparing macro  e(depvar)
comparing scalar e(N)
comparing scalar e(df_m)
r; t=0.00 20:13:49

. assert reldif(e(cstat),cstat) < 1e-7
r; t=0.00 20:13:49

. assert reldif(e(cstatp),cstatp) < 1e-7
r; t=0.00 20:13:49

. assert cstatdf == e(cstatdf)
r; t=0.00 20:13:49

.
. use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta,clear
(Wages of Very Young Men, Zvi Griliches, J.Pol.Ec. 1976)
r; t=0.15 20:13:49

. assert _N == 758
r; t=0.00 20:13:49

. xi  i.year
i.year            _Iyear_66-73        (naturally coded; _Iyear_66 omitted)
r; t=0.01 20:13:49

. ivreg2 lw s expr tenure rns _I* (iq=kww age), cluster(year)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on year

Number of clusters (year) = 7                         Number of obs =      758
                                                      F( 11,     6) =    28.08
                                                      Prob > F      =   0.0003
Total (centered) SS     =  139.2861498                Centered R2   =   0.4110
Total (uncentered) SS   =  24652.24662                Uncentered R2 =   0.9967
Residual SS             =   82.0377585                Root MSE      =     .329

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0029033    .0044047      0.66    0.510    -.0057297     .0115362
           s |    .0632679    .0176721      3.58    0.000     .0286312     .0979046
        expr |    .0303563    .0118331      2.57    0.010     .0071639     .0535487
      tenure |    .0434166    .0054945      7.90    0.000     .0326476     .0541855
         rns |   -.1170553    .0410638     -2.85    0.004     -.197539    -.0365717
   _Iyear_67 |   -.0528787    .0179969     -2.94    0.003     -.088152    -.0176054
   _Iyear_68 |    .0809012    .0214341      3.77    0.000     .0388912     .1229111
   _Iyear_69 |    .2007175    .0166742     12.04    0.000     .1680366     .2333983
   _Iyear_70 |     .235459    .0237865      9.90    0.000     .1888382     .2820797
   _Iyear_71 |    .2151632    .0283299      7.59    0.000     .1596376     .2706889
   _Iyear_73 |    .3302726    .0375734      8.79    0.000     .2566302     .4039151
       _cons |    4.295046    .3529368     12.17    0.000     3.603302     4.986789
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              5.653
                                                   Chi-sq(2) P-val =    0.0592
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         43.005
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
------------------------------------------------------------------------------
Warning: estimated covariance matrix of moment conditions not of full rank.
         overidentification statistic not reported, and
         standard errors and model tests should be interpreted with caution.
Possible causes:
         number of clusters insufficient to calculate robust covariance matrix
         singleton dummy variable (dummy with one 1 and N-1 0s or vice versa)
partial option may address problem.
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: s expr tenure rns _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70
                      _Iyear_71 _Iyear_73
Excluded instruments: kww age
------------------------------------------------------------------------------
r; t=0.30 20:13:49

. mat bfwl1 = e(b)
r; t=0.00 20:13:49

. mat Vfwl1 = e(V)
r; t=0.00 20:13:49

. savedresults save nofwl e()
r; t=0.04 20:13:49

. ivreg2 lw s expr tenure rns _I* (iq=kww age), cluster(year) partial(_I*)

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

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and clustering on year

Number of clusters (year) = 7                         Number of obs =      758
                                                      F(  5,     6) =    84.64
                                                      Prob > F      =   0.0000
Total (centered) SS     =  104.5637465                Centered R2   =   0.2154
Total (uncentered) SS   =  104.5637465                Uncentered R2 =   0.2154
Residual SS             =  82.03775814                Root MSE      =     .329

 -------------+----------------------------------------------------------------
             |                Robust
           lw |      Coef.    Std. Err.       z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
          iq |    .0029033    .0044047      0.66    0.510    -.0057297     .0115362
           s |    .0632679    .0176721      3.58    0.000     .0286312     .0979046
        expr |    .0303563    .0118331      2.57    0.010     .0071639     .0535487
      tenure |    .0434166    .0054945      7.90    0.000     .0326476     .0541855
         rns |   -.1170553    .0410638     -2.85    0.004     -.197539    -.0365717
 -------------+----------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              5.653
                                                   Chi-sq(2) P-val =    0.0592
------------------------------------------------------------------------------
Weak identification test (Kleibergen-Paap rk Wald F statistic):         43.005
Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                         15% maximal IV size             11.59
                                         20% maximal IV size              8.75
                                         25% maximal IV size              7.25
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):         5.251
                                                   Chi-sq(1) P-val =    0.0219
------------------------------------------------------------------------------
Instrumented:         iq
Included instruments: s expr tenure rns
Excluded instruments: kww age
Partialled-out:       _Iyear_67 _Iyear_68 _Iyear_69 _Iyear_70 _Iyear_71
                      _Iyear_73 _cons
                      nb: small-sample adjustments account for
                          partialled-out variables
------------------------------------------------------------------------------
r; t=0.30 20:13:49

. mat bfwl2 = e(b)
r; t=0.00 20:13:49

. mat Vfwl2 = e(V)
r; t=0.00 20:13:49

. savedresults compare nofwl e(), include(scalar: N N_clust rss rmse idstat) tol(1e-7)
r; t=0.00 20:13:49

. assert reldif(bfwl1[1,1],bfwl2[1,1]) < 1e-7
r; t=0.00 20:13:49

. assert reldif(bfwl1[1,2],bfwl2[1,2]) < 1e-7
r; t=0.00 20:13:49

. assert reldif(Vfwl1[1,1],Vfwl2[1,1]) < 1e-7
r; t=0.00 20:13:49

. assert reldif(Vfwl1[1,2],Vfwl2[1,2]) < 1e-7
r; t=0.00 20:13:49

. assert reldif(Vfwl1[2,2],Vfwl2[2,2]) < 1e-7
r; t=0.00 20:13:49

.
.
. log close
      name:  <unnamed>
       log:  /Users/baum/doc/Stata devel/ Cert scripts/cs_ivreg2.smcl
  log type:  smcl
 closed on:  14 Aug 2009, 20:13:49
-------------