[R] problem with predict()
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Mon Jul 1 15:38:01 CEST 2002
I should point that there is (as I thought) nothing wrong with predict.lm
on a rank-degenerate problem, e.g.
x1 <- rnorm(100)
x3 <- rnorm(100)
y <- rnorm(100)
train <- data.frame(y=y, x1=x1, x2=x1, x3=x3)
fit <- lm(y ~ ., train)
stopifnot(all.equal(predict(fit), predict(fit, train)))
although as Thomas points out a warning would be useful.
The problem here is that model.matrix is (for me) adding 13 duplicate
columns in lm and not in predict.lm. That's a bug unrelated to predict().
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help