Learn R Programming

TDA (version 1.0)

kde: Kernel Density Estimator over a Grid of Points

Description

Given a point cloud X ($n$ points), this function computes the Kernel Density Estimator over a grid of points. The kernel is a Gaussian Kernel with smoothing parameter h. For each $x \in R^d$, the Kernel Density estimator is defined as $$p_X(x)=\frac{1}{n (\sqrt{2 \pi} h )^d} \sum_{i=1}^n \exp \left( \frac{- \Vert x-X_i \Vert_2^2}{2h^2} \right).$$

Usage

kde(X, Grid, h)

Arguments

X
an $n$ by $d$ matrix of coordinates of points used in the kernel density estimation process, where $n$ is the number of points and $d$ is the dimension.
Grid
an $m$ by $d$ matrix of coordinates, where $m$ is the number of points in the grid.
h
number: the smoothing paramter of the Gaussian Kernel.

Value

  • kde returns a vector of length $m$ (the number of points in the grid) containing the value of the kernel density estimator for each point in the grid.

References

Larry Wasserman (2004), "All of statistics: a concise course in statistical inference", Springer.

Brittany T. Fasy, Fabrizio Lecci, Alessandro Rinaldo, Larry Wasserman, Sivaraman Balakrishnan, and Aarti Singh. (2013), "Statistical Inference For Persistent Homology: Confidence Sets for Persistence Diagrams", (arXiv:1303.7117). To appear, Annals of Statistics.

See Also

kernelDist, distFct, dtm

Examples

Run this code
## Generate Data from the unit circle
n = 300
X = circleUnif(n)

## Construct a grid of points over which we evaluate the function
by=0.065
Xseq=seq(-1.6, 1.6, by=by)
Yseq=seq(-1.7, 1.7, by=by)
Grid=expand.grid(Xseq,Yseq)

## kernel density estimator
h=0.3
KDE= kde(X, Grid, h)

Run the code above in your browser using DataLab