[R] R stepping through multiplie interactions

Chuck Cleland ccleland at optonline.net
Fri Jan 23 19:06:32 CET 2009


On 1/23/2009 12:44 PM, ppeetteerr wrote:
> I have a lm in R in the form
> model <- lm( Z ~ A*B*C*D,data=mydata)
> I want to run the model and include all interactions expect the 4 way
> (A:B:C:D) is there an easy way of doing this? I then want to step down the
> model eliminating the non-significant terms I understand step() does this
> but how would I do it by hand?

  For the first part, try this:

lm(Z ~ (A + B + C + D)^3, data = mydata)

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list