Description Usage Arguments Details Value Author(s) References See Also Examples
The (S3) generic function kernel.fun
computes the
r'th derivative for kernel density.
1 2 3 4 5 | kernel.fun(x, ...)
## Default S3 method:
kernel.fun(x = NULL, deriv.order = 0, kernel = c("gaussian","epanechnikov",
"uniform", "triangular", "triweight", "tricube",
"biweight", "cosine", "silverman"), ...)
|
x |
points at which the derivative of kernel function is to be evaluated. |
deriv.order |
derivative order (scalar). |
kernel |
a character string giving the smoothing kernel to be used,
with default |
... |
further arguments for (non-default) methods. |
We give a short survey of some kernels functions K(x;r); where r is derivative order,
Gaussian: K(x;Inf) = 1/sqrt(2pi) exp(-0.5 x^2)
Epanechnikov: K(x;2) = 0.75 (1-x^2) (abs(x) <= 1)
uniform (rectangular): K(x;0) = 0.5 (abs(x) <= 1)
triangular: K(x;1) = (1-abs(x)) (abs(x) <= 1)
triweight: K(x;6) = 35/36 (1-x^2)^3 (abs(x) <= 1)
tricube: K(x;9) = 70/81 (1-abs(x)^3)^3 (abs(x) <= 1)
biweight: K(x;4) = 15/16 (1-x^2)^2 (abs(x) <= 1)
cosine: 0.25 pi cos(0.5 pi x) (abs(x) <= 1)
Silverman: K(x;r mod 8)= 0.5 exp(-abs(x)/sqrt(2)) sin(abs(x)/sqrt(2) + 0.25 pi)
The r'th derivative for kernel function K(x) is written:
K(x;r) = d^r / dx^r K(x)
for r = 0, 1, 2, …
The r'th derivative of the Gaussian kernel K(x) is given by:
K(x;r) = (-1)^r H(x;r) K(x)
where H(x;r) is the r'th Hermite polynomial. This polynomials
are set of orthogonal polynomials, for more details see, hermite.h.polynomials
in package orthopolynom.
kernel |
name of kernel to use. |
deriv.order |
the derivative order to use. |
x |
the n coordinates of the points where the derivative of kernel function is evaluated. |
kx |
the kernel derivative values. |
Arsalane Chouaib Guidoum acguidoum@usthb.dz
Jones, M. C. (1992). Differences and derivatives in kernel estimation. Metrika, 39, 335–340.
Olver, F. W., Lozier, D. W., Boisvert, R. F. and Clark, C. W. (2010). NIST Handbook of Mathematical Functions. Cambridge University Press, New York, USA.
Silverman, B. W. (1986). Density Estimation for Statistics and Data Analysis. Chapman & Hall/CRC. London.
plot.kernel.fun
, deriv
and D
in
package "stats" for symbolic and algorithmic derivatives of simple expressions.
1 2 3 4 5 6 7 8 9 10 | kernels <- eval(formals(kernel.fun.default)$kernel)
kernels
## gaussian
kernel.fun(x = 0,kernel=kernels[1],deriv.order=0)
kernel.fun(x = 0,kernel=kernels[1],deriv.order=1)
## silverman
kernel.fun(x = 0,kernel=kernels[9],deriv.order=0)
kernel.fun(x = 0,kernel=kernels[9],deriv.order=1)
|
[1] "gaussian" "epanechnikov" "uniform" "triangular" "triweight"
[6] "tricube" "biweight" "cosine" "silverman"
$kernel
[1] "gaussian"
$deriv.order
[1] 0
$x
[1] 0
$kx
[1] 0.3989423
attr(,"class")
[1] "kernel.fun"
$kernel
[1] "gaussian"
$deriv.order
[1] 1
$x
[1] 0
$kx
[1] 0
attr(,"class")
[1] "kernel.fun"
$kernel
[1] "silverman"
$deriv.order
[1] 0
$x
[1] 0
$kx
[1] 0.3535534
attr(,"class")
[1] "kernel.fun"
$kernel
[1] "silverman"
$deriv.order
[1] 1
$x
[1] 0
$kx
[1] 3.925231e-17
attr(,"class")
[1] "kernel.fun"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.