iosmooth (version 0.94)

bwplot.numeric: Bandwidth plot for density estimation or regression

Description

Plots the magnitude of the empirical characteristic function at frequencies 0 to smax.

Usage

"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 [0, smax]. smax is problem dependent, and the defaults are not consistently appropriate.
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 FALSE.
n.points
The number of points in [0, smax] at which at which the sample characteristic function is calculated. If the sample characteristic function is highly oscillatory on [0,smax], this may need to be increased.
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 c.thresh*sqrt(log(n,10)/n) and stays below that level for a distance of Kn.
...
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.

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

Run this code
### 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")

Run the code above in your browser using DataLab