Example: One-Sample $z$-Test for Proportions
Suppose we toss a coin $100$ times and observe $60$ heads. Test at the $5\%$ level whether the coin is fair.
Answer
Using what we learned, we have:
Step 1: State hypotheses and significance level.
\[
H_0: p = 0.5,
\qquad
H_A: p \neq 0.5,
\qquad
\alpha = 0.05.
\]
Step 2: Choose test and distribution under $H_0$. This is a one-sample $z$-test for a proportion. Under $H_0$,
\[
Z = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}} \;\sim\; \mathcal{N}(0,1).
\]
Step 3: Compute observed test statistic.
\[
\hat{p} = \tfrac{60}{100} = 0.6,
\quad
z_{\text{obs}} = \frac{0.6 - 0.5}{\sqrt{0.5 \cdot 0.5 / 100}}
= \frac{0.1}{0.05} = 2.0.
\]
Step 4: Decision using $p$-value.
\[
p = 2 \cdot P(Z > 2.0) \approx 2 \cdot 0.0228 = 0.0456.
\]
Since $p = 0.0456 < 0.05$, we reject $H_0$. There is evidence at the $5\%$ level that the coin is not fair.