Probability

Points too even to be random

Independent random points clump, and the clumping is what makes the error fall only as the square root. Points chosen to be evenly spread rather than independently beat that rate, and the price is that nothing about them is random at all.

Worth reading first: The error that does not care how many dimensions · How close a fraction can get.

Independent random points look, to the eye, badly distributed. They arrive in clumps with gaps between, and a scatter of two hundred of them across a square will have a knot in one corner and an empty patch in another. That is not a failure of the generator; it is what independence produces, and anybody laying out points by hand would do considerably better.

The error of a Monte Carlo estimate falls like 1/N1/\sqrt N precisely because of that clumping. The question this rung asks is what happens if the clumping is simply prevented.

Points too even to be random. 256 independent random points beside 256 points of a Halton sequence, with the largest mismatch between a box's share of points and its area plotted against the number of points for both.
Fig. 1 Two hundred and fifty-six independent random points beside two hundred and fifty-six points of a Halton sequence, with the largest mismatch between a box’s share of points and its area measured for each. The Halton points fill the square visibly better, and the measurement says so.

Measuring evenness

Before anything can be improved, evenness has to be a number. The standard one is discrepancy: over all boxes with one corner at the origin, the largest difference between the share of the points inside and the area of the box.

DN=supB#{points in B}Narea(B).D_N = \sup_B \left|\frac{\#\{\text{points in }B\}}{N} - \operatorname{area}(B)\right|.

A perfectly even set has small discrepancy; a set with a clump has a box around the clump holding more than its share, so its discrepancy is large.

The figures measure this over a grid of test boxes rather than over all of them, which gives a lower bound on the true supremum — the worst box has a corner at a data point and the grid need not contain it. That is stated in the caption, because it matters: a lower bound is enough to establish that one set is worse than another, which is what the comparison needs, and is not enough to certify that any set is good.

There is a second reason to define evenness by boxes with a corner at the origin rather than by all boxes, or by discs, or by anything else. Every such definition gives a slightly different number, and they are all equivalent up to constants in a fixed dimension — so the rate is the same whichever is used, and the rate is what everything here turns on. The corner-anchored version is chosen because it is the one that appears in the error bound below, and because it is the cheapest to compute.

That is worth noticing as a general habit: when several reasonable definitions of a quantity exist and all give the same asymptotics, the one to standardise on is the one a theorem uses.

The rate

For independent random points the discrepancy is about loglogN/N\sqrt{\log\log N / N}, so it falls essentially like 1/N1/\sqrt N — the same rate as the integration error, for the same reason.

For a well-chosen deterministic sequence it falls like (logN)d/N(\log N)^d/N, which for any fixed dimension is very nearly 1/N1/N. Squaring the rate: a hundred points of such a sequence are worth ten thousand random ones, in a sense the bound below makes precise.

The figure measures both slopes rather than quoting them. It computes the discrepancy of each kind of point set at six sizes from 64 to 2,048, fits a line to the logarithms, and asserts that the random slope is 0.5-0.5 to within 0.12 and that the Halton slope is steeper by at least 0.2.

How the points are made

The Halton sequence is built out of the digits of the counting numbers, reflected about the point.

Write nn in base bb. Reverse the digits and put them after a decimal point in the same base. That is the nn-th term of the van der Corput sequence in base bb: in base 2 it gives 1/21/2, 1/41/4, 3/43/4, 1/81/8, 5/85/8, 3/83/8, 7/87/8, and so on — each new term landing in the largest remaining gap.

That is not a metaphor. The sequence halves the largest gap at every step — the same behaviour that three gaps and no more describes for a different construction, then halves the next largest, and so on, which is exactly the behaviour that keeps the discrepancy small. A dd-dimensional Halton sequence uses a different prime base for each coordinate, so that the coordinates do not fall into step with one another.

Points too even to be random. 512 independent random points beside 512 points of a Halton sequence, with the largest mismatch between a box's share of points and its area plotted against the number of points for both.
Fig. 2 Five hundred and twelve points of each kind. The random set still has visible clumps and voids; the Halton set has filled in at a finer scale, which is what its construction does — every new point lands where the gaps are largest.

Why reversing the digits works

The construction looks arbitrary and is not, and the reason is worth a paragraph.

Consider the first 2k2^k terms of the base-2 sequence. Their binary expansions are the reversals of 11 through 2k2^k, which are exactly all the kk-bit strings — so those 2k2^k points are precisely the points j/2kj/2^k, one in each interval of length 2k2^{-k}. Every dyadic interval of that size contains exactly one point.

That property holds at every scale simultaneously, and it is what small discrepancy means: a box of any size contains its fair share. The reversal is doing something specific — it converts the counting numbers’ habit of filling the low bits first into the habit of filling the finest scale last, so the sequence refines uniformly rather than sweeping from one end.

