Nonparametric estimation of regression function using kernel regression with local or global data-adaptive plug-in bandwidth and optimal kernels.
smoothing(x = c(1:length(y)), y, bandwidth.type = "local",
bandwidth.value = NULL, kernel.order = 2)
data values. Supported data types
a numeric vector
a time series object ts
a time series object xts
a time series object zoo
a numeric vector of data values.
a character string specifying the type of bandwidth.
Possible options are
"local"
(default) to use local bandwidth
"global"
to use global bandwidth
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.
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
A list is returned with elements:
a numeric vector of estimates of the kernel regression function (smoothed data).
a numeric vector of smoothing residuals
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).
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<U+00FC>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
# NOT RUN {
data("mydata", package = "openair")
x = mydata$o3[format(mydata$date, "%m %Y") == "12 2002"]
smoothed = smoothing(y = x)
smoothed$data.smoothed
smoothed$residuals
# }
Run the code above in your browser using DataLab