| dkde | R Documentation |
Computes the r'th derivative of a kernel density estimator at a grid
of evaluation points. For deriv.order = 0 this reduces to an
ordinary kernel density estimate.
dkde(x = NULL, data, h, deriv.order = 0L,
kernel = "gaussian", nthreads = 0L)
x |
numeric vector of evaluation points. If |
data |
numeric vector of observations. |
h |
positive bandwidth scalar. If missing, the UCV bandwidth
|
deriv.order |
non-negative integer: derivative order |
kernel |
character string giving the kernel; one of
|
nthreads |
number of OpenMP threads for this call: |
The r'th derivative kernel density estimator is:
\hat{f}_h^{(r)}(x) =
\frac{1}{n\,h^{r+1}}\sum_{i=1}^{n}K^{(r)}\!\left(\frac{x-X_i}{h}\right)
where K^{(r)}(x)=d^r K(x)/dx^r
(see kernel.fun).
Theoretical properties (Bhattacharya 1967; Schuster 1969):
Bias:
E[\hat{f}_h^{(r)}(x)] - f^{(r)}(x) =
\frac{h^2}{2}\mu_2(K)\,f^{(r+2)}(x) + o(h^2)
Variance:
Var[\hat{f}_h^{(r)}(x)] =
\frac{f(x)\,R(K^{(r)})}{n\,h^{2r+1}} + o(1/(n\,h^{2r+1}))
The AMISE-optimal bandwidth is of order n^{-1/(2r+5)},
so higher derivatives require larger bandwidths.
The AMISE is:
AMISE(\hat{f}_h^{(r)}) =
\frac{R(K^{(r)})}{n\,h^{2r+1}} +
\frac{\mu_2^2(K)}{4}\,h^4\,R(f^{(r+2)})
where R(K^{(r)})=\int (K^{(r)})^2\,dx and
\mu_2(K)=\int x^2 K(x)\,dx.
An S4 object of class dkde with slots x
(evaluation points), y (estimates
\hat{f}_h^{(r)}(x_i)), h, kernel,
deriv.order, n, data and call. Use
show() for a summary and plot() for a ggplot2 graphic.
Arsalane Chouaib Guidoum acguidoum@univ-tam.dz, Amel Henider amel.henider@univ-tam.dz and Iago Giné-Vázquez iago.gin-vaz@protonmail.com
Bhattacharya, P. K. (1967). Estimation of a probability density function and its derivatives. Sankhya: The Indian Journal of Statistics, Series A, 29, 373–382.
Radhey, S. S. (1987). MISE of kernel estimates of a density and its derivatives. Statistics and Probability Letters, 5, 153–159.
Schuster, E. F. (1969). Estimation of a probability density function and its derivatives. The Annals of Mathematical Statistics, 40(4), 1187–1195.
Scott, D. W. (1992). Multivariate Density Estimation. Theory, Practice and Visualization. New York: Wiley.
Silverman, B. W. (1986). Density Estimation for Statistics and Data Analysis. Chapman & Hall/CRC. London.
Wand, M. P. and Jones, M. C. (1995). Kernel Smoothing. Chapman and Hall, London.
Härdle, W. (1991). Smoothing Techniques, With Implementation in S. Springer-Verlag, New York.
kernel.fun, h.ucv, h.bcv,
h.amise, density (for r=0).
x <- rnorm(100)
## density (r = 0) with automatic UCV bandwidth
est0 <- dkde(data = x, deriv.order = 0)
est0
plot(est0)
## first derivative (r = 1)
est1 <- dkde(data = x, deriv.order = 1)
plot(est1)
## fixed bandwidth, other kernels; slots are accessed with @
est2 <- dkde(data = x, h = 0.5, kernel = "epanechnikov")
head(cbind(x = est2@x, y = est2@y))
plot(dkde(data = x, h = 0.6, kernel = kernel.pow(2, 3)), rug = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.