The same construction in base 3 gives one point in each third, then each ninth, and so on. Using bases 2 and 3 for two coordinates makes them refine at incommensurable rates, so no correlation builds up between them — and using two bases that shared a factor would give points on a lattice rather than a filled square, which is why the bases are primes.

The bound that connects evenness to error

The link between discrepancy and integration error is the Koksma–Hlawka inequality:

1Nif(xi)fV(f)DN,\left|\frac1N\sum_{i} f(x_i) - \int f\right| \leq V(f)\, D_N,

where V(f)V(f) measures how much ff wiggles — its total variation in the sense of Hardy and Krause.

Two things about this bound are worth separating.

It is deterministic. There is no probability in it. A Monte Carlo error bar is a statement about a distribution of possible errors; this is a guarantee about the error of the run actually performed. That is a genuinely different kind of statement and is the strongest argument for these methods.

It is nearly useless as a number. Computing V(f)V(f) is harder than computing the integral, and computing DND_N exactly is itself an expensive combinatorial problem. So the bound is used to establish the rate and essentially never to produce an actual error estimate.

That leaves a practical awkwardness. Quasi-Monte Carlo converges faster and reports no error, while Monte Carlo converges more slowly and reports one. The usual response — randomised quasi-Monte Carlo, in which a low-discrepancy set is randomly shifted and several such shifts are averaged — recovers an error estimate by making the whole thing random again at a coarser level, and keeps most of the rate.

Points too even to be random. 64 independent random points beside 64 points of a Halton sequence, with the largest mismatch between a box's share of points and its area plotted against the number of points for both.
Fig. 3 The smallest case drawn here, at sixty-four points. Even this early the Halton set is measurably more even, and the two sets look different enough that the measurement is confirming what the eye already reports rather than revealing something hidden.
How fast each way of averaging closes in, as the dimension grows. Relative error against the number of points, both on logarithmic scales, for a regular grid in 1, 4, 8 dimensions and for random points in 8; the grid's lines steepen or flatten with the dimension and the random one does not move from a slope of a half.
Fig. 4 And the reason any of it matters: the rate at which each kind of averaging closes in. The random line’s slope of a half is the thing quasi-random points are trying to beat, and the grid lines are the alternative that beating it must not cost — a low-discrepancy set is meant to keep the dimension-independence of random points while improving on their rate.

Where the advantage goes

The (logN)d(\log N)^d in the numerator is doing real damage in high dimensions and it is honest to say so.

At d=30d = 30 the bound (logN)30/N(\log N)^{30}/N does not beat 1/N1/\sqrt N until NN is astronomically large, so the theory says quasi-random points should be useless for the very problems Monte Carlo was invented for. And yet they are used, successfully, on financial problems in hundreds of dimensions.

The resolution is that such problems have a low effective dimension: most of the variance comes from a handful of coordinates, and the low-discrepancy construction is good in exactly those first coordinates. Halton’s later bases are large primes and its higher coordinates are visibly poor, so a construction that puts the important variables first works and one that does not is worse than random. Sobol sequences are used in practice partly because their coordinates degrade far more slowly.

This is one of the places where the theory is pessimistic and the practice is fine, and the honest summary is that the bound is worst-case, most problems are not the worst case, and nobody has a satisfying general account of which are.

Points too even to be random. 128 independent random points beside 128 points of a Halton sequence, with the largest mismatch between a box's share of points and its area plotted against the number of points for both.
Fig. 5 A shorter sweep at 128 points. The two lines separate immediately and stay separated, and the slopes are what the assertion checks — the random discrepancy falling like a square root, the Halton one appreciably faster.

What was given up

The word “random” has left, and several things went with it.

Independence. No error estimate comes free from the run, as noted above.

Robustness to the integrand. A random sample is good against every integrand at once, , because the argument uses nothing about ff except its variance. A fixed point set is good against integrands that do not conspire with it — and one can be built that does. Deterministic points have an adversary; random ones do not. It is the same distinction as between a rule that can be gamed and one that cannot, transplanted from voting to numerical integration.

The ability to stop anywhere. Many low-discrepancy constructions are only good at particular sample sizes — powers of two for a Sobol sequence — so stopping after 1,500 points may be worse than stopping after 1,024.

What is gained is the rate and the deterministic bound. Whether the trade is worth making is a question about the problem, and the fact that both methods remain in wide use is the honest indication that neither dominates.

1500 triples from a generator, on 15 planes. Consecutive triples of outputs of a linear congruential generator plotted in a cube, seen from an angle that shows them lying on a small number of parallel planes.
Fig. 6 The other kind of unreality in a random sample: the points a computer supplies are not random either. Fifteen hundred consecutive triples from a linear congruential generator, seen from the angle that shows them lying on fifteen parallel planes — a structure the figure finds rather than assumes. Both this essay’s subject and its foil are deterministic sequences standing in for randomness; one of them says so.

The one-dimensional case, which is a different subject

In one dimension all of this is older and sharper, and it is worth naming because it connects to a part of this collection that looks unrelated.

