kernelDist: Kernel distance over a Grid of Points

View source: R/kernelDist.R

kernelDistR Documentation

Kernel distance over a Grid of Points

Description

Given a point cloud X, the function kernelDist computes the kernel distance over a grid of points. The kernel is a Gaussian Kernel with smoothing parameter h:

K_h (x,y) = exp( -(||x-y||^2)/(2h^2) ).

For each x in R^d, the Kernel distance is defined by

κ_X (x) = √( 1/(n^2) ∑_{i=1}^n∑_{j=1}^n K_h(X_i, X_j) + K_h(x,x) - 2/n ∑_{i=1}^n K_h(x,X_i) ).

Usage

kernelDist(X, Grid, h, weight = 1, printProgress = FALSE)

Arguments

X

an n by d matrix of coordinates of points, 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.

weight

either a number, or a vector of length n. If it is a number, then same weight is applied to each points of X. If it is a vector, weight represents weights of each points of X. The default value is 1.

printProgress

if TRUE, a progress bar is printed. The default value is FALSE.

Value

The function kernelDist returns a vector of lenght m (the number of points in the grid) containing the value of the Kernel distance for each point in the grid.

Author(s)

Jisu Kim and Fabrizio Lecci

References

Phillips JM, Wang B, Zheng Y (2013). "Geometric Inference on Kernel Density Estimates." arXiv:1307.7760.

Chazal F, Fasy BT, Lecci F, Michel B, Rinaldo A, Wasserman L (2014). "Robust Topological Inference: Distance-To-a-Measure and Kernel Distance." Technical Report.

See Also

kde, dtm, distFct

Examples

## Generate Data from the unit circle
n <- 300
X <- circleUnif(n)

## Construct a grid of points over which we evaluate the functions
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 distance estimator
h <- 0.3
Kdist <- kernelDist(X, Grid, h)

TDA documentation built on Feb. 16, 2023, 6:35 p.m.