loessDemo.RdA 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.
numeric vectors of the same length; the demo is about
loess(y ~ x).
the smoothing parameter \(\alpha\).
the degree of the polynomials to be used; must be in \({0,1,2}\).
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.
logical indicating how \(x_0\) should be determined,
the value at which \(\hat{f}(x_0)\) is computed. If
nearest is true, the closest data value is taken.
the number of points at which to evaluate, i.e, determining \(u_i\), \(i = 1,2, \dots, \mathtt{nout}\), at which \(\hat{f}(u_i)\) is computed.
x-range; to extend or determine (iff strictlim is
true) the \(x\)-range for plotting.
y-range; to extend or determine (iff strictlim is
true) the \(y\)-range for plotting.
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.
logical ......
symbol size in inches of the maximal weight circle symbol.
plotting character, see points.
logical; if true, polygon(.., density=..)
will be used to shade off the regions where the weights are zero.
logical indicating if the non-zero weights should be
visualized by circles with radius proportional to inch.sym
and \(\sqrt{w}\) where \(w\) are the weights.
colors for the symbols, weights and lines, respectively.
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"
}