[R] Remove term from formula for predict.lm
wwwhsd at gmail.com
Tue Jan 19 17:18:47 CET 2010
mod1 <- lm(y ~ u + v + w, data = d)
update(mod1, . ~ . -v)
On Tue, Jan 19, 2010 at 2:10 PM, Werner W. <pensterfuzzer at yahoo.de> wrote:
> probably just a quick question: can I somehow change the formula used with predict? E.g., the regression was run on "y ~ u + v + w" but for the prediction the term v should be removed from the formula contained in the regression object and only "y ~ u + w" be used.
> I could use model.matrix etc. to do the predictions but it would be very helpful to know a simpler way.
> Thanks so much,
> verfügt über einen herausragenden Schutz gegen Massenmails.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
25° 25' 40" S 49° 16' 22" O
More information about the R-help