Confidence intervals – repeated samples, confidence level and margin of error

MathematicsStatisticsAges 17–18

Loading…

Use with my class ✨ Customize with AI Report a problem

Draw hundreds of random samples from a population whose parameter is known and see whether each confidence interval p̂ ± z*·√(p̂(1 − p̂)/n), x̄ ± t*·s/√n or x̄ ± z*·σ/√n captures the true value. The capture rate changes with the confidence level and the sample size, and there is also an interval for a difference of two proportions. The Margin of error screen shows the critical values z* and t*, the margin of error against n and the sample size needed.

Lesson: Confidence intervals for a proportion and a mean

What it shows

A confidence interval estimates an unknown population parameter as estimate ± margin of error, where the margin of error is a critical value times the standard error. Here the population is simulated, so the true proportion or mean is known and every interval can be checked. Over many samples about C% of the intervals capture the parameter: the confidence level describes the method, not one particular interval. Intervals for a proportion use the normal approximation (Wald interval); a mean uses t* with n − 1 degrees of freedom when σ is unknown.

How to use

Choose what to estimate under Estimate and set the population and Sample size n. Press Take 1 sample, +20 samples, +100 samples or Run and watch the intervals turn green (capture) or red (miss). Move Confidence level C to recompute the same samples, click an interval to see its working, and untick Show true parameter to hide it. On Margin of error, drag the red line or n and set Target margin of error E.

Parameters you can change

  • Screen Repeated samples, Margin of error and sample size
  • Parameter to estimate Proportion p, Mean μ, Difference of proportions p₁ − p₂
  • Interval for a mean t*·s/√n (σ unknown), z*·σ/√n (σ known), z*·s/√n (wrong for small n)
  • Shape of the population Normal, Right-skewed, Uniform
  • Population proportion p (or p₁) 0.01–0.99
  • Population proportion p₂ 0.01–0.99
  • Population mean μ -1000–1000
  • Population standard deviation σ 0.1–1000
  • Sample size n (each group) 2–1000
  • Confidence level C 50–99.9 %
  • Show the true parameter
  • Target margin of error E (proportion) 0.005–0.5
  • Target margin of error E (mean) 0.01–1000
  • Random seed (same number, same samples) 1–999

Questions to explore

  1. Why do roughly 5 in every 100 intervals at the 95% level miss the true value?
  2. What happens to the width of the intervals when you quadruple the sample size?
  3. Why does using z* instead of t* with a small sample capture the mean less often?