Field

Probability — page 4

Randomness with a shape.
A single table for 9 guests over 4 nights. Small circles of 9 guests, one per night, each showing the night's seating as a closed zigzag path; every pair of guests is adjacent in exactly one of them.

Every pair side by side, once

Seat an odd number of guests at round tables for as many nights as it takes, the same table sizes every night, so that every two guests sit side by side on exactly one night. For a single table a zigzag turned a notch each night does it for any number of guests. For other table plans the answer is almost always yes — and for six guests at two tables of three, nine at tables of four and five, and eleven at three, three and five, an exhaustive search proves it is no.

A fair coin judged by someone who thinks it is biased. Posterior probabilities of three wrong coin biases over two thousand tosses of a fair coin, for five runs; the bias 0.6 wins every run.

Certain of a coin that is not there

Bayes' theorem is exact, and it is only as good as the list of hypotheses it is given. Hand it a list that leaves out the truth and it does not hesitate: it becomes certain of the entry that is least wrong, in a precise sense — the one closest in Kullback–Leibler divergence — and if two entries are equally wrong it never settles at all. Hand it a model that assumes independence where there is none, and its intervals shrink as fast as they would for honest data while covering the truth less and less often.

Walks that prefer the steps they have taken. 12 Pólya-urn walks of 2000 steps, each heading off along its own straight line, with final speeds 0.99, −0.87, −0.02, −0.66, 0.01, 0.78, 0.47, 0.44, −0.04, 0.38, 0.83, 0.55, against the ±2√n band of an ordinary walk.

A walk that follows its own footsteps

Let a walk step up with probability equal to the share of up-steps it has taken so far, and every count of up-steps after twenty steps is exactly equally likely. The walk leaves along a straight line at a speed chosen by its first few steps, and although it is expected to come back to its start infinitely often, almost every run comes back only a few times.

Five urns, each drawn as walks. Simulated walks of 2000 draws for urns with replacement matrices (0,1,1,0), (2,1,1,2), (3,1,1,3), (7,1,1,7), (1,0,0,1).

An urn forgets its start only below one half

Let each draw from an urn add balls of both colours in fixed amounts, and the long run depends on a single ratio of two eigenvalues. Below one half the urn behaves like a coin, its fluctuations spread like the square root of the draws and settle into a bell. Above one half the first few draws decide most of the outcome, the spread grows faster, and the shape that results is not a bell and depends on how the urn began.

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.

Leading digits of products of random numbers, against Benford's law. 1 factor: ones 11.1%, nines 11.1%; 2 factors: ones 24.1%, nines 3.4%; 3 factors: ones 30.1%, nines 4.2%; 6 factors: ones 30.1%, nines 4.6%; the law gives 30.1% and 4.6%.

Multiplying makes the digit one common

Multiply a few random numbers together and the product starts with 1 about 30 per cent of the time and with 9 under 5 per cent — Benford's law, which no factor contains. The logarithm of a product is a sum, the central limit theorem spreads that sum across many powers of ten, and once it is spread its fractional part is uniform. The approach is geometric, at a rate fixed by a single number for each kind of factor; sums never get there, and the powers of two get there with no randomness at all.

Four lists, merged in pairs, find a cancelling quadruple. A merge tree for four lists of 256 random 24-bit strings: two merges on the low 8 bits, then one on all 24, ending in 1 solution(s).

Four lists find a collision sooner

Two lists of random 24-bit strings need about four thousand entries each before some string appears in both — the birthday bound. Ask instead for one string from each of four lists whose exclusive-or is zero, and lists of a few hundred suffice, because merging the lists in pairs manufactures the near-misses a direct search would have to find by luck. David Wagner's algorithm turns the square root into a cube root, and more lists into smaller roots.

One shared birthday, as a measurement of the year. Histogram over 20000 rooms of the estimate T(T − 1)/2 from the first shared birthday, averaging 361 against 365, spread widely.

Counting a population by its repeats

The birthday problem runs forwards from a known year to the chance of a match. Run it backwards and the matches measure the year: count how many pairs among the draws came out the same, and the number of kinds is about the number of pairs divided by that. It costs the square root of the population rather than a census of it — and when the kinds are unevenly common, what the repeats measure is not how many kinds there are but how many they behave like.

Records in a thousand draws, and the lengthening waits between them. A sequence of 1000 uniform draws on a logarithmic position axis, with records at positions 1, 6, 11, 27, 36, 145, 539, 927.

A wait that ends and has no average

Draw a number, then keep drawing until one beats it. Half the time the very next draw does. The wait is certain to end, it is usually short, and its average is infinite — and the chance of still waiting after n draws is exactly 1/(n + 1), whatever the numbers are drawn from, because symmetry is the only thing the calculation uses.

Running totals of random steps, stopped as they pass 4. Four staircases of uniform steps stopped on passing 4, taking 11, 8, 8, 10 steps; the exact mean is 8.666604.

