# Kernel (statistics)

The term kernel is used in statistical analysis to refer to a window function. The term "kernel" has several distinct meanings in different branches of statistics.

## Bayesian statistics

In statistics, especially in Bayesian statistics, the kernel of a probability density function (pdf) or probability mass function (pmf) is the form of the pdf or pmf in which any factors that are not functions of any of the variables in the domain are omitted.[citation needed] Note that such factors may well be functions of the parameters of the pdf or pmf. These factors form part of the normalization factor of the probability distribution, and are unnecessary in many situations. For example, in pseudo-random number sampling, most sampling algorithms ignore the normalization factor. In addition, in Bayesian analysis of conjugate prior distributions, the normalization factors are generally ignored during the calculations, and only the kernel considered. At the end, the form of the kernel is examined, and if it matches a known distribution, the normalization factor can be reinstated. Otherwise, it may be unnecessary (for example, if the distribution only needs to be sampled from).

For many distributions, the kernel can be written in closed form, but not the normalization constant.

An example is the normal distribution. Its probability density function is

${\displaystyle p(x|\mu ,\sigma ^{2})={\frac {1}{\sqrt {2\pi \sigma ^{2}}}}e^{-{\frac {(x-\mu )^{2}}{2\sigma ^{2}}}}}$

and the associated kernel is

${\displaystyle p(x|\mu ,\sigma ^{2})\propto e^{-{\frac {(x-\mu )^{2}}{2\sigma ^{2}}}}}$

Note that the factor in front of the exponential has been omitted, even though it contains the parameter ${\displaystyle \sigma ^{2}}$  , because it is not a function of the domain variable ${\displaystyle x}$  .

## Pattern analysis

The kernel of a reproducing kernel Hilbert space is used in the suite of techniques known as kernel methods to perform tasks such as statistical classification, regression analysis, and cluster analysis on data in an implicit space. This usage is particularly common in machine learning.

## Nonparametric statistics

In nonparametric statistics, a kernel is a weighting function used in non-parametric estimation techniques. Kernels are used in kernel density estimation to estimate random variables' density functions, or in kernel regression to estimate the conditional expectation of a random variable. Kernels are also used in time-series, in the use of the periodogram to estimate the spectral density where they are known as window functions. An additional use is in the estimation of a time-varying intensity for a point process where window functions (kernels) are convolved with time-series data.

Commonly, kernel widths must also be specified when running a non-parametric estimation.

### Definition

A kernel is a non-negative real-valued integrable function K. For most applications, it is desirable to define the function to satisfy two additional requirements:

${\displaystyle \int _{-\infty }^{+\infty }K(u)\,du=1\,;}$
• Symmetry:
${\displaystyle K(-u)=K(u){\mbox{ for all values of }}u\,.}$

The first requirement ensures that the method of kernel density estimation results in a probability density function. The second requirement ensures that the average of the corresponding distribution is equal to that of the sample used.

If K is a kernel, then so is the function K* defined by K*(u) = λKu), where λ > 0. This can be used to select a scale that is appropriate for the data.

### Kernel functions in common use

All of the kernels below in a common coordinate system.

Several types of kernel functions are commonly used: uniform, triangle, Epanechnikov,[1] quartic (biweight), tricube,[2] triweight, Gaussian, quadratic[3] and cosine.

In the table below, if ${\displaystyle K}$  is given with a bounded support, then ${\displaystyle K(u)=0}$  for values of u lying outside the support.

Kernel Functions, K(u) ${\displaystyle \textstyle \int u^{2}K(u)du}$  ${\displaystyle \textstyle \int K(u)^{2}du}$  Efficiency[4] relative to the Epanechnikov kernel
Uniform ("rectangular window") ${\displaystyle K(u)={\frac {1}{2}}}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle {\frac {1}{3}}}$    ${\displaystyle {\frac {1}{2}}}$  92.9%
Triangular ${\displaystyle K(u)=(1-|u|)}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle {\frac {1}{6}}}$    ${\displaystyle {\frac {2}{3}}}$  98.6%
Epanechnikov

(parabolic)

${\displaystyle K(u)={\frac {3}{4}}(1-u^{2})}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle {\frac {1}{5}}}$    ${\displaystyle {\frac {3}{5}}}$  100%
Quartic
(biweight)
${\displaystyle K(u)={\frac {15}{16}}(1-u^{2})^{2}}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle {\frac {1}{7}}}$    ${\displaystyle {\frac {5}{7}}}$  99.4%
Triweight ${\displaystyle K(u)={\frac {35}{32}}(1-u^{2})^{3}}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle {\frac {1}{9}}}$    ${\displaystyle {\frac {350}{429}}}$  98.7%
Tricube ${\displaystyle K(u)={\frac {70}{81}}(1-{\left|u\right|}^{3})^{3}}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle {\frac {35}{243}}}$    ${\displaystyle {\frac {175}{247}}}$  99.8%
Gaussian ${\displaystyle K(u)={\frac {1}{\sqrt {2\pi }}}e^{-{\frac {1}{2}}u^{2}}}$      ${\displaystyle 1\,}$    ${\displaystyle {\frac {1}{2{\sqrt {\pi }}}}}$  95.1%
Cosine ${\displaystyle K(u)={\frac {\pi }{4}}\cos \left({\frac {\pi }{2}}u\right)}$

Support: ${\displaystyle |u|\leq 1}$

${\displaystyle 1-{\frac {8}{\pi ^{2}}}}$    ${\displaystyle {\frac {\pi ^{2}}{16}}}$  99.9%
Logistic ${\displaystyle K(u)={\frac {1}{e^{u}+2+e^{-u}}}}$      ${\displaystyle {\frac {\pi ^{2}}{3}}}$    ${\displaystyle {\frac {1}{6}}}$  88.7%
Sigmoid function ${\displaystyle K(u)={\frac {2}{\pi }}{\frac {1}{e^{u}+e^{-u}}}}$      ${\displaystyle {\frac {\pi ^{2}}{4}}}$    ${\displaystyle {\frac {2}{\pi ^{2}}}}$  84.3%
Silverman kernel[5] ${\displaystyle K(u)={\frac {1}{2}}e^{-{\frac {|u|}{\sqrt {2}}}}\cdot \sin \left({\frac {|u|}{\sqrt {2}}}+{\frac {\pi }{4}}\right)}$      ${\displaystyle 0}$    ${\displaystyle {\frac {3{\sqrt {2}}}{16}}}$  not applicable

4. ^ Efficiency is defined as ${\displaystyle {\sqrt {\int u^{2}K(u)\,du}}\int K(u)^{2}\,du}$ .