Advanced level

Point and interval estimation

A thousand people were surveyed and the conclusion is meant to be about thirty million. An estimator turns a sample into a number, the standard error says how much that number wobbles, and a confidence interval turns one value into an honest range — together with the arithmetic for how many observations a given range costs.

Before you start

This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:

Where this is used

Real situations where you count exactly the way this lesson teaches:

  • A poll with a margin of error
    A pollster surveys 1067 people and reports 34 per cent support "with a margin of error of 3 percentage points". That number is not a convention: at the worst possible spread of answers the standard error is √(0.25/1067) ≈ 0.0153, and the margin at a 95 per cent confidence level is 1.96 · 0.0153 ≈ 0.030, i.e. 3.0 points. The confidence interval therefore runs from 31 to 37 per cent — and it is the interval, not the single number, that is the result of the poll.
  • Batch quality control
    A filling machine is supposed to dispense 500 g. An inspector weighs 100 random packs and gets a mean of 499.4 g with a deviation of 2 g. The standard error is 2/√100 = 0.2 g, so the 95 per cent interval runs 499.4 ± 1.96 · 0.2, that is from 499.01 to 499.79 g. The nominal 500 g lies outside it — the machine is underfilling systematically rather than by chance, and that is grounds for stopping the line.
  • A laboratory measurement
    A lab reports a concentration as 4.20 ± 0.08 mg/l. That notation is a confidence interval: 0.08 is the margin of error at a stated confidence level, not the range within which every individual measurement falls. With 16 repeats and a deviation of 0.16 mg/l the standard error is 0.04 mg/l, so 0.08 is exactly two standard errors — roughly 95 per cent confidence.
  • How many measurements to take
    You want the mean commute time to within one minute at 95 per cent confidence, and the standard deviation is 5 minutes. The required number of measurements is n = (1.96 · 5 / 1)² ≈ 96, about four months of daily notes. Settling for two minutes of accuracy drops that to 24 — a factor of four, because accuracy enters the formula squared.

All formulas

  • Point estimator of the mean

    μ^=xˉ=1ni=1nxi\hat{\mu} = \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i

    one number computed from the sample

  • An unbiased estimator

    E(θ^)=θE(\hat{\theta}) = \theta

    it does not err systematically — it errs at random

  • Sample variance

    s2=1n1i=1n(xixˉ)2s^2 = \frac{1}{n-1}\sum_{i=1}^{n} (x_i - \bar{x})^2

    the n − 1 divisor is the correction for unbiasedness

  • Standard error of the mean

    SE(xˉ)=σn\mathrm{SE}(\bar{x}) = \frac{\sigma}{\sqrt{n}}

    the spread of the MEAN, not of the data

  • Confidence interval for a mean

    xˉ±zσn\bar{x} \pm z \cdot \frac{\sigma}{\sqrt{n}}

    z = 1.64 · 1.96 · 2.58 for 90 · 95 · 99 per cent

  • Margin of error

    d=zσnd = z \cdot \frac{\sigma}{\sqrt{n}}

    half the width of the interval

  • Required sample size

    n=(zσd)2n = \left(\frac{z\sigma}{d}\right)^{2}

    the same formula read from the d end

The previous lesson ended on the central limit theorem and on a formula whose denominator was σ/n\sigma/\sqrt{n}. This lesson is about what that denominator is for: reasoning about a whole population from a sample.

The question is a practical one. A thousand people were surveyed and the conclusion is meant to be about thirty million. What exactly may be said — and how precisely?

Sample, population, estimator

The distinction between a population and a sample was introduced by the lesson on variance; here it is a tool rather than a topic. What is worth fixing is the notation, because from here on the two worlds stay strictly apart:

quantitypopulation (unknown)sample (computable)
meanμ\muxˉ\bar{x}
deviationσ\sigmass
sizeNNnn

Greek letters are parameters — fixed numbers we do not know. Latin letters are statistics — numbers computed from the sample, and therefore random: a second sample gives different ones.

An estimator is a recipe for estimating a parameter from a statistic. The natural estimator of the population mean is the sample mean:

μ^=xˉ=1ni=1nxi\hat{\mu} = \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i

The hat means "an estimate of". This is point estimation: one number. And there is a fundamental problem with it — for a continuous variable the probability that we hit exactly is zero. The number alone therefore says nothing about how far off we are.

Unbiasedness, or what the n − 1 divisor is for

An estimator is unbiased when its expected value equals the parameter being estimated:

E(θ^)=θE(\hat{\theta}) = \theta

This does not mean it hits — it means it errs equally in both directions, so averaged over many samples it hits. A biased estimator errs systematically one way, and no number of repetitions repairs that.

The sample mean is unbiased, since E(xˉ)=μE(\bar{x}) = \mu. The more interesting case is the variance — and here the divisor returns that the variance lesson stated without a full justification:

s2=1n1i=1n(xixˉ)2s^2 = \frac{1}{n-1}\sum_{i=1}^{n} (x_i - \bar{x})^2

