The most common case that I see that error is when someone fits their
model using syntax like:
fit <- lm( mydata$y ~ mydata$x )
instead of the preferred method:
fit <- lm( y ~ x, data=mydata )
The fix (if this is what you did and why you are getting the error) is
to not use the first way and in
nesday, October 03, 2012 7:37 AM
> To: r-help@r-project.org
> Subject: [R] predict.lm if regression vector is longer than predicton vector
>
> Hi everybody,
>
> recently a member of the community pointed me to the useful predict.lm()
> comment. While I was toying with it, I stumbled
> Of course I can extend the new dataframe with a few thousands
> NAs, but is there a more elegant solution?
That should not be necessary: predict.lm should work on any number of newdata
rows, whether longer or shorter than the original data set.
However, the help page for predict.lm says (among
Hi everybody,
recently a member of the community pointed me to the useful predict.lm()
comment. While I was toying with it, I stumbled across the following
problem.
I do the regression with data from five years. But I want to do a prediction
with predict.lm for only one year. Thus my dataframe f
4 matches
Mail list logo