Hypothesis tests · 假设检验
| English | 中文 | Pinyin · 拼音 |
|---|---|---|
| hypothesis test/haɪˈpɒθəsɪs test/ | 假设检验 | jiǎ shè jiǎn yàn |
| null hypothesis/nʌl haɪˈpɒθəsɪs/ | 原假设 | yuán jiǎ shè |
| alternative/ɔːlˈtɜːnətɪv/ | 备择假设 | bèi zé jiǎ shè |
| one-tailed/wʌn teɪld/ | 单尾 | dān wěi |
| two-tailed/tuː teɪld/ | 双尾 | shuāng wěi |
| significance level/sɪɡˈnɪfɪkəns ˈlevl/ | 显著性水平 | xiǎn zhù xìng shuǐ píng |
| test statistic/test stəˈtɪstɪk/ | 检验统计量 | jiǎn yàn tǒng jì liàng |
| rejection region/rɪˈdʒekʃn ˈriːdʒn/ | 拒绝域 | jù jué yù |
| critical value/ˈkrɪtɪkl ˈvæljuː/ | 临界值 | lín jiè zhí |
| Type I error/taɪp aɪ ˈerə/ | 第一类错误 | dì yī lèi cuò wù |
| Type II error/taɪp ˈtuː ˈerə/ | 第二类错误 | dì èr lèi cuò wù |
The courtroom of statistics
- A drug company claims their new medicine works better than the old one. How do you decide if the evidence is strong enough?
- Hypothesis testing 假设检验 is the statistical equivalent of a courtroom: you assume the defendant (the null hypothesis 原假设) is innocent until proven guilty beyond reasonable doubt.
统计学的法庭
- 一家药企声称他们的新药比旧药更有效。你如何决定证据是否足够强?
- 假设检验(hypothesis testing)是统计学中的法庭:你假定被告(原假设)无罪,直到被排除合理怀疑地证明有罪。
Setting up the hypotheses
- A hypothesis test uses sample data to judge a claim.
- The null hypothesis $H_0$ — the default position (usually "no change" or "no effect").
- The alternative 备择假设 $H_1$ — what you suspect is true.
- One-tailed 单尾 if $H_1$ points one way ($\mu > 50$); two-tailed 双尾 if both ($\mu \neq 50$).
Worked example. A machine fills bottles with 500 mL. You suspect it's underfilling. $H_0: \mu = 500$ (machine is correct). $H_1: \mu < 500$ (underfilling). This is a one-tailed test.
A two-tailed 5% test rejects H0 in the shaded tails beyond plus or minus 1.96
建立假设
- 一个假设检验用样本数据来评判一个声称。
- 原假设(null hypothesis)$H_0$——默认的立场(通常是“没有改变”或“没有效果”)。
- 备择假设(alternative)$H_1$——你怀疑为真的。
- 如果 $H_1$ 指向一个方向($\mu > 50$)就是单尾(one-tailed);如果两个方向($\mu \neq 50$)就是双尾(two-tailed)。
算例。 一台机器给瓶子装 500 mL。你怀疑它装少了。 $H_0: \mu = 500$(机器正确)。$H_1: \mu < 500$(装少了)。这是一个单尾检验。

一个双尾 5% 检验在超出正负 1.96 的阴影尾部拒绝 H0
The rejection region · 拒绝域
reject H₀ if z < −z*
The shaded tail is the rejection region — if the test statistic lands there, reject H₀. · 阴影的尾部是拒绝域——如果检验统计量落在那里,就拒绝 H₀。
The null hypothesis H₀ usually states that: · 原假设 H₀ 通常陈述:
H₀ is the claim being tested, usually "no change"; H₁ is the suspected alternative. · H₀ 是被检验的声称,通常是“没有改变”;H₁ 是被怀疑的备择。
If H₁ states μ > 50, the test is: · 如果 H₁ 陈述 μ > 50,这个检验是:
H₁ pointing in one direction (μ > 50 or μ < 50) makes it a one-tailed test. · H₁ 指向一个方向(μ > 50 或 μ < 50)使它成为一个单尾检验。
Running the test
- Fix a significance level 显著性水平 (often 5%), compute a test statistic 检验统计量, and see if it lands in the rejection region 拒绝域.
- If $|z|$ exceeds the critical value 临界值 (1.96 for 5% two-tailed, 1.645 for 5% one-tailed), reject $H_0$.
A one-tailed test at 5% rejects H₀ only if the test statistic lands in the shaded tail.
Significance level is NOT the probability that $H_0$ is true. A 5% significance level means: if $H_0$ is true, there's a 5% chance of getting data this extreme. It does NOT mean there's a 5% chance $H_0$ is true.
进行检验
- 固定一个显著性水平(significance level,常常 5%),计算一个检验统计量(test statistic),并看它是否落在拒绝域(rejection region)中。
- 如果 $|z|$ 超过临界值(5% 双尾为 1.96,5% 单尾为 1.645),拒绝 $H_0$。

