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

st: RE: Creating interaction terms of 30 continuous variables

From   "Lachenbruch, Peter" <>
To   <>
Subject   st: RE: Creating interaction terms of 30 continuous variables
Date   Thu, 10 Sep 2009 08:55:22 -0700

This seems like data snooping.  You will have 435 products.  Have you
considered how you will use these?  If you use a Bonferroni on
significance tests, you will need to be less than 0.00011 (.05/435) to
even get a little excited.  You might consider defining some specific
interactions of interest.


Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001

-----Original Message-----
[] On Behalf Of Jean-Gael
Sent: Wednesday, September 09, 2009 8:13 AM
Subject: st: Creating interaction terms of 30 continuous variables

I am trying to explore all possible interaction terms in my dataset  
and I am not sure how to do this efficiently using stata. I have about  
30  continuous variables. It seems that xi is limited to non  
continuous variables and xi3 does not seem to work for 30 variables,  
unless I am doing something wrong. I came up with a solution using  
"foreach" to generate all the interactions terms and then try them in  
a regression model:

foreach x of varlist var1-var30 {
foreach y of varlist var1-var30 {
generate `x'X`y'=`x'*`y'

The first problem I have is that this created duplicates (i.e.  
var1Xvar2 is the same as var2Xvar1). Furthermore, I feel it is a  
cumbersome way to do it, and I wonder if there is a more efficient way  
to generate all possible pair interaction terms or better yet to have  
an exploratory regression models testing all these pairs out and  
selecting the best model. I saw someone someone doing something  
similar very quickly in NCSS and I was hoping I could do the same in  
Thanks for your feedback.

Jean-Gael "JG" E. Collomb
PhD candidate
School of Natural Resources and Environment / School of Forest  
Resources and Conservation
University of Florida
+1 (352) 870 6696

*   For searches and help try:

*   For searches and help try:

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