# How to do an instrumental variables regression with an instrumented interaction term in Stata?

I'm having a bit of a problem with Stata syntax. I need to do the following regression:

$$y = ax + bz + c(xz) + e$$

where both $x$ and $z$ are instrumented and also the interaction term $xz$ uses the instrumented values of $x$ and $z$.

Just generating the predicted values for $x$ and $z$ and using them as regressors yields incorrect standard errors.

Edit: I also need to do a similar regression with only one of the variables instrumented and with this one instrumented variable being in the interaction term.

This is a question which appears sometimes in the Statalist. Let me write $x_{1}$ and $x_{2}$ instead of $x$ and $z$ (in the literature $z$ is usually reserved for instruments rather than endogenous variables) and let $x_3 = x_1 \cdot x_2$. Your model then becomes: $$y = ax_1 + bx_2 + cx_3 + e$$ which has three endogenous variables. Assuming that you have two variables $z_1$ and $z_2$ which are valid instruments for $x_1$ and $x_2$, then a valid instrument for $x_3$ is $z_3 = z_1 \cdot z_2$. In Stata it is straightforward to generate the corresponding interactions and to use them in the appropriate estimation command like ivreg2, for instance.
Your second problem is similar for the case where you interact an endogenous ($x$) and an exogenous variable ($w$) in a model of the type $$y = ax + bw + c(x\cdot w) + e$$ If $z$ is a valid instrument for $x$, then a valid instrument for $(x\cdot w)$ is $(z\cdot w)$. This procedure was suggested in the Statalist. I just provide one link but there are many more discussions about this (most of which will pop up on Google when searching for: interaction of "two endogenous variables").