I am new to using xtivreg2 – and have a question. Sorry if this has been addressed before.

Here goes.

My question is on 2SLS regression with panel data.

I am interested in estimating an interaction effects model with one endogenous regressor (X1) and two endogenous regressors X2 and X3

Y = X1 + X1* X2 + X1* X3 + controls1

X1 is endogenous

X2 and X3 are exogenous

Controls1- set of controls to explain Y

And X1= Z+ controls2

Controls2 – set of controls to explain X1

Right now I am doing it 2SLS by hand, by predicting X1hat and sticking it in the equation for Y. I am concerned that this may not be the right way to do it.

Based on some material I have seen on Stata forums, I understand that I have to instrument X1*X2 by Z*X2.. and in essence estimate this model as a multiple endogenous regressor model.

Thanks for your help in advance,

Rajashri Srinivasan

**Contents**hide

#### Best Answer

This is a common mistake.

Here is the right way to do it, all in one step (towards the end). I also show your method with my first stage to keep it apples to apples, as well as OLS. Note that I also added own effects for X2 and X3, since that is generally good practice.

`set more off webuse nlswork, clear gen tenureXage = c.tenure#c.age gen tenureXhours = c.tenure#c.hours /* OLS */ xtreg ln_w i.not_smsa c.tenure##(c.age c.hours), fe margins, dydx(tenure) at(age=30 hour=40) /* Your Method With My First Stage */ xtreg tenure i.not_smsa i.union##(c.age c.hours), fe predict that, xbu xtreg ln_w i.not_smsa c.that##(c.age c.hours), fe margins, dydx(that) at(age=30 hour=40) /* My Method */ xtivreg ln_w i.not_smsa c.age c.hours (tenure tenureXage tenureXhours = i.union##(c.age c.hours)), fe first nlcom ME: _b[tenure] + _b[tenureXage]*30 + _b[tenureXhours]*40 `

The last line gives you the marginal effect of endogenous tenure for a thirty-year-old who works 40 hours a week. Note how different it is from your approach and from OLS.

### Similar Posts:

- Solved – IV-RE xtoverid testing both IV validity and RE vs FE
- Solved – IV-RE xtoverid testing both IV validity and RE vs FE
- Solved – IV-RE xtoverid testing both IV validity and RE vs FE
- Solved – IV-RE xtoverid testing both IV validity and RE vs FE
- Solved – 2SLS with two instruments for one endogenous variable in MATLAB