scatter.smooth {stats}R Documentation

Scatter Plot with Smooth Curve Fitted by Loess

Description

Plot and add a smooth curve computed by loess to a scatter plot.

Usage

scatter.smooth(x, y, span = 2/3, degree = 1,
    family = c("symmetric", "gaussian"),
    xlab = deparse(substitute(x)), ylab = deparse(substitute(y)),
    ylim = range(y, prediction$y, na.rm = TRUE),
    evaluation = 50, ...)

loess.smooth(x, y, span = 2/3, degree = 1,
    family = c("symmetric", "gaussian"), evaluation = 50, ...)

Arguments

x x coordinates for scatter plot.
y y coordinates for scatter plot.
span smoothness parameter for loess.
degree degree of local polynomial used.
family if "gaussian" fitting is by least-squares, and if family="symmetric" a re-descending M estimator is used.
xlab label for x axis.
ylab label for y axis.
ylim the y limits of the plot.
evaluation number of points at which to evaluate the smooth curve.
... graphical parameters.

Details

loess.smooth is an auxiliary function which evaluates the loess smooth at evaluation equally spaced points covering the range of x.

Value

For scatter.smooth, none.
For loess.smooth, a list with two components, x (the grid of evaluation points) and y (the smoothed values at the grid points).

See Also

loess

Examples

attach(cars)
scatter.smooth(speed, dist)
detach()

[Package stats version 2.1.0 Index]