A restaurant and a shuffled deck
Worth reading first: How many new kinds the next sample will show · A hundred prisoners and one shuffle.
How many new kinds the next sample will show estimated, with no model at all, how many species remain to be found. Its method runs out soon, since the first sample says nothing about what it has not seen. Going further needs an assumption about how kinds are distributed, and the most natural such assumption has an extraordinary range. It gives the alleles of a gene under neutral evolution, it gives the species in a sample, and in one special case it gives the cycles of a shuffled deck. It gets the shares of the prime factors of a random number too, although nothing there is random in the same way.
Warren Ewens found the formula in 1972 while studying genetics. A little later a memorable picture was attached to it, by Lester Dubins and Jim Pitman, and it is the easiest way into the whole structure. Customers come into a restaurant with infinitely many tables. The first sits at a table. Each customer after that either joins an occupied table, with probability proportional to the number of people there, or starts a new one with probability proportional to a fixed number . That is all there is to it.
Why the number of tables is so simple
Customer starts a new table with chance exactly , whatever the arrangement of the earlier customers. That is the key. The denominator is the total weight of all the choices, people and for a new table, and it does not depend on how those people have divided themselves. So “a new table at step ” is a sequence of independent events. The number of tables is a sum of independent coin tosses with shrinking chances, and:
At 10,000 customers, the exact sum gives 5.59, 17.58 and 69.60, and simulations agree within their sampling error. It grows like , so that a thousand times more data brings only about more kinds. There is always another new one to be found, ever more rarely, with a chance of at the next draw. That is a clean answer to the earlier essay’s question within this model. The singleton count from Good and Turing’s method estimates the same thing, as the expected number of tables with exactly one customer is about , whatever is, so the estimate of “next is new” is about . Good and Turing’s formula does not assume any of this, and yet the two agree where the model holds.
Ronald Fisher’s logarithmic series of 1943, for butterflies collected by Corbet in Malaya, had already found the same shape: numbers of species represented by individuals fall like , and the total grows like a logarithm. Fisher’s is this . So ecologists had been using the parameter thirty years before Ewens, and for quite a different reason.
Twenty-three at a table
The scheme has an unexpected link to the oldest question about collisions. All customers sit alone with probability , which for large is close to . That is the birthday calculation, with playing the part of the number of days. Put . The chance that 23 people all sit apart is 0.5070, and the same 23 in the usual model of 365 days give 0.4927, so the even-odds point moves only from 23 people to 24. They differ in that here a repeat is chosen in proportion to popularity rather than uniformly, and that matters less than one might think, since a first repeat is a matter of pairs. So the restaurant with large can be seen as a birthday problem in which the number of possible birthdays is infinite and the distribution comes from the sampling itself.
It also gives a simple way of reading from a sample, by setting the observed number of kinds equal to the sum. A catch of 1,000 individuals with 40 species gives , and it predicts that doubling the catch brings about 6 more species, whereas a million individuals would bring only about 57 more. That prediction is much stronger than anything the assumption-free extrapolation can make, and it is only as good as the model.
The cycles of a shuffle
Now the surprise. Set and compare the tables with the cycles of a random permutation.
The bars match, and they lie along : the number of fixed points of a shuffle averages one, the number of 2-cycles averages one half, and so on. In 4,000 runs the cycle counts are 1.020, 0.488 and 0.330, and the tables give 1.015, 0.502 and 0.335. It is not an approximation. It is an exact identity, as the following construction shows. Build a permutation in cycle notation, one number at a time. Number can either close off into a new cycle on its own, in one way, or be inserted after any of the earlier numbers, which puts it into that number’s cycle. So of equally likely places, one starts a new cycle, and a cycle is chosen with probability proportional to its length. That is the restaurant at , and it is the Feller coupling, described by William Feller in 1945.
So everything known about cycles carries over. The fixed points of a hundred prisoners’ shuffle, and the fact that the longest cycle exceeds half with probability , are statements about a restaurant. The number of cycles is the number of tables: about . It also generalises, because for it is still a distribution on permutations: give each permutation a weight of to the power of its number of cycles. For an exact check, all 5,040 permutations of seven elements were grouped by their cycle type, and each share is the sampling formula at to twelve places.
One formula for every split
The probability of any particular arrangement, with tables of size , is Ewens’s sampling formula:
At , six draws all at one table have probability 0.1667, one in six, and all at separate tables it is . Larger favours more kinds. The eleven values add up to one for all , and the sum was checked at sizes 5, 8 and 12 for three values of . Look at how appears in the formula. Only through , where is the number of tables. So given , the probability of a split does not depend on at all, which means that the number of kinds is a sufficient statistic for . Everything the sample has to say about is contained in how many kinds there are, and the rest of the configuration tells nothing.
That is what made the formula so useful in genetics. Motoo Kimura’s neutral theory holds that most variation between alleles has no effect on fitness. Given the number of alleles observed in a sample, the distribution of their counts is then completely known, and it does not involve the unknown mutation rate. So one can compare the actual counts against that exact distribution, as a test of neutrality. Ewens’s formula gives this directly. Mutations in this model are new tables, and measures the rate at which they come, in units of the population size.
John Kingman showed in 1978 that the scheme is, in a sense, the only one of its type: a partition of a sample is exchangeable and consistent as the sample grows exactly when it comes from a random “paintbox”, in which each individual picks a colour according to a fixed random list of shares. So there has to be a limit distribution for the shares, and it has a tidy description. Break a stick, keeping a fraction, then break what remains in the same way, and sort the pieces. That is the Poisson–Dirichlet distribution.
The largest table
Given that there are about tables, a guess would be that any one table holds a vanishing share of everyone. It does not. The largest table keeps a positive share however large becomes, and the same goes for the second and third. At the simulation gives 0.6265 for the largest, near the limit of 0.62433, the Golomb–Dickman constant. Lawrence Shepp and Stuart Lloyd in 1966 found this as the mean length of the longest cycle of a random permutation.
Then comes the most striking connection of all. Take a random number near , and consider its prime factors. Karl Dickman studied in 1930 the size of the largest prime in a typical number, and that size, expressed as a power of , has a limit distribution. Its mean is 0.62433, the same constant. Patrick Billingsley showed in 1972 that the whole list is the same: the logarithms of the prime factors of a random number, divided by and sorted, converge to Poisson–Dirichlet with . So a random number’s factorisation looks statistically like a shuffled deck’s cycles. There is a real reason, as Richard Arratia, Andrew Barbour and Simon Tavaré explored. Both structures decompose an object uniquely into irreducible pieces, a cycle or a prime, and in both cases the number of irreducible objects of size is about of the available weight. Polynomials over finite fields behave in the same way, and the way they factor has precisely this limit, and the same is true of the components of random mappings, at . So the numbers follow the distribution of a card shuffle, even though nothing is being shuffled, and this has become a useful heuristic for making guesses about how many primes a typical number has.
A second parameter
One thing the Ewens scheme cannot produce is a power law. Real collections of kinds frequently have far more than kinds, and they have heavy-tailed sizes. Words in English are the standard example, with their vocabulary growing like a power of the length of text.
Subtract a small discount from every occupied table’s weight and add it to a new table’s weight. Then the new-table chance is , which is no longer independent of the past. It grows as tables accumulate, and the feedback changes the growth. Pitman and Marc Yor’s two-parameter scheme gives for . The straight lines on the figure’s logarithmic axes have roughly this slope, with 56, 338 and 2,769 kinds at 30,000 customers. The singletons are now a fixed share of everyone, at 0.0048 to 0.0696 of customers, as opposed to a constant number. That is the signature of a power law, and it is a relative of the digit laws that come from multiplying, in that a simple self-reinforcing mechanism gives a heavy tail.
A further feature of this family deserves mention, since it decides whether a sample could tell the two kinds of process apart. Ewens’s scheme has singletons in a fixed number whatever the sample size, while a discount has them in a fixed share. So a simple test is to double the sample and look at how many singletons there are. Doubling the catch above leaves its expected 8 or so singletons unchanged, under the Ewens model, though the sample has grown. Under a discount they would double. It is a very direct way of distinguishing the logarithm from the power, and it needs no fitted parameter of any kind at all, and a small survey can do it.
These schemes have been widely used in statistical language modelling, and they fit word counts remarkably well in the middle of the range. Nobody thinks that writers are sitting at tables, of course. The fit shows that the statistics of new words are close to those of a rich-get-richer process with a small new-word cost. This has been said many times about many things, and it is worth remembering that a good fit of a curve is only weak evidence for a mechanism.
How far a simulation can go
The exact parts here are the sum for tables, the formula, its check on small sizes, and the identity for permutations. The rest is sampling. Shares and counts come from modest numbers of seeded runs, with sampling error visible in the last digits. The largest-table figure at 3,000 customers has also not fully converged to its limit, so that it could differ by a part in a hundred from the true value. The power-law slopes cannot be read exactly, since convergence is very slow: 30,000 customers is not a large sample for an exponent, with a value of 0.75 giving about 2,769 kinds where a pure power would give somewhat more, because the slope settles slowly.
Nothing here is a claim about a real ecology or genome. A sample that fits the formula has passed one test, and that is consistent with neutrality without demonstrating it. Equally, the numbers-and-permutations analogy is a theorem about limits, and it says nothing about any particular number.
What was computed and what was quoted
The sum for the mean, and the formula’s total, were computed directly. All 5,040 permutations of seven were enumerated for the check at . The other figures are seeded simulations: restaurants by direct sampling, cycles by a Fisher–Yates shuffle, with both sizes given. The discount scheme uses a sampler that picks an existing customer’s table and thins it by rejection, and that is exact in distribution.
Quoted: the theorems of Ewens, Kingman, Pitman and Yor, Shepp and Lloyd, Dickman, Billingsley, and Arratia, Barbour and Tavaré; Fisher’s series; the genetics interpretation; and the constant 0.62433. The identity between restaurant and permutation is proved above, and the one between restaurant and prime factors is quoted only.
Still open: where the analogy with primes stops
How far does the analogy between prime factors and cycles extend? At the level of the largest few shares it is a theorem. Finer questions are open. Do the prime factors of integers near a given size have the same joint statistics at a very fine scale as a random permutation’s cycles? Whether the two match in the small print, in questions about whether two numbers share a divisor in a given range, or the fine-scale distribution of the number of divisors, is a matter of active study by Kannan Soundararajan, Adam Harper, Andrew Granville and others. Harper showed that a certain random multiplicative model has behaviour that is better than expected, and it is not yet clear where the permutation analogy gives a wrong answer.
For word statistics the open question is different. What mechanism produces the observed exponents? Herbert Simon’s rich-get-richer model of 1955 and many successors reproduce the form, and none explains why language should have this particular exponent, and it is not clear that a single explanation exists.
One rule, and shares that stay
A customer joins a table with probability proportional to its size or starts a new one with weight , and everything follows from one exact formula: about tables, a number of kinds that is sufficient for , and shares that stay positive however many customers come. At the restaurant is exactly the cycle structure of a shuffled deck.
And the same shares then appear in the prime factorisation of a random number. The largest table, the longest cycle and the largest prime take about 62% of the whole on average, on their respective scales. It is not common for one constant to tie together something as concrete as a shuffle, something as biological as a neutral gene and something as rigid as an integer’s factors. It seems to be just what happens when a large object breaks uniquely into irreducible pieces, and nobody has a theorem saying how general that is.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A cluster grown by random walkers — both name power law, simulation
- A room where nobody is alone — both name expected value, simulation
Named objects
A dashed tag is an object no other essay names yet.