Hi statalist,
I am looking into ways to average IV estimates across different sample ( and test their significance). To simplify my problem, let's say I have a variable X taking two value (1 and 2). I implement an IV regression for each value of X and would like to calculate the average effect. I though that I could do that:
ivreg Y (D=Z*X Z) X
with D the endogenous variable and Z the instrument and Y the dependent variable.
As it turns out, when stacking both IV regression to compare both estimate as advised here
https://www.stata.com/statalist/arch.../msg01493.html
I do not find the same results but they are very close. Here is an example with Z=tenure D=hours X=south
est clear
sysuse nlsw88, clear
* estimation without interaction
ivreg wage (hours=tenure ) if south==1
est sto south1
sca n1=e(N)
ivreg wage (hours=tenure ) if south==0
est sto south0
sca n0=e(N)
preserve
expand 2
bys idcode: g n=_n-1
keep if (n==0&south==0)|(n==1&south==1)
forval k=0/1 {
foreach j in tenure hours south {
g `j'`k'=`j'*(n==`k' | south==`k')
}
}
ivreg wage (hours?=tenure?) n, cl(idcode)
lincom n0/(n1+n0)*_b[hours0]+n1/(n1+n0)*_b[hours1]
// gives an average effect of .5742095
est sto stacked
restore
esttab south1 south0 stacked, nogaps mti
gen inter=tenure*south
xi:ivreg wage (hours=tenure inter) south, cl(idcode)
// gives .5746572
It is very close but not quite the same. Does it make sense for you that the IV regression with interaction term should give the same results than the stacked IV reg? If yes, why don't I find the same results?
Thanks for your inputs
I am looking into ways to average IV estimates across different sample ( and test their significance). To simplify my problem, let's say I have a variable X taking two value (1 and 2). I implement an IV regression for each value of X and would like to calculate the average effect. I though that I could do that:
ivreg Y (D=Z*X Z) X
with D the endogenous variable and Z the instrument and Y the dependent variable.
As it turns out, when stacking both IV regression to compare both estimate as advised here
https://www.stata.com/statalist/arch.../msg01493.html
I do not find the same results but they are very close. Here is an example with Z=tenure D=hours X=south
est clear
sysuse nlsw88, clear
* estimation without interaction
ivreg wage (hours=tenure ) if south==1
est sto south1
sca n1=e(N)
ivreg wage (hours=tenure ) if south==0
est sto south0
sca n0=e(N)
preserve
expand 2
bys idcode: g n=_n-1
keep if (n==0&south==0)|(n==1&south==1)
forval k=0/1 {
foreach j in tenure hours south {
g `j'`k'=`j'*(n==`k' | south==`k')
}
}
ivreg wage (hours?=tenure?) n, cl(idcode)
lincom n0/(n1+n0)*_b[hours0]+n1/(n1+n0)*_b[hours1]
// gives an average effect of .5742095
est sto stacked
restore
esttab south1 south0 stacked, nogaps mti
gen inter=tenure*south
xi:ivreg wage (hours=tenure inter) south, cl(idcode)
// gives .5746572
It is very close but not quite the same. Does it make sense for you that the IV regression with interaction term should give the same results than the stacked IV reg? If yes, why don't I find the same results?
Thanks for your inputs
Comment