Series

Monte Carlo — the series

10 essays on one idea, from the one that introduces it to the one that assumes the rest.
  1. 120 needles on a lined floor. 120 needles dropped at random across evenly spaced lines; 83 of them cross a line.

    Getting pi by dropping needles on the floor

    Throw a needle at a lined floor enough times, count how often it crosses a line, and pi falls out. There is no circle anywhere in the experiment.

    part 1 · probability
  2. 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.

    The error that does not care how many dimensions

    A grid gets rapidly better in one dimension and hopelessly worse in twenty. Random points get better at the same slow rate whatever the dimension, which is why a method that is bad everywhere ends up being the only one that works.

    part 2 · probability
  3. Two unbiased estimates of one integral, and their spread. The sharply peaked integrand with the proposal density that follows it, above a strip plot of 200 estimates from each of two methods; the weighted estimates cluster 4.2 times more tightly about the same value.

    Sampling where the answer lives

    Monte Carlo error cannot be made to fall faster than the square root, so the only thing left to attack is the constant in front of it. Drawing points where the integrand is large, and dividing by how often they were drawn, leaves the answer alone and can shrink the noise many times over.

    part 3 · probability
  4. A walk that visits each state as often as its weight says. The target distribution over 12 states with the share of a 40,000-step Metropolis run beside each bar, above the first 300 steps of the walk itself; the two distributions differ by 0.5 per cent in total.

    A walk that samples a distribution

    When a distribution can be evaluated but not drawn from, a wandering point can be arranged to visit each state as often as its weight says. The rule needs no normalising constant, compares two weights and steps or stays.

    part 4 · probability
  5. 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.

    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.

    part 5 · probability
  6. Integration error against the number of points: lattice, Halton and random, on a smooth periodic function. Log-log plot of integration error against N for random points (slope -0.47), Halton points (-0.96) and Fibonacci lattices (-1.83).

    Points on a lattice that see almost nothing

    Average a function over the points of a carefully tilted lattice and the error can fall like one over the square of the number of points — far faster than random sampling, and faster than the most evenly spread sequences. The reason is that a lattice rule is blind to only a thin set of frequencies, its dual lattice, and a smooth periodic function has almost nothing there.

    part 6 · probability
  7. Error against the number of points for three randomised methods. Log-log plot of root-mean-square integration error against N from 16 to 4096 for plain Monte Carlo (slope -0.52), digitally shifted Sobol' points (-1.00) and Owen-scrambled Sobol' points (-1.43).

    An error bar for points that are not random

    Evenly spread points integrate far better than random ones and give no error bar; random points give an error bar and integrate badly. Randomise the even points themselves — shift a lattice by a random vector, or scramble the digits of a Sobol' sequence — and both are kept: an unbiased estimate, a confidence interval from a handful of repeats, and an error that falls faster than any deterministic set's.

    part 7 · probability
  8. Where a jump puts the error of evenly spread points. Three unit squares with 16, 64, 256 scrambled Sobol' points, one per box, and the line y = 0.15 + 0.7x crossing 6, 12, 26 boxes.

    What a jump costs evenly spread points

    Scrambled Sobol' points integrate a smooth function with an error that falls like N to the power −3/2. Put a jump in the integrand along a tilted line and the exponent halves, to −3/4, because about √N of the N boxes the points fill are cut by the jump and each of those is left to chance. A jump along an axis costs almost nothing, the cost grows with the length of the jump and the dimension, and integrating across the jump before sampling gives the whole rate back.

    part 8 · probability
  9. One random path estimates the whole tree. probe columns 4,2,5,3,6,0; choices 8,5,3,1,2,1; estimate 769; exact 2057.

    One random path down a search tree

    Before running a search that may take a week, it is worth knowing whether it will take a week or a century. Donald Knuth's answer, from 1975, is to walk down the search tree once at random, multiply the numbers of choices met on the way, and add up the products: the result is, on average, exactly the size of the tree. On the eight-queens tree one path guesses 769 against a true 2,057 and twenty thousand paths average to within a tenth of a per cent. On a tree built to hide its bulk, the same unbiased estimate is almost always wrong by a factor of thousands.

    part 9 · probability
  10. Three ways to draw a random chord. Samples of 220 chords from each of three procedures: random ends, random radius and random midpoint; chords longer than the triangle's side are coloured; chances 1/3, 1/2 and 1/4.

    What a random chord is

    Draw a chord of a circle at random. How often is it longer than the side of the inscribed equilateral triangle? Pick two random points on the rim and the answer is 1/3. Pick a radius and a random point on it, and the answer is 1/2. Pick a random midpoint in the disc, and the answer is 1/4. All three calculations are correct, and Bertrand published them in 1889 to warn that the phrase had no meaning. Eighty-four years later Jaynes argued that one answer is right after all.

    part 10 · probability

All series