^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e"...

16
\V // 0$)<O^ ^st*\c\ ^,5 fi t /-3 MJj&4**aM tsJi' /k -e^t^C, *• A*, ft. <- -a. L 'f fr+TL *0*ft t> % ft * M*» -/?*ft +m. ft) *M. £)»>jl. £©*=> ( ft ,<) £ $ *&*»> «#iA-

Transcript of ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e"...

Page 1: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.

\V //

0$)<O^ ^st*\c\

^,5 fi

t

/-3 MJj&4**aM tsJi' /k -e^t^C,

*• A*, ft. <- -a.

L

'f fr+TL *0*ft

t>% ft * M*»

-/?*ft +m.

ft) *M.

£)»>jl. £©*=> ( ft ,<) $© £ $ *&*»>

«#iA-

Page 2: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 3: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 4: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 5: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 6: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 7: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 8: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 9: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 10: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 11: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 12: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 13: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 14: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.
Page 15: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.

Printed on Tuesday, March 29, 2011 at 09:13:48Page 1 of 2

01 * file chap10.do for Using Stata for Principles of Econometrics, 4e0203 * cd c:\data\poe4stata04 webuse set http://www.principlesofeconometrics.com/poe4/data/stata/05 * Stata do-file 06 * copyright C 2011 by Lee C. Adkins and R. Carter Hill 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011)09 * John Wiley and Sons, Inc.1011 * setup12 version 11.11314 * open data and examine15 webuse mroz, clear16 describe17 summarize 1819 * drop nonworking women and summarize20 drop if lfp==021 summarize wage educ exper2223 * create variables24 gen lwage = ln(wage)2526 * Least squares estimation27 reg lwage educ exper c.exper#c.exper28 estimates store ls29 ivregress 2sls lwage (educ=mothereduc) exper c.exper#c.exper, small30 estimates store iv131 ivregress 2sls lwage (educ=mothereduc fathereduc) exper c.exper#c.exper, small32 estimates store iv23334 esttab ls iv1 iv2, compress t(%12.2f) b(%12.5f) nostar ///35 gaps scalars(rss F) title("LS vs IV")3637 * Manually using only mothereduc as IV (wrong standard errors)38 * first stage regression39 reg educ exper c.exper#c.exper mothereduc4041 * test IV strength42 test mothereduc4344 * obtain predicted values45 predict educhat4647 * 2sls using 2-stages48 reg lwage educhat exper c.exper#c.exper4950 ivregress 2sls lwage (educ=mothereduc fathereduc) exper c.exper#c.exper, small51 estat firststage52 estat overid5354 ********** Hausman test5556 * reduced form57 reg educ exper c.exper#c.exper mothereduc fathereduc58 predict vhat, residuals5960 * augment wage equation with reduced form residuals61 reg lwage exper c.exper#c.exper educ vhat62 reg lwage exper c.exper#c.exper educ vhat, vce(robust)6364 * Hausman test automatic65 hausman iv2 ls, constant sigmamore66

Page 16: ^,5 fi - LearnEconometrics.com · 07 * webused for "Using Stata for Principles of Econometrics, 4e" 08 * by Lee C. Adkins and R. Carter Hill (2011) 09 * John Wiley and Sons, Inc.

Printed on Tuesday, March 29, 2011 at 09:13:48Page 2 of 2

67 ********** Testing surplus moment conditions6869 * obtain 2sls residuals70 quietly ivregress 2sls lwage (educ=mothereduc fathereduc) exper c.exper#c.exper, small71 predict ehat, residuals7273 * regress 2sls residuals on all IV74 reg ehat exper c.exper#c.exper mothereduc fathereduc75 ereturn list7677 * NR^2 test78 scalar nr2 = e(N)*e(r2)79 scalar chic = invchi2tail(1,.05)80 scalar pvalue = chi2tail(1,nr2)81 di "R^2 from artificial regression = " e(r2)82 di "NR^2 test of overidentifying restriction = " nr283 di "Chi-square critical value 1 df, .05 level = " chic84 di "p value for overidentifying test 1 df, .05 level = " pvalue8586 * Using estat87 quietly ivregress 2sls lwage (educ=mothereduc fathereduc) exper c.exper#c.exper, small88 estat overid8990