# Practice IV - Exercise 2
open wage2.gdt
# OLS without ability
ols lwage const educ exper tenure --robust
# OLS with IQ as ability
ols lwage const educ exper tenure IQ --robust
# Hausman Test
# Reduced form for IQ: with KWW and meduc as instruments
ols IQ const educ exper tenure KWW meduc --robust
uhat = $uhat
# alternatively: series ehat=$uhat
# Second step Hausman test
ols lwage const educ exper tenure IQ uhat --robust
omit uhat --quiet
#or just look at the t-statistic for uhat
#We can get Hausman from IV
tsls lwage const educ exper tenure IQ; const educ exper tenure KWW meduc --robust
# Validity of instruments: correlation with IQ
ols IQ const educ exper tenure KWW meduc --robust
omit KWW meduc --wald --quiet
#Exogeneity: Sargan
tsls lwage const educ exper tenure IQ; const educ exper tenure KWW meduc --robust
utsls = $uhat
ols utsls const educ exper tenure KWW meduc --robust
extest = $rsq*$T
pvalue X 1 extest
# IV estimation
tsls lwage const educ exper tenure IQ; const educ exper tenure KWW meduc --robust