Mathematical foundations
Confidence Intervals, Hypothesis Tests, and Bootstrap
Distinguish confidence, credible, and prediction intervals; interpret p-values; control multiplicity; and resample data at the correct dependency level.
By the end you can
- Interpret frequentist confidence coverage and Bayesian credible probability correctly
- Explain null-model testing and common p-value misinterpretations
- Recognize optional stopping and multiple-comparison risks
- Choose bootstrap units that preserve the sampling dependence
Example
An A/B test with repeated peeking, and the 1969 paper that priced it
A product team checks a conversion experiment every hour and stops when p < 0.05. That habit has a price, and the price was worked out numerically long before online experimentation existed. In 1969 Armitage and colleagues published the calculation in the Journal of the Royal Statistical Society, with numerical results for binomial, normal and exponential series. Their abstract states the mechanism without hedging: “If significance tests at a fixed level are repeated at stages during the accumulation of data the probability of obtaining a significant result when the null hypothesis is true rises above the nominal significance level.”
Fifty years later the same result is a regulatory requirement rather than a curiosity.
- Nominal rule: A fixed-horizon p-value controls Type I error under its planned design, and only under that design. The horizon is part of the procedure, not an administrative detail.
- Repeated looks: Optional stopping increases the chance of eventually crossing the threshold. That is the inflation Armitage and colleagues tabulated in 1969 for binomial, normal and exponential series. The hourly dashboard did not discover a new problem. It industrialised an old one.
- Repair: Use a sequential design, an alpha-spending rule, or a predeclared stopping policy. The FDA's November 2019 guidance on adaptive designs puts the requirement in its own words: “Performing each of the multiple statistical hypothesis tests for efficacy in a group sequential trial at the conventional .025 one-sided significance level would inflate the Type I error probability and, therefore, increase the chance of erroneous conclusions.” The remedies it names are prespecified stopping boundaries — O'Brien–Fleming, Pocock — or the Lan–DeMets alpha-spending function.
- Effect size: Report the estimated lift and its interval, not only significance. A boundary crossed at hour nine says the monitoring rule fired. It does not say how large the lift is.
- Decision: Include business value, guardrails, and heterogeneous effects. The stopping rule governs the error rate. The decision still needs magnitude and cost.
Uncertainty statements require a procedure, not just an error bar
An interval or a p-value is defined by a procedure — repeated sampling, or a posterior. Its meaning cannot be recovered from the endpoints alone. Confidence intervals, credible intervals, prediction intervals, hypothesis tests and bootstrap intervals answer different questions. Each depends on a model for sampling, dependence, or prior information.
How far the endpoints alone mislead has been measured, not merely suspected. In 2018 Lyu and colleagues put p-value and confidence-interval items to 362 Chinese psychology researchers and students. Ninety-nine per cent got at least one p-value item wrong. Ninety-three per cent got at least one confidence-interval item wrong. Those figures are not a verdict on the participants. They measure how little a pair of endpoints carries once it has been separated from the procedure that produced it.
A responsible analysis states the procedure, the assumptions, the target and the decision rule together.
An interval without its construction and target is incomplete evidence.
Analogy
Enough casts in the same pond will produce an impressive catch
Many nets are cast, and only the catch that looks unusually large is reported. Even if each individual test has a low false-alarm rate, repeated opportunities increase the chance of an impressive accident. A predeclared testing plan controls how many casts count and when the experiment stops.
The growth rate is not a matter of impression. The FDA's October 2022 final guidance on multiple endpoints does the arithmetic, for endpoints each tested at two-sided α = 0.05: “For example, for three independent endpoints, the Type I error rate is 1 - (0.975 * 0.975 * 0.975), which is about 7%. For ten independent endpoints, the Type I error rate is about 22%.” Three casts, seven per cent. Ten casts, twenty-two. A dashboard that tracks ten metrics and reports whichever moved is running the second of those experiments and describing the first.
How many casts were made is part of the evidence. A report that leaves the number out has left out the multiplicity with it.
More opportunities to declare success require stronger error control.
Bootstrap the sampling mechanism you actually have
The nonparametric bootstrap resamples observed units with replacement to approximate an estimator's sampling distribution. It works when the empirical distribution is a reasonable stand-in for the data-generating process. Dependent data need a different resampling unit, or a block, cluster, or time-series bootstrap. Resampling individual rows from repeated users breaks the dependence structure.
The method got its name in 1979, in a paper by Bradley Efron in The Annals of Statistics that took another look at the jackknife. It won him the 2018 International Prize in Statistics, an $80,000 award. The Royal Statistical Society's announcement records the method's spread as a count rather than an adjective: “It has been referenced in more than 200,000 peer-reviewed journal articles since 1980”.
The failure modes are published results too, not cautions written by nervous instructors. Bickel and Freedman proved bootstrap validity in 1981 for t-statistics, empirical and quantile processes and von Mises functionals. The same abstract supplies the other half: “Some counter-examples are also given, to show that the approximation does not always succeed.” A specific broken case arrived in 2010. For the Grenander estimator, a cube-root-n-rate estimator, Sen and colleagues showed that bootstrapping from the empirical distribution function has no weak limit in probability. The same paper gives the repair: the m-out-of-n bootstrap is consistent there. Nonsmooth statistics, boundary parameters, extreme tails and very small samples are the neighbourhood in which that happens.
Comparison
Confidence, credible, and prediction intervals
The words sound similar, but the random objects differ, and the difference is not one that trained readers reliably hold. In 2014 Hoekstra and colleagues put six statements about a 95% confidence interval, ranging from 0.1 to 0.4, to 120 researchers and 442 psychology students. All six statements were false. Their abstract reports what happened: “Although all six statements were false, both researchers and students endorsed, on average, more than three statements, indicating a gross misunderstanding of CIs.” The researchers barely outperformed the students, who had had no training in statistical inference at all. Lyu and colleagues found the same pattern in a separate sample of 362 people in 2018.
The most-endorsed misreading attaches a probability to the parameter given this interval. That is the credible-interval claim, made without a prior, a likelihood, or a posterior. The confidence statement runs the other way: the coverage belongs to the procedure across repeated samples, and the target is fixed. The prediction interval answers a third question entirely, about an outcome not yet observed.
Five hundred and sixty-two people in one study and 362 in another endorsed readings of this kind. Naming which of the three objects an interval describes is part of reporting it, not pedantry about it.
Confidence interval
A repeated-sampling procedure for an unknown fixed target.
- Coverage belongs to the procedure
- Observed target is not random in the frequentist interpretation
- Depends on sampling assumptions
- Can be asymptotic or exact
Credible interval
A posterior probability region for an uncertain parameter.
- Conditional on prior and likelihood
- Probability statement is about the parameter
- Can be equal-tailed or highest-density
- Requires model checking
Prediction interval
A region for a future or unobserved outcome.
- Includes outcome variability
- Usually wider than a parameter interval
- Depends on covariates and horizon
- Can be frequentist or Bayesian
Key idea
A p-value is not the probability that the null is true
The p-value is computed assuming the null model. It measures how extreme the observed statistic would be under that reference. It does not give P(H₀ | data) without a prior and a model comparison framework, and it does not measure effect size, practical value, or replication probability.
Small p-values can come from large samples and tiny effects. Important effects can stay uncertain in small studies. The American Statistical Association's executive director, Wasserstein, put the underlying point in the association's own 2016 release: “The p-value was never intended to be a substitute for scientific reasoning,” A threshold invites that substitution. A reported magnitude does not.
Statistical surprise under a null model is not the same as decision value.
Case
The ASA's 2016 statement, and what its second principle denies
The American Statistical Association said so itself, and it said so on a date. On 7 March 2016 the ASA released its statement on statistical significance and p-values: six principles, issued by the ASA Board of Directors and published in The American Statistician. Nature ran the news the same day under the headline “Statisticians issue warning over misuse of P values”.
The second of the six principles is a denial rather than a caveat: “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.” Both halves of that sentence matter. The first rules out reading p as P(H₀ | data). The second rules out the looser gloss — that a small p-value shows the result was not produced by chance — which is the form the misreading usually takes in a summary written for a non-statistical reader.
A professional body does not issue six principles about a single quantity unless the quantity is being read wrongly at scale. The measurement studies say it is: 99% of the 362 participants in the 2018 Frontiers in Psychology sample got at least one p-value item wrong.
Steps
Design an uncertainty and testing plan
Make inferential choices before inspecting the desired outcome. That sequencing is written into regulation, not left to disposition. The European Medicines Agency's draft guideline on multiplicity issues in clinical trials, released for consultation in December 2016, does one of the sums. Test five independent subgroups, each at a significance level of 2.5% with one-sided directional hypotheses, and the chance of at least one false positive rises to approximately 12%. The conclusion the guideline draws is procedural: “it is therefore necessary that the statistical procedures planned to deal with, or to avoid, multiplicity are fully detailed in the study protocol or in the statistical analysis plan”.
The steps below are that requirement in miniature. The plan is a document written before the data are inspected. Each step names a choice that cannot be made honestly afterwards: the target, the sampling unit, the procedure, the multiplicity budget, the magnitude to be reported, and the assumptions to be stressed.
1. Define the target
Parameter, contrast, future outcome, or operational decision.
2. Define the sampling unit
Preserve grouping, time, and adaptive assignment.
3. Choose the procedure
Interval, test, bootstrap, Bayesian model, or sequential design.
4. Declare multiplicity
Account for metrics, slices, variants, and repeated looks.
5. Report magnitude
Include effect size, uncertainty, and practical thresholds.
6. Stress assumptions
Use simulations, diagnostics, and alternative specifications.
Visual
The logic of a hypothesis test
A test compares an observed statistic with its behavior under a null model. The null model fixes a reference distribution or randomization scheme. The test statistic compresses the data toward the discrepancy of interest. The reference tail identifies outcomes at least as extreme. The p-value is the probability of that tail event under the null model, and nothing more than that — which is what principle 2 of the ASA's 2016 statement spells out.
The decision rule is the step where the other evidence enters: costs, the number of tests run, the monitoring schedule, and prior evidence. The 1969 result and the FDA's 2019 adaptive-designs guidance both act at that last step, not at the p-value itself. The tail probability is computed correctly at each look. It is the rule built on top of the looks that has to absorb them.
- 1
Null model
Defines the reference distribution or randomization scheme.
- 2
Test statistic
Compresses the data toward the discrepancy of interest.
- 3
Reference tail
Identifies outcomes at least as extreme under the null.
- 4
p-value
Probability of that tail event under the null model.
- 5
Decision rule
Combines the p-value with costs, multiplicity, and prior evidence.
Key takeaways
- Confidence, credible, and prediction intervals describe different random objects. Hoekstra and colleagues put six false readings of a 95% confidence interval to 120 researchers and 442 psychology students; both groups endorsed more than three on average.
- A p-value is a tail probability under a null model, not the probability that the null is true. Principle 2 of the ASA's 7 March 2016 statement denies that reading and the looser one about random chance.
- Optional stopping and multiple comparisons require explicit error-control procedures. Armitage and colleagues tabulated the inflation in 1969, and the FDA's November 2019 adaptive-designs guidance requires prespecified boundaries or a Lan–DeMets alpha-spending function.
- Effect magnitude and uncertainty matter independently of statistical significance. Ten independent endpoints at two-sided α = 0.05 carry about a 22% Type I error rate, by the FDA's own arithmetic.
- Bootstrap resampling must reproduce the relevant dependence and sampling unit, and its limits are proved rather than suspected. For the Grenander estimator, the empirical-distribution bootstrap has no weak limit in probability, while the m-out-of-n bootstrap is consistent.
- Every uncertainty statement should name its target, construction, assumptions, and decision context. The EMA guideline requires those procedures to be fully detailed in the protocol or the statistical analysis plan, before the data are seen.