The OpenD Programming Language

KernelDensity

Construct an N-dimensional kernel density estimator. This is done using the textbook definition of kernel density estimation, since the binning and convolving method used in the 1-D case would rapidly become unfeasible w.r.t. memory usage as dimensionality increased.

Eventually, a 2-D estimator might be added as another special case, but beyond 2-D, bin-and-convolute clearly isn't feasible.

This class can be used for 1-D estimation instead of KernelDensity1D, and will work properly. This is useful if:

1. You can't accept even the slightest deviation from the results that the textbook definition of kernel density estimation would produce.

2. You are only going to evaluate at a few points and want to avoid the up-front cost of the convolution used in the 1-D case.

3. You're using some weird kernel that doesn't meet the assumptions required for KernelDensity1D.

Members

Functions

nDimensions
uint nDimensions()

Returns the number of dimensions in the estimator.

opCall
double opCall(double[] x)

Estimate the density at the point given by x. The variables in X are provided in the same order as the ranges were provided for estimation.

Static functions

fromCallable
KernelDensity fromCallable(C kernel, R ranges)

Construct a kernel density estimator from a kernel provided as a callable object (such as a function pointer, delegate, or class with overloaded opCall). R must be either a range of ranges, multiple ranges passed in as variadic arguments, or a single range for the 1D case. Each range represents the values of one variable in the joint distribution. kernel must accept either an array of doubles or the same number of arguments as the number of dimensions, and must return a floating point number.

Meta