Gavin Simpson wrote: Dear list,
I am very sorry for being inaccurate in my question. But re-reading the predict.loess help site does not provide a solution. As long as predict is used on a new dataset based on this dataset, the strange values remain and can be reproduced. Adding a new element to both vectors (at the beginning, e.g. "1" for each vector) results in plausible values - but not in every case. Even switching x and y is sufficient (i.e. x as predictor and y as dependent variable). So my question is: Is it normal - or under which conditions does it take place - that predict.loess predicts values that are almost 20000/max(y) ~ 5000 times higher than expected? best, leo gürtler >On Tue, 2005-12-06 at 18:09 +0100, Leo Gürtler wrote: > > >>Dear altogether, >> >> ><snip> > > >># here is the difference!! >>predict(mod, data.frame(x=X), se=TRUE) >>predict(mod, x=X, se=TRUE) >> >> >><--- end of snip ---> >> >>I assume this has some reason but I do not understand this reason. >>Merci, >> >> > >Not sure if this is the reason, but there is no argument x in >predict.loess, and: > >a <- predict(mod, se = TRUE) > >gives you the same results as: > >b <- predict(mod, x=X, se=TRUE) > >so the x argument appears to be being passed on/in the ... arguments and >ignored? As such, you have no newdata, so mod$x is used. > >Now, when you do: > >c <- predict(mod, data.frame(x=X), se=TRUE) > >You have used an un-named argument in position 2. R takes this to be >what you want to use for newdata and so works with this data rather than >the one in mod$x as in the first case: > ># now named second argument - gets ignored as in a and b >d <- predict(mod, x = data.frame(x=X), se=TRUE) > >all.equal(a, b) # TRUE >all.equal(a, c) # FALSE >all.equal(a, d) # TRUE > ># this time we assign X to x by using (), the result is used as newdata >e <- predict(mod, (x=X), se=TRUE) > >all.equal(c, e) # TRUE > >If in doubt, name your arguments and check the help! ?predict.loess >would have quickly shown you where the problem lay. > >HTH > >G > > > >>best regards >> >>leo gürtler >> >>______________________________________________ >>R-help@stat.math.ethz.ch mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >> >> -- email: [EMAIL PROTECTED] www: http://www.anicca-vijja.de/ ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html