Another option is
set.seed(10) dat <- data.frame(xxA = rnorm(20,10), xxB = rnorm(20,20)) dat$out <- with(dat,xxA+xxB+xxA*xxB+rnorm(20,20)) lm.mod <- lm(out ~ I(scale(xxA))*I(scale(xxB)), data=dat) newdata <- data.frame(xxA=c(-1,0,1),xxB=c(-1,0,1)) preds <- predict(lm.mod, newdata) Best, Ista On Sat, Jan 29, 2011 at 5:12 PM, Russell Pierce <rpier...@ucr.edu> wrote: > Just in case someone else stumbles onto this thread and is facing a > similar issue: The quick solution for me turned out to be using Glm > and Predict in the rms package. Thanks go to Joshua and Ista for > helping me out with this issue. Double thanks go to Joshua for > suggesting I take a closer look at the rms package. > > library(rms) > dat <- data.frame(xxA = rnorm(20,10), xxB = rnorm(20,20)) > dat$out <- with(dat,xxA+xxB+xxA*xxB+rnorm(20,20)) > rms.res <- Glm(out ~ scale(xxA)*scale(xxB),data=dat) > newdata <- as.data.frame(Predict(rms.res,xxA=c(-1,0,1),xxB=c(-1,0,1))[,1:3]) > > ----------------------------------- > Russell S. Pierce, M.A. > Visual Cognition Lab > Department of Psychology > University of California, Riverside > 900 University Avenue > Riverside, CA 92521 > Lab Phone: (951) 827-7399 > > ______________________________________________ > 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. > -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org ______________________________________________ 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.