smoothing {envoutliers}R Documentation

Kernel regression smoothing

Description

Nonparametric estimation of regression function using kernel regression with local or global data-adaptive plug-in bandwidth and optimal kernels.

Usage

smoothing(x = c(1:length(y)), y, bandwidth.type = "local",
  bandwidth.value = NULL, kernel.order = 2)

Arguments

x

data values. Supported data types

  • a numeric vector

  • a time series object ts

  • a time series object xts

  • a time series object zoo

y

a numeric vector of data values.

bandwidth.type

a character string specifying the type of bandwidth.

Possible options are

  • "local" (default) to use local bandwidth

  • "global" to use global bandwidth

bandwidth.value

a local bandwidth array (for bandwidth.type = "local") or global bandwidth value (for bandwidth.type = "global") for kernel regression estimation. If bandwidth.type = "NULL" (default), a data-adaptive local plug-in (Herrmann, 1997) (for bandwidth.type = "local") or data-adaptive global plug-in (Gasser et al., 1991) (for bandwidth.type = "global") bandwidth is used instead.

kernel.order

a nonnegative integer giving the order of the optimal kernel (Gasser et al., 1985) used for smoothing.

Possible options are

  • kernel.order = 2 (default)

  • kernel.order = 4

Details

This function computes the estimate of kernel regression function using a local or global data-adaptive plug-in algorithm and optimal kernels (Gasser et al., 1985).

Value

A list is returned with elements:

data.smoothed

a numeric vector of estimates of the kernel regression function (smoothed data).

residuals

a numeric vector of smoothing residuals

References

Gasser T, Kneip A, Kohler W (1991). A flexible and fast method for automatic smoothing. Journal of the American Statistical Association, 86, 643-652.

Herrmann E (1997). Local bandwidth choice in kernel regression estimation. Journal of Computational and Graphical Statistics, 6(1), 35-54.

Gasser, T, Müller, H-G, Mammitzsch, V (1985). Kernels for nonparametric curve estimation. Journal of the Royal Statistical Society, B Met., 47(2), 238-252.

Eva Herrmann; Packaged for R and enhanced by Martin Maechler (2016). lokern: Kernel Regression Smoothing with Local or Global Plug-in Bandwidth. R package version 1.1-8. https://CRAN.R-project.org/package=lokern

Examples

data("mydata", package = "openair")
x = mydata$o3[format(mydata$date, "%m %Y") == "12 2002"]
smoothed = smoothing(y = x)
smoothed$data.smoothed
smoothed$residuals

[Package envoutliers version 1.1.0 Index]