bwplot.numeric {iosmooth} | R Documentation |
Bandwidth plot for density estimation or regression
Description
Plots the magnitude of the empirical characteristic function at frequencies 0 to smax
.
Usage
## S3 method for class 'numeric'
bwplot(x, y, smax = 13.49/IQR(x), normalize = FALSE, n.points = 1000, c.thresh = 2, ...)
Arguments
x |
A univariate data set. |
y |
A vector of responses, for regression only. |
smax |
The algorithm searches for smoothing parameters on the interval |
normalize |
Rescale the sample characteristic function so that it is 1 at frequency 0. Does not affect plots for density estimation. For regression it is often better to leave this as |
n.points |
The number of points in |
c.thresh |
For regression, this is not meaningful. For density estimation, the bandwidth is chosen by looking for the first time the sample characteristic function drops below |
... |
Currently unimplemented. |
Details
Produces a plot that is helpful in choosing the bandwidth for infinite order flat-top kernel smoothers. Roughly, the bandwidth should be chosen to let the large low frequency component pass unpreturbed while damping out smaller high frequency components. This can be accomplished by choosing h = 1/l
where l
is a frequency threshold above which the sample characteristic function is negligible. For regression, this is done heuristically. For density estimation there is a formal recommendation, implemented in bwplot.numeric
.
Author(s)
Timothy L. McMurry
References
Politis, D. N. (2003). Adaptive bandwidth choice. Journal of Nonparametric Statistics, 15(4-5), 517-533.
McMurry, T. L. and Politis, D. N. Minimally biased nonparametric regression and autoregression. RevStat - Statistical Journal, 6(2):123-150, 2008
See Also
bwadap
, bwadap.ts
, bwplot.numeric
, bwplot
Examples
### Density Estimation
set.seed(123)
x <- rnorm(100)
bwplot(x, smax=8)
#Choose bandwidth roughly h=1/2
plot(iodensity(x, bw=1/2), type="l")
rug(x)
#### Nadaraya-Watson kernel regression
y <- sin(x) + .1 *rnorm(100)
bwplot(x,y, smax=12)
# Choose bandwidth roughly h = 1/2.5
plot(x, y)
lines(ioksmooth(x, y, bw = 1/2.5, kernel="SupSm"), type="l")