The reason is this. The deviations are measured from xˉ\bar{x}, not from the unknown μ\mu. But xˉ\bar{x} is the mean of exactly those points, so it lies closer to them than the true μ\mu does — the sum of squared deviations from a sample's own mean is the smallest such sum there is. Dividing by nn would therefore give a number that is systematically too small. The n1n-1 correction is chosen precisely so that

E(s2)=σ2E(s^2) = \sigma^2

This is called the number of degrees of freedom: given xˉ\bar{x}, the last deviation follows from the others, because the deviations sum to zero. There are n1n-1 independent pieces of information about the spread, not nn.

Sample: 4, 7, 10. Compute the sample variance and compare it with dividing by n.

The standard error of the mean

Since xˉ\bar{x} is a random number, it has a distribution of its own — the sampling distribution of the mean. The central limit theorem of the previous lesson tells us everything we need about it: it is approximately normal, has the same mean μ\mu, and a standard deviation of

SE(xˉ)=σn\mathrm{SE}(\bar{x}) = \frac{\sigma}{\sqrt{n}}

This quantity is called the standard error of the mean, and it has to be kept apart from the standard deviation:

  • σ\sigma measures the spread of the data and does not depend on how much of it was collected;
  • SE\mathrm{SE} measures the spread of the mean and shrinks with sample size.
809010011012000.050.10.15valuedensityobservation, σ = 15mean of n = 25, SE = 3
One population, two different distributions. The wide curve is a single observation, the narrow one is the mean of twenty-five. The square root of twenty-five is five, so the mean is five times less spread out.

"People are 175±7175 \pm 7 cm tall" is a statement about the deviation. "The mean height is 175±0.7175 \pm 0.7 cm" is a statement about the standard error. Those are two entirely different claims, and confusing them is the commonest mistake in all of statistical inference.

The confidence interval for a mean

Since xˉ\bar{x} is approximately normal with standard deviation SE\mathrm{SE}, the three-sigma rule tells us how far from μ\mu it usually falls. Turning that sentence around gives the confidence interval:

xˉ±zσn\bar{x} \pm z \cdot \frac{\sigma}{\sqrt{n}}

The coefficient zz is chosen to match the required confidence level:

confidence levelzzintervals that miss
90%90\%1.641.6411 in 1010
95%95\%1.961.9611 in 2020
99%99\%2.582.5811 in 100100

The value 1.961.96 is worth recognising: it is the exact version of the "two sigmas" of the 68–95–99.7 rule. Half the width of the interval is called the margin of error:

d=zσnd = z \cdot \frac{\sigma}{\sqrt{n}}
n = 36 measurements, x̄ = 50, σ = 18. Give the 95% confidence interval.

What "95 per cent" actually means

This is where it is easiest to say something untrue, so it is worth settling with a picture.

889296100104108112116μ = 100x̄ = 101x̄ = 98x̄ = 103x̄ = 96x̄ = 107 — missesx̄ = 99
Six samples from the same population with mean 100, six intervals. Five cover the true value, one does not. The intervals move from sample to sample; the vertical mark stays put.

The picture shows what a sentence cannot: the interval is random, the parameter is not. The true mean μ\mu is a fixed number and either lies inside a given interval or does not — there is no probability involved. What is random is the sample, and therefore the interval built from it.

The correct sentence is: the procedure that produced this interval hits in 95 cases out of 100. We return to the incorrect one in the section on abuses, because it is the single most common misstatement in applied statistics.

How many observations are needed

The margin-of-error formula also reads backwards. If we know in advance how narrow an interval will do, then

d=zσnn=(zσd)2d = z \cdot \frac{\sigma}{\sqrt{n}} \quad\Longrightarrow\quad n = \left(\frac{z\sigma}{d}\right)^{2}

The square is the crux: accuracy enters the sample size in the second power. An interval half as wide costs four times the sample; one ten times as narrow costs a hundred times.

σ = 12, and we want a margin of error of 3 at 95% confidence. How many observations?

That is also the answer to why polls are run on samples of about a thousand. The first three percentage points of accuracy are cheap; every one after that costs four times the last.

Where this mathematics gets abused

Four abuses, each with a name, because a named one is easier to spot.

1. "There is a 95 per cent probability the parameter lies in the interval"

The commonest misstatement in applied statistics, and one that appears even in textbooks. It is false in the language we are working in: μ\mu is not a random variable, so the statement "μ(31%; 37%)\mu \in (31\%;\ 37\%)" has no probability — it is simply true or false.

The correction: the percentage refers to the procedure, not to a particular interval. Correctly: "if the study were repeated many times, about 95 per cent of intervals built this way would cover μ\mu." The reading in which the parameter is random is a separate approach — the Bayesian one — and there it is called a credible interval, not a confidence interval, and it is computed quite differently.

2. A margin of error with no confidence level

"The margin of error is 3 points" is not complete information: on the same sample, the margin at 99%99\% is half again as large as at 90%90\%. Giving the number alone lets the confidence level be chosen after looking at the result.

The correction: a margin of error is always quoted with its confidence level, and the level is fixed before the data is collected.

3. A confidence interval mistaken for a range of observations

