Hi I have a data frame, including x1, x2, x3, and y. I use lm() to fit second-order linear model, like the following:
ft <- lm(y ~ x1 + x2 + x3 + I(x1 * x1) + I(x1 * x2) + I(x1 * x3) + I(x2 * x2) + I(x2 * x3) + I(x3 * x3), mydata) if the independent variable number is large, the formula will be very long. Is there a easy way to write formula like the above one? I have read the R introduction, however, I don't find a easy way. Any hints will be appreciated. Thanks, Jinsong ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.