Puneet Varma (Editor)

Halton sequence

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Halton sequence

In statistics, Halton sequences are sequences used to generate points in space for numerical methods such as Monte Carlo simulations. Although these sequences are deterministic, they are of low discrepancy, that is, appear to be random for many purposes. They were first introduced in 1960 and are an example of a quasi-random number sequence. They generalise the one-dimensional van der Corput sequences, consult that article for a precise definition.

Contents

Example of Halton sequence used to generate points in (0, 1) × (0, 1) in R2

The Halton sequence is constructed according to a deterministic method that uses coprime numbers as its bases. As a simple example, let's take one dimension of the Halton sequence to be based on 2 and the other on 3. To generate the sequence for 2, we start by dividing the interval (0,1) in half, then in fourths, eighths, etc., which generates

12, 14, 34, 18, 58, 38, 78, 116, 916,...

Equivalently, the nth number of this sequence is the number n written in binary representation, inversed, and written after the decimal point. This is true for any base. As an example, to find the sixth element of the above sequence, we'd write 6 = 1*22 + 1*21 + 0*20 = 1102, which can be inverted and placed after the decimal point to give 0.0112 = 0*2-1 + 1*2-2 + 1*2-3 = 38. So the sequence above is the same as

0.12, 0.012, 0.112, 0.0012, 0.1012, 0.0112, 0.1112, 0.00012, 0.10012,...

To generate the sequence for 3, we divide the interval (0,1) in thirds, then ninths, twenty-sevenths, etc., which generates

13, 23, 19, 49, 79, 29, 59, 89, 127,...

When we pair them up, we get a sequence of points in a unit square:

(12, 13), (14, 23), (34, 19), (18, 49), (58, 79), (38, 29), (78, 59), (116, 89), (916, 127).

Even though standard Halton sequences perform very well in low dimensions, correlation problems have been noted between sequences generated from higher primes. For example, if we started with the primes 17 and 19, the first 16 pairs of points: (117, 119), (217, 219), (317, 319) ... (1617, 1619) have perfect linear correlation. To avoid this, it is common to drop the first 20 entries, or some other predetermined number depending on the primes chosen. In order to deal with this problem, various other methods have been proposed; one of the most prominent solutions is the scrambled Halton sequence, which uses permutations of the coefficients used in the construction of the standard sequence. Another solution is using leaped Halton, just skipping points. If you use e.g. only each 409th point (also other prime numbers not used in the Halton core sequence are possible), then you can achieve significant improvements.

Implementation in pseudocode

algorithm Halton-Sequence is inputs: index i base b output: result r f 1 r 0 while i > 0 do f f / b r r + f ( i mod b ) i i / b return r

References

Halton sequence Wikipedia