Learn R Programming

kernopt (version 1.0.0)

discrete_kernel: Discrete kernel function

Description

Discrete kernel function

Usage

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

Value

Returns the value of the associated kernel function

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

See Also

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

Examples

Run this code
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)

Run the code above in your browser using DataLab