Two-thirds of a step past the line

Add random numbers between nought and one until the total passes one, and it takes e of them on average. Ask the same about passing any t and the answer is an exact finite sum that settles, within a few units, onto the line 2t + 2/3. The slope is one over the average step. The two-thirds is the interesting part: it is what the one step that crosses the line charges for being chosen by its length, and it is set entirely by how much the steps vary.

The longest run of heads at three sizes, never the same shape. n=65536: 12:0.018 13:0.117 14:0.233 15:0.239 16:0.172 17:0.104 18:0.057 19:0.030 20:0.015; n=82273: 13:0.075 14:0.204 15:0.249 16:0.197 17:0.124 18:0.070 19:0.037 20:0.019; n=104408: 13:0.040 14:0.162 15:0.248 16:0.221 17:0.148 18:0.086 19:0.046 20:0.024 21:0.012.

The longest run has no limit

Toss a fair coin n times and the longest run of heads is about log₂ n. The average settles: it is log₂ n − 0.667 to within a few millionths by a million tosses. The distribution does not. Because the run is a whole number and log₂ n is not, the chance of each value swings round the same cycle once every doubling of n, for ever, and computing it exactly to a million tosses shows the swing as large at the end as at the start.

The share of numbers beginning with 1, never settling. 10^1.0: 0.2000, 10^1.8: 0.1746, 10^2.3: 0.5487, 10^2.8: 0.1841, 10^3.3: 0.5231, 10^3.8: 0.1931, 10^4.3: 0.5002, 10^4.7: 0.2022, 10^5.2: 0.4766, 10^5.7: 0.2117, 10^6.2: 0.4519, 10^6.7: 0.2217, 10^7.2: 0.4261, 10^7.7: 0.2321, 10^8.2: 0.3990, 10^8.7: 0.2431, 10^9.2: 0.3707, 10^9.6: 0.2545, 10^10.1: 0.3411, 10^10.6: 0.2665, 10^11.1: 0.3100, 10^11.6: 0.2791.

A share that depends on the average

What share of the whole numbers begin with the digit 1? Counted up to N, the answer swings between one ninth and five ninths for ever, and averaging the swing over N, even three times over, narrows it without removing it. Weight each number n by 1/n instead and the share settles at log₁₀ 2 — Benford's value — and so does every other sensible weighting that counts each decade alike. The primes behave the same way. Benford's law for the counting numbers is not a fact about them; it is a fact about how they are averaged.

Two edges of a small graph, and whether one makes the other less likely. tree: 8 total, 5 with e, 5 with f, 3 with both, ratio 0.9600; forest: 24 total, 10 with e, 10 with f, 4 with both, ratio 0.9600; connected: 14 total, 10 with e, 10 with f, 7 with both, ratio 0.9800.

Edges that crowd each other out

Pick a spanning tree of a graph uniformly at random, and the presence of one edge makes every other edge less likely — a theorem of Kirchhoff's electricity. Pick a forest instead, or a connected subgraph, and the same is believed and unproved. Checking every pair of edges in every labelled graph up to six vertices, 871,926 pairs for forests alone, finds no exception, and comes as close as 0.9994 to one.

Two random strings of bits and the longest thread between them. Two random binary strings of length 36; longest common subsequence 27.

The longest thread between two random strings

Write down two random strings of a thousand bits each and find the longest sequence that can be read in both, skipping freely. It is about 81% of each, and the exact share — the Chvátal–Sankoff constant — has resisted computation for fifty years. Its fluctuations are a smaller mystery with a sharper edge: the variance is known to be at most n/2, and over every length that can be computed it grows like n to the power 0.7, with nobody able to say what it does after that.

A fixed p-value favours the null more as the sample grows. Even odds at p=0.05 near n=76, at p=0.01 near n=1202, at p=0.001 near n=83176; p=0.05 at n=10⁶ gives 116.9 to one for the fair coin; PEAR data z=3.614, p=0.00030, BF₀₁=11.90.

A result at five per cent that favours the null

Toss a coin a million times and find a count of heads exactly at the edge of significance, p = 0.05. A test at the usual level rejects fairness. A Bayes factor comparing a fair coin with a coin of unknown bias says the opposite, by 117 to one. Both computations are right, and the sample size that separates them is about seventy-six tosses.

Watching a fair coin until it looks unfair. Fair coins, 2000 runs to 100000: share reaching p<0.05 by 10³ 0.468, by 10⁵ 0.697; share reaching BF₁₀≥20 by 10³ 0.0280, by 10⁵ 0.0340.

Peeking until the answer is yes

Toss a fair coin, test for bias after every toss, and stop the moment the result is significant at 5%. Within a thousand tosses nearly half of fair coins have been declared biased, and with no limit on the tosses every one of them is. Watch a Bayes factor the same way, stopping at twenty to one, and no amount of watching gets more than one fair coin in twenty past the line.

