Statistical inference
Sample means have their own distribution; the standard error and the confidence interval are how we say how wrong a sample might be.
You measure the average latency of a new API on 500 requests and get 214 ms. Should you announce that the API is faster than the old one at 220 ms? The sample mean is a single number, but it is not the truth — a different 500 requests would have given a different number. Inference is the machinery for saying how much a sample can wobble, so that a comparison can be made with the wobble in view.
The central object is the sampling distribution: the distribution of a statistic (like the mean) over all the samples you might have drawn. You never see it directly, because you only get one sample, but its width is what controls every confidence interval and p-value you will ever report.
One sample, many possibilities
Imagine repeating the experiment a thousand times. Each repeat gives its own mean. Those means scatter around the true mean, and their scatter is the standard error. A confidence interval is just a compact way of reporting that scatter; a p-value is a way of asking how surprising the observed scatter would be if there were no effect at all.
Draw many samples — the histogram of their means tightens as n grows, at a rate of 1/√n
sampling distribution of the mean · 800 samples of size 12 · curve is the CLT normal
Population
- population mean
- 28.081
- population σ
- 18.079
- σ/√n
- 5.219
- observed SE
- 5.175
The observed standard error tracks σ/√n to within sampling noise, and the histogram is normal even when the exponential population is strongly skewed. The picture is illustrative and the population is synthetic, but the arithmetic of the standard error is exactly what a confidence interval is built from.
The standard error and the central limit theorem
If observations are independent with population mean and standard deviation , the sample mean of draws has
The is the whole story of why more data helps and why it helps slowly: to halve the error bar you need four times the data. The central limit theorem adds that, for large , the sampling distribution is approximately normal regardless of the shape of the population — which is why the ubiquitous interval works even for skewed inputs, as the exponential population in the artifact shows.
With unknown we substitute the sample standard deviation and use the -distribution with degrees of freedom:
p-values, said carefully
A p-value is the probability, assuming the null hypothesis is true, of observing a test statistic at least as extreme as the one you saw:
It is not the probability that is true, and it is not the probability that your result will replicate. A small means the data are surprising under ; it does not by itself tell you the effect matters. Always report the effect size and its interval, not just the verdict.
Careful
Testing many hypotheses inflates false positives: at , twenty independent null tests are expected to produce about one "significant" result by chance. If you slice a dataset into subgroups until something lights up, you have not made a discovery — you have run a multiple-comparisons machine. Correct for it (Bonferroni, Benjamini-Hochberg) or pre-register the comparison.
When theory is not available: the bootstrap
For statistics with no clean formula — a median, a ratio, an — resample the data with replacement many times, recompute the statistic each time, and read the spread of the resampled values. The bootstrap turns the sampling distribution from a theoretical object into a computational one, at the cost of assuming your sample is representative enough to stand in for the population.
Illustrative vs real
The artifact draws from a synthetic population so the sampling distribution is visible, and the "population σ" is estimated from a 20,000-point pilot, which real studies never have. The formulas — , the normal approximation, the bootstrap — are exact procedures; the comfort they give still depends on independent, unbiased sampling, which is the assumption most often violated in practice.
Check yourself
Eduspheria wiki · Data, MLOps & Deployment, Data science foundations
0 / 5 answered
From the exam paper
Modeled on NITJ AI-505, End-Sem December 2024
0 / 4 answered
Where next: feature generation — where domain knowledge and transformations turn raw columns into signal.