Dear R experts,
I am observing undesired behavior of predict(fit, newdata), in case when fit
object is produced by lm() involving a poly(). Here is how to reproduce:
x <- c(1:10)
y <- sin(c(1:10))
fit <- lm(formula=y~poly(x, 5, raw=TRUE))
predict(fit, newdata=data.frame(x=c(1:10))) ## this works
Thank you much for the useful pointers. Turns out, I can get what I want with
predict(fit, newdata = newdata). But for the record, there is no way to get the
fit function, from lm object, is there?
Alex
-
This transmission may contain information that i
Dear experts,
I am trying to obtain a function from a model, so that I could further
manipulate it, plot it, etc. I can get model estimates and manually construct
a function, but this gets tedious when trying out different functions to fit
the data. There must be a better way of doing it, no?
3 matches
Mail list logo