lowess(x, y, f = 2/3, iter = 3, delta = .01*range(x))
x
point. The
larger the
f
value, the smoother the fit.
x
). If
lowess
estimates at two
x
values within
delta
of one another,
it fits any points between them by linear interpolation.
The default is 1% of the range of
x
.
If
delta=0
all but identical
x
values are estimated independently.
x
and
y
which
are the x,y points of the smoothed scatter plot. Note that
x
is a sorted version of the input
x
vector, with
duplicate points removed.
This function may be slow for large numbers of points; execution time
is proportional to (
iter*f*n^2
).
Increasing
delta
should speed things up, as will decreasing
f
.
This is a scatterplot smoother - it does not make any assumptions about the
x
values being evenly spaced.
Lowess uses robust locally linear fits.
A window, dependent on
f
, is placed about each
x
value;
points that are inside the window
are weighted so that nearby points get the most weight.
Cleveland, W. S. (1979).
Robust locally weighted regression and smoothing scatterplots.
Journal of the American Statistical Association
74, 829-836.
Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P. A. (1983).
Graphical Methods for Data Analysis.
Wadsworth, Belmont, California.
x <- car.miles y <- car.gals plot(x,y) lines(lowess(x,y)) # scatter plot with smooth fit <- lowess(x,y) resid <- y-approx(fit,xout=x)$y # residual from smooth