Predicting the unseen works until the future outgrows the past. Zipf population of 5000, mean sample 2000: seen 756, f1 561, f2 95; at t = 1, 2, 4: truth 489/873/1462, smoothed 492/843/1243.

How many new kinds the next sample will show

Count how many kinds were seen once, twice, three times. Good and Toulmin's alternating sum f₁t − f₂t² + f₃t³ − … then predicts, with no bias at all, how many new kinds a further sample t times as large will reveal. It works perfectly up to t = 1 and is worthless just beyond: past that point the kinds seen most often are multiplied by t to a high power, and the spread of the estimate passes 10⁴⁰ by t = 1.5. Truncating the sum at a random point rescues it, and each fourfold increase in the first sample buys about half a unit more of future.

Two losing games that win together. A alone: -3.000 after 300; B alone: -3.131 after 300; A or B at random: 4.428 after 300; A A B B repeated: 4.322 after 300.

Two losing games that win together

Game A is a coin that wins 49.5% of the time. Game B tosses a bad coin when the capital is a multiple of three and a good one otherwise, and it loses too, because the capital spends more than a third of its time on multiples of three. Choose between the two games at random and the walk drifts upwards by 0.0157 a round; play A, B, B over and over and it gains 0.0574. Nothing is wrong with the arithmetic. The losing coin A wins by knocking the capital off the bad remainder.

The chance a random formula can be satisfied. n=20: 3:1.000 3.25:0.988 3.5:0.988 3.75:0.938 4:0.863 4.25:0.762 4.5:0.563 4.75:0.400 5:0.200 5.25:0.275 5.5:0.100 5.75:0.050 6:0.013; n=40: 3:1.000 3.25:1.000 3.5:1.000 3.75:0.963 4:0.863 4.25:0.575 4.5:0.425 4.75:0.138 5:0.050 5.25:0.025 5.5:0.037 5.75:0.000 6:0.000; n=80: 3:1.000 3.25:1.000 3.5:1.000 3.75:1.000 4:0.912 4.25:0.613 4.5:0.275 4.75:0.075 5:0.050 5.25:0.000 5.5:0.000 5.75:0.000 6:0.000.

A threshold nobody can place

Random three-literal clauses on n variables: below about 4.27 clauses a variable a formula can almost always be satisfied, above it almost never. The change is proved to be sharp and nobody has proved where it is. Counting solutions overshoots to 5.19, counting pairs of them fails outright, and every algorithm with a proof stops well short.

Four fractions staked on one run of tosses. p=0.6, 1000 tosses, 604 heads; final log10 wealth: Kelly 9.449, half Kelly 6.881, twice Kelly 0.409, everything ruined at toss 10.

The best average is the worst bet

A coin lands heads six times in ten and pays even money. Stake everything on every toss and the expected wealth grows by a fifth a toss — and the bettor is ruined at the first tail, which is certain to come. Stake a fifth of wealth each time instead and the average grows far more slowly, while the typical bettor grows faster than with any other fraction. The expectation is maximised by the strategy almost nobody should use.

Knowing the coin, learning it, and guessing it once. p=0.6, 2000 tosses; final log10 wealth: hindsight 19.30, knew p 19.25, learned 17.73, plug-in from 20 tosses (15 heads, f=0.50) -25.88.

What not knowing the coin costs

Kelly's rule stakes the edge, and the edge is the one thing a bettor never has. Estimate it from twenty tosses and stake the estimate, and a lucky start can turn a favourable coin into certain ruin. Learn it toss by toss instead, with Laplace's rule, and the cost of ignorance shrinks to a factor of about the square root of the number of tosses — because a bettor who learns is exactly a bettor who split the money among every fixed fraction at once.

Twelve studies of one coin, three ways of adding them up. theta=0.6, 12 studies of 40: heads 26,21,25,25,25,22,25,20,23,34,22,27; log10 learned product 0.06,-0.33,0.10,0.56,1.05,1.00,1.49,1.13,1.30,3.42,3.35,4.27; fresh 0.06,-0.63,-0.80,-0.98,-1.16,-1.78,-1.96,-2.67,-3.19,0.66,0.03,0.38; Fisher p 8.07e-2,2.58e-1,1.71e-1,1.19e-1,8.54e-2,1.34e-1,9.71e-2,1.72e-1,1.96e-1,7.44e-4,1.40e-3,4.71e-4; cross at 7 (learned e) and 10 (p).

Evidence that can be multiplied

A p-value from one study and a p-value from the next cannot simply be multiplied, and a researcher who decides whether to run the next study by looking at the last one quietly breaks the rule that combines them. An e-value — a number whose average under the null is at most one — can be multiplied, study after study, under any rule for continuing, and never passes twenty to one more than one time in twenty. What it costs is tosses, and what it demands is a decision about which alternatives to be good at finding.

All essays