Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Interaction terms in dynamic models


From   Hewan Belay <[email protected]>
To   [email protected]
Subject   Re: st: Interaction terms in dynamic models
Date   Tue, 10 May 2011 10:12:22 -0700 (PDT)

Dear Maarten,

Thanks for your response. Yes, I used to make interaction variables by hand in the past, and just recently learned of the approach c.varname1#c.varname2, and rewrote my dofiles to clean out the more clunky by-hand notation...only to find that the above approach doesn't work on xtdpd, which is what most of my equations are!

By the way, I think the issue is not about "factor variables" (ie categorical variables) as you state, but rather about interaction terms between any two (or more) vars, whether these be categorical or continuous vars. E.g. interactions can be between say income * population size or whatever. 

Ok, thanks for confirming that (for some reason, possibly a technical one) the c.varname1#c.varname2 doesn't work on xtabond and xtdpd. If someone else knows whether in stata the interaction term should be specified differently for it to work on these estimations (other than by-hand, which I known is always a fall back option) please let me know!

Thanks,
Hewan

--- On Tue, 5/10/11, Maarten Buis <[email protected]> wrote:

> From: Maarten Buis <[email protected]>
> Subject: Re: st: Interaction terms in dynamic models
> To: [email protected]
> Date: Tuesday, May 10, 2011, 4:45 PM
> On Tue, May 10, 2011 at 6:07 PM,
> Hewan Belay <[email protected]>
> 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/
>


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index