Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: creating interaction variables


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: creating interaction variables
Date   Fri, 11 Jun 2004 13:38:33 +0900

-help xi- will show how to do you what you want.  You can probably automate
the exercise, too, with a couple of -foreach- or -for- loops.

You'll need to stay aware whether one or both the predictor variables are
continuous in each instance of the many different interaction terms that
you're exploring, since -xi-'s syntax will be slightly different from the
case in which they are both categorical.

Joseph Coveney

Tewodaj Mogues wrote:

>I have a simple question. Suppose I want to include in a regression the
>interaction term x1*x2, where x1 and x2 are two variables. Is there any way
>for me to NOT have to first create a new variable, say by typing
>
>gen x1_x2 = x1*x2 ?
>
>I tried running a regression that looks like
>
>regress  y   x1*x2  x3  x4
>
>but that gives an error message. The problem is that I want to try out many
>different interaction terms with existing variables, and having to create
>new variables in the above fashion is really a big bother.





*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index