A graphical and interactive demonstration and visualization of how loess works. By clicking on the graphic, the user determines the current estimation window which is visualized together with the weights.
x,y: numeric vectors of the same length; the demo is about loess(y ~ x).
span: the smoothing parameter α.
degree: the degree of the polynomials to be used; must be in 0,1,2.
family: if "gaussian" fitting is by least-squares, and if "symmetric" a re-descending M estimator is used with Tukey's biweight function. Can be abbreviated.
nearest: logical indicating how x0 should be determined, the value at which f(x0) is computed. If nearest is true, the closest data value is taken.
nout: the number of points at which to evaluate, i.e, determining ui, i=1,2,…,nout, at which f(ui) is computed.
xlim: x-range; to extend or determine (iff strictlim is true) the x-range for plotting.
ylim: y-range; to extend or determine (iff strictlim is true) the y-range for plotting.
strictlim: logical determining if xlim and ylim
should be strict limits (as e.g., in plot.default), or just a suggestion to extend the data-dependent ranges.
verbose: logical ......
inch.sym: symbol size in inches of the maximal weight circle symbol.
pch: plotting character, see points.
shade: logical; if true, polygon(.., density=..)
will be used to shade off the regions where the weights are zero.
w.symbols: logical indicating if the non-zero weights should be visualized by circles with radius proportional to inch.sym
and w where w are the weights.
sym.col, w.col, line.col: colors for the symbols, weights and lines, respectively.
Author(s)
As function loess.demo(), written and posted to S-news, on 27 Sep 2001, by Greg Snow, Brigham Young University,
it was modified by Henrik Aa. Nielsen, IMM, DTU,
and subsequently spiffed up for by Martin Maechler.
See Also
loess.
Examples
if(dev.interactive()){if(requireNamespace("lattice")){ data("ethanol", package ="lattice") attach(ethanol) loessDemo(E,NOx, span=.25) loessDemo(E,NOx, span=.25, family ="symmetric") loessDemo(E,NOx, degree=0)# Tricube Kernel estimate}## Artificial Example with one outlier n2 <-50; x <-1:(1+2*n2) fx <-(x/10-5)^2 y <- fx +4*rnorm(x) y[n2+1]<-1e4 loessDemo(x,y, span=1/3, ylim= c(0,1000))# not robust !! loessDemo(x,y, span=1/3, family ="symm") loessDemo(x,y, span=1/3, family ="symm", w.symb =FALSE, ylim = c(0,40)) loessDemo(x,y, span=1/3, family ="symm", ylim = c(0,40))## but see warnings() --- there's a "fixup"}