Ir para o conteúdo

Lição 17 · Uncertainty and Sampling

Chance Variation and Margin of Error

See why results jump by chance, what a margin of error and confidence interval mean, why small samples mislead and what statistical significance does not show.

If you flip a fair coin 10 times, you will often get 6 or 7 heads. The coin did not change; chance did that. The same happens with surveys, sales, test scores and defect counts. Chance variation is the natural wobble in results even when nothing underneath has changed. If you react to every wobble, you will chase ghosts.

Small samples wobble more

Python How far can chance take you?

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With 10 flips, large departures from 50% are common. With 1,000 flips, you should essentially never see them. This is why the best and worst performers in a ranking are often small groups. A school with 20 students can top or bottom a list from one unusual year.

The margin of error

When a poll says "52%, plus or minus 3 points", the margin of error describes uncertainty from random sampling. A confidence interval is the resulting range: about 49% to 55%.

For a simple random sample and a reasonably large sample size, a rough 95% margin of error for a share is:

margin = 1.96 * square root of (p * (1 - p) / n)

where p is the share and n is the sample size.

Python Margin of error by sample size

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

To cut the margin in half, you need about four times as many responses. This is why very high precision gets expensive.

Margin of error covers

Random sampling Chance in who was picked
1 / 2

A poll can have a small stated margin and still be badly wrong because of bias.

What "95% confidence" means

The 95% refers to the method. If you repeated the sampling many times and built an interval each time with this method, about 95% of those intervals would contain the true value, assuming the method's conditions hold. It is not a promise about one particular interval. Also note that a stated margin usually applies to the whole sample. A subgroup, such as one age band, is smaller, so its margin is larger.

Comparing two numbers

If one product scores 52% and another 49% from small samples, the difference may be chance. Be careful with the shortcut "intervals overlap, so there is no difference": overlapping intervals do not settle the question. A proper comparison looks at the uncertainty of the difference itself.

One way to build intuition is to simulate what chance alone could produce. Here, two groups of 50 are drawn from the same underlying 50% rate.

Python How big a gap can pure chance make?

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With 50 per group, gaps of 10 points happen quite often with no real difference at all.

Statistical significance

A result is often called statistically significant when it would be unusual if there were no real effect, judged by a chosen threshold. Keep three cautions in mind:

  • Significant is not the same as important. With huge samples, a tiny, useless difference can be "significant".
  • Not significant is not proof of no effect. The study may be too small to detect it.
  • Many tries create false winners. If you run 20 tests at a 5% threshold when none of the ideas works, you should expect about one false positive on average.

Always report the size of the effect and its uncertainty, not only a yes or no. The hypothesis testing lesson explains the formal method.

Regression to the mean

An extreme result is usually partly skill or true level and partly luck. The next measurement tends to be closer to average because the luck is unlikely to repeat. If you praise or punish the most extreme performers and they then move back toward the middle, it can look as though your action caused it. We return to this in Reasoning Traps.

Practical habits

  • Show the sample size next to every percentage.
  • Watch trends over several periods before reacting.
  • Compare with the normal range of past variation, not just last week.
  • Say "the evidence is not clear yet" when that is the truth.

A worked reading of a poll

A report says: "54% of 400 randomly selected residents support the new bus route, up from 51% last spring." The rough margin of error for 400 replies is about 5 points, so the current figure is compatible with roughly 49% to 59%.

Can you say support is above half? Not with confidence, because the range includes values below 50%. Can you say it rose? The earlier figure has uncertainty too, and the 3-point difference is well within what chance could produce with samples of this size. A careful summary is: "Support was about even to slightly positive in both surveys; these samples cannot show whether it changed." To detect a small change reliably, you would need much larger samples or several surveys over time.

Practice

A shop's daily complaints are usually between 2 and 9. Today there are 8. Should you react? Another day brings 25. What now?

Answers: 8 sits inside the usual range, so it is probably ordinary variation, although you may still want to read the complaints. A count of 25 is far outside the past range and deserves a prompt look: it could be a real fault, a promotion that brought many more customers or a change in how complaints are logged. Even then, check the number of orders, because complaints per order may not have changed.

Common mistakes: treating a 2-point change in a small survey as a real shift; ranking small groups without showing their sizes; thinking the margin of error covers all errors; and equating "significant" with "large".

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Roughly how many times larger must a sample be to halve the margin of error?

    The margin shrinks with the square root of the sample size.
  2. 2. What does a poll's margin of error usually NOT account for?

    It describes random sampling variation only.
  3. 3. Why are small groups often at both the top and bottom of rankings?

    With few observations, luck has a bigger influence on the average.
  4. 4. A huge study finds a statistically significant difference of 0.1%. What should you ask?

    Significance says little about practical importance.

Summary

  • Results vary by chance, especially in small samples.
  • A margin of error describes random sampling uncertainty only.
  • Quadrupling the sample roughly halves the margin.
  • Significance is not importance, and many tests create false winners.
  • Extreme results often move back toward average.

Next: Correlation and Causation

Seu progresso fica salvo neste navegador. Não precisa de conta.