capture log close
log using table3, text replace
clear all
use base
d
//Column 1
areg Y12 S C1 C2 [aw=W], absorb(year) robust
//Column 2
areg Y12 S C1 C2 [aw=W], absorb(stateyear) robust
//Column 3
areg Y12 Z C1 C2 [aw=W], absorb(year) robust
//Column 4
areg Y12 Z C1 C2 [aw=W], absorb(stateyear) robust
//Column 5
foreach var in Y12 S Z {
quietly areg `var' C1 C2 [aw=W], absorb(year)
predict double r`var', resid
}
ivreg rY12 (rS=rZ) [aw=W], robust
capture drop rY12 rS rZ
//Column 6
//Note: these standards errors are a bit too small
//because they ignore the dof adjustment for absorbing
//so many effects. The standard errors in the paper
//reflect the correct dof adjustment.
foreach var in Y12 S Z {
quietly areg `var' C1 C2 [aw=W], absorb(stateyear)
predict double r`var', resid
}
ivreg rY12 (rS=rZ) [aw=W], robust
capture drop rY12 rS rZ
//Column 7
foreach var in Y12 S Z {
quietly areg `var' C1 C2 [aw=W], absorb(year)
predict double r`var', resid
}
ivreg rY12 (rZ=rS) [aw=W], robust
capture drop rY12 rZ rS
//Column 8
//Note: these standards errors are a bit too small
//(see dof discussion above)
foreach var in Y12 S Z {
quietly areg `var' C1 C2 [aw=W], absorb(stateyear)
predict double r`var', resid
}
ivreg rY12 (rZ=rS) [aw=W], robust
//Now I do not drop these because I am going to use them for
//column (9)
//capture drop rY12 rZ rS
//Column 9
//Reproduces forward IV
//gmm ( F: rY12 - {b}*rS ) [aw=W], instruments(F: rZ)
//Reproduces reflected IV
//gmm ( R: rY12 - {b}*rZ ) [aw=W], instruments(R: rS)
//Produces the pooled estimate
//Note: these standards errors are a bit too small
//(see dof discussion above)
gmm ( F: rY12 - {b}*rS ) ( R: rY12 - {b}*rZ ) [aw=W], ///
instruments(F: rZ) instruments(R: rS) ///
winitial(identity) twostep
log close