Learn R Programming

demoKde (version 1.0.1)

kernelBiweight: Kernel functions for use with kde

Description

These functions, all with idenical argument lists, provide kernel functions for use with the KDE function.

Usage

kernelBiweight(x, mean = 0, sd = 1)
kernelCosine(x, mean = 0, sd = 1)
kernelEpanechnikov(x, mean = 0, sd = 1)
kernelGaussian(x, mean = 0, sd = 1)
kernelLogistic(x, mean = 0, sd = 1)
kernelOptCosine(x, mean = 0, sd = 1)
kernelRectangular(x, mean = 0, sd = 1)
kernelSquaredCosine(x, mean = 0, sd = 1)
kernelTriangular(x, mean = 0, sd = 1)
kernelTricube(x, mean = 0, sd = 1)
kernelTriweight(x, mean = 0, sd = 1)
kernelUniform(x, mean = 0, sd = 1)

Value

The evaluated kernel for each supplied x value.

Arguments

x

Values for which the kernel function is to be evaluated.

mean

Mean (or location parameter) of the kernel function.

sd

Standard deviation (or scale paramenter) of the kernel function.

Author

Bill Venables

Details

These are all continuous, symmetric probability density functions parametrised by a location and scale parameter, here taken to be the mean and standard deviation respectively. Most have finite support, he two exceptions here being kernelGaussian and kernelLogistic, which have unbounded support.

The functions provided cover all those listed in https://en.wikipedia.org/wiki/Kernel_(statistics), with obvious name correspondences. Of the additional ones, kernelSquaredCosine appears to be thus far new, and kernelOptCosine is explained in the help file for stats::density.

The functions kernelUniform and kernelRectangular are identical, and provided for convenience.

The functions are vectorized with respect to all three parameters.

References

See this web site, primarily.

See Also

kde, density

Examples

Run this code
if(require("graphics")) {
  curve(kernelGaussian, xlim = c(-4.5, 4.5), ylim = c(0, 0.45))
  curve(kernelLogistic, add = TRUE, col = "red")
  curve(kernelUniform, add = TRUE, col = "blue", lwd=2, n = 5000)
}

Run the code above in your browser using DataLab