Re: st: Interaction terms in dynamic models

On Tue, May 10, 2011 at 6:07 PM, Hewan Belay <hewan_belay@yahoo.com> wrote:
> I am wondering about the following: I am able to include interaction terms with no problem in a range of estimation models, but not in dynamic ones. Is there a reason why this is not working, or do I need to do something differently? Here are some toy examples of what I mean:
>
> All of the following regression commands run just fine:
>
> webuse abdata
> regress wage c.emp#c.cap
> xtreg wage c.emp#c.cap
> xtreg wage c.emp#c.cap, fe
> xtgls wage c.emp#c.cap
> xttobit wage c.emp#c.cap
>
> But the following don't run:
> xtabond wage c.emp#c.cap
> xtdpd L(0/1).wage c.emp#c.cap, dgmmiv(wage) div(c.emp#c.cap)
>
> In the above two, I get the error message "cemp#c: operator invalid". For some reason xtabond and xtdpd don't seem to recognise the interaction specification c.varname1#c.varname2.
You can add interaction, you just need to make them yourself. Remember
that an interaction nothing other than a new variable containing the
product of two variables.
What you noticed is that Stata's new factor variable notation did not
(yet) make it into -xtabond- and -xtdpd-. This is (rather tersely)
documented in the helpfile by the absence of a sentence like
"indepvars may contain factor variables". It is good that Stata's
helpfiles are concise but here they may have overdone that a bit.
Adding a sentence saying that factor variables are not allowed could
be helpful.
My guess on why StataCorp has not implemented factor variables for
-xtabond- and -stdpd- (yet) is that there is something special about
how variable lists are parsed in these commands that would require
them to do a major rewrite of these commands in order to implement the
factor variable notation for these commands. But that is just my
gut-feeling, I haven't looked at the underlying code of these commands
to substantiate this guess.
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/