Hello,
I'm trying to do a 2SLS estimation with an endogenous variable and its instrument by hand with command reghdfe. Therefore, I need to also calculate the statistics evaluating the instrument, namely, Cragg-Donald Wald F statistic, Anderson canon. corr. LM statistic and Sargan statistic as can be reported by command ivreghdfe. I read the original codes by Sergio Correia who writes the package reghdfe and ivreghdfe, but still cannot make it.
The reason why I have to do this estimation manually (using reghdfe twice) instead of using ivreghdfe directly is that, in my analysis, the instrument I use is an election dummy D which equals 1 in the six months ahead of the election month. However, I'm using a first-difference estimation equation, which means that all the variables are first differenced before being estimated. Let's say, my endogenous variable is Z, the dependent variable is Y, and a set of controls X.
Employing ivreghdfe, my estimation equation would be:
ivreghdfe d.Y d.X (d.Z = d.D), absorb(t industry) vce(cluster t industry)
But I feel like that doing a first difference on the dummy variable D does not make too much sense. Therefore, an idea comes into my mind where I regress Z on D with a set of controls in level in the first stage:
reghdfe Z D X, absorb(t industry) vce(cluster t industry)
predict fitted_Z, xbd
After obtaining fitted_Z, I use the first-diffrenced fitted_Z (d.fitted_Z) into the second stage estimation, which writes:
reghdfe d.Y d.X d.fitted_Z, absorb(t industry) vce(cluster t industry)
I know by doing this, I have to adjust the standard errors of the covariance matrix e(V). And I did it by following the codes written by someone else. But does anyone know how I can calculate the above-mentioned three statistics? Any comment or advice is appreciated.
Best,
Xin
I'm trying to do a 2SLS estimation with an endogenous variable and its instrument by hand with command reghdfe. Therefore, I need to also calculate the statistics evaluating the instrument, namely, Cragg-Donald Wald F statistic, Anderson canon. corr. LM statistic and Sargan statistic as can be reported by command ivreghdfe. I read the original codes by Sergio Correia who writes the package reghdfe and ivreghdfe, but still cannot make it.
The reason why I have to do this estimation manually (using reghdfe twice) instead of using ivreghdfe directly is that, in my analysis, the instrument I use is an election dummy D which equals 1 in the six months ahead of the election month. However, I'm using a first-difference estimation equation, which means that all the variables are first differenced before being estimated. Let's say, my endogenous variable is Z, the dependent variable is Y, and a set of controls X.
Employing ivreghdfe, my estimation equation would be:
ivreghdfe d.Y d.X (d.Z = d.D), absorb(t industry) vce(cluster t industry)
But I feel like that doing a first difference on the dummy variable D does not make too much sense. Therefore, an idea comes into my mind where I regress Z on D with a set of controls in level in the first stage:
reghdfe Z D X, absorb(t industry) vce(cluster t industry)
predict fitted_Z, xbd
After obtaining fitted_Z, I use the first-diffrenced fitted_Z (d.fitted_Z) into the second stage estimation, which writes:
reghdfe d.Y d.X d.fitted_Z, absorb(t industry) vce(cluster t industry)
I know by doing this, I have to adjust the standard errors of the covariance matrix e(V). And I did it by following the codes written by someone else. But does anyone know how I can calculate the above-mentioned three statistics? Any comment or advice is appreciated.
Best,
Xin