discrete_kernel: Discrete kernel function

View source: R/discrete_kernel.r

discrete_kernelR Documentation

Discrete kernel function

Description

Discrete kernel function

Usage

discrete_kernel(
  kernel = c("optimal", "triang", "epanech", "binomial"),
  x,
  z,
  h,
  k = NULL
)

Arguments

kernel

the type of kernel. Currently supported kernels are limited to: "optimal", "triang", "epanech" and "binomial"

x

the target point at which the density is calculated

z

the vector of observations

h

the bandwidth (or smoothing parameter)

k

Optional: the integer (positive) parameter that defined the support of the kernel function (corresponds to parameter 'a' for triangular kernel). It is only used for optimal and triangular kernel

Value

Returns the value of the associated kernel function

See Also

discrete_optimal(), discrete_triang(), discrete_epanech(), discrete_binomial() which this function wraps.

Examples

discrete_kernel(kernel = "optimal", x = 25, z = 1:50, h = 0.9, k = 20)
discrete_kernel(kernel = "triang", x = 25, z = 1:50, h = 10, k = 20)
discrete_kernel(kernel = "epanech", x = 25, z = 1:50, h = 20)
discrete_kernel(kernel = "binomial", x = 25, z = 1:50, h = 0.5)

kernopt documentation built on April 3, 2025, 9:34 p.m.