fitLoess: Fit a loess curve

View source: R/functions_range.R

fitLoessR Documentation

Fit a loess curve

Description

Wrapper function for fitting and predicting from loess().

Usage

fitLoess(y, x, newx = x, span = 0.5, ...)

Arguments

y

Dependent variable values

x

Independent variable values

newx

Values of x to use for prediction.

span

Controls the amount of smoothing. Passed to loess; see that function for details.

...

Additional arguments passed to loess

Value

A vector of the same length of newx

Examples

x <- seq(0, 5, length=50)
y <- cos(4*x) + rnorm(50, sd=0.5)
xplot <- seq(0, 5, length=200)
lfit <- fitLoess(y=y, x=x, newx=xplot, span=0.2)
plot(x, y)
points(xplot, lfit, type="l")

jpkeller/spconf documentation built on Oct. 20, 2024, 2 a.m.