dpilc {sharpPen} | R Documentation |
Select a Bandwidth for Local Quadratic and Cubic Regression
Description
Use direct plug-in methodology to select the bandwidth
of a local quadratic and local cubic Gaussian kernel regression estimate,
as an extension of Wand's dpill
function.
Usage
dpilc(xx, yy, blockmax = 5, divisor = 20, trim = 0.01,
proptrun = 0.05, gridsize = 401L, range.x = range(x))
Arguments
xx |
numeric vector of x data. Missing values are not accepted. |
yy |
numeric vector of y data.
This must be same length as |
blockmax |
the maximum number of blocks of the data for construction of an initial parametric estimate. |
divisor |
the value that the sample size is divided by to determine a lower limit on the number of blocks of the data for construction of an initial parametric estimate. |
trim |
the proportion of the sample trimmed from each end in the
|
proptrun |
the proportion of the range of |
gridsize |
number of equally-spaced grid points over which the function is to be estimated. |
range.x |
vector containing the minimum and maximum values of |
Details
This function is a local cubic (also quadratic) extension of
the dpill
function of Wand's KernSmooth package.
The kernel is the standard normal density.
Least squares octic fits over blocks of data are used to
obtain an initial estimate. As in Wand's implementation
of the Ruppert, Sheather and Wand selector,
Mallow's C_p
is used to select
the number of blocks. An option is available to
make use of a periodic penalty (with possible trend)
relating the 4th derivative of the regression function
to a constant (gamma) times the 2nd derivative. This
avoids the need to calculate the octic fits and reverts
back to the original quartic fits of dpill
with
appropriate adjustments to the estimated functionals
needed in the direct-plug-in bandwidth calculation. This
code is similar to dpilq
but uses a 6th degree
polyomial approximation instead of an 8th degree polynomial
approximation.
Value
the selected bandwidth.
Warning
If there are severe irregularities (i.e. outliers, sparse regions)
in the x
values then the local polynomial smooths required for the
bandwidth selection algorithm may become degenerate and the function
will crash. Outliers in the y
direction may lead to deterioration
of the quality of the selected bandwidth.
Author(s)
D.Wang and W.J.Braun
References
Ruppert, D., Sheather, S. J. and Wand, M. P. (1995). An effective bandwidth selector for local least squares regression. Journal of the American Statistical Association, 90, 1257–1270.
Wand, M. P. and Jones, M. C. (1995). Kernel Smoothing. Chapman and Hall, London.
See Also
Examples
x <- faithful$eruptions
y <- faithful$waiting
plot(x, y)
h <- dpill(x, y)
fit <- locpoly(x, y, bandwidth = h, degree=1)
lines(fit)
h <- dpilc(x, y)
fit <- locpoly(x, y, bandwidth = h, degree=2)
lines(fit, col=3, lwd=2)
fit <- locpoly(x, y, bandwidth = h, degree=3)
lines(fit, col=2, lwd=2)