smoothRegr | R Documentation |
These functions wrap the loess
smoothing function or
the lm.fit
function in order to meet the argument conventions
used in the plgraphics
package.
smoothRegr(x, y, weights = NULL, par = NULL, iterations = 50, minobs=NULL, ...)
smoothLm(x, y, weights = NULL, ...)
x |
vector of x values |
y |
vector of y values to be smoothed |
weights |
vector of weigths used for fitting the smooth |
par |
value for the |
iterations |
number of iterations for the |
minobs |
minimal number of observations. If less valid observations
are provided, the result is |
... |
Further arguments, passed to |
vector of smoothed values, with an attribute xtrim
,
which is 1 for smoothRegr
and 0 for smoothLm
.
If loess
fails, NAs will be returned without issuing a
warning.
Werner A. Stahel, ETH Zurich
loess
, gensmooth
t.x <- (1:50)^1.5
t.y <- log10(t.x) + rnorm(length(t.x),0,0.3)
t.y[40] <- 5
r.sm <- smoothRegr(t.x, t.y, par=0.5)
r.sm1 <- smoothRegr(t.x, t.y, iterations=1, par=0.5)
plot(t.x,t.y)
lines(t.x,r.sm, col=2)
lines(t.x,r.sm1, col=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.