"The confidence interval for mean height is (174.3; 175.7)(174.3;\ 175.7) cm" does not mean that 95 per cent of people are that tall. It speaks only about the mean, not about any individual — which is precisely why it is so narrow. The range holding 95 per cent of the observations is a different thing entirely, computed from σ\sigma rather than σ/n\sigma/\sqrt{n}, and at n=400n = 400 it is twenty times wider.

The correction: a confidence interval is about the parameter, a prediction interval about a future observation. Confusing them is exactly confusing σ\sigma with σ/n\sigma/\sqrt{n}.

4. A margin of error read as a guarantee of sample quality

This one is the most expensive. The formula zσ/nz\sigma/\sqrt{n} measures only sampling error — it assumes the sample is random and that everyone drawn answered. It measures neither selection bias, nor non-response, nor a badly worded question. An online survey with fifty thousand responses has a negligible margin of error and may be worthless, because the people who filled it in are the people who wanted to.

The correction: the margin of error is a lower bound on uncertainty, not an upper one. Collecting a larger sample narrows it and removes not one systematic error.

Exercises

The first set follows the order in which such a problem is actually worked. The s/√n prompt gives a deviation and a sample size and asks for the standard error — the one step that separates the spread of the data from the spread of the mean. The "confidence interval" prompt gives xˉ\bar{x}, σ\sigma, nn and zz, and the answer is a pair of numbers in brackets, left end first: an interval is ordered, so writing it the other way round does not pass.

The third prompt reads the same relation both ways: sometimes it asks for the margin of error at a given nn, sometimes for the required sample size at a given margin. The sample size comes out a whole number in these questions, because the data is built backwards from the answer.

Practice

Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.

Exercise 1 of 8Score: 0
s/√n: s = 8, n = 16

The second set is authored, and it asks not about the arithmetic but about the behaviour of the interval: how it responds to a change of sample size, how many intervals miss at a given confidence level, how large the bias of an unbiased estimator is. The generator does not draw these, because they are properties of the procedure rather than the result of one problem.

Practice

Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.

Exercise 1 of 6Score: 0
The sample grows 4 times. How many times narrower is the confidence interval?

The judgement "may such an interval be computed here at all" has no number for an answer and stays content — the four situations in which the answer is no are in the section on abuses.

Common mistakes

  • Confusing σ\sigma with σ/n\sigma/\sqrt{n} — the first measures the spread of the data, the second the spread of the mean; the slip inflates the interval by a factor of n\sqrt{n} and is mistake number one in this lesson.
  • "There is a 95 per cent probability the mean lies in this interval" — the interval is random, the parameter is not; the percentage describes a procedure repeated many times.
  • Multiplying by zz before dividing by n\sqrt{n} — the order does not change the answer, but omitting the division does; check that the denominator really carries a square root.
  • Rounding a required sample size down61.561.5 observations means 6262; rounding down gives a margin larger than the one asked for.
  • Treating a confidence interval as a range of observations — the first is about the mean and is very narrow at large nn; the range holding 95 per cent of the units is computed from σ\sigma.
  • Reading a small margin of error as proof of a sound study — the margin measures sampling error alone and sees neither selection bias nor non-response.
  • Using zz on a small sample with unknown σ\sigma — below roughly thirty observations the right distribution is Student's t with n1n-1 degrees of freedom, whose critical values are larger.

Formula card

Topic: Estimation and confidence intervals

  • Point estimator of the mean

    μ^=xˉ=1ni=1nxi\hat{\mu} = \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i

    one number computed from the sample

  • An unbiased estimator

    E(θ^)=θE(\hat{\theta}) = \theta

    it does not err systematically — it errs at random

  • Sample variance

    s2=1n1i=1n(xixˉ)2s^2 = \frac{1}{n-1}\sum_{i=1}^{n} (x_i - \bar{x})^2

    the n − 1 divisor is the correction for unbiasedness

  • Standard error of the mean

    SE(xˉ)=σn\mathrm{SE}(\bar{x}) = \frac{\sigma}{\sqrt{n}}

    the spread of the MEAN, not of the data

  • Confidence interval for a mean

    xˉ±zσn\bar{x} \pm z \cdot \frac{\sigma}{\sqrt{n}}

    z = 1.64 · 1.96 · 2.58 for 90 · 95 · 99 per cent

  • Margin of error

    d=zσnd = z \cdot \frac{\sigma}{\sqrt{n}}

    half the width of the interval

  • Required sample size

    n=(zσd)2n = \left(\frac{z\sigma}{d}\right)^{2}

    the same formula read from the d end

809010011012000.050.10.15valuedensityone observation, σ = 15mean of n = 25, SE = 3
The distribution of a single observation and of the mean of twenty-five observations, sharing a centre. The mean is five times less spread out, because the square root of twenty-five is five — that is the whole mechanism of reasoning from a sample.
889296100104108112116μ = 100x̄ = 101x̄ = 98x̄ = 103x̄ = 96x̄ = 107 — missesx̄ = 99
Six confidence intervals built from six different samples of the same population, whose mean is 100. Five of them cover the true value and one does not — and that is exactly what a confidence level means: the interval is random, the parameter is not.

Frequently asked questions

Related articles