📚 Statistical Tests: Chi-Squared and t-Tests | 统计检验:卡方检验与t检验
Statistical tests form the backbone of decision-making in applied mathematics and data-driven disciplines. In the IB Mathematics: Applications and Interpretation course, hypothesis testing moves beyond theoretical distributions into practical tools that allow you to evaluate claims, compare groups, and assess relationships between categorical variables. This article unpacks the two most commonly tested families of procedures—chi‑squared tests and t‑tests—providing a structured review of their logic, computation, and interpretation. With examination-style explanations and worked examples, you will gain the confidence to tackle Paper 3 investigations and unseen data questions.
统计检验是应用数学和数据驱动学科中决策制定的核心。在IB数学:应用与解释课程中,假设检验超越了理论分布,成为评估主张、比较组别以及评估分类变量之间关系的实用工具。本文将剖析两种最常考察的检验方法——卡方检验与t检验,系统梳理其逻辑、计算与解读方式。通过考试风格的讲解和例题精解,你将获得应对试卷三调查研究和陌生数据题的信心。
1. Introduction to Hypothesis Testing | 假设检验简介
A hypothesis test is a formal procedure for deciding whether sample data provide sufficient evidence against a default assumption, called the null hypothesis H₀. The alternative hypothesis H₁ captures the claim we are trying to support. In IB Applications and Interpretation, you will always set up both hypotheses before performing any calculations, and you will interpret the result by comparing a computed test statistic to a critical value or by examining a p‑value.
假设检验是一个正式程序,用于判断样本数据是否提供了足够的证据来反驳一个默认假设,即零假设 H₀。备择假设 H₁ 则代表我们试图支持的论点。在IB应用与解释课程中,进行计算之前,你始终需要先设定两个假设,并通过将计算出的检验统计量与临界值比较,或通过观察 p 值来解释结果。
- Null hypothesis H₀: There is no effect, no difference, or no association.
- 零假设 H₀:没有效应、没有差异或没有关联。
- Alternative hypothesis H₁: There is an effect, a difference, or an association.
- 备择假设 H₁:存在效应、存在差异或存在关联。
For chi‑squared tests, H₀ usually states that two variables are independent or that observed frequencies follow a specified distribution. For t‑tests, H₀ typically asserts that a population mean equals a given value, or that two population means are equal.
对于卡方检验,H₀ 通常陈述两个变量相互独立,或观测频率服从某个特定分布。对于 t 检验,H₀ 通常声称总体均值等于某个给定值,或两个总体均值相等。
2. Types of Errors | 错误类型
Because hypothesis testing relies on sample data, there is always a risk of drawing an incorrect conclusion. IB examiners expect you to distinguish between Type I and Type II errors and to understand how the significance level α controls the probability of a Type I error.
由于假设检验依赖于样本数据,因此总是存在得出错误结论的风险。IB考官希望你能够区分第一类错误和第二类错误,并理解显著性水平 α 如何控制第一类错误的概率。
| Decision / 决策 | H₀ is true / H₀ 为真 | H₀ is false / H₀ 为假 |
|---|---|---|
| Reject H₀ / 拒绝 H₀ | Type I error (α) / 第一类错误 (α) | Correct decision / 正确决策 |
| Do not reject H₀ / 不拒绝 H₀ | Correct decision / 正确决策 | Type II error (β) / 第二类错误 (β) |
In IB problems, a significance level of 5% (α = 0.05) is most common, though 10% and 1% levels appear as well. When you set α = 0.05, you accept a 5% chance of rejecting a true null hypothesis. Reducing α decreases the risk of a Type I error but increases the risk of a Type II error for a fixed sample size.
在IB试题中,最常用的是 5% 的显著性水平(α = 0.05),尽管也会出现 10% 和 1% 的水平。当设定 α = 0.05 时,你接受 5% 拒绝一个真实零假设的风险。降低 α 会降低第一类错误的风险,但在固定样本量下会增加第二类错误的风险。
3. Chi-Squared Test for Independence | 独立性卡方检验
The chi‑squared test for independence assesses whether two categorical variables are associated. It uses data arranged in a contingency table and compares observed frequencies O with expected frequencies E under the assumption of independence.
独立性卡方检验用于评估两个分类变量是否相关。它利用列联表中的数据,比较在独立性假设下的观测频数 O 与期望频数 E。
Expected frequency formula: E = (row total × column total) ÷ grand total
期望频数公式:E = (行合计数 × 列合计数) ÷ 总计数
The test statistic is:
χ² = Σ (O − E)² / E
The degrees of freedom: ν = (number of rows − 1) × (number of columns − 1)
自由度:ν = (行数 − 1) × (列数 − 1)
For example, a 2 × 2 table has ν = 1. The IB formula booklet provides critical values for the χ² distribution at various significance levels. A computed χ² larger than the critical value leads to rejection of H₀, implying a significant association.
例如,一个 2 × 2 表具有 ν = 1。IB公式手册提供了不同显著性水平下χ²分布的临界值。计算出的 χ² 大于临界值将导致拒绝 H₀,意味着存在显著关联。
4. Chi-Squared Goodness of Fit | 拟合优度卡方检验
A chi‑squared goodness‑of‑fit test is used when you want to check whether an observed distribution of a single categorical variable matches a theoretical distribution. For instance, you might test whether a die is fair or whether the ratio of phenotypes in a genetic cross follows Mendelian proportions.
当你想要检验单个分类变量的观测分布是否与某个理论分布相符时,使用卡方拟合优度检验。例如,你可能检验一个骰子是否公平,或者遗传杂交中的表型比例是否符合孟德尔比例。
H₀: The observed frequencies follow the specified distribution.
H₀:观测频数遵循指定的分布。
H₁: The observed frequencies do NOT follow the specified distribution.
H₁:观测频数不遵循指定的分布。
Expected frequencies are calculated by multiplying the total sample size by the theoretical probability for each category. The same χ² = Σ (O − E)² / E formula applies. The degrees of freedom are ν = (number of categories − 1). If a parameter is estimated from data, an extra degree of freedom is lost per parameter estimated.
期望频数通过将总样本量乘以每个类别的理论概率来计算。适用相同的 χ² = Σ (O − E)² / E 公式。自由度为 ν = (类别数 − 1)。如果从数据中估计了一个参数,则每估计一个参数需减少一个自由度。
A common IB question provides observed counts and theoretical proportions; you must compute expected counts, calculate χ², and compare it with the critical value from tables. Remember that all expected frequencies should be at least 5 for the test to be valid; otherwise categories must be merged.
一个常见的IB题目会提供观测频数和理论比例;你必须计算期望频数,计算 χ²,并与表中的临界值进行比较。记住,所有期望频数应至少为 5,该检验才有效;否则必须合并类别。
5. t-Test for a Population Mean | 单样本t检验
When you have a single sample and want to test whether the population mean μ equals a hypothesized value μ₀, and the population standard deviation σ is unknown, the one‑sample t‑test is appropriate. This test is central to the IB Applications and Interpretation syllabus because it addresses realistic scenarios where σ is not known.
当你有一个样本,并希望检验总体均值 μ 是否等于假设值 μ₀,且总体标准差 σ 未知时,单样本 t 检验是合适的。这一检验在IB应用与解释大纲中居于核心地位,因为它解决的是 σ 未知的现实情境。
Test statistic:
t = (x̄ − μ₀) / (s / √n)
where x̄ is the sample mean, s is the sample standard deviation, and n is the sample size. The statistic follows a t‑distribution with ν = n − 1 degrees of freedom.
其中 x̄ 为样本均值,s 为样本标准差,n 为样本量。该统计量服从自由度为 ν = n − 1 的 t 分布。
IB exam papers will expect you to identify whether the test is one‑tailed or two‑tailed. A two‑tailed test uses H₁: μ ≠ μ₀, while a one‑tailed test uses H₁: μ > μ₀ or H₁: μ < μ₀, depending on the context. The p‑value from a GDC (or from the t‑table) is then compared to α.
IB试卷会期待你识别该检验是单尾还是双尾。双尾检验使用 H₁: μ ≠ μ₀,而单尾检验根据情境使用 H₁: μ > μ₀ 或 H₁: μ < μ₀。然后,将计算器得出的 p 值(或来自 t 表的)与 α 进行比较。
6. Two-Sample t-Test (Independent) | 独立双样本t检验
When comparing the means of two independent populations, the two‑sample t‑test determines whether the observed difference is statistically significant. The IB syllabus covers both the case where the two population variances are assumed equal (pooled variance) and the case where they are not assumed equal. The latter, known as Welch’s t‑test, is the default on most GDC models and is recommended when sample sizes are unequal.
当比较两个独立总体的均值时,双样本 t 检验用于判断观测到的差异是否具有统计显著性。IB大纲涵盖两种情形:假定两个总体方差相等的情形(合并方差),以及不假定方差相等的情形。后者被称为 Welch t 检验,是大多数图形计算器中的默认设置,并在样本量不相等时被推荐使用。
Hypotheses:
H₀: μ₁ − μ₂ = 0 (or μ₁ = μ₂)
H₁: μ₁ − μ₂ ≠ 0 (or >, <)
The test statistic for the unpooled (Welch) version is:
t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)
The degrees of freedom are calculated using the Welch‑Satterthwaite formula, but on IB exams the GDC automatically computes both the test statistic and the p‑value. You simply need to write down the values from the GDC, state the p‑value, compare it to α, and write a conclusion in context.
自由度使用 Welch‑Satterthwaite 公式计算,但在IB考试中,GDC会自动计算检验统计量和 p 值。你只需记录计算器上的数值,陈述 p 值,将其与 α 比较,并结合情境写出结论。
7. Paired t-Test | 配对t检验
A paired t‑test is used when the two samples consist of matched pairs or repeated measurements on the same subjects—for example, before‑and‑after studies. Instead of comparing two separate group means, the test analyses the differences dᵢ = x₁ᵢ − x₂ᵢ for each pair.
当两个样本由配对数据或同一受试者的重复测量组成时——例如,前后对比研究——使用配对 t 检验。该检验分析每对数据的差值 dᵢ = x₁ᵢ − x₂ᵢ,而不是直接比较两组的均值。
H₀: The mean of the population of differences μd = 0.
H₀:差值总体的均值 μd = 0。
H₁: μd ≠ 0, μd > 0, or μd < 0.
H₁:μd ≠ 0,μd > 0 或 μd < 0。
Calculate the sample mean d̄ and sample standard deviation sd of the differences. The test statistic:
t = d̄ / (sd / √n)
with ν = n − 1, where n is the number of pairs. This is mathematically identical to a one‑sample t‑test on the differences. IB questions often provide a table of “before” and “after” values; you must compute differences and then run the test using GDC.
其中 ν = n − 1,n 为配对数目。这在数学上与对差值进行单样本 t 检验相同。IB题目经常提供一个“前”与“后”的表格;你必须计算差值,然后使用 GDC 进行检验。
8. Interpreting p-values | 解释p值
The p‑value is the probability of obtaining a test statistic at least as extreme as the one observed, assuming H₀ is true. In IB, you must consistently interpret the p‑value by comparing it to the significance level α.
p 值是在 H₀ 为真的前提下,获得至少与观测值一样极端的检验统计量的概率。在IB中,你必须始终通过将 p 值与显著性水平 α 进行比较来解释它。
- If p ≤ α: Reject H₀. The result is statistically significant.
- 如果 p ≤ α:拒绝 H₀。结果具有统计显著性。
- If p > α: Do not reject H₀. There is insufficient evidence to support H₁.
- 如果 p > α:不拒绝 H₀。没有充分证据支持 H₁。
For example, a p‑value of 0.023 with α = 0.05 means that if H₀ were true, there would be only a 2.3% chance of seeing a result as extreme as ours. Since 0.023 < 0.05, we reject H₀. Beware of common misconceptions: the p‑value is NOT the probability that H₀ is true, nor is it the probability that the results occurred by chance alone in the way laypeople might assume.
例如,α = 0.05 时 p 值为 0.023,意味着如果 H₀ 为真,只有 2.3% 的概率会看到如此极端的结果。由于 0.023 < 0.05,我们拒绝 H₀。注意常见的误区:p 值不是 H₀ 为真的概率,也不是普通人理解的那种“结果纯属偶然”的概率。
9. Assumptions and Conditions | 假设与条件
Every statistical test relies on assumptions about the data. IB marks schemes often include a check of these conditions, especially in Paper 3 investigations.
每一种统计检验都依赖于关于数据的假设。IB评分方案通常包含对这些条件的检查,尤其是在试卷三调查研究中。
For chi‑squared tests:
- Observations are independent.
- 观测值相互独立。
- All expected frequencies ≥ 5. If not, combine categories.
- 所有期望频数 ≥ 5。如果不满足,合并类别。
- Data are categorical (nominal or ordinal).
- 数据为分类数据(名义或有序)。
For t‑tests (one‑sample, two‑sample, paired):
- Data should be a random sample from the population(s).
- 数据应来自总体的随机样本。
- The sample mean is approximately normally distributed. This is satisfied if the population is normal or if the sample size is large enough (Central Limit Theorem, n ≥ 30).
- 样本均值近似服从正态分布。若总体正态或样本量足够大(中心极限定理,n ≥ 30),则满足该条件。
- For the two‑sample t‑test, the two samples must be independent (unless paired). The paired t‑test requires that the pairs are randomly selected and the differences are approximately normal.
- 对于双样本 t 检验,两个样本必须独立(除非是配对检验)。配对 t 检验要求配对是随机选取的,且差值近似服从正态分布。
Check normality using a histogram or boxplot of the sample data (or differences for paired test). Mild skewness is acceptable with larger samples.
使用样本数据的直方图或箱线图(或配对检验中的差值)检查正态性。样本较大时,轻微偏态是可接受的。
10. Worked Examples | 例题精解
Example 1 – Chi‑squared goodness of fit: A biologist expects a 9:3:3:1 ratio of four phenotypes in a genetic cross. Out of 160 offspring, she observes 94, 28, 26, and 12. Test at the 5% significance level.
例题1 – 拟合优度卡方检验:一位生物学家预期一个遗传杂交中四种表型的比例为 9:3:3:1。在 160 个后代中,她观察到 94、28、26 和 12。在 5% 的显著性水平下进行检验。
Total = 160. Expected: (9/16)×160 = 90, (3/16)×160 = 30, (3/16)×160 = 30, (1/16)×160 = 10.
总数 = 160。期望值:(9/16)×160 = 90,(3/16)×160 = 30,(3/16)×160 = 30,(1/16)×160 = 10。
χ² = (94−90)²/90 + (28−30)²/30 + (26−30)²/30 + (12−10)²/10 = 16/90 + 4/30 + 16/30 + 4/10 = 0.1778 + 0.1333 + 0.5333 + 0.4 = 1.2444. Degrees of freedom ν = 4 − 1 = 3. Critical value at 5% for ν=3 is 7.815. Since 1.24 < 7.815, we do not reject H₀. There is no evidence that the observed ratio differs from 9:3:3:1.
χ² = (94−90)²/90 + (28−30)²/30 + (26−30)²/30 + (12−10)²/10 = 16/90 + 4/30 + 16/30 + 4/10 = 0.1778 + 0.1333 + 0.5333 + 0.4 = 1.2444。自由度 ν = 4 − 1 = 3。ν=3 时 5% 水平的临界值为 7.815。由于 1.24 < 7.815,我们不拒绝 H₀。没有证据表明观测比例与 9:3:3:1 不同。
Example 2 – Two‑sample t‑test: A teacher compares test scores of two independent classes. Class A: n₁=20, x̄₁=72, s₁=8. Class B: n₂=25, x̄₂=66, s₂=10. Test for a difference at α=0.05.
例题2 – 双样本 t 检验:一位教师比较两个独立班级的考试成绩。A 班:n₁=20,x̄₁=72,s₁=8。B 班:n₂=25,x̄₂=66,s₂=10。在 α=0.05 下检验差异。
Using GDC (2‑Sample t‑Test, pooled off), we obtain t ≈ 2.22, p‑value ≈ 0.031. Since 0.031 < 0.05, we reject H₀. There is significant evidence of a difference in mean scores between the two classes.
使用 GDC(双样本 t 检验,不合并方差),我们得到 t ≈ 2.22,p 值 ≈ 0.031。由于 0.031 < 0.05,我们拒绝 H₀。有显著证据表明两个班级的平均分存在差异。
Always state the conclusion in the context of the problem: “The data provide sufficient evidence to conclude that the mean scores differ.”
结合问题情境陈述结论:“数据提供了足够的证据表明平均分数不同。”
Published by TutorHao | Mathematics: Applications and Interpretation Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导