Debian Codegraph @

man/loessDemo.Rd

raw
1 \name{loessDemo}
2 \title{Graphical Interactive Demo of loess()}
3 \alias{loessDemo}
4 \description{
5 A graphical and interactive demonstration and visualization of how
6 \code{\link{loess}} works. By clicking on the graphic, the user
7 determines the current estimation window which is visualized together
8 with the weights.
9 }
10 \usage{
11 loessDemo(x, y, span = 1/2, degree = 1, family = c("gaussian", "symmetric"),
12 nearest = FALSE, nout = 501,
13 xlim = numeric(0), ylim = numeric(0), strictlim = TRUE, verbose = TRUE,
14 inch.sym = 0.25, pch = 4, shade = TRUE, w.symbols = TRUE,
15 sym.col = "blue", w.col = "light blue", line.col = "steelblue")
16 }
17 \arguments{
18 \item{x,y}{numeric vectors of the same length; the demo is about
19 \code{\link{loess}(y ~ x)}.}
20 \item{span}{the smoothing parameter \eqn{\alpha}.}
21 \item{degree}{the degree of the polynomials to be used; must be in \eqn{{0,1,2}}.}
22 \item{family}{if \code{"gaussian"} fitting is by least-squares, and if
23 \code{"symmetric"} a re-descending M estimator is used with Tukey's
24 biweight function. Can be abbreviated.}
25 \item{nearest}{logical indicating how \eqn{x_0} should be determined,
26 the value at which \eqn{\hat{f}(x_0)}{f^(x_0)} is computed. If
27 \code{nearest} is true, the closest \emph{data} value is taken.
28 }
29 \item{nout}{the number of points at which to evaluate, i.e,
30 determining \eqn{u_i}, \eqn{i = 1,2, \dots, \mathtt{nout}}, at
31 which \eqn{\hat{f}(u_i)}{f^(u_i)} is computed.}
32 \item{xlim}{x-range; to extend or determine (iff \code{strictlim} is
33 true) the \eqn{x}-range for plotting.}
34 \item{ylim}{y-range; to extend or determine (iff \code{strictlim} is
35 true) the \eqn{y}-range for plotting.}
36 \item{strictlim}{logical determining if \code{xlim} and \code{ylim}
37 should be strict limits (as e.g., in \code{\link{plot.default}}), or
38 just a suggestion to \emph{extend} the data-dependent ranges.}
39 \item{verbose}{logical ......}
40 \item{inch.sym}{symbol size in inches of the maximal weight circle symbol.}
41 \item{pch}{plotting character, see \code{\link{points}}.}
42 \item{shade}{logical; if true, \code{\link{polygon}(.., density=..)}
43 will be used to shade off the regions where the weights are zero.}
44 \item{w.symbols}{logical indicating if the non-zero weights should be
45 visualized by circles with radius proportional to \code{inch.sym}
46 and \eqn{\sqrt{w}} where \eqn{w} are the weights.}
47 \item{sym.col, w.col, line.col}{colors for the symbols, weights and
48 lines, respectively.}
49 }
50 %% \value{
51 %% }
52 \author{%%for grep: Greg Snow, ... Henrik Aa. Nielsen ..
53 As function \code{loess.demo()}, written and posted to S-news, on 27
54 Sep 2001, by Greg Snow, Brigham Young University, % [email protected]
55 it was modified by Henrik Aa. Nielsen, IMM, DTU, % [email protected]
56 and subsequently spiffed up for \R by Martin Maechler.
57 }
58 \seealso{
59 \code{\link{loess}}.
60 }
61 \examples{
62 if(dev.interactive()) {
63
64 if(requireNamespace("lattice")) {
65 data("ethanol", package = "lattice")
66 attach(ethanol)
67 loessDemo(E,NOx, span=.25)
68 loessDemo(E,NOx, span=.25, family = "symmetric")
69
70 loessDemo(E,NOx, degree=0)# Tricube Kernel estimate
71 }% if (. lattice .)
72
73 ## Artificial Example with one outlier
74 n2 <- 50; x <- 1:(1+2*n2)
75 fx <- (x/10 - 5)^2
76 y <- fx + 4*rnorm(x)
77 y[n2+1] <- 1e4
78 loessDemo(x,y, span=1/3, ylim= c(0,1000))# not robust !!
79 loessDemo(x,y, span=1/3, family = "symm")
80 loessDemo(x,y, span=1/3, family = "symm", w.symb = FALSE, ylim = c(0,40))
81 loessDemo(x,y, span=1/3, family = "symm", ylim = c(0,40))
82 ## but see warnings() --- there's a "fixup"
83
84 }% only if interactive
85 }
86 \keyword{loess}
87 \keyword{dynamic}
88 \keyword{hplot}