Hi!
I have an issue with an IV estimation. I am using Stata19.
I have a balanced panel dataset at day (t) and identifier (i) level. In other words, for each identifier i I have multiple observations, one for each day t.
Call N the total number of identifiers and T the total number of periods.
I have the following OLS regression:
yi,t = a Xt + b Wi,t + ei,t
where yi,t is the outcome, Xt is an endogenous regressor, Wi,t is a vector of exogenous regressors varying both at t and i levels, and ei,t is the error term.
I want to instrument Xt using an instrument Zt, which is in itself only time varying.
The problem is that when using standard packages in Stata (I have tried both with ivreghdfe and xtivreg), the first stage is estimated as follows:
Xt = c Zt + d Wi,t + ni,t
In other words, the first stage is estimated on the whole dataset, made of (N x T) observations, and for each period t the same values of Xt and Zt are repeated N times.
As a consequence, the F-statistic of the first stage (or the Cragg-Donald Wald F-stat) is incredibly large.
Is there a way to estimate correctly the first stage in this context?
The only solution I have imagined is to average observations at daily level, then manually calculate the first stage, merge predicted values with the original dataset at i and t levels, and then estimate manually the second stage bootstrapping the standard errors, to avoid the estimated regressor issue. This is still not perfect, as I have to average also Wi,t at t level, but I can't think of any better solution.
Here is an example made from a sample dataset:
As you can see from this example, the Cragg-Donald Wald F-stat in the first case is much larger than the F-stat in the second case.
I know they're not exactly comparable, but anyways it seems to me that ivreghdfe doesn't account for the fact that end_reg and instrument are repeated within person.
I have an issue with an IV estimation. I am using Stata19.
I have a balanced panel dataset at day (t) and identifier (i) level. In other words, for each identifier i I have multiple observations, one for each day t.
Call N the total number of identifiers and T the total number of periods.
I have the following OLS regression:
yi,t = a Xt + b Wi,t + ei,t
where yi,t is the outcome, Xt is an endogenous regressor, Wi,t is a vector of exogenous regressors varying both at t and i levels, and ei,t is the error term.
I want to instrument Xt using an instrument Zt, which is in itself only time varying.
The problem is that when using standard packages in Stata (I have tried both with ivreghdfe and xtivreg), the first stage is estimated as follows:
Xt = c Zt + d Wi,t + ni,t
In other words, the first stage is estimated on the whole dataset, made of (N x T) observations, and for each period t the same values of Xt and Zt are repeated N times.
As a consequence, the F-statistic of the first stage (or the Cragg-Donald Wald F-stat) is incredibly large.
Is there a way to estimate correctly the first stage in this context?
The only solution I have imagined is to average observations at daily level, then manually calculate the first stage, merge predicted values with the original dataset at i and t levels, and then estimate manually the second stage bootstrapping the standard errors, to avoid the estimated regressor issue. This is still not perfect, as I have to average also Wi,t at t level, but I can't think of any better solution.
Here is an example made from a sample dataset:
Code:
clear all sysuse xtline1.dta, clear set seed 1542 preserve collapse (mean) calories, by(day) bysort day : gen end_reg = calories + rnormal(0,1) bysort day : gen instrument = end_reg + 0.01*rnormal(0,1)*calories tempfile variables save `variables', replace restore merge m:1 day using `variables', keep(1 3) nogen bysort day (person) : gen outcome = calories*rnormal(0,1) + rnormal(2,3) bysort day (person) : gen exo_reg = calories*rnormal(3,6) + rnormal(0,1) ivreghdfe outcome (end_reg = instrument) exo_reg, absorb(person) vce(cluster day) first disp in red `e(cdf)' collapse (mean) exo_reg, by(day end_reg instrument) reg end_reg instrument exo_reg, vce(cluster day) disp in red `e(F)'
I know they're not exactly comparable, but anyways it seems to me that ivreghdfe doesn't account for the fact that end_reg and instrument are repeated within person.

Comment