make_kernel: Construct and check a kernel for the kernel-type estimators

View source: R/kernels.R

make_kernelR Documentation

Construct and check a kernel for the kernel-type estimators

Description

'make_kernel()' turns a kernel density function into the object used by [qdf_kernel()], [qdf_kernel_corrected()], [qdf_jones()], [qdf_soni()] and [qdf()] (argument 'kernel'). The distribution function needed by the boundary-corrected and Soni estimators is computed numerically. 'check_kernel()' reports the properties that matter for these estimators: total mass, symmetry, support, order (the first non-vanishing moment), \int k^2 and whether the kernel takes negative values; it warns when a property required by the theory fails.

Usage

make_kernel(k, name = "custom", support = 1, n_grid = 20001L)

check_kernel(kernel, verbose = TRUE)

Arguments

k

a vectorised function, the kernel density.

name

a label.

support

half-width of an interval [-s, s] containing the support (or, for kernels with unbounded support, essentially all of the mass).

n_grid

number of grid points for the numerical integration.

kernel

a kernel name, a function, or an object from 'make_kernel()'.

verbose

print the report.

Value

'make_kernel()': an object of class '"qdf_kernel"' (a list with the density 'd', the distribution function 'p', 'name' and the 'check' results). 'check_kernel()': a list of properties, printed invisibly.

Examples

# the biweight (quartic) kernel
biweight <- make_kernel(function(u) 15 / 16 * (1 - u^2)^2 * (abs(u) <= 1), "biweight")
biweight
x <- rgamma(100, 5)
qdf_kernel(c(0.25, 0.5, 0.75), x, h = 0.05, kernel = biweight)
check_kernel("epanechnikov")

qdfauction documentation built on Nov. 10, 2026, 5:07 p.m.