Kernel density estimation is a nonparametric technique for density estimation i.e., estimation of probability density functions, which is one of the fundamental questions in statistics. It can be viewed as a generalisation of histogram density estimation with improved statistical properties. Apart from histograms, other types of density estimators include parametric, spline, wavelet and Fourier series. Kernel density estimators were first introduced in the scientific literature for univariate data in the 1950s and 1960s[1][2] and subsequently have been widely adopted. It was soon recognised that analogous estimators for multivariate data would be an important addition to multivariate statistics. Based on research carried out in the 1990s and 2000s, multivariate kernel density estimation has reached a level of maturity comparable to their univariate counterparts.[3]
Motivation
We take a illustrative synthetic bivariate data set of 50 points to illustrate the construction of histograms. This requires the choice of an anchor point (the lower left corner of the histogram grid). For the histogram on the left, we choose (−1.5, −1.5): for the one on the right, we shift the anchor point by 0.125 in both directions to (−1.625, −1.625). Both histograms have a binwidth of 0.5, so any differences are due to the change in the anchor point only. The colour coding indicates the number of data points which fall into a bin: 0=white, 1=pale yellow, 2=bright yellow, 3=orange, 4=red. The left histogram appears to indicate that the upper half has a higher density than the lower half, whereas it is the reverse is the case for the right-hand histogram, confirming that histograms are highly sensitive the placement of the anchor point.[4]
One possible solution to this anchor point placement problem to remove the histogram binning grid completely. In the left figure below, a kernel (represented by the dashed grey lines) is centred at each of the 50 data points above. The result of summing these kernels is given on the right figure, which is a kernel density estimate. The most striking difference between kernel density estimates and histograms is that the former are easier to interpret since they do not contain artifices induced by a binning grid. The coloured contours correspond to the smallest region which contains the respective probability mass: red = 25%, orange + red = 50%, yellow + orange + red = 75%, thus indicating that a single central region contains the highest density.
Definition
The previous figure is a graphical representation of kernel density estimate, which we now define in an exact manner. Let X1, X2, …, Xn be a d-variate random sample drawn from a common density function ƒ. The kernel density estimate is defined to be
where
- x = (x1, x2, …, xd)T, Xi = (Xi1, Xi2, …, Xid)T, i = 1, 2, …, n are d-vectors
- K is the kernel function which is a symmetric density function, with KH(x) = |H|−1/2K(H−1/2x)
- H is the bandwidth (or smoothing) matrix which is a symmetric, positive definite d x d matrix.
The choice of the kernel function K is not crucial to the accuracy of kernel density estimators, so we use the standard multivariate normal or Gaussian density function as our kernel K throughout: . Whereas the choice of the bandwidth matrix H is the single most important factor affecting its accuracy since it controls the amount of and orientation of smoothing induced.[5]: 36–39
Optimal bandwidth matrix selection
The most commonly used optimality criterion for selecting a bandwidth matrix is the MISE or Mean Integrated Squared Error
This in general does not possess a closed form expression, so it is usual to use its asymptotic approximation (AMISE) as a proxy
where
- , with R(K) = (4π)−d/2 when K is a normal kernel
- , with Id being the d x d identity matrix, with m2 = 1 for the normal kernel
- D2ƒ is the d x d Hessian matrix of second order partial derivatives of ƒ
- is a d2 x d2 matrix of integrated fourth order partial derivatives of f
- vec is the vector operator which stacks the columns of a matrix into a single vector e.g.
The quality of the AMISE approximation to the MISE[5]: 97 is given by
where o indicates the usual small o notation. Heuristically this statement implies that the AMISE is a 'good' approximation of the MISE as the sample size n → ∞. An ideal optimal bandwidth selector is
where F is the space of all symmetric, positive definite matrices. Since this ideal selector contains the unknown density function f, it cannot be used directly. The many different varieties of data-based bandwidth selectors arise from the different estimators of the AMISE. We concentrate on two classes of selectors which have been shown to be the most widely applicable in practise: smoothed cross validation and plug-in selectors.
Plug-in
The plug-in (PI) estimate of the AMISE is formed by replacing Ψ4 by its estimator
where . Thus is the plug-in selector.[6][7] These references also contain algorithms on optimal estimation of the pilot bandwidth matrix G and establish that converges in probability to HAMISE.
Smoothed cross validation
Smoothed cross validation (SCV) is a subset of a larger class of cross validation techniques. The SCV estimator differs from the plug-in estimator in the second term
Thus is the SCV selector.[8][9] These references also contain algorithms on optimal estimation of the pilot bandwidth matrix G and establish that converges in probability to HAMISE.
Computer implementation
The ks package[10] in R implements the plug-in and smoothed cross validation selectors (amongst others). This dataset (included in the base distribution of R) contains 272 records with two measurements each: the duration time of an eruprion (minutes) and the waiting time until the next eruption (minutes) of the Old Faithful Geyser in Yellowstone National Park, USA.
The code fragment computes the kernel density estimate with the plug-in bandwidth matrix Again, the coloured contours correspond to the smallest region which contains the respective probability mass: red = 25%, orange + red = 50%, yellow + orange + red = 75%. To compute the SCV selector, Hpi
is replaced with Hscv
. This is not displayed here since it is mostly similar to the plug-in estimate for this example.
library(ks) data(faithful) H <- Hpi(x=faithful) fhat <- kde(x=faithful, H=H) plot(fhat, display="filled.contour2") points(faithful, cex=0.5, pch=16)
References
- ^ Rosenblatt, M. (1956). "Remarks on some nonparametric estimates of a density function". Annals of Mathematical Statistics. 27: 832–837. doi:10.1214/aoms/1177728190.
- ^ Parzen, E. (1962). "On estimation of a probability density function and mode". Annals of Mathematical Statistics. 33: 1065–1076. doi:10.1214/aoms/1177704472.
- ^ Simonoff, J.S. (1996). Smoothing Methods in Statistics. Springer. ISBN 0387947167.
- ^ Silverman, B.W. (1986). Density Estimation for Statistics and Data Analysis. Chapman & Hall/CRC. pp. 7–11. ISBN 0412246201.
- ^ a b Wand, M.P; Jones, M.C. (1995). Kernel Smoothing. London: Chapman & Hall/CRC. ISBN 0412552701.
- ^ Wand, M.P.; Jones, M.C. (1994). "Multivariate plug-in bandwidth selection". Computational Statistics. 9: 97–177.
- ^ Duong, T.; Hazelton, M.L. (2003). "Plug-in bandwidth matrices for bivariate kernel density estimation". Journal of Nonparametric Statistics. 15: 17–30. doi:10.1080/10485250306039.
- ^ Hall, P.; Marron, J.; Park, B. (1992). "Smoothed cross-validation". Probability Theory and Related Fields. 92: 1–20. doi:10.1007/BF01205233.
- ^ Duong, T.; Hazelton, M.L. (2005). "Cross validation bandwidth matrices for multivariate kernel density estimation". Scandinavian Journal of Statistics. 32: 485–506. doi:10.1111/j.1467-9469.2005.00445.x.
- ^ Duong, T. (2007). "ks: Kernel density estimation and kernel discriminant analysis in R". Journal of Statistical Software. 21(7).
External links
- www.mvstat.net/tduong/research A collection of peer-reviewed articles of the mathematical details of multivariate kernel density estimation and their bandwidth selectors.
See also
- Kernel density estimation Univariate kernel density estimation.