Hi all,

I've run into a bit of a problem with regard to the use of an interaction term in a panel instrumental variable regression. In particular, the following is my specification:

pit = a + b1wit + b2wit2+...

and I would like to obtain the marginal effect of wit on pit;that is,

(dpit/dwit) = b1 + b2wit

However, wit is endogenous, so I must instrument it with xit. (the above model is a simplification, of course; I have to account for fixed effects along with my other control variables). The following is the code I have employed for it:

Code:
xtivreg2 ln_PovPercent (StateMinWage_real_effln c.StateMinWage_real_effln#c.StateMinWage_real_effln = ln_StateMinWage_real c.ln_StateMinWage_real#c.ln_StateMinWage_real c.ln_MedWage_real#c.ln_StateMinWage_real) ln_EmplRate ln_UnemplRate ln_LFParticipRate i.Year if Code != 0, fe vce(cluster Code)

estpost margins, dydx(StateMinWage_real_effln)
However, IV doesn't support interactions in varlist_1, as the set of endogenous variables is called in the documentation. In my reading of Statalist, a lot of people suggest just generating the squared (or generally transformed) variable, and then running the regression. This has worked for me, but it doesn't allow me to get marginal effects, as of course the margins command will not recognize the transformed variable as a transformation. For context on the code - StateMinWage_real_effln is a measure of the effective minimum wage, constructed as the log difference between the minimum and the median; this is why their interaction is included in the list of instruments. Therefore I was wondering if there are any suggestions that the community has as to how I can get around this problem - whether there are any alternatives to xtivreg which don't encounter this problem.

I look forward to reading your replies.
Salman