[R] predict.lm with matrix as newdata
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sat Feb 16 12:10:08 CET 2008
Marlin Keith Cox wrote:
> Z is a matrix and when I run the following line, it creates a prediction
> estimate using each column, how can I get it an estimate for each individual
> number. I have tried changing Z to a data.frame, but this does not do it
> either.
>
> model.lm<-lm(w~x)
>
> pred.est <- predict.lm(model.lm, data.frame(x=Z))
That's what I do and it always worked for me. Can you please specify a
reproducible example that shows what you got and tells us exactly what
you expected?
BTW: It is expected that you call the generic predict() rather than its
particular method.
Uwe Ligges
> Thanks in advance,
> keith
>
More information about the R-help
mailing list