Confidence intervals
What 95 % confidence really means: a hundred samples, a hundred intervals, and how many catch the true value. For μ with σ known (z), with σ unknown (t) and for a proportion, with any level and n. It runs in your browser, on your phone too.
How to use it
- Start with the coffee packs lesson: one interval, twenty and a hundred.
- Change the kind of interval, the level (90, 95 or 99 %) and the sample size; draw 1 sample, +20 or +100.
- Tap any line to see its calculation: x̄, s, the quantile, the standard error, the margin and the R call.
What it works out
With σ known, x̄ ± z·σ/√n; with σ unknown, x̄ ± tn−1·s/√n (what t.test(x)$conf.int gives); for a proportion, p̂ ± z·√(p̂(1 − p̂)/n). The coral lines are the intervals that leave the true value out.
The rules it follows
- The population is normal with μ = 250 g and σ = 5 g (coffee packs), or a true proportion of 0.30.
- The «Use z with s» box shows the classic mistake of using 1.96 with s in small samples: the intervals are right less often than they promise.
For the exam
In the exam you compute the interval, interpret it and find the n for a given margin. Remember: the 95 % belongs to the method, not to one particular interval. The challenge below gives you new data.
