[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Richard Williams <Richard.A.Williams.5@ND.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: creating interaction variables |

Date |
Fri, 11 Jun 2004 08:55:15 -0500 |

At 01:38 PM 6/11/2004 +0900, Joseph Coveney wrote:

Doesn't -xi- require that one of the vars be categorical though? How about if both x's are continuous? If it doesn't exist already, it seems like it would be nice to have something like -xi- for continuous vars, e.g. if you have x1*x2 it expands to include the terms x1, x2 and x1*x2, so you don't have to bother computing the interactions beforehand.-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.

As an alternative, I think -anova- might do the trick, e.g. you can have syntax like

anova y x1 x2 x1*x2, continuous(x1 x2)

As a possibly unnecessary sidelight, going back to the original requested regression:

regress y x1*x2 x3 x4

However the problem gets solved, you'd probably want to have the lower order terms included, e.g. it should expand to

regress y x1 x2 x1*x2 x3 x4

*

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

**References**:**Re: st: creating interaction variables***From:*Joseph Coveney <jcoveney@bigplanet.com>

- Prev by Date:
**Re: st: How -ovtest- works?** - Next by Date:
**st: Maximum length of macros** - Previous by thread:
**Re: st: creating interaction variables** - Next by thread:
**Re: st: creating interaction variables** - Index(es):

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