Every number computed from data is one draw of a random variable. Statistics measures how far it would move on another sample of the same size (its standard error), and asks whether a difference is bigger than that wobble.
The running example is the one from Topic: math: a tiny language model whose bet for the word after "the cat" is over cat, dog, sat. Its average loss is its entropy, 0.832 nats, and here (unlike in real life) we know it exactly, so we can count how often each statistical tool recovers it. Fig. 1 is the whole page in five steps:
simulated marks numbers from this page's seeded simulations (src/sims.py); exact marks numbers computed exactly.
You need: random variables, expectation and variance, the normal and Beta distributions, and Bayes' rule, from Probability for ML (its sections 1, 3 and 5). This page uses them without re-deriving them.
| Idea (section) | In one line | On the running example |
|---|---|---|
| Estimators (1) | judge a recipe by bias² + variance = MSE, not by bias alone | at the bias-corrected entropy estimate has the larger MSE |
| Maximum likelihood (2) | the curvature of the log-likelihood is the error bar | 9 heads of 10: = 0.9, SE 0.0949 |
| Why (3) | spread around a fitted mean is too small by | divide-by- variance at averages 0.340, not 0.424 |
| Central limit theorem (4) | averages are nearly normal, width | at the average wobbles by 0.119 |
| Confidence interval (5) | a procedure, not a probability for this interval | t-interval at covers 0.832 in 92.7% of repeats |
| Bootstrap (6) | resample the sample | spread 0.122 against the true 0.119 |
| Tests, power, A/B (7 to 9) | how surprising under "no effect", and how often a real effect is found | 9 heads of 10: two-sided = 0.021 |
| Bayesian estimation (10) | a probability for the parameter itself | Bayes factor 9.3 against "fair" |
| Regression (11) | least squares is MLE; ridge is a Gaussian prior | slope 0.81 0.33 |
| Bounds, models, CV (12 to 14) | guarantees at every ; bias and variance of a fitted model; what CV estimates | naive CV interval covered 85.8% |
Where this page sits: the root gives the intuition in its section 6 ("Statistics: was the improvement real?"). Eval statistics owns statistics on real benchmarks: Wilson and Bayes intervals for small evals, clustered errors, paired tests on real model comparisons, and a sample-size calculator; each section below links its match there. Regularisation owns the bias-variance trade-off as a model-choice tool and double descent; this page keeps the bias and variance of an estimator (section 1).
You computed a validation loss of 0.81 on 10 examples; a colleague, on 10 other examples from the same source, got 1.11. Both are honest. Ten sampled words, 7 cat, 2 dog and 1 sat, average ; ten more, 5 cat, 3 dog and 2 sat, average 1.108. exact The spread of such averages over many samples of 10 is , so a gap of 0.3 between two samples of 10 is ordinary.
The vocabulary, briefly: the population is everything you could have measured (here every word the model could sample; in ML, the inputs the model will meet in use) and a parameter is a fixed number describing it, such as ; a sample is the values observed, usually assumed i.i.d. (independent draws from the same population); an estimator is a statistic (any number computed from the sample: its average, its largest value, its median) used as a recipe to turn the sample into a guess of a parameter , and the estimate is what it gives on one sample. Over all the samples you might have drawn, the estimate has a sampling distribution; its standard deviation is the standard error.
When i.i.d. fails (near-duplicate test items, several items cut from one document, leaked test data, users in both train and test), the draws carry less information than their count suggests and every error bar computed as if they were independent is too narrow (clustered standard errors: section 3 of Eval statistics). The test set is a sample from deployment; the trained weights are an estimate; so is every metric you report; keeping train and test samples apart is what makes a test score an honest estimate.
What makes an estimator good. Think of darts at a bullseye , one throw per sample. The throws can be centred off the bullseye (bias) or scattered (variance); the mean squared error counts both:
So being unbiased is not the goal; being close is. Estimate from samples of variance 4: the sample mean is unbiased with MSE ; the shrunk estimate has bias and variance 0.25, so MSE , half the error. exact When three or more means are estimated together, a data-driven shrinkage beats the plain sample means in total MSE whatever the true means are (James and Stein 1961); weight decay and a prior towards zero (Probability for ML, section 9) are the same trade.
The tiny model's entropy (0.832 nats) can be estimated from sampled words in three ways: Monte Carlo averages and needs the model's probabilities; plug-in counts the words and computes the entropy of the frequencies , needing only samples (how entropy and mutual information of data are usually estimated); Miller-Madow adds to the plug-in, with the number of distinct words seen, a first-order bias correction (Miller 1955; Paninski 2003, Neural Computation 15, section 3). Predict before you look: which has the smallest error at ?
| Estimator | Mean | Bias | Variance | MSE | |
|---|---|---|---|---|---|
| 5 | Monte Carlo | 0.832 | 0 | 0.0849 | 0.0849 |
| Plug-in | 0.608 | -0.224 | 0.0926 | 0.1428 | |
| Miller-Madow | 0.721 | -0.111 | 0.1321 | 0.1446 | |
| 10 | Monte Carlo | 0.832 | 0 | 0.0424 | 0.0424 |
| Plug-in | 0.718 | -0.114 | 0.0509 | 0.0639 | |
| Miller-Madow | 0.796 | -0.0365 | 0.0615 | 0.0629 | |
| 30 | Monte Carlo | 0.832 | 0 | 0.0141 | 0.0141 |
| Plug-in | 0.797 | -0.0356 | 0.0157 | 0.0169 | |
| Miller-Madow | 0.829 | -0.0032 | 0.0161 | 0.0161 | |
| 100 | Monte Carlo | 0.832 | 0 | 0.0042 | 0.0042 |
| Plug-in | 0.822 | -0.0101 | 0.0044 | 0.0045 | |
| Miller-Madow | 0.832 | -0.0001 | 0.0044 | 0.0044 |
Estimating the entropy of a large vocabulary from few samples is where this bias bites (Paninski 2003).
In ML: when a paper calls a new estimator (of a gradient, a mutual information, a KL, a policy value) "unbiased" or "lower variance", compare MSE at your sample size; REINFORCE against the reparameterised gradient (Probability for ML, section 11), policy-gradient baselines and importance-sampling corrections are all this trade.
The bias correction removes bias but adds variance: at it loses
Each bar is one estimator's MSE, split into bias² and variance; each panel has its own scale. Exact: every possible set of counts, weighted by its multinomial probability. exact The plug-in is always biased low (a small sample looks more predictable than the population; at its bias is , close to the first-order for words). Miller-Madow removes most of the bias, yet at its MSE (0.1446) is slightly worse than the plug-in's (0.1428). By all three agree to 0.01: all are consistent.
Probability for ML (section 7) derives the maximum-likelihood estimate (the parameters that make the observed data most probable) and shows that minimising cross-entropy is exactly that. The statistician's questions are different: how good is the MLE as an estimator, and where does its error bar come from?
A worked example. Sample 30 words from the tiny model and get 22 cat, 5 dog, 3 sat. The MLE of the probabilities is the frequencies, , against the truth . The MLE of any function of the parameters is that function of the MLE (invariance), so the MLE of the entropy is the plug-in estimate of section 1, 0.756 here. That is why the plug-in is biased low: the MLE is consistent and, for large , as precise as any unbiased estimator can be, but it is not unbiased.
The error bar is the curvature. For large the MLE is approximately normal around the truth,
where is the log-likelihood of the whole sample and is the Fisher information of one observation (equivalently the variance of the score, the slope of the log-likelihood). A sharply curved log-likelihood pins the parameter down; a flat one does not. For a coin with 9 heads in 10, , , the curvature at is , so the standard error is . exact
Efficiency. No unbiased estimator can beat the Cramér-Rao bound . For a coin , so the bound is : exactly the variance of the observed fraction of heads, which is therefore efficient. The MLE reaches the bound as (Wasserman, All of Statistics, chapter 9). For the 30-word sample the standard error of is .
The Fisher information is also the curvature the root page reads three ways ("same object in different hats").
A sharper peak is a smaller error bar, and at small the peak is not a parabola
The solid curve is the log-likelihood minus its maximum; the dashed parabola is the normal approximation with the same curvature, whose 95% interval is the bracket. Predict, then switch: does the parabola fit better or worse as grows? At 9 of 10 the parabola is symmetric while the curve is not, and its interval (0.714, 1.086) runs past 1, an impossible heads probability. At 90 of 100 (SE 0.030) and 900 of 1,000 (SE 0.0095) the two agree: this is the asymptotic normality above, visible. Near a boundary at small , use Wilson or Bayes intervals instead (section 1 of Eval statistics).
The sample mean is unbiased for (linearity of expectation) with variance (variances of independent draws add, then dividing by divides the variance by ), so its standard error is . The spread is harder: the average squared distance from is too small, because was fitted to these very points.
Estimating the mean from the same data uses up one of the pieces of information: the deviations add to zero, so only are free (the degrees of freedom). Dividing by (Bessel's correction) pays it back. For the eight numbers: divide-by- variance (the MLE), divide-by- , so . On the tiny model (population variance 0.424) the divide-by- variance at averages , a 20% underestimate. exact
First fine point: itself is still biased low for , because the square root is concave (Jensen's inequality); for normal data with , . Nobody corrects this in practice; the t-distribution of section 5 absorbs it. Second: unbiased is not best in MSE; for normal data dividing by gives the smallest MSE of all divisors (a standard exercise; the shrinkage of section 1 again).
What the libraries do, a classic port bug: NumPy's np.var divides by unless you pass ddof=1; PyTorch's torch.var defaults to correction=1 ("Defaults to Bessel's correction", v2.14.1 source); pandas' .var() divides by . BatchNorm uses both. Pass ddof or correction explicitly.
BatchNorm: "At train time in the forward pass, the standard-deviation is calculated via the biased estimator, equivalent to torch.var(input, correction=0). However, the value stored in the moving average of the standard-deviation is calculated via the unbiased estimator" (PyTorch v2.14.1, torch/nn/modules/batchnorm.py, saved in src/inputs/). Adam's bias correction of its second-moment estimate is the same family of idea (a running estimate corrected for how it was started; Optimisers and learning-rate schedulers).
The fitted mean is the centre that makes the squared deviations smallest, so they understate the spread
For the eight numbers (the same as Probability for ML, section 7), the sum of squared deviations from a centre is . It bottoms out at ; any other centre, including the unknown true mean, gives more. On average the shortfall is exactly one .
Skew slows the bell; infinite variance stops it
Bars: the distribution of the sample mean over 20,000 simulated samples per setting simulated; line: the normal curve the CLT predicts; green: the true mean. The four numbers under it are for the shown.
Probability for ML (section 4) states and simulates the two theorems: the law of large numbers (an average of i.i.d. draws converges to ) and the central limit theorem (for finite variance the average is close to whatever the shape of one draw, so four times the samples halve the error). This section keeps what a statistician needs from them: the numbers that set error bars, and where the bell fails. An accuracy is a mean of 0/1 scores; at accuracy 0.5 one score has , so the standard error is on 500 examples and on 2,000. On the tiny model an average of 30 losses has standard error and a 95% half-width of , although one draw is skewed (skewness 1.26: a long right tail from the rare "sat"). exact
Fig. 4 steps from 1 to 1,000 for four populations. Predict first: by , which of them look like a bell? The tiny model's three spikes blur into one by , the lognormal stays lopsided much longer, and the Pareto never settles.
Two things slow the approach: skew (the skewness of a mean is that of one draw divided by , so a lognormal's 6.18 needs in the hundreds to fade) and heavy tails. With infinite variance the theorem does not apply: averages of a Pareto with tail index 1.5 never settle into a bell and their spread shrinks more slowly than . For skewed means use the t multiplier (section 5), the BCa bootstrap (section 6) or a transform; when the variance may be infinite (losses on rare tokens, heavy-tailed rewards, latencies) report medians, quantiles or trimmed means rather than a mean with a normal error bar. The same law sets the noise of a minibatch gradient (Calculus and optimisation for ML, section 10) and of Monte Carlo estimates (Probability for ML, section 4).
With finite variance the LLN is one line: has variance , so by Chebyshev (section 12) . Formally the CLT says converges in distribution to : the probability of landing in any interval approaches the normal one, and 95% of lies within .
The largest gap between the distribution function of the standardised mean and the normal one is at most , with and (Shevtsova 2011, arXiv 1111.6554). When 0/1 scores are few (an AIME paper has 15 items) the normal approximation fails near 0% and 100%; exact coverage of Wald, Wilson, Clopper-Pearson and Bayes intervals is in section 1 of Eval statistics.
The promise is about the procedure: skewed small samples break it, all on one side
Each row is one experiment: draws, their mean (dot) and 95% interval (line); the vertical line is the truth; grey intervals catch it, orange ones miss. simulated, seeded; long-run rates from 5,000 repetitions (every combination is in the CI and test lab).
Turn the CLT around: if is within 1.96 standard errors of in 95% of samples, then contains in 95% of samples. We do not know , so we plug in and pay with a wider multiplier, the 97.5% point of Student's t-distribution with degrees of freedom, which has heavier tails than the normal and approaches 1.96 as grows (exact for normal data; Gosset, writing as "Student", Biometrika 1908):
For the eight numbers of section 3: SE , , interval . For an accuracy near 0.5 on 500 questions: SE 0.022, half-width 0.044 with 1.96 and 0.045 with "2 standard errors"; pick one multiplier and say which. exact
Fig. 5 runs one experiment 100 times, in six stretches, and draws every interval. Pick a population on the figure; the step list follows it.
It means: the procedure catches the true value in 95% of repetitions of the whole experiment.
It does not mean (1) "a 95% probability that is in this interval": is fixed and this interval either contains it or not (that is a Bayesian credible interval, section 10); (2) "95% of the data lie inside": that is a much wider prediction interval; (3) "a repeat will land inside with 95% probability": for a normal mean with known , a replication's mean lands inside the original interval only of the time on average, because both estimates wobble (Cumming and Maillardet 2006, Psychological Methods 11).
Do not compare intervals by overlap. Two equal-width 95% intervals fail to overlap only when the estimates differ by standard errors, but the difference is significant at 5% already at (the difference of independent estimates has standard error times one). Overlap does not mean "not significant", and non-overlap corresponds to (Schenker and Gentleman, The American Statistician 55, 2001). For paired data overlap is even less informative: test the per-example differences (section 8).
Report the interval, the and how it was computed. Intervals for 0/1 eval scores, the variance split between items, samples and judges, and a real comparison worked through every interval are sections 1 and 2 and the Interval lab of Eval statistics.
is for means. What is the error bar on a median, an F1 score, a ratio of losses, a pass@k curve, or the entropy estimate of section 1? The ideal is to draw many fresh samples and watch the statistic vary; we have one sample. Efron's bootstrap (Annals of Statistics 7, 1979) treats the sample as the population: draw points with replacement from your (some twice, some not at all), recompute the statistic, repeat times (a few thousand). The spread of the values estimates the standard error; their percentiles give an interval.
with any recipe computed the same way on the resample, and a star marking a bootstrap quantity. It works because the resample is to the sample what the sample is to the population: if the statistic's wobble depends on the population only through features the sample reproduces well (centre, spread and shape, for smooth statistics), the two wobbles match. Each resample leaves out of the points on average: 36.2% at , tending to .
Truth: 20,000 fresh samples from the population (impossible in practice). Bootstrap: 4,000 resamples of one sample. simulated On the tiny model at they agree: bootstrap spread 0.122 against the true 0.119. On a lognormal at the one sample happened to contain no large value (its is 0.70 against a population of 2.16), so the bootstrap thinks the spread is 0.21 when it is 0.70. The six resamples drawn in Fig. 6 come from src/mk_stage.py (seed 2026); the 4,000 and the 20,000 from src/sims.py.
From resamples to an interval. The percentile interval takes the 2.5th and 97.5th percentiles of the : simple, never leaves the range of possible values, but inherits any bias and narrowness of the bootstrap distribution. BCa (bias-corrected and accelerated; Efron, JASA 82, 1987) shifts those percentiles to correct for median bias and for skew, and its coverage error shrinks like rather than (Efron and Tibshirani, An Introduction to the Bootstrap, 1993, chapters 14 and 22). Over 5,000 repetitions on the lognormal at , coverage is 88.6% (t), 88.3% (percentile) and 89.4% (BCa): BCa helps, but nothing reaches 95% there. simulated
When it struggles. Small : at from a normal population the percentile interval covers only 83.0% (t: 94.9%), because a resample's spread is the divide-by- spread with no t-correction. Heavy symmetric tails: on a t-distribution with 3 degrees of freedom at , BCa covers 86.4% against t's 95.9%, because one outlier swings the jackknife acceleration. Extremes (the maximum) and dependent data (time series, items in clusters) need other schemes: the -out-of- bootstrap, block or cluster resampling.
The paired bootstrap. To compare models A and B scored on the same examples, resample examples, keeping each example's pair of scores together, and compute A minus B on each resample. The spread of those differences is the uncertainty of the delta, and the fraction of resamples in which A wins says how often the ordering survives. Keeping the pair together keeps each example's shared difficulty in both columns, so it cancels. It is the robust default for LLM evals with a few hundred to a few thousand examples (Koehn 2004 popularised it for machine translation); the paired and cluster bootstrap on real model comparisons are sections 4 and 5 of Eval statistics. Bagging (train on resamples and average: variance reduction; ensembles are on Regularisation, section 1) and the out-of-bag error of random forests (the 36.8% left out are a free validation set) are the same resampling.
The intervals. On the sample above (22 cat, 5 dog, 3 sat; mean 0.775; truth 0.832): t-interval (0.525, 1.024), percentile (0.541, 1.041), BCa (0.575, 1.108), shifted right because the population's tail is to the right. Lognormal, (truth 1.649): t (0.668, 1.665) just catches it, percentile (0.792, 1.598) misses, BCa (0.848, 1.756) catches it. simulated
BCa uses shifted percentiles instead of 2.5% and 97.5%:
and the same with . measures the median bias of the bootstrap distribution (0 if half the resamples fall below ); is the statistic with point left out (the jackknife) and their average; , the acceleration, measures how the standard error changes with the parameter, which is what skew does.
Bias. The bootstrap estimates bias as the average of minus . On the tiny-model sample the plug-in entropy is 0.756; the resamples average 0.718, so the estimated bias is (the exact bias at is , section 1), and the corrected estimate is .
Counting. There are distinct resamples (10 at ; about at ), so we sample them rather than list them.
A coin lands heads 9 times in 10. Biased, or a fair coin that got lucky? Every "B beats A" is the same question. A test is a proof by near-contradiction: state a null hypothesis (no effect: the coin is fair), choose a test statistic that grows with evidence against it (heads far from 5), work out its distribution if were true, and ask how surprising the observed value is. The p-value is the probability, under , of a result at least as extreme as the one observed.
Reject when , the significance level (conventionally 0.05). Two mistakes are possible: a Type I error (false positive; rate when is true) and a Type II error (false negative; rate when there is a real effect). Power is how often a real effect is found; you set , while power depends on the effect size, the noise and . A two-sided test at level rejects "" exactly when lies outside the confidence interval built from the same statistic, which is why the CI and test lab computes power from intervals.
The p-value is the tail mass of the null distribution beyond what you saw
Heads in 10 flips of a fair coin, exact. ; counting the equally extreme "at most 1 head" too gives the two-sided . exact
Power and sample size. For a two-sided z-test of a mean shift with noise , power needs
A/B tests. An online A/B test is this test on two proportions with each user randomised to one arm. To detect a lift from a 10% to an 11% conversion rate at with 80% power, each arm needs
so 14,749 users per arm; a half-point lift needs 57,760. exact (derived from the formula; sample sizes are rounded up). Small lifts on low base rates are expensive. Running them in production: Production eval engineering; as explore-then-commit: Bandits and exploration; for evals, with a calculator: section 7 of Eval statistics.Peeking breaks the test. Testing as the data arrive and stopping at the first "significant" result makes each look another test. Our simulation: 200,000 runs with no real effect, up to 100 observations, a z-test at 5% after every -th observation, stopping at the first rejection. simulated
Ten looks almost quadruple the nominal 5% (19.4%); checking after every observation gives 37.6%. Armitage, McPherson and Rowe (JRSS A 132, 1969) worked this out for repeated significance tests (their tables are not re-fetched here). Fixes: decide in advance; use a sequential design whose boundaries spend across looks (Pocock, O'Brien-Fleming); or use always-valid sequential tests. A dashboard with a live p-value invites exactly this mistake.
The American Statistical Association's 2016 statement (Wasserstein and Lazar, The American Statistician 70; principles quoted from the ASA's release, saved in src/inputs/) lists six principles; three are about misreadings: "2. P-values do not measure the probability that the studied hypothesis is true, or the probability that the data were produced by random chance alone." "5. A p-value, or statistical significance, does not measure the size of an effect or the importance of a result." "6. By itself, a p-value does not provide a good measure of evidence regarding a model or hypothesis."
So is not "a 2.1% chance the coin is fair" (that needs a prior; section 10 computes 9.7% under even prior odds), and is not the probability the effect is real. A large is not evidence of no effect: a test with low power usually fails to reject a real effect (30 observations find a half-standard-deviation shift only 78% of the time), so report the interval, which shows which effects the data rule out. A tiny on a huge eval can come from a trivial effect.
Power is the part of the "real effect" curve beyond the rejection line
The test statistic under "no effect" (grey) and under a real shift of half a standard deviation (blue), two-sided. Predict how large must be for 80% power, then drag. With and , , so 32 observations (power 80.7%); with 30 the power is 78.2%, with 10 it is 35.3%. Halving the effect quadruples . exact
The t-test divides a distance by its standard error, , compared with Student's . The paired t-test is the same test on per-example differences with ; for two independent groups, Welch's t-test uses , which does not assume equal variances. Why pairing matters: when two models are scored on the same examples, most of the variation in a score is which examples are easy, which both models share; per-example differences cancel it, while comparing two separate averages carries it twice.
McNemar's test (McNemar 1947) is the paired test for right/wrong scores. Only the discordant examples count:
Here , : no evidence. The paired standard error of the difference is , a 95% interval of (about points); treated as independent, with accuracies near 0.5, it would be , about points. Pairing halves the error bar but still cannot rescue a 1-point claim. With , (a 3-point lead), , . exact
Some texts subtract 1 from before squaring, slightly more conservative: 4.36 and for the 3-point lead. With few discordant examples use the exact version: under , , which gives .
Only the examples where the models disagree carry evidence
| B right | B wrong | |
|---|---|---|
| A right | both right: drops out | = 30 |
| A wrong | = 25 | both wrong: drops out |
500 examples; A leads by point. Under each discordant example is equally likely to fall either way, and is compared with a chi-squared distribution with one degree of freedom (5% critical value 3.84).
Permutation tests need no distribution, only a symmetry of the null (R. A. Fisher, The Design of Experiments, 1935): if A and B are equally good, each per-example difference was as likely to be as . Flip the signs every possible way, recompute the mean, and count how often it is as extreme as observed.
Rank tests (Wilcoxon's signed-rank for pairs, Mann-Whitney for two groups) are the classic robust choice for ordinal or heavy-tailed scores; they test a shift in location rather than the mean. For training runs across seeds, Welch's test with few seeds works, more seeds work better; Dietterich (1998, Neural Computation 10) compares the tests for comparing learning algorithms. Which test fits which eval, with one real comparison run through all of them, is section 5 of Eval statistics; its section 4 measures how much pairing shrinks the interval on real models.
An exact p-value by flipping signs: 16 of 256 patterns are as extreme
Eight per-example loss improvements illustrative, mean 0.1525. The dots are the means of all sign patterns; the orange ones are at least as far from zero as observed, so , exact at any . The paired t-test on the same numbers gives , : close, but it leaned on normality that eight numbers cannot confirm. With large , sample a few thousand random sign patterns.
You try 20 prompt variants and one beats the baseline with . Each test at has a 5% false-positive rate when nothing is going on, so 20 independent tests on true nulls produce at least one "significant" result with probability , the family-wise error rate (FWER).
The hidden comparisons count too: every prompt, seed, checkpoint, metric, subset and preprocessing choice tried and dropped (Gelman and Loken's "garden of forking paths", 2013). Simmons, Nelson and Simonsohn (Psychological Science 22, 2011) showed by simulation that four common flexible choices together push a nominal 5% false-positive rate to about 61%. The best of a sweep (the best of 50 runs) is also optimistically biased as an estimate of its own performance. The cleanest fix is a held-out confirmation run on new data, decided in advance, or a pre-registered analysis. The same problem appears in evaluating many benchmarks or slices, per-feature or per-neuron tests in interpretability, and release gates that check many metrics (section 6 of Eval statistics).
Same ten p-values, three rules: 7, 1 and 4 discoveries
Ten sorted p-values illustrative: 0.001, 0.008, 0.012, 0.019, 0.030, 0.041, 0.045, 0.21, 0.50, 0.80. Uncorrected at 0.05: 7 rejections. Bonferroni (each below 0.005): 1. Holm: 0.001 0.05/10, then 0.008 0.05/9 = 0.0056, stop: 1. Benjamini-Hochberg at 5%: thresholds are 0.005, 0.010, 0.015, 0.020, ...; the first four are under theirs (0.019 0.020) and none after, so 4 rejections, of which on average at most 5% are false. exact
What most people want to say is "a 95% probability the true accuracy is in this range" or "B is better with probability 0.9". That needs the unknown to be a random variable with a prior, updated by Bayes' rule into a posterior (Probability for ML, section 9, derives the coin case). A 95% credible interval holds 95% of the posterior probability: the statement a confidence interval is often misread as making, now true by construction, at the price of choosing a prior.
A prior is conjugate to a likelihood when the posterior has the same form, so updating is arithmetic. For a heads probability with a Beta prior and heads in flips,
so the prior acts like heads and tails seen before the data (Gamma for Poisson rates and normal for normal means are the other common pairs).
Bayes factors compare two hypotheses by how well each predicted the data, , each likelihood averaged over that hypothesis's prior. Fair coin: ; any bias, uniform: . So , and with even prior odds the posterior probability of a fair coin is : about 10%, not the 2.1% a misread p-value suggests. Kass and Raftery (JASA 90, 1995) call factors from 3 to 20 "positive" evidence. exact
Credible intervals from weak priors match confidence intervals closely once is large; they differ, usefully, when is small or the parameter is near a boundary (accuracy near 0% or 100%). In ML: small evals of tens of items, A/B tests reported as "probability B beats A", Thompson sampling (Bandits and exploration) and Bayesian optimisation of hyperparameters. Beta-Bernoulli intervals for small evals and their exact coverage are in section 1 of Eval statistics.
Bayes factors depend strongly on the prior under (a very wide prior spreads its bets and predicts the data poorly), and with huge a tiny p-value can come with a Bayes factor favouring (Lindley's paradox, 1957).
With 10 flips the prior still moves the answer; the data pull every prior towards 0.9
Dashed: the prior; solid: the posterior after 9 heads in 10; shaded: its 95% equal-tailed credible interval. exact Uniform: Beta(10, 2), mean , interval (0.587, 0.977), . Sceptical Beta(5, 5), as if 5 heads and 5 tails were already seen: Beta(14, 6), mean 0.700, interval (0.488, 0.874), . Jeffreys: Beta(9.5, 1.5), mean 0.864, interval (0.619, 0.989).
Fit with Gaussian noise . The log-likelihood is plus a constant, so least squares is the MLE. Because the fitted weights are a linear function of the noisy , their sampling distribution is exact for Gaussian noise:
with and because two parameters were fitted (the degrees-of-freedom idea of section 3 again). Worked example illustrative: the eight numbers of section 3 as against . , , slope , intercept 1.357, residual sum of squares 4.476, , . The t-test of "no slope" gives on 6 degrees of freedom (), and the 95% interval is .
Ridge is a Gaussian prior. Give the slope a prior ; the MAP estimate minimises with (the MAP derivation is Probability for ML, section 9). With centred and the intercept left unpenalised, the slope becomes .
This is the shrinkage of section 1 in a model: the penalty adds bias and removes variance, and is chosen by cross-validation (section 14) or, in the Bayesian reading, by the prior. Weight decay, dropout and early stopping as variance control are on Regularisation; linear and logistic regression in practice are on Classical ML.
A stronger prior pulls the slope towards zero: bias bought for variance
Dots: the eight points; dashed: least squares; solid: ridge. The equivalent prior standard deviation is , taking as the noise level. : slope 0.7907 (); : 0.6538 (); : 0.4048, exactly half, with , the size of the slope's own standard error. exact
The CLT is a statement about the limit. A concentration inequality bounds the chance that an average lands far from its mean at every , with no "approximately". Three, each built on the previous: Markov, for , ; Chebyshev, (and for a mean of draws); Hoeffding (JASA 58, 1963, Theorem 2), for the mean of i.i.d. variables in ,
An accuracy on 500 examples: the chance of being off by 5 points or more is at most by Hoeffding and by Chebyshev; the CLT approximation says 0.025 and the exact binomial answer at accuracy 0.5 is 0.028. Pushing Hoeffding below 0.05 needs , so 738 examples. exact
In ML these give worst-case eval sizes, generalisation bounds, and the confidence bonuses of bandits (UCB adds a Hoeffding-shaped bonus; Bandits and exploration), which must decide from finitely many samples which option is best, as RLHF data selection must.
Tiny model: Markov says ; the truth is 0.090. Chebyshev bounds the chance of landing two standard deviations (1.302) from the mean by 0.25; the truth is again 0.090 (only "sat" is that far). How loose a bound is depends on how much it assumes.
Generalisation bounds: the same inequality, plus a union bound. For one model fixed in advance and a test set of examples with 0/1 loss, with probability at least , . If you pick the best of models on the same data, each must be covered at once: becomes and the gap (Shalev-Shwartz and Ben-David, Understanding Machine Learning, 2014, chapter 4). With and : 0.0136 for one model, 0.0296 for the best of a million. Selecting on the test set costs you, but only logarithmically. For a training set and an infinite family, is replaced by a capacity measure (VC dimension, Rademacher complexity). For deep networks these bounds are vacuous (larger than 1): Zhang et al. (ICLR 2017, arXiv 1611.03530) showed that standard image networks fit random labels perfectly, so any bound that depends only on the family's capacity cannot explain why they generalise on real labels. PAC-Bayes bounds, which depend on how far the trained weights moved from a prior and how flat the minimum is, gave the first non-vacuous numbers for such networks (Dziugaite and Roy, UAI 2017, arXiv 1703.11008).
High dimensions concentrate hard. The squared norm of a random Gaussian vector in dimensions is close to (its length close to ), and the cosine similarity of two independent random vectors has standard deviation about (0.031 at ). Random vectors are nearly orthogonal and nearly equal-length, which is why random projections, hashing and random-feature models work, and part of the geometry of embeddings.
A guarantee costs you: the bounds sit far above the exact tail
The probability that an accuracy of 0.5 measured on examples is off by at least 5 points: exact binomial, the CLT approximation, and the two bounds. Hoeffding assumes the worst variance a bounded variable can have, which is why it is loose; it is still a guarantee.
A trained model is an estimator too, so section 1's split applies to its predictions; how that split guides model choice (the U-shaped trade-off, ensembles against boosting, double descent decomposed into bias² and variance with Belkin, Hsu and Xu's exact formula, and why a little ridge removes the peak) is owned by Regularisation, sections 1 and 8.
-fold cross-validation: split the data into folds; for each fold, train on the other and record the loss on the held-out fold; average all held-out losses. Every example is tested once by a model that did not see it (leave-one-out: ). It is how models and hyperparameters are chosen on small data, and how out-of-fold predictions for stacking are made.
It does not estimate what you think. Bates, Hastie and Tibshirani (JASA 2023, arXiv 2104.00673) show that cross-validation "estimates the average prediction error of models fit on other unseen training sets drawn from the same population", not the error of the model fitted on your data, and that naive intervals "may have coverage far below the desired level"; they propose nested cross-validation to estimate the variance. Our run simulated: linear regression with 20 Gaussian features, , noise variance 1, 10-fold CV on 4,000 independent datasets. The naive 95% interval covered the error of the model actually fitted on that dataset in only 85.8% of runs, and the average error over training sets (1.253, exact for this design) in 89.5%. The CV estimate's real standard deviation across datasets was 0.214, against an average naive standard error of 0.179, and it was essentially uncorrelated with the error of the model it was meant to assess (correlation ): exactly Bates et al.'s point. CV tells you how well this recipe (family, hyperparameters, training procedure) does on data like yours, not how good this fitted model is.
Selection inside CV. Choosing hyperparameters by CV and reporting the same CV score is optimistic (the best of many noisy numbers, section 9): use nested CV (an inner loop to choose, an outer loop to score) or a final untouched test set. Preprocessing fitted on all the data (scaling, feature selection) must also go inside the loop, or the held-out folds leak (Classical ML).
Any two fold models share most of their training data, so their errors are correlated
10-fold CV: each row is one model, the orange cell its held-out fold. Rows 1 and 2 share 8 of their 9 training folds, so their held-out errors move together, and the naive standard error of the held-out losses is too small. Bengio and Grandvalet (JMLR 5, 2004) prove "there exists no universal (valid under all distributions) unbiased estimator of the variance of K-fold cross-validation".
| Symbol | Read as | Meaning |
|---|---|---|
| , | theta hat | an estimate of from data (of size ) |
| , | x bar, s squared | sample mean; sample variance with |
| , | standard error | standard deviation of an estimate; its estimate |
| normal | the second argument is a variance, not a standard deviation | |
| , | quantiles | the point below which a fraction of the normal (or t with degrees of freedom) lies; |
| , | Phi | the standard normal CDF and its inverse |
| , | converges in probability, in distribution | LLN-type and CLT-type limits |
| big O in probability | "of order with high probability": the size of the estimation error | |
| , , , | null, alternative, false-positive rate, false-negative rate (power ) | |
| , | x star | a bootstrap resample, a bootstrap replicate |
| theta hat, i left out | the jackknife: the estimate without observation | |
| expectation over datasets | the average over training sets in bias-variance statements |
Choose a population, a sample size and interval methods. Every number is from 5,000 simulated experiments per setting, each with its own sample, its own intervals and (for the two bootstrap methods) 999 resamples simulated (seeded; src/sims.py). Monte Carlo error is about points on a coverage near 95% (two standard errors of a proportion over 5,000 runs). The four methods are those of the Reading tab: z (1.96 with ), t (Student's multiplier), percentile bootstrap and BCa bootstrap (sections 5 and 6).
At h = 0 the "power" is the false-positive rate, 1 minus coverage (should be 5%). Shifts are in units of the population's standard deviation; the test is "reject if it lies outside the interval", the duality of section 7.
Reading times for knowledge base pages are the page's own stated time where it gives one, otherwise estimated at about 230 words a minute. Times for outside resources are for the part recommended, checked on 5 October 2026. Every link opens in a new tab.
Coverage, one-sided misses, width and power curves of z, t, percentile and BCa intervals for six populations and seven sample sizes, 5,000 simulated experiments each.
Which maths each part of ML uses and the tiny model's training step; its last step, "Was it real?", is this page in one line (standard error, 95% interval, paired comparison). Its tabs: Notation decoder, Gradient lab. 16 min, plus 6 in closed details.
Random variables, expectation and variance, the distributions, MLE, MAP, full Bayesian inference and Monte Carlo: everything this page builds on. 32 min, plus 16 in closed details.
Entropy, cross-entropy, KL and mutual information; section 1's plug-in entropy estimator is their estimation problem. 38 min, plus 8 in closed details.
Singular values, rank and conditioning: why a nearly singular matrix amplifies noise, the cause of the double-descent peak. 45 min, plus 13 in closed details.
Derivatives, convexity, Hessians and Newton's method; minibatch gradients as estimators. 32 min, plus 11 in closed details.
Jacobians, layouts, vector-Jacobian products and autodiff. 32 min, plus 22 in closed details.
Floating point and stable formulas, including the one-pass variance that cancels catastrophically. 40 min, plus 9 in closed details.
The ELBO, VAEs and diffusion: estimators of intractable expectations, and their variance. 23 min, plus 18 in closed details.
This page's sections 4 to 9 applied to evals with real measurements: Wilson and Bayes intervals, variance components, clustered errors, paired tests on real models, power and a sample-size calculator. About 23 min.
Gates, golden sets, shadow and A/B tests: where peeking and many-metric gates bite. 30 min, plus 7 in closed details.
Owns bias and variance for model choice and double descent: the decomposition, ensembles against boosting, double descent on real digits and in weak-features regression decomposed into bias² and variance, and L2 removing the peak; the double-descent papers are listed there. 27 min, plus 8 in closed details.
Cross-validation in practice, leakage through preprocessing, bagging and boosting. 29 min, plus 8 in closed details.
Hoeffding-style confidence bonuses (UCB) and Thompson sampling: concentration and Bayes used to decide, not just to report. About 27 min.
The metrics whose error bars the bootstrap computes. 27 min, plus 7 in closed details.
The fastest serious route through estimation and testing; the reference for MLE properties and hypothesis testing. Chapters 4 (inequalities), 5 (convergence: LLN, CLT), 6 to 9 (estimation, the bootstrap, parametric inference), 10 (tests and p-values, including Bonferroni and Benjamini-Hochberg), 11 (Bayesian inference). About 4 h for the estimation and testing chapters.
Chapters 10 and 11: the jackknife, the bootstrap and bootstrap confidence intervals including BCa, by the bootstrap's inventor; chapter 15 on large-scale testing and false discovery rates. About 3 h.
Chapter 7 (model assessment: bias-variance, cross-validation, the bootstrap) and chapter 15 (random forests, eq. 15.1 for the variance of an average). About 2 h.
Chapters 2 to 6: PAC learning, the finite-class bound of section 12, uniform convergence, VC dimension. About 3 h.
Chapters 12 to 14 and 22: bootstrap intervals, BCa and why it is second-order accurate. About 2 h.
What CV estimates, why naive intervals undercover, nested CV. 45 min.
The impossibility result of section 14. 30 min.
The six principles quoted in section 7. 15 min.
The FDR procedure of section 9. 25 min.
BCa, with the acceleration constant. 40 min.
Networks fit random labels: why capacity-only bounds are vacuous. 25 min.
The first non-vacuous PAC-Bayes numbers. 40 min.
This page's tools written for LLM evals: CLT intervals, clustering, pairing, power. 30 min.