kernel.fun: Derivatives of Kernel Function

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

The (S3) generic function kernel.fun computes the r'th derivative for kernel density.

Usage

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"), ...)

Arguments

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 "gaussian".

...

further arguments for (non-default) methods.

Details

We give a short survey of some kernels functions K(x;r); where r is derivative order,

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.

Value

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.

Author(s)

Arsalane Chouaib Guidoum acguidoum@usthb.dz

References

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.

See Also

plot.kernel.fun, deriv and D in package "stats" for symbolic and algorithmic derivatives of simple expressions.

Examples

 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)

Example output

[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"

kedd documentation built on May 2, 2019, 7:32 a.m.