| kedd-data | R Documentation |
Five samples of size 200 drawn from normal mixtures of Marron and Wand
(1992), classical test cases for density (derivative) estimation and
bandwidth selection. Writing N(\mu, \sigma^2) for a normal density:
kurtotickurtotic unimodal density (#4):
\frac23 N(0,1) + \frac13 N(0, (1/10)^2).
outlieroutlier density (#5):
\frac1{10} N(0,1) + \frac9{10} N(0, (1/10)^2).
bimodalseparated bimodal density (#7):
\frac12 N(-\frac32, (\frac12)^2) + \frac12 N(\frac32, (\frac12)^2).
trimodaltrimodal density (#9):
\frac9{20} N(-\frac65, (\frac35)^2) + \frac9{20} N(\frac65, (\frac35)^2) + \frac1{10} N(0, (\frac14)^2).
clawclaw density (#10):
\frac12 N(0,1) + \sum_{l=0}^{4} \frac1{10} N(\frac l2 - 1, (\frac1{10})^2).
bimodal
claw
kurtotic
outlier
trimodal
Each object is a numeric vector of length 200.
The datasets are loaded lazily: claw is available as soon as the
package is attached (data(claw) also works). The true densities are
known, so the estimates \hat f_h^{(r)} and the selected bandwidths can
be compared with the truth.
Simulated samples, as in previous versions of kedd.
Marron, J. S. and Wand, M. P. (1992). Exact mean integrated squared error. The Annals of Statistics, 20, 712–736.
dkde, h.ucv, kedd-package.
## the five samples
sapply(list(kurtotic = kurtotic, outlier = outlier, bimodal = bimodal,
trimodal = trimodal, claw = claw), summary)
## claw density: estimate with an MCV bandwidth and the true density
bw <- h.mcv(claw)
f_claw <- function(x) 0.5 * dnorm(x) +
rowSums(sapply(0:4, function(l) 0.1 * dnorm(x, l / 2 - 1, 0.1)))
p <- plot(dkde(data = claw, h = bw@h))
p + ggplot2::stat_function(fun = f_claw, linetype = "dashed")
## first derivative of the bimodal sample
plot(dkde(data = bimodal, h = h.ucv(bimodal, deriv.order = 1)@h, deriv.order = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.