I need help in how to formulate institutions variables in 2SLS regression using the ivreg2 command. Thanks
-
Login or Register
- Log in with
webuse hsng2, clear *ENDOGENOUS VAR (RED), INSTRUMENTS (BLUE) ivregress 2sls rent pcturban (hsngval = faminc i.region) ivreg2 rent pcturban (hsngval = faminc i.region)
. ivregress 2sls rent pcturban (hsngval = faminc i.region) Instrumental variables (2SLS) regression Number of obs = 50 Wald chi2(2) = 90.76 Prob > chi2 = 0.0000 R-squared = 0.5989 Root MSE = 22.166 ------------------------------------------------------------------------------ rent | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- hsngval | .0022398 .0003284 6.82 0.000 .0015961 .0028836 pcturban | .081516 .2987652 0.27 0.785 -.504053 .667085 _cons | 120.7065 15.22839 7.93 0.000 90.85942 150.5536 ------------------------------------------------------------------------------ Instrumented: hsngval Instruments: pcturban faminc 2.region 3.region 4.region . . ivreg2 rent pcturban (hsngval = faminc i.region) IV (2SLS) estimation -------------------- Estimates efficient for homoskedasticity only Statistics consistent for homoskedasticity only Number of obs = 50 F( 2, 47) = 42.66 Prob > F = 0.0000 Total (centered) SS = 61243.12 Centered R2 = 0.5989 Total (uncentered) SS = 2816856 Uncentered R2 = 0.9913 Residual SS = 24565.71669 Root MSE = 22.17 ------------------------------------------------------------------------------ rent | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- hsngval | .0022398 .0003284 6.82 0.000 .0015961 .0028836 pcturban | .081516 .2987652 0.27 0.785 -.504053 .667085 _cons | 120.7065 15.22839 7.93 0.000 90.85942 150.5536 ------------------------------------------------------------------------------ Underidentification test (Anderson canon. corr. LM statistic): 27.364 Chi-sq(4) P-val = 0.0000 ------------------------------------------------------------------------------ Weak identification test (Cragg-Donald Wald F statistic): 13.298 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): 11.288 Chi-sq(3) P-val = 0.0103 ------------------------------------------------------------------------------ Instrumented: hsngval Included instruments: pcturban Excluded instruments: faminc 2.region 3.region 4.region ------------------------------------------------------------------------------
ssc install estout, replace
webuse hsng2, clear set seed 06122021 forval i=1/5{ gen indvar`i' = pcturban+ runiformint(0, 20) } *START HERE eststo clear local estimates foreach var of varlist indvar1-indvar5{ rename `var' indvar eststo `var': ivreg2 rent indvar (hsngval = faminc i.region) local estimates "`estimates' `var'" rename indvar `var' } esttab `estimates', keep(indvar) mlab(`estimates') nonumbers coeflab(indvar "Coefficient")
. esttab `estimates', keep(indvar) mlab(`estimates') nonumbers coeflab(indvar "Coefficient") -------------------------------------------------------------------------------------------- indvar1 indvar2 indvar3 indvar4 indvar5 -------------------------------------------------------------------------------------------- Coefficient 0.154 0.00972 0.102 0.0103 -0.0128 (0.60) (0.04) (0.34) (0.04) (-0.05) -------------------------------------------------------------------------------------------- N 50 50 50 50 50 -------------------------------------------------------------------------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001
Comment