Re: [R] problems with loess

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 08 Oct 2005 - 02:14:58 EST

On Fri, 7 Oct 2005, Dimitri Giunchi wrote:

> Hi all,
> I was unable to obtained a smoothed line using the loess function.I used the following code reported in the examples of R documentation:
> cars.lo <- loess(dist ~ speed, cars)
> Then I tried to plot both the data and the smoothed line
> plot(cars)lines(cars.lo)
> but what I obtained is simply a broken line joining all the data points.I tried with different spans, but the results did not change.
>
> Does anyone know what's going wrong?

Yes. lines(cars.lo) plots the original data stored in the loess fit.

You need to predict, or use scatter.smooth to do it for you.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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
Received on Sat Oct 08 02:21:47 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:28:54 EST