Let's start assuming that I have cross-sectional data on $y$, $x_1$, $x_2$ (see below for $y$, $x_1$, $x_2$).
I want to estimate the effect of variables $x_1$ and $x_2$ and their interaction ($x_3= x_1*x_2$) on variable $y$ using the control function approach, and highly likely $x_1$ and $x_2$ are endogenous. I have two instruments, $z_1$ and $z_2$. I estimate the following two first stage equations and I save the predicted residuals in the following way:
ivreg2 x1 z1 z2 predict error1hat, residuals ivreg2 x2 z1 z2 predict error2hat, residuals
Once I save the predicted residuals, I estimate the second-stage equation in the following way:
ivreg2 y x1 x2 x3 error1hat error2hat
Even though the estimated coefficients of $x_1$, $x_2$ and $x_3$ make sense, I know that the standard errors are not OK (see page 8 of http://eml.berkeley.edu/~train/petrintrain.pdf).
In page 8 of http://eml.berkeley.edu/~train/petrintrain.pdf, the authors suggest to use the bootstrap to obtain corrected standard errors for $x_1$, $x_2$ and $x_3$.
My questions are:
- How should I set up the bootstrap?
- Is the bootstrap applied only to the second-stage equation, or is it applied to both the first-stage and second-stage equation?
Now, let's assume that I have panel data on $y$, $x_1$, and $x_2$. First, I use the within-group differencing to delete unobserved heterogeneity, then I estimate the parameters using the control function approach as if the data is cross-sectional data (see above). Do I need to make some additional adjustments in the case that I use panel data with respect to the case shown above?