Answers · The mathematics underneath
Why does the average of many random samples get closer to the true value as I take more samples?
In shortBecause the average of independent draws is centred on the true value at every sample size, and its typical distance from that value shrinks like one over the square root of the number of draws.
Each sample average is itself a random number, but the whole cloud of possible averages is pinned to the true value: it is centred there at every sample size, and its typical distance from the truth shrinks like . So the estimate does not creep in from one side. It jitters around the right answer with an amplitude that shrinks to nothing.
Where the square root comes from
Write the estimate as , where each draw has average and spread . Averages add, so the average of the estimate is . That is exact, not a limit: ten draws are centred on the truth exactly as a million are. Spreads do not add that simply, but variances do provided the draws are independent. The variance of the sum is ; dividing by divides a variance by , which leaves .
Put numbers in. With a single draw of spread one, ten draws give a typical error of ; a hundred give ; a thousand give ; ten thousand give . To halve the error from you need , which is . Four times the draws for a factor of two. Every further halving costs another fourfold, which is why the curve falls steeply at first and then flattens.
| draws n | typical error 1/sqrt(n) | draws needed to halve it |
|---|---|---|
| 10 | 0.316 | 40 |
| 100 | 0.100 | 400 |
| 1 000 | 0.0316 | 4 000 |
| 10 000 | 0.0100 | 40 000 |
The natural guess is that a large sample washes out error of every kind, and that is what fails. The narrowing is not what makes the average trustworthy; the centring is. If every draw were shifted by a fixed , the average would still narrow at exactly the same rate, onto instead of . At a hundred draws that offset hides inside a typical error of . At a hundred thousand draws the typical error is , so the offset is about six times the noise and the estimate is confidently, precisely wrong. A big sample cannot tell you which of those two situations you are in.
Independence is doing the work
The step from to used independence and nothing else. Let every pair of draws share a covariance , as they do when a simulation carries state from one run to the next or the generator has hidden structure. The variance of the sum gains a term for each pair, and there are of them.
With and , a thousand draws give , a typical error of rather than the independent . Take a million draws instead and the first term vanishes while the second stays at , so the error settles at and stays there. The average converges to something. It is not the quantity wanted, and more samples will not fix it.
When there is no spread to speak of
The rate presumes a finite , and some quantities do not have one. When the tail is heavy enough, a single enormous draw moves the running average more than everything before it: a draw of among ordinary draws of size one shifts the average by when it lands, which is at a thousand draws and still at ten thousand. The running average jumps at the biggest sample sizes instead of settling, and it does so while looking from the inside exactly like an ordinary simulation that has produced a confident figure.
The figure is a typical error across many repetitions, not a bound on the run in front of you, so a single run can wander anywhere inside it and is not obliged to be closer at a larger sample size than at a smaller one. What is reliable is the width of the cloud, and that is the number worth quoting: with spread one, a thousand draws put you within roughly of the answer, and ten thousand within roughly .
Worth keeping
- The average of independent draws is centred on the true value at every sample size, so a small run is noisy rather than biased.
- Its typical distance from the truth is the spread of one draw divided by the square root of the number of draws, so halving the error costs four times the draws.
- Without independence the average still settles, but on the wrong number, and no number of draws removes the gap.
Where this goes next
This question is one step of Answering With Random Samples, a course that works through its subject from the beginning. The page that teaches this part of it is The Average Is the Answer, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- When should I give up on finding an exact formula and simulate instead?Give up on an exact formula when the quantity can be written as an average of something drawable, since simulation then gives an estimate with a measurable error.
- How do I estimate the error of a statistic when I don't have a formula for it?Resample your own data many times, recompute the statistic each time, and use the spread of those results as the error bar.
- Why does cutting the error in half require four times as many samples?The error shrinks in proportion to one over the square root of the sample count, so halving it needs four times the samples.
- What is the difference between variance and standard deviation?They measure the same spread: variance is the average squared distance from the mean, standard deviation is its square root, so you report the standard deviation and calculate with the variance.
- How do you make a vague claim precise enough to tell whether it's true?Fix what is being talked about, what is asserted, which cases are covered and the cut-off, then name an observation that would prove it false.
- How do you find the parabola that best fits a function near a point?Match the function's height, slope and bending at the chosen point; those three conditions single out exactly one parabola.