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 at 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