loess.as: Fit a local polynomial regression with automatic smoothing...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/fANCOVA_all.R

Description

Fit a local polynomial regression with automatic smoothing parameter selection. Two methods are available for the selection of the smoothing parameter: bias-corrected Akaike information criterion (aicc); and generalized cross-validation (gcv).

Usage

1
2
3
loess.as(x, y, degree = 1, criterion = c("aicc", "gcv"), 
		family = c("gaussian", "symmetric"), user.span = NULL, 
		plot = FALSE, ...)

Arguments

x

a vector or two-column matrix of covariate values.

y

a vector of response values.

degree

the degree of the local polynomials to be used. It can ben 0, 1 or 2.

criterion

the criterion for automatic smoothing parameter selection: “aicc” denotes bias-corrected AIC criterion, “gcv” denotes generalized cross-validation.

family

if “gaussian” fitting is by least-squares, and if “symmetric” a re-descending M estimator is used with Tukey's biweight function.

user.span

the user-defined parameter which controls the degree of smoothing.

plot

if TRUE, the fitted curve or surface will be generated.

...

control parameters.

Details

Fit a local polynomial regression with automatic smoothing parameter selection. The predictor x can either one-dimensional or two-dimensional.

Value

An object of class “loess”.

Author(s)

X.F. Wang [email protected]

References

Cleveland, W. S. (1979) Robust locally weighted regression and smoothing scatterplots. Journal of the American Statistical Association. 74, 829–836.

Hurvich, C.M., Simonoff, J.S., and Tsai, C.L. (1998), Smoothing Parameter Selection in Nonparametric Regression Using an Improved Akaike Information Criterion. Journal of the Royal Statistical Society B. 60, 271–293.

Golub, G., Heath, M. and Wahba, G. (1979). Generalized cross validation as a method for choosing a good ridge parameter. Technometrics. 21, 215–224.

See Also

loess, loess.ancova, T.L2, T.aov, T.var.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Fit Local Polynomial Regression with Automatic Smoothing Parameter Selection
n1 <- 100
x1 <- runif(n1,min=0, max=3)
sd1 <- 0.2
e1 <- rnorm(n1,sd=sd1)
y1 <- sin(2*x1) + e1

(y1.fit <- loess.as(x1, y1, plot=TRUE))

n2 <- 100
x21 <- runif(n2, min=0, max=3)
x22 <- runif(n2, min=0, max=3)
sd2 <- 0.25
e2 <- rnorm(n2, sd=sd2)
y2 <- sin(2*x21) + sin(2*x22) + 1 + e2

(y2.fit <- loess.as(cbind(x21, x22), y2, plot=TRUE))

fANCOVA documentation built on May 30, 2017, 8:15 a.m.