Hi,
I am creating a model with loess  but predict complains about missing
variables. This doesn't help with single variable formulas or with lm with
any formula. Looks like a bug to me

# doesn't work
> l = loess(y ~ log(x) + log(z) , data.frame(z = 1:100, x=1:100 +
rnorm(100), y=1:100))
> predict(l, data.frame(x=1:100, z=1:100))
Error in predict.loess(l, data.frame(x = 1:100, z = 1:100)) :
  'newdata' does not contain the variables needed

#works with lm
> l = lm(y ~ log(x) + log(z) , data.frame(z = 1:100, x=1:100 + rnorm(100),
y=1:100))
> predict(l, data.frame(x=1:100, z=1:100))
         1          2          3          4          5          6
7          8          9         10         11         12
-53.790533 -33.916997 -22.291724 -14.043461  -7.645611  -2.418188   2.001536
5.830075   9.207086  12.227925  14.960606  17.455348
[...]

#works with simpler formula
l = loess(y ~ log(x) , data.frame(z = 1:100, x=1:100 + rnorm(100), y=1:100))
> predict(l, data.frame(x=1:100))
  [1]  3.213052  5.524131 19.785356 54.505929        NA        NA
NA        NA        NA        NA        NA        NA        NA
 [14]        NA        NA        NA        NA        NA        NA
NA        NA        NA        NA        NA        NA        NA
[...]


Suggestions? Thanks


A

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to