STAT5002 Chap.9 Unknown Proportions: Intervals and Z-tests
Unknown Proportions: Intervals and Z-tests
Most yes/no questions in statistics come down to an unknown proportion: the share of voters who back a policy, of parcels that arrive damaged, of days with rain. This chapter treats every such question as random draws from a box that holds only 0s and 1s, where the proportion of 1s is p.
Because that box has mean p and SD √(p(1−p)), the sample proportion has expected value p and standard error √(p(1−p)/n), and the Central Limit Theorem makes its behaviour roughly normal. You start with the case where p is known and build a 95% prediction interval, p ± 1.96 SE, which forecasts where the sample proportion will land. Then the logic is turned around.
When p is unknown, the Wilson confidence interval collects every value of p whose prediction interval contains the proportion you actually observed. You get it in R with binom.confint(x, n, method = "wilson"), remembering that x is the count of 1s, and you learn why the interval is not centred on the sample proportion and what 95% confidence does and does not promise.
The second half sets up the Z-test for a proportion using the HATPC framework: hypotheses, assumptions, test statistic, P-value and conclusion. You will see how the false alarm rate links to the level of significance, how the observed z converts into a P-value with pnorm, why a two-sided alternative doubles the tail area, and how a one-sided question changes which tail counts.
The chapter finishes with two habits that markers look for: never saying you accept the null hypothesis, and fixing the alternative, the level and the rejection rule before the data are seen, including turning the rule into a critical count of 1s.
What this chapter covers
- 01
The 0-1 box: mean p and SD √(p(1−p))
- 02
Standard error of the sample proportion
- 03
Prediction intervals when p is known
- 04
Why p(1−p) makes intervals widest near 0.5
- 05
Wilson confidence interval by inverting prediction intervals
- 06
The binom.confint() function and its conf.level argument
- 07
Long-run meaning of 95% confidence
- 08
False alarm rate, level of significance and P-value
- 09
HATPC steps for a Z-test on a proportion
- 10
One-sided versus two-sided alternatives in pnorm()
- 11
Critical regions and critical counts decided in advance
Worked example · free
Is the clinic meeting its 70% waiting-time target?
- +1H: Let p be the proportion of all visits seen within 15 minutes. H₀: p = 0.7 against H₁: p < 0.7, because only a shortfall is of concern.
- +1A: The 90 visits are a random sample from many visits, so they behave like independent draws from a 0-1 box, and n = 90 is large enough for the normal approximation to the sample proportion.
- +1T: Under H₀, SE₀ = √(0.7 × 0.3 / 90) = 0.0483. The observed proportion is 54/90 = 0.600, so z = (0.600 − 0.7)/0.0483 = −2.070. Small values of z argue against H₀.
- +1P: The lower tail is the one that counts, so the P-value is pnorm(−2.070) = 0.0192.
- +1C: 0.0192 < 0.05, so reject H₀. The data are evidence that fewer than 70% of patients are seen within 15 minutes.
Key terms
- Zero-one box
- A box model whose tickets are only 0s and 1s, with the proportion of 1s equal to p; its mean is p and its SD is √(p(1−p)).
- Prediction interval
- An interval centred at a known p, such as p ± 1.96 SE, that contains the sample proportion with a stated chance before the sample is drawn.
- Wilson confidence interval
- The set of values of p whose prediction interval contains the observed sample proportion; R gives it with binom.confint(..., method = "wilson").
- False alarm rate
- The chance of rejecting the null hypothesis when it is actually true; it is the level of significance α of the test.
- P-value
- The probability, computed assuming H₀ is true, of getting evidence against H₀ at least as strong as what was observed.
- Critical region
- The set of test statistic values, fixed by α before the data are seen, for which the null hypothesis is rejected.
Unknown Proportions: Intervals and Z-tests FAQ
Why is the Wilson interval not centred on the sample proportion?
Because the standard error depends on p itself, the edges come from solving a quadratic rather than adding and subtracting a fixed amount. The result is pulled towards 0.5, so its midpoint lies between the sample proportion and one half.
Can I say I accept the null hypothesis if the P-value is large?
No. A large P-value only means the data are consistent with H₀ at your chosen level. One sample cannot prove a hypothesis true, and many nearby values of p would fit the data just as well, so write that you do not reject H₀.
How do I choose between a one-sided and two-sided Z-test?
Read the question wording before looking at the data. Asking whether p is greater than or less than a value gives a one-sided alternative and a single tail; asking whether it is different gives a two-sided alternative and twice the tail area.
What does x mean in binom.confint?
It is the number of 1s in the sample, the sample sum, not the sample proportion. Before running it, check that x is a whole number between 0 and n, and that n is the full sample size.
Exam move
Start by drawing a 0-1 box for three different values of p and computing SE = √(p(1−p)/n) for one sample size, so the link between p and interval width becomes automatic. Next, pick an observed count, compute prediction intervals for several candidate values of p by hand, and mark which ones contain your observation; then confirm the span with binom.confint and check both edges with the 1.96 multiplier.
For tests, write the five HATPC headings on a blank page and fill them for one two-sided and one one-sided scenario, noting the exact pnorm call each time. Make a small table of the critical values from qnorm for 10%, 5%, 1% and 0.1% in both one-sided and two-sided form.
Finally, practise turning a one-sided rule into a critical count with ceiling(), and rehearse the sentence that a non-significant result is consistent with H₀ rather than proof of it.
Working through Unknown Proportions: Intervals and Z-tests in STAT5002? Sia is AskSia’s AI Statistics tutor — ask any STAT5002 Unknown Proportions: Intervals and Z-tests question and get a clear, step-by-step explanation grounded in how STAT5002 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.
STAT5003 Computational Statistical Methods · DATA2002 Data Analytics: Learning from Data · QBUS5001 Foundation in Data Analytics for Business