Nearest neighbour density estimation Created 2026-10-05 Updated 2026-10-07
In one dimension, a nearest neighbour density estimator is . It uses the nearest neighbour distance to select an interval containing a fixed number of observations. The factor corresponds to the exact expected value of the associated uniform order statistic.
Nearest neighbour distance 2026-10-05
For observations , the nearest neighbour distance of order at is the th order statistic of the distances . An atomless distance distribution function ensures ties occur with probability zero.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 112 3 ii Solution Created 2026-10-03 Updated 2026-10-14
Interpret as the length of a shortest Euclidean travelling salesman tour, and take the points to be independent random variables with the uniform distribution on the square. We assume ; a closed tour on one point has length zero, so the printed lower bound would be false for . For two points the closed tour traverses the joining segment twice.
For the deterministic upper bound, use the following precise geometric result, the squared edge bound for tours in the unit square: every finite set of points in admits a cyclic ordering such thatHere is a proof of that geometric result. First consider a right triangle with hypotenuse endpoints , hypotenuse length , and right-angle vertex . The quadratic path bound in a right triangle supplies a path from to through any finite set inside the triangle whose sum of squared edge lengths is at most . For an empty set use the edge . For a single point , use : the triangle lies in the disk with diameter , so and the law of cosines gives .
For several points, draw the altitude from to the hypotenuse. It splits the triangle into two smaller right triangles with hypotenuses and . Their squared hypotenuse lengths sum to by the Pythagorean theorem. Repeated altitude subdivision eventually makes every cell small enough to contain at most one of the given distinct points: each child is similar to the original triangle and its diameter contracts by at most the fixed factor . Construct the base-case paths and combine them from the bottom of this finite subdivision tree. The two child paths concatenate at . If is an auxiliary point, delete it by joining its two neighbours directly. Both neighbours lie in the right-angle sector of the parent triangle at , so their angle at is at most . The law of cosines now shows that this shortcut does not increase the sum of squared edge lengths. The combined path still has endpoints and squared cost at most .
One can first put the given points in generic positions, avoiding subdivision boundaries, and then pass to a limit. There are only finitely many possible visiting orders, so a subsequence keeps the same order and its squared cost converges; this also handles coincident locations. No assumption about a minimum separation remains in the result.
Split the square along a diagonal . Apply the triangle result in each half, following one path from to and the other back to . Each half contributes at most . Remove either diagonal endpoint if it was auxiliary. At a square corner all neighbours lie in a sector of angle , so the same squared-cost shortcut applies. This gives the asserted cyclic ordering with total squared cost at most four. It does not assert that the tour minimizing ordinary length itself has this squared-edge property. The Cauchy-Schwarz inequality applied to the tour supplied by the theorem provesThus the upper bound is deterministic, independently of the sampling law.
For the lower bound, put , the nearest neighbour distance at . Both edges incident to in any closed tour have length at least . Summing over vertices and then dividing by two gives . Conditional on , the union bound and the uniform distribution giveBoundary clipping only makes the ball smaller. Apply the layer cake representation of the expected value, restricting the integral to :Linearity of the expected value now yieldsThe unspecified sampling phrase in the paper must therefore be understood as independent uniform sampling: an arbitrary distribution concentrated in a tiny region cannot satisfy this lower bound.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 210 1 Solution Created 2026-10-03 Updated 2026-10-05
For , the nearest neighbour distance is the th order statistic of . Each has continuous distribution function on . The probability integral transform makes independent and identically distributed random variables with the uniform distribution on . Monotonicity of gives , a uniform order statistic. Strict monotonicity is not needed at this stage.
For , counting observations below givesDifferentiating and cancelling consecutive terms gives the Beta distribution:The Gamma function identity identifies this with the stated normalization. Ratios of Beta function integrals yield the momentsThis is the probability content of a nearest neighbour ball identity, specialized to intervals on the real line.
Now write . The Lipschitz bound givesThusStrict positivity of the probability density function makes continuous and strictly increasing from zero to one, so its inverse function is defined for every .
For the requested conditional calculation, suppose . At the preceding bound givesTherefore , and substituting in the approximation proves the inverse probability content bound for a Lipschitz density:The same argument works, without , on the meaningful local range with .
Since the nearest neighbour density estimator obeys , its conditional bound follows from the Beta distribution moments:Hence, under the printed location condition,The conditional inverse function bound also bounds , so the expected value in this calculation is finite under those formal hypotheses.
There is, however, a genuine flaw in the original PDF: the printed condition has no admissible points when is strictly positive on all of . A probability density function on all of cannot have Lipschitz constant zero, so . Its Lipschitz bound forcesIntegrating this triangular lower envelope gives the Lipschitz density height boundThe inequality is strict because the probability density function has positive mass outside the finite interval. Thus everywhere. The last two conditional conclusions above are valid implications but vacuous as printed. Dropping strict positivity gives only , with equality forcing the entire probability density function to be the normalized triangular envelope. The local inverse bound does not justify replacing the printed condition by its reverse in the final expected value bound, since ranges over all of .