See: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67474.html
and also the other posts in that thread. On 10/24/07, Sandy Weisberg <[EMAIL PROTECTED]> wrote: > I would like to write a function that computes Tukey's 1 df for > nonadditivity. Here is a simplified version of the function I'd like to > write: (m is an object created by lm): > > tukey.test <- function(m) { > m1 <- update(m, ~.+I(predict(m)^2)) > summary(m1)$coef > } > > The t-test for the added variable is Tukey's test. This won't work: > > data(BOD) > m1 <- lm(demand~Time,BOD) > tukey.test(m1) > > Error in predict(m) : object "m" not found > > This function doesn't work for two reasons: > 1. The statement m1 <- update(m, ~.+I(predict(m)^2)) can't see 'm' in > the call to predict. > 2. If in creating m missing values had been present, then predict(m), > even if it could be computed, could be of the wrong length. > > Can anyone help? > > > > -- > Sanford Weisberg, [EMAIL PROTECTED] > Office and mailing address: > University of Minnesota, School of Statistics > 312 Ford Hall, 224 Church St. SE, Minneapolis, MN 55455 > 612-625-8355, FAX 612-624-8868 > > St. Paul office: > 146 Classroom-Office Building, 612-625-8777 > > ______________________________________________ > 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. > ______________________________________________ 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.