Displaying 3 results from an estimated 3 matches for "stolpovski".
Did you mean:
stolpovsky
2009 Jul 09
3
How to get function from lm object?
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?
x <- c(1:10)
y <- c(1:10)
fit <- lm(y ~ x)
f <- function(x){fit$coef[1] + fit$coef[2]*x}
2010 Aug 03
0
Issue with prediction from lm object with poly
DDear developeRs,
about a year ago, Alex Stolpovsky posted an issue with predict.lm on a
fit generated using poly with the raw=TRUE option and too few new data
(slightly modified reproducible example below). Alex did not get any
reply. I have just stumbled on the same problem, and I think that this
is a bug of function poly, which arises from the check whether the
polynomial degree is
2009 Jul 13
0
problem predict/poly
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
predict(fit, newdata=data.frame(x=c(1:1))) ## this is broken, error below
Error in poly(x,