Message-ID: <AANLkTim+BhcgVKhG5GwrHwOffjWBfNDTNXB8zzXXnxeW@mail.gmail.com>
Date: 2010-12-05T20:19:05Z
From: William Simpson
Subject: lm() and interactions in model formula for x passed as matrix
In-Reply-To: <AANLkTimx5yFTKCPFJBQL=Z=y9X3X4G4yUD-1VSCz7Ygz@mail.gmail.com>
Suppose I have x variables x1, x2, x3 (however in general I don't know
how many x variables there are). I can do
X<-cbind(x1,x2,x3)
lm(y ~ X)
This fits the no-interaction model with b0, b1, b2, b3.
How can I get lm() to fit the model that includes interactions when I
pass X to lm()? For my example,
lm(y~x1*x2*x3)
I am looking for something along the lines of
lm(y~X ...)
where ... is some extra stuff I need to fill in.
Thanks for any help.
Bill