dpill | R Documentation |
Use direct plug-in methodology to select the bandwidth of a local linear Gaussian kernel regression estimate, as described by Ruppert, Sheather and Wand (1995).
dpill(x, y, blockmax = 5, divisor = 20, trim = 0.01, proptrun = 0.05,
gridsize = 401L, range.x, truncate = TRUE)
x |
numeric vector of x data. Missing values are not accepted. |
y |
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 |
truncate |
logical flag: if |
The direct plug-in approach, where unknown functionals
that appear in expressions for the asymptotically
optimal bandwidths
are replaced by kernel estimates, is used.
The kernel is the standard normal density.
Least squares quartic fits over blocks of data are used to
obtain an initial estimate. Mallow's C_p
is used to select
the number of blocks.
the selected bandwidth.
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.
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.
ksmooth
, locpoly
.
data(geyser, package = "MASS")
x <- geyser$duration
y <- geyser$waiting
plot(x, y)
h <- dpill(x, y)
fit <- locpoly(x, y, bandwidth = h)
lines(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.