smoothRegr: Smoothing function used as a default in regr

Description Usage Arguments Value Author(s) See Also Examples

View source: R/regr.R

Description

This function wraps the loess smoothing function in order to meet the argument conventions used in the regr0 package.

Usage

1
2
smoothRegr(x, y, weights, par = 5 * length(x)^log10(1/2),
  iterations = 50, minobs=NULL)

Arguments

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 span argument of loess.

iterations

number of iterations for the loess algorithm. If ==1, the non-robust, least squares version is applied.

minobs

minimal number of observations. If less valid observations are provided, the result is NULL.

Value

vector of smoothed values. If loess fails, NAs will be returned without issuing a warning.

Author(s)

Werner A. Stahel, ETH Zurich

See Also

loess, smoothM

Examples

1
2
3
4
5
6
7
8
9
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)

regr0 documentation built on May 31, 2017, 2:26 a.m.