The loessLine
function is a re-implementation of the loess
smoother
that was used in car prior to September 2012. The main enhancement is the ability to
set more options through the smoother.args
argument.
The gamLine
function is more general than loessLine
because it supports fitting a generalized spline regression model, with user-specified error
distribution and link function.
The quantregLine
function fits a model using splines with estimation
based on L1 regression for the median and quantile regression the (optional) spread. It is
likely to be more robust than the other smoothers.
The smoother.args
argument is a list of named elements (or sub-arguments) used to pass
additional arguments to the smoother. As of November, 2016, the smoother is evaluated by default at an equally spaced grid of 50 points in the range of the horizontal variable. With any of the smoothers, you can change to, say, 100 evaluation points via the argument smoother.args=list(evaluation=100)
. As of version 3.0-1, the smoother.args
elements col.var
, lty.var
, and lwd.var
are equivalent to col.spread
, lty.spread
, and lwd.spread
, respectively. The style
sub-argument controls how spread/variance envelopes are displayed, with choices "filled"
(the default), "lines"
, and "none"
(which is equivalent to var=FALSE
). The alpha
subargument controls the transparency/opacity of filled spread envelopes with allowable values between 0
and 1
(default 0.15
). The border
subargument controls whether a border line is drawn around the filled region (the default is TRUE
). The vertical
subargument controls whether the left and right ends of the filled region are forced to be vertical (the default is TRUE
).
For loessLine
, the default is
smoother.args=list(lty.smooth=1, lwd.smooth=2, lty.spread=4, lwd.spread=2, style="filled", alpha=0.15, span=2/3,
degree=1, family="symmetric", iterations=4)
. (Prior to November 2016, the default span was 1/2.)
The elements lty.smooth
, lwd.smooth
, and col.spread
are the line type, line width, and line color,
respectively of the mean or median smooth; lty.spread
,
lwd.spread
, and col.spread
are the line type, width, and color of the spread smooths, if requested.
The elements span
, degree
, and family
are
passed as arguments to the loess
function, along with iterations
robustness iterations.
For gamLine
, the default is
smoother.args=list(lty.smooth=1, lwd.smooth=2, lty.spread=4, lwd.spread=2, style="filled", alpha=0.15,
k=-1, bs="tp", family="gaussian", link=NULL, weights=NULL)
.
The first six elements are as for loessLine
. The next two
elements are passed to the gam
function to control smoothing:
k=-1
allows gam
to choose the number of splines in the basis
function; bs="tp"
provides the type of spline basis to be used, with "tp"
for the default thin-plate splines. The last three arguments specify
a distributional family, link function, and weights as in generalized linear models. See the examples
below. The spread
element is ignored unless family="gaussian"
and link=NULL
.
For quantregLine
, the default is
smoother.args=list(lty.smooth=1, lwd.smooth=2, lty.spread=4, lwd.spread=2, style="filled", alpha=0.15,
lambda=IQR(x))
. The first six
elements are as for loessLine
. The last element is passed to the
qss
function in quantreg. It is a smoothing
parameter, by default a robust estimate of the scale of the horizontal axis variable.
This is an arbitrary choice, and may not work well in all circumstances.