Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Problem with ivregress
From
Jorge Eduardo Pérez Pérez <[email protected]>
To
<[email protected]>
Subject
st: Problem with ivregress
Date
Mon, 14 Feb 2011 15:53:03 -0500
Dear Statalist.
I am doing an instrumental variable analysis in Stata MP 11 on Windows
XP, and I am getting different results using the official -ivregress-
and the user written -ivreg2- by Baum, Schaffer and Stillman. The
first stage is the same for both commands, but -ivrregress- is
estimating all the coefficients for indicator variables as 0 in the
second stage. I am using the user written command -xi- , but the
same happens if I use factor variables. Can someone provide a hint
about why this might be happenning? Below I reproduce the code and
the output. Thank you.
Jorge Eduardo Pérez Pérez.
**********************
xi: ivregress 2sls k0301_atracos_robos ingresost_real_08
tamaño_hogar i.id_loc i.periodo (tasa_hurtoapersonas =p2), first r
i.id_loc _Iid_loc_1-19 (naturally coded; _Iid_loc_1 omitted)
i.periodo _Iperiodo_2003-2007 (naturally coded; _Iperiodo_2003 omitted)
First-stage regressions
-----------------------
Number of obs = 32791
F( 22, 32768) = 31741.67
Prob > F = 0.0000
R-squared = 0.8872
Adj R-squared = 0.8872
Root MSE = 0.7055
------------------------------------------------------------------------------
| Robust
tasa_hur~nas | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ingresost~08 | 1.04e-08 1.62e-09 6.41 0.000 7.20e-09 1.36e-08
tamaño_hogar | -.0030897 .002369 -1.30 0.192 -.007733 .0015535
_Iid_loc_2 | 5.27154 .0433654 121.56 0.000 5.186543 5.356538
_Iid_loc_3 | 1.973202 .0165279 119.39 0.000 1.940807 2.005597
_Iid_loc_4 | -1.946336 .0249419 -78.03 0.000 -1.995223 -1.897449
_Iid_loc_5 | -1.767474 .0211708 -83.49 0.000 -1.808969 -1.725978
_Iid_loc_6 | -2.002477 .0124427 -160.94 0.000 -2.026865 -1.978088
_Iid_loc_7 | -1.756571 .048963 -35.88 0.000 -1.85254 -1.660602
_Iid_loc_8 | -1.079661 .0453333 -23.82 0.000 -1.168516 -.9908059
_Iid_loc_9 | -1.246213 .0137561 -90.59 0.000 -1.273176 -1.219251
_Iid_loc_10 | -1.303529 .0160533 -81.20 0.000 -1.334994 -1.272064
_Iid_loc_11 | -.8877222 .026013 -34.13 0.000 -.9387087 -.8367357
_Iid_loc_12 | -.0862089 .0073475 -11.73 0.000 -.1006103 -.0718075
_Iid_loc_13 | .5957273 .0041545 143.39 0.000 .5875843 .6038704
_Iid_loc_14 | .2936037 .0085725 34.25 0.000 .2768013 .3104061
_Iid_loc_15 | -.7183004 .0068685 -104.58 0.000 -.7317629 -.7048379
_Iid_loc_16 | -1.164804 .0073667 -158.12 0.000 -1.179243 -1.150365
_Iid_loc_17 | 1.213225 .0419733 28.90 0.000 1.130955 1.295494
_Iid_loc_18 | -1.902673 .0127997 -148.65 0.000 -1.92776 -1.877585
_Iid_loc_19 | -1.621821 .0464246 -34.93 0.000 -1.712815 -1.530827
_Iperio~2007 | 1.098923 .0109695 100.18 0.000 1.077422 1.120424
p2 | -1.590905 .3481715 -4.57 0.000 -2.273334 -.9084763
_cons | 1.822721 .0146755 124.20 0.000 1.793957 1.851486
------------------------------------------------------------------------------
Instrumental variables (2SLS) regression Number of obs = 32791
Wald chi2(22) = 1745.09
Prob > chi2 = 0.0000
R-squared = 0.0024
Root MSE = .3795
------------------------------------------------------------------------------
| Robust
k0301_atra~s | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tasa_hur~nas | .0054031 .0011131 4.85 0.000 .0032215 .0075848
ingresost~08 | -1.91e-10 6.24e-10 -0.31 0.760 -1.41e-09 1.03e-09
tamaño_hogar | .0112917 .001331 8.48 0.000 .008683 .0139004
_Iid_loc_2 | 0 .0017814 0.00 1.000 -.0034915 .0034915
_Iid_loc_3 | 0 .0002642 0.00 1.000 -.0005177 .0005177
_Iid_loc_4 | 0 .001214 0.00 1.000 -.0023793 .0023793
_Iid_loc_5 | 0 .000805 0.00 1.000 -.0015777 .0015777
_Iid_loc_6 | 0 .0014651 0.00 1.000 -.0028716 .0028716
_Iid_loc_7 | 0 .0011398 0.00 1.000 -.0022339 .0022339
_Iid_loc_8 | 0 .0008904 0.00 1.000 -.0017451 .0017451
_Iid_loc_9 | 0 .0010533 0.00 1.000 -.0020643 .0020643
_Iid_loc_10 | 0 .0011803 0.00 1.000 -.0023133 .0023133
_Iid_loc_11 | 0 .0011657 0.00 1.000 -.0022848 .0022848
_Iid_loc_12 | 0 .0007197 0.00 1.000 -.0014106 .0014106
_Iid_loc_13 | 0 .0007106 0.00 1.000 -.0013928 .0013928
_Iid_loc_14 | 0 .0003831 0.00 1.000 -.0007508 .0007508
_Iid_loc_15 | 0 .0007006 0.00 1.000 -.0013731 .0013731
_Iid_loc_16 | 0 .0009818 0.00 1.000 -.0019242 .0019242
_Iid_loc_17 | 0 .0005453 0.00 1.000 -.0010688 .0010688
_Iid_loc_18 | 0 .001187 0.00 1.000 -.0023265 .0023265
_Iid_loc_19 | 0 .000885 0.00 1.000 -.0017345 .0017345
_Iperio~2007 | .0103882 .0047167 2.20 0.028 .0011437 .0196328
_cons | .118648 .0060432 19.63 0.000 .1068036 .1304925
------------------------------------------------------------------------------
Instrumented: tasa_hurtoapersonas
Instruments: ingresost_real_08 tamaño_hogar _Iid_loc_2 _Iid_loc_3
_Iid_loc_4 _Iid_loc_5 _Iid_loc_6 _Iid_loc_7 _Iid_loc_8
_Iid_loc_9 _Iid_loc_10 _Iid_loc_11 _Iid_loc_12 _Iid_loc_13
_Iid_loc_14 _Iid_loc_15 _Iid_loc_16 _Iid_loc_17 _Iid_loc_18
_Iid_loc_19 _Iperiodo_2007 p2
. xi: ivreg2 k0301_atracos_robos ingresost_real_08 tamaño_hogar
i.id_loc i.periodo (tasa_hurtoapersonas =p2), r first
i.id_loc _Iid_loc_1-19 (naturally coded; _Iid_loc_1 omitted)
i.periodo _Iperiodo_2003-2007 (naturally coded; _Iperiodo_2003 omitted)
First-stage regressions
-----------------------
First-stage regression of tasa_hurtoapersonas:
OLS estimation
--------------
Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity
Number of obs = 32791
F( 22, 32768) = 31741.67
Prob > F = 0.0000
Total (centered) SS = 144629.9156 Centered R2 = 0.8872
Total (uncentered) SS = 291983.6931 Uncentered R2 = 0.9441
Residual SS = 16307.65347 Root MSE = .7055
------------------------------------------------------------------------------
| Robust
tasa_hur~nas | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ingresost~08 | 1.04e-08 1.62e-09 6.41 0.000 7.20e-09 1.36e-08
tamaño_hogar | -.0030897 .002369 -1.30 0.192 -.007733 .0015535
_Iid_loc_2 | 5.27154 .0433654 121.56 0.000 5.186543 5.356538
_Iid_loc_3 | 1.973202 .0165279 119.39 0.000 1.940807 2.005597
_Iid_loc_4 | -1.946336 .0249419 -78.03 0.000 -1.995223 -1.897449
_Iid_loc_5 | -1.767474 .0211708 -83.49 0.000 -1.808969 -1.725978
_Iid_loc_6 | -2.002477 .0124427 -160.94 0.000 -2.026865 -1.978088
_Iid_loc_7 | -1.756571 .048963 -35.88 0.000 -1.85254 -1.660602
_Iid_loc_8 | -1.079661 .0453333 -23.82 0.000 -1.168516 -.9908059
_Iid_loc_9 | -1.246213 .0137561 -90.59 0.000 -1.273176 -1.219251
_Iid_loc_10 | -1.303529 .0160533 -81.20 0.000 -1.334994 -1.272064
_Iid_loc_11 | -.8877222 .026013 -34.13 0.000 -.9387087 -.8367357
_Iid_loc_12 | -.0862089 .0073475 -11.73 0.000 -.1006103 -.0718075
_Iid_loc_13 | .5957273 .0041545 143.39 0.000 .5875843 .6038704
_Iid_loc_14 | .2936037 .0085725 34.25 0.000 .2768013 .3104061
_Iid_loc_15 | -.7183004 .0068685 -104.58 0.000 -.7317629 -.7048379
_Iid_loc_16 | -1.164804 .0073667 -158.12 0.000 -1.179243 -1.150365
_Iid_loc_17 | 1.213225 .0419733 28.90 0.000 1.130955 1.295494
_Iid_loc_18 | -1.902673 .0127997 -148.65 0.000 -1.92776 -1.877585
_Iid_loc_19 | -1.621821 .0464246 -34.93 0.000 -1.712815 -1.530827
_Iperio~2007 | 1.098923 .0109695 100.18 0.000 1.077422 1.120424
p2 | -1.590905 .3481715 -4.57 0.000 -2.273334 -.9084763
_cons | 1.822721 .0146755 124.20 0.000 1.793957 1.851486
------------------------------------------------------------------------------
Included instruments: ingresost_real_08 tamaño_hogar _Iid_loc_2 _Iid_loc_3
_Iid_loc_4 _Iid_loc_5 _Iid_loc_6 _Iid_loc_7 _Iid_loc_8
_Iid_loc_9 _Iid_loc_10 _Iid_loc_11 _Iid_loc_12 _Iid_loc_13
_Iid_loc_14 _Iid_loc_15 _Iid_loc_16 _Iid_loc_17
_Iid_loc_18 _Iid_loc_19 _Iperiodo_2007 p2
------------------------------------------------------------------------------
F test of excluded instruments:
F( 1, 32768) = 0.00
Prob > F = 1.0000
Angrist-Pischke multivariate F test of excluded instruments:
F( 1, 32768) = 20.88
Prob > F = 0.0000
Summary results for first-stage regressions
-------------------------------------------
(Underid) (Weak id)
Variable | F( 1, 32768) P-val | AP Chi-sq( 1) P-val | AP F( 1, 32768)
tasa_hurtoap | 0.00 1.0000 | 20.89 0.0000 | 20.88
NB: first-stage test statistics heteroskedasticity-robust
Stock-Yogo weak ID test critical values for single endogenous regressor:
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.
Underidentification test
Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
Ha: matrix has rank=K1 (identified)
Kleibergen-Paap rk LM statistic Chi-sq(1)=6035.07 P-val=0.0000
Weak identification test
Ho: equation is weakly identified
Cragg-Donald Wald F statistic 5579.68
Kleibergen-Paap Wald rk F statistic 8710.03
Stock-Yogo weak ID test critical values for K1=1 and L1=1:
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.
Weak-instrument-robust inference
Tests of joint significance of endogenous regressors B1 in main equation
Ho: B1=0 and orthogonality conditions are valid
Anderson-Rubin Wald test F(1,32768)= 12.67 P-val=0.0004
Anderson-Rubin Wald test Chi-sq(1)= 12.68 P-val=0.0004
Stock-Wright LM S statistic Chi-sq(1)= 6.55 P-val=0.0105
NB: Underidentification, weak identification and weak-identification-robust
test statistics heteroskedasticity-robust
Number of observations N = 32791
Number of regressors K = 23
Number of endogenous regressors K1 = 1
Number of instruments L = 23
Number of excluded instruments L1 = 1
IV (2SLS) estimation
--------------------
Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity
Number of obs = 32791
F( 22, 32768) = 6.50
Prob > F = 0.0000
Total (centered) SS = 4733.924369 Centered R2 = -0.6001
Total (uncentered) SS = 5738 Uncentered R2 = -0.3201
Residual SS = 7574.702273 Root MSE = .4806
------------------------------------------------------------------------------
| Robust
k0301_atra~s | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
tasa_hur~nas | -.4315895 .1533126 -2.82 0.005 -.7320766 -.1311024
ingresost~08 | 3.86e-09 1.87e-09 2.06 0.039 1.95e-10 7.53e-09
tamaño_hogar | .0103241 .0017357 5.95 0.000 .0069222 .0137261
_Iid_loc_2 | 2.279047 .8066942 2.83 0.005 .6979552 3.860138
_Iid_loc_3 | .8114659 .2965028 2.74 0.006 .230331 1.392601
_Iid_loc_4 | -.9297313 .3133736 -2.97 0.003 -1.543932 -.3155304
_Iid_loc_5 | -.8477445 .2811298 -3.02 0.003 -1.398749 -.2967402
_Iid_loc_6 | -.9289934 .3118999 -2.98 0.003 -1.540306 -.3176809
_Iid_loc_7 | -.8715542 .3034539 -2.87 0.004 -1.466313 -.2767955
_Iid_loc_8 | -.5591256 .1960105 -2.85 0.004 -.943299 -.1749521
_Iid_loc_9 | -.5681679 .1920347 -2.96 0.003 -.9445491 -.1917868
_Iid_loc_10 | -.638851 .2106601 -3.03 0.002 -1.051737 -.2259649
_Iid_loc_11 | -.4688454 .1545254 -3.03 0.002 -.7717097 -.1659811
_Iid_loc_12 | -.0429292 .0189115 -2.27 0.023 -.0799951 -.0058633
_Iid_loc_13 | .2792315 .0928979 3.01 0.003 .0971549 .4613081
_Iid_loc_14 | .109001 .0441723 2.47 0.014 .0224248 .1955771
_Iid_loc_15 | -.2907344 .1091203 -2.66 0.008 -.5046063 -.0768625
_Iid_loc_16 | -.52421 .1794661 -2.92 0.003 -.8759572 -.1724628
_Iid_loc_17 | .4924595 .1872782 2.63 0.009 .125401 .8595181
_Iid_loc_18 | -.845298 .2977425 -2.84 0.005 -1.428863 -.2617333
_Iid_loc_19 | -.8390708 .2807746 -2.99 0.003 -1.389379 -.2887626
_Iperio~2007 | .490548 .1689138 2.90 0.004 .159483 .8216131
_cons | .9218263 .2754487 3.35 0.001 .3819568 1.461696
------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic): 6035.075
Chi-sq(1) P-val = 0.0000
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic): 5579.677
(Kleibergen-Paap rk Wald F statistic): 8710.031
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.
------------------------------------------------------------------------------
Hansen J statistic (overidentification test of all instruments): 0.000
(equation exactly identified)
------------------------------------------------------------------------------
Instrumented: tasa_hurtoapersonas
Included instruments: ingresost_real_08 tamaño_hogar _Iid_loc_2 _Iid_loc_3
_Iid_loc_4 _Iid_loc_5 _Iid_loc_6 _Iid_loc_7 _Iid_loc_8
_Iid_loc_9 _Iid_loc_10 _Iid_loc_11 _Iid_loc_12 _Iid_loc_13
_Iid_loc_14 _Iid_loc_15 _Iid_loc_16 _Iid_loc_17
_Iid_loc_18 _Iid_loc_19 _Iperiodo_2007
Excluded instruments: p2
------------------------------------------------------------------------------
_______________________
Jorge Eduardo Pérez Pérez
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/