University of Sydney · FACULTY OF STATISTICS

STAT5002 Chap.9 Unknown Proportions: Intervals and Z-tests

- one subject, every graph, every model, every mark
11 Chapters5-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 9 of 12 · STAT5002

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.

In this chapter

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?

Q [5 marks]. A clinic claims that 70% of patients are seen within 15 minutes. A health officer suspects the true proportion is lower and records 90 randomly chosen visits, of which 54 were seen within 15 minutes. Carry out a Z-test at the 5% level using HATPC. (5 marks. The mark allocation is ours, not the University's.)
Purple rows are candidate values of p whose 95% prediction interval reaches the observed proportion; grey rows miss it.Purple rows are candidate values of p whose 95% prediction interval reaches the observed proportion; grey rows miss it. Collecting the purple dots and filling the gaps between them gives the Wilson interval on the bottom bar. Note how the bars widen as p moves towards 0.5.WHICH VALUES OF p COULD HAVE PRODUCED 17 OUT OF 60?p = 0.10p = 0.15p = 0.20p = 0.25p = 0.30p = 0.35p = 0.40p = 0.45p = 0.50p = 0.55observed 0.28330.00.10.20.30.40.50.60.7Wilson 95%: 0.185to 0.408
Purple rows are candidate values of p whose 95% prediction interval reaches the observed proportion; grey rows miss it. Collecting the purple dots and filling the gaps between them gives the Wilson interval on the bottom bar. Note how the bars widen as p moves towards 0.5.
  • +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.
z = −2.070 with a one-sided P-value of 0.0192, so at the 5% level we reject the claim and conclude the clinic is seeing fewer than 70% of patients within 15 minutes.
Sia tip — Before computing z, write the direction of H₁ next to the matching R call: p < p₀ goes with pnorm(z), p > p₀ with pnorm(z, lower.tail = F), and p ≠ p₀ with 2*pnorm(abs(z), lower.tail = F); doubling a P-value for a one-sided question gives the wrong answer.
Glossary

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.
FAQ

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.

Study strategy

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.

A+Everything unlocked
Unlocks this Bible + all 165 of your University of Sydney subjects - and 1,000+ Bibles across every Australian university.
Sia - your STAT5002 tutor, unlimited, worked the way the exam marks it
The full 5-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works