  We consider density estimators based on the nearest neighbors method applied
to discrete point distibutions in spaces of arbitrary dimensionality. If the
density is constant, the volume of a hypersphere centered at a random location
is proportional to the expected number of points falling within the hypersphere
radius. The distance to the $N$-th nearest neighbor alone is then a sufficient
statistic for the density. In the non-uniform case the proportionality is
distorted. We model this distortion by normalizing hypersphere volumes to the
largest one and expressing the resulting distribution in terms of the Legendre
polynomials. Using Monte Carlo simulations we show that this approach can be
used to effectively address the tradeoff between smoothing bias and estimator
variance for sparsely sampled distributions.