The points {nα}\{n\alpha\} — the fractional parts of multiples of an irrational α\alpha — are equidistributed for every irrational, and how evenly depends on how badly α\alpha is approximated by fractions. A number with a very good rational approximation p/qp/q has its first qq multiples nearly repeating, which is a clump; a number with no good approximations never does. The golden ratio, the hardest number to approximate, gives the most even sequence, and the gaps between consecutive points take only ever three distinct values.

So the one-dimensional theory of low-discrepancy points is a chapter of the theory of continued fractions, and the quantity governing it is how well a number can be approximated. That is a satisfying place for the subject to come from and it does not generalise: in higher dimensions there is no analogue of continued fractions with the same power, which is part of why the constructions become combinatorial rather than arithmetic.

What the eye was right about

It is worth closing the loop on the observation the essay opened with, because it is unusual for an aesthetic judgement to be correct.

A scatter of independent points does look badly distributed, and it is badly distributed by the measure that matters for integration. The clumps are real, the gaps are real, and the reason a hand-placed set looks better is that a person placing points by hand is minimising something like discrepancy without knowing the word.

The usual lesson drawn from random scatter — that people are bad at recognising randomness, and expect it to look more even than it is — is true and is a different point. Both are true at once: a random scatter looks less even than people expect, and is less even than is useful. The first is a fact about intuition and the second is a fact about integration, and confusing them leads to the conclusion that the clumping must be fine because randomness is supposed to look like that.

For deciding whether a pattern is random, the clumping is exactly what to expect. For estimating an integral, it is what to eliminate.

One more comparison is worth making explicit, since it is the reason this rung follows the Metropolis one rather than preceding it. A chain gives up independence in order to sample a distribution that cannot be drawn from; a quasi-random set gives up randomness in order to sample the uniform distribution better than randomness can. Both trades abandon the same property and buy different things, and neither can be applied to the other’s problem — there is no low-discrepancy sequence for an unnormalised target, because evenness is defined against a measure that has to be known.

What the picture cannot show

The discrepancy printed under each panel is a lower bound, computed over a grid of test boxes. The true supremum is over all boxes and is attained at one whose corner sits at a data point; computing it exactly is possible and expensive, and in two dimensions with a few hundred points the grid is close. In higher dimensions the exact computation is out of reach entirely, so discrepancy — the quantity the whole subject is about — is essentially never measured on the sets that matter.

The pictures are also two-dimensional, and evenness in two dimensions is something the eye judges well. That is why the figures are persuasive and why they are misleading: in twenty dimensions no set of points looks like anything, every pair is nearly the same distance apart, and intuitions formed on a square do not survive — which is the same warning the dimension-counting rung gives about grids, arriving here about the eye instead.

And the (logN)d(\log N)^d cannot be drawn. It is invisible at the sizes shown, and it is the term that decides whether any of this helps at the dimensions where the methods are used.

The ladder from here

Rungs above: Sobol and Niederreiter sequences, and the digital-net construction they come from. Randomised quasi-Monte Carlo, and the scrambling that restores an error estimate. Effective dimension and the ANOVA decomposition that measures it. Lattice rules, which are the higher-dimensional relatives of {nα}\{n\alpha\}. And the lower bounds on discrepancy, which say how even a set of NN points can possibly be — a question with a known answer in one dimension and open in general.

Where the two methods meet

The neatest way to hold both rungs at once is to notice that they are attacking different factors of the same expression.

Monte Carlo error is roughly variability of the integrand times how unevenly the points fall, and the two methods split along that product. Importance sampling attacks the first factor: it does not change how the points clump, it changes the function being averaged so that clumping matters less. Quasi-random points attack the second: they leave the integrand alone and make the points fall evenly.

The two are compatible, and combining them is standard practice — a low-discrepancy set pushed through the inverse of a well-chosen proposal gives points that are both evenly spread and concentrated where the integrand is. Neither idea interferes with the other, because they are about different halves of the same product.

What neither can do is change the exponent from the underlying source: Monte Carlo’s half is a fact about independent averaging, and quasi-random points’ near-one is a fact about how evenly NN points can be placed in a cube. Those are the two floors, and everything in this ladder is a matter of getting near one of them.

The trade in one sentence

Randomness was never the point.

Monte Carlo is called a random method and the randomness is a means: what the argument actually needs is that the sample represents the domain, and independence is one way of arranging that — a cheap, robust, universally applicable way, whose price is the clumping. Choosing points to be representative directly is another way, more effective and less robust.

Naming what a technique actually requires, as against what it happens to use, is worth doing whenever a method is being improved. Here the requirement was evenness, the tool was independence, and the improvement came from noticing that they are not the same thing.

What links here

Computed from the collection, not written here: the essays that point at this one.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

Convergence rateDiscrepancyEquidistributionError boundIntegralMonte CarloPseudorandomnessQuasi random sequenceSamplingUniform distribution