lowess
returns a list containing components
x
and y
which give the coordinates of the smooth.
The smooth should be added to a plot of the original
points with the function lines
.lowess(x, ...)
## S3 method for class 'default':
lowess(x, y = NULL, f = 2/3, iter = 3, delta = 0.01 *
diff(range(xy$x[o])), ...)
## S3 method for class 'formula':
lowess(formula,data = parent.frame(), subset, na.action,
f=2/3, iter=3, delta=.01*diff(range(mf[-response])), ... )
iter
will make lowess
run faster.x
which lie within delta
of each other replaced by a single value in the output from
lowess
.Cleveland, W. S. (1981) LOWESS: A program for smoothing scatterplots by robust locally weighted regression. The American Statistician, 35, 54.
loess
(in package modreg
), a newer
formula based version of lowess
(with different defaults!).data(cars)
# default method
plot(cars, main = "lowess(cars)")
lines(lowess(cars), col = 2)
lines(lowess(cars, f=.2), col = 3)
legend(5, 120, c(paste("f = ", c("2/3", ".2"))), lty = 1, col = 2:3)
# formula method
plot(dist ~ speed, data=cars, main = "lowess(cars)")
lines(lowess(dist ~ speed, data=cars), col = 2)
lines(lowess(dist ~ speed, data=cars, f=.2), col = 3)
legend(5, 120, c(paste("f = ", c("2/3", ".2"))), lty = 1, col = 2:3)
Run the code above in your browser using DataLab