一个 5% 的单尾检验只在检验统计量落在阴影尾部时拒绝 H₀。
显著性水平不是 $H_0$ 为真的概率。 一个 5% 的显著性水平意味着:如果 $H_0$ 为真,有 5% 的机会得到这么极端的数据。它不意味着 $H_0$ 有 5% 的机会为真。
Types of error
- Type I error 第一类错误: rejecting $H_0$ when it is true (false positive). Probability = significance level $\alpha$.
- Type II error 第二类错误: accepting $H_0$ when it is false (false negative).
错误的类型
- 第一类错误(Type I error):在 $H_0$ 为真时拒绝它(假阳性)。概率 = 显著性水平 $\alpha$。
- 第二类错误(Type II error):在 $H_0$ 为假时接受它(假阴性)。
A Type I error is: · 一个第一类错误是:
Type I = reject a true H₀; Type II = accept a false H₀. · 第一类 = 拒绝一个真的 H₀;第二类 = 接受一个假的 H₀。
A Type II error means accepting H₀ when it is actually false. · 一个第二类错误意味着在 H₀ 实际为假时接受它。
Type II = fail to reject a false H₀ (false negative). · 第二类 = 未能拒绝一个假的 H₀(假阴性)。
Worked example — z-test
- $H_0: \mu = 50$, $H_1: \mu \neq 50$ (two-tailed, 5% level). $\sigma = 8$, $n = 64$, $\bar{x} = 52$.
- $z = \dfrac{52 - 50}{8/\sqrt{64}} = \dfrac{2}{1} = 2$.
- Critical value for 5% two-tailed: $1.96$. Since $2 > 1.96$, reject $H_0$.
- Set a null and alternative hypothesis; the test statistic falls in the critical region (reject) or the acceptance region. A Type II error is accepting a false $H_0$. Tests may use a binomial or Poisson distribution.
算例——z 检验
- $H_0: \mu = 50$,$H_1: \mu \neq 50$(双尾,5% 水平)。$\sigma = 8$,$n = 64$,$\bar{x} = 52$。
- $z = \dfrac{52 - 50}{8/\sqrt{64}} = \dfrac{2}{1} = 2$。
- 5% 双尾的临界值:$1.96$。因为 $2 > 1.96$,拒绝 $H_0$。
- 设原假设与备择假设(alternative hypothesis);检验统计量落入拒绝域(critical region,拒绝)或接受域(acceptance region)。第二类错误(Type II errors)是接受错误的 $H_0$。检验可用二项(binomial)或泊松分布(Poisson distribution)。
Population mean claimed 50, σ = 8, sample n = 64, x̄ = 52. What is z = (x̄ − μ)/(σ/√n)? · 总体平均数声称为 50,σ = 8,样本 n = 64,x̄ = 52。z = (x̄ − μ)/(σ/√n) 是多少?
z = (52 − 50)/(8/√64) = 2/(8/8) = 2/1 = 2. · z = (52 − 50)/(8/√64) = 2/(8/8) = 2/1 = 2。
For a 5% two-tailed test, you reject H₀ if |z| > 1.96. · 对一个 5% 的双尾检验,如果 |z| > 1.96 你就拒绝 H₀。
The critical value for a 5% two-tailed test is 1.96. If |z| exceeds this, reject H₀. · 一个 5% 双尾检验的临界值是 1.96。如果 |z| 超过它,拒绝 H₀。
You've got it
- $H_0$ (no change) vs $H_1$ (suspected); one- or two-tailed
- test statistic $z = \dfrac{\bar{x} - \mu}{\sigma/\sqrt{n}}$; reject $H_0$ if it's in the rejection region
- Type I = reject a true $H_0$; Type II = accept a false $H_0$
你掌握了
- $H_0$(没有改变)对 $H_1$(被怀疑的);单尾或双尾
- 检验统计量 $z = \dfrac{\bar{x} - \mu}{\sigma/\sqrt{n}}$;如果它在拒绝域中就拒绝 $H_0$
- 第一类 = 拒绝一个真的 $H_0$;第二类 = 接受一个假的 $H_0$