Content deleted Content added
No edit summary |
No edit summary |
||
Line 7:
== Motivation ==
To motivate the definition of multivariate kernel density estimators, we take as an illustrative synthetic [[bivariate]] data set of 50 points. First we create a histogram. 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 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. It is well-known that histograms are highly sensitive the placement of the anchor point.
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 placed at the same 50 data points above. Then the result of summing these kernels is given on the right figure, which is a kernel density estimate.
== Definition ==
The previous figure is a graphical representation of kernel density estimate. We now define it in an exact manner.
Let <math>\bold{X}_1, \bold{X}_2, \dots, \bold{X}_n</math> be a <em>d</em>-variate random sample drawn from a common density function <em>f</em>. The kernel density estimate is defined to be
Line 24 ⟶ 27:
</ul>
The choice of the kernel function <em>K</em> is not crucial to the accuracy of kernel density estimators,
Whereas the choice of the bandwidth matrix <strong>H</strong> is the single most important factor affecting its accuracy <ref name="WJ1995">{{cite book | author1=Wand, M.P | author2=Jones, M.C. | title=Kernel Smoothing | publisher=Chapman & Hall | ___location=London | date=1995 | isbn = 0412552701}}</ref>(pp. 36-39). (The bandwith for a kernel density estimate is analogous to the binwidth of histograms).
<math>K (\bold{x}) = (2\pi)^{-d/2} \exp(-\tfrac{1}{2} \, \bold{x}^T \bold{x}).</math>
Line 78 ⟶ 82:
These references also contain algorithms on optimal estimation of the pilot bandwidth matrix <strong>G</strong>.
== Computer implementation==
The [http://cran.r-project.org/web/packages/ks/index.html ks package]<ref>{{cite journal | author1=Duong, T. | title=ks: Kernel density estimation and kernel discriminant analysis in R | journal=Journal of Statistical Software | year=2007 | volume=21(7) | url=http://www.jstatsoft.org/v21/i07}}</ref> in
272 records with two measurements each: the eruption duration time (minutes) and the
waiting time until the next eruption (minutes), and is contained in the base distribution of R. This code fragment computes the kernel density estimate with the plug-in bandwidth matrix. The coloured contours correspond to the smallest region which contains that corresponding probability mass: red = 25%, orange + red = 50%, yellow + orange + red = 75%. To compute the SCV selector, <code>Hpi</code> is replaced with <code>Hscv</code>. This is not displayed here since it is mostly similar to the plug-in estimate for this data set. ▼
▲This code fragment computes the kernel density estimate with the plug-in bandwidth matrix. The coloured contours correspond to the smallest region which contains that corresponding probability mass: red = 25%, orange + red = 50%, yellow + orange + red = 75%. To compute the SCV selector, <code>Hpi</code> is replaced with <code>Hscv</code>. This is not displayed here since it is mostly similar to the plug-in estimate for this data set.
<pre>
|