I am trying to run 2SLS with an interaction term. My treatment variable is a dummy 0/1 called Industry. My instrument is a continuous variable called IV_jack. Without interaction, I run:
ivreg2 Y (industry=IV_jack) i.(year female),r
Now, I want to interact industry with a categorical variable called Field (Field=1 for Life Sciences, Field=2 for Computer Sciences etc.). I tried:
ivreg2 Y (industry##i.Field=c.IV_jack##i.major_field) i.(year female),r
but I am getting an error equation not identified; must have at least as many instruments not in the regression as there are instrumented variables Note that when I interact Industry with a dummy variable (e.g. Young which takes the value 0/1), the following works:
ivreg2 Y (industry##i.young=c.IV_jack##i.young) i.(year female),r
The problem is that with an ordinal variable with more than two categories, i.e., Fields, Stata isn't able to interact multiple categories. You will most likely need to break that variable apart into individual dummy variables, then create a separate interaction for each one. If you don't want to have a huge model, you could use t-tests to prune down the full model to interactions with only the statistically-significant categories from your Fields variable.