Setting Up a Test for p
| English | Chinese | Pinyin |
|---|---|---|
| null hypothesis | 原假设 | yuán jiǎ shè |
| alternative hypothesis | 备择假设 | bèi zé jiǎ shè |
| one-sample z-test | 单样本z检验 | dān yàng běn z jiǎn yàn |
| test statistic | 检验统计量 | jiǎn yàn tǒng jì liàng |
Two competing claims
- A significance test pits two hypotheses against each other.
- The null hypothesis 原假设 $H_0: p = p_0$ is the "no effect / status quo" claim.
- The alternative hypothesis 备择假设 $H_a$ is what we suspect ($p \ne p_0$, $p > p_0$, or $p < p_0$).
- We assume $H_0$ is true, then see if the data are too surprising for it.
One- or two-sided
- Choose $H_a$ from the question before seeing the data.
- Two-sided: $H_a: p \ne p_0$ (a difference in either direction).
- One-sided: $H_a: p > p_0$ or $p < p_0$ (a specific direction).
- The appropriate procedure is the one-sample z-test 单样本z检验 for a proportion.
Conditions — use p₀
- Check random, 10%, and large counts — but for the test, use the hypothesized $p_0$:
-
$$n p_0 \ge 10 \quad\text{and}\quad n(1-p_0) \ge 10$$
- We use $p_0$ (not $\hat{p}$) because the test assumes $H_0$ is true.
- This is a subtle but important difference from the confidence interval.
The test statistic
- The test statistic 检验统计量 measures how far $\hat{p}$ is from $p_0$, in standard errors:
-
$$z = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}$$
- The denominator uses $p_0$ — the SD under the null.
- A large $|z|$ means the data are far from what $H_0$ predicts.
For a test, use $p_0$ in the conditions and the standard error — not $\hat{p}$. The whole logic assumes $H_0$ is true, so the SD is $\sqrt{p_0(1-p_0)/n}$. (The interval, which assumes nothing, uses $\hat{p}$.) Also, pick a one- or two-sided $H_a$ before collecting data — choosing it afterward to match the result is cheating.
A company claims $p_0 = 0.90$ of orders ship on time. A sample of $n = 100$ gives $\hat{p} = 0.85$.
- $H_0: p = 0.90$, $H_a: p < 0.90$ (we suspect worse).
- Conditions (use $p_0$): $np_0 = 90 \ge 10$, $n(1-p_0) = 10 \ge 10$. ✓
- Test statistic: $z = \dfrac{0.85 - 0.90}{\sqrt{0.9 \times 0.1/100}} = \dfrac{-0.05}{0.03} \approx -1.67$.
A test states $H_0: p = p_0$ vs. a one- or two-sided $H_a$. Use the one-sample $z$-test, checking random, 10%, and large counts with the hypothesized $p_0$. The test statistic is $z = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}$ — how many standard errors $\hat{p}$ sits from $p_0$.
Where the test statistic falls
z measures how far p̂ sits from p0 under the null model.
The null hypothesis for a one-proportion test has the form...
H0 states a specific value p0 (the status quo).
For a significance test, the conditions and standard error use p0, not p̂.
The test assumes H0 true, so it uses p0.
p0 = 0.90, n = 100, p̂ = 0.85. Compute z = (p̂−p0)/√(p0(1−p0)/n). Two decimals.
(−0.05)/√(0.09/100) = −0.05/0.03 ≈ −1.67.
You should choose a one- or two-sided alternative after looking at the data to match it.
Choose Ha before collecting data — matching it afterward is cheating.
A test statistic with a large |z| means...
Large |z| = far from the null-predicted value.