loessDemo | R Documentation |
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.
loessDemo(x, y, span = 1/2, degree = 1, family = c("gaussian", "symmetric"),
nearest = FALSE, nout = 501,
xlim = numeric(0), ylim = numeric(0), strictlim = TRUE, verbose = TRUE,
inch.sym = 0.25, pch = 4, shade = TRUE, w.symbols = TRUE,
sym.col = "blue", w.col = "light blue", line.col = "steelblue")
x , y |
numeric vectors of the same length; the demo is about
|
span |
the smoothing parameter |
degree |
the degree of the polynomials to be used; must be in |
family |
if |
nearest |
logical indicating how |
nout |
the number of points at which to evaluate, i.e,
determining |
xlim |
x-range; to extend or determine (iff |
ylim |
y-range; to extend or determine (iff |
strictlim |
logical determining if |
verbose |
logical ...... |
inch.sym |
symbol size in inches of the maximal weight circle symbol. |
pch |
plotting character, see |
shade |
logical; if true, |
w.symbols |
logical indicating if the non-zero weights should be
visualized by circles with radius proportional to |
sym.col , w.col , line.col |
colors for the symbols, weights and lines, respectively. |
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 R by Martin Maechler.
loess
.
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"
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.