numeric vector containing the sample on which the
kernel density estimate is to be constructed.
scalest
estimate of scale.
"stdev" - standard deviation is used.
"iqr" - inter-quartile range divided by 1.349 is used.
"minim" - minimum of "stdev" and "iqr" is used.
level
number of levels of functional estimation used in the
plug-in rule.
kernel
character string which determines the smoothing kernel.
kernel can be:
"normal" - the Gaussian density function (the default).
"box" - a rectangular box.
"epanech" - the centred beta(2,2) density.
"biweight" - the centred beta(3,3) density.
"triweight" - the centred beta(4,4) density.
This can be abbreviated to any unique abbreviation.
canonical
logical flag: if TRUE, canonically scaled kernels are used
gridsize
the number of equally-spaced points over which binning is
performed to obtain kernel functional approximation.
range.x
vector containing the minimum and maximum values of x
at which to compute the estimate.
The default is the minimum and maximum data values.
truncate
logical flag: if TRUE, data with x values outside the
range specified by range.x are ignored.
Details
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 normal distribution is used to provide an
initial estimate.
Value
the selected bandwidth.
Background
This method for selecting the bandwidth of a kernel
density estimate was proposed by Sheather and
Jones (1991)
and is
described in Section 3.6 of Wand and Jones (1995).
References
Sheather, S. J. and Jones, M. C. (1991).
A reliable data-based bandwidth selection method for
kernel density estimation.
Journal of the Royal Statistical Society, Series B,
53, 683–690.
Wand, M. P. and Jones, M. C. (1995).
Kernel Smoothing.
Chapman and Hall, London.
See Also
bkde, density, ksmooth
Examples
data(geyser, package="MASS")
x <- geyser$duration
h <- dpik(x)
est <- bkde(x, bandwidth=h)
plot(est,type="l")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(KernSmooth)
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/KernSmooth/dpik.Rd_%03d_medium.png", width=480, height=480)
> ### Name: dpik
> ### Title: Select a Bandwidth for Kernel Density Estimation
> ### Aliases: dpik
> ### Keywords: smooth
>
> ### ** Examples
>
> data(geyser, package="MASS")
> x <- geyser$duration
> h <- dpik(x)
> est <- bkde(x, bandwidth=h)
> plot(est,type="l")
>
>
>
>
>
> dev.off()
null device
1
>