← 返回资讯屏轩教育 · 行业资讯

Using Contingency Tables | 使用列联表

2026-08-29 17:23 · 本文部分内容由AI辅助创作

📚 Using Contingency Tables | 使用列联表

A contingency table is one of the most practical tools in A-Level statistics. It lets you organise two categorical variables and test whether they are associated or independent. This article walks through the key definitions, calculations and the chi-squared test for independence exactly as required by the Edexcel specification.

列联表是 A-Level 统计学中最实用的工具之一。它可以用来整理两个分类变量,并检验它们之间是否存在关联或相互独立。本文将围绕 Edexcel 考试要求,讲解关键定义、计算方法以及独立性卡方检验。


1. What Is a Contingency Table? | 什么是列联表?

A contingency table, also called a two-way table, displays the frequencies of two categorical variables. One variable is shown in rows and the other in columns. Each cell contains the observed frequency for a particular combination of categories.

列联表又称双向表,用来展示两个分类变量的频数。一个变量放在行中,另一个变量放在列中。每个单元格给出某一特定类别组合的观测频数。

For example, a table might classify 100 students by gender and by whether they enjoy mathematics. The purpose is to see whether the two variables are linked.

例如,一张表可以将 100 名学生按照性别和是否喜欢数学进行分类。目的是判断这两个变量之间是否存在联系。


2. Structure and Notation | 结构与符号

We usually write a two-way table with r rows and c columns. The observed frequency in cell (i, j) is labelled Oᵢⱼ. Row totals and column totals are called marginal totals, and the total of all observations is the grand total, denoted n.

通常我们把双向表写成 r 行和 c 列。单元格 (i, j) 中的观测频数记为 Oᵢⱼ。行合计与列合计称为边缘总计,所有观测值的总和称为总计,记为 n。

Column 1Column 2Row total
Row 1O₁₁O₁₂R₁
Row 2O₂₁O₂₂R₂
Column totalC₁C₂n

Using clear notation helps avoid errors when calculating expected frequencies and the test statistic later.

使用清晰的符号有助于在后面计算期望频数和检验统计量时避免出错。


3. Joint and Marginal Frequencies | 联合频数与边缘频数

Joint frequencies are the counts inside the body of the table. They show how many observations fall into each overlap of the two categories. Marginal frequencies are the row totals and column totals obtained by adding along each row or column.

联合频数是表格主体内的计数。它们表示每个两个类别组合中有多少个观测值。边缘频数是通过对每一行或每一列求和得到的行合计和列合计。

sum of all four joint frequencies, and it is also the sum of the two row totals or the two column totals.

对于 2 × 2 表,总计是所有四个联合频数之和,同时也是两个行合计或两个列合计之和。

Marginal frequencies are useful because they give the overall distribution of each variable separately, ignoring the other variable.

边缘频数很有用,因为它们给出每个变量单独的总体分布,而不考虑另一个变量。


4. Expected Frequencies | 期望频数

If the two variables are independent, the proportion in each column should be the same across all rows. On this basis, we calculate an expected frequency for each cell under the null hypothesis.

如果两个变量相互独立,那么每一列所占的比例在所有行中应该相同。基于这一点,我们在原假设下计算每个单元格的期望频数。

The expected frequency for cell (i, j) is given by:

单元格 (i, j) 的期望频数由下式给出:

Eᵢⱼ = (row total × column total) / grand total

In symbols, Eᵢⱼ = (Rᵢ × Cⱼ) / n, where Rᵢ is the total of row i and Cⱼ is the total of column j.

用符号表示为 Eᵢⱼ = (Rᵢ × Cⱼ) / n,其中 Rᵢ 是第 i 行的合计,Cⱼ 是第 j 列的合计。

Expected frequencies are usually not whole numbers. Do not round them too early when computing the test statistic.

期望频数通常不是整数。在计算检验统计量时不要过早四舍五入。


5. The Chi-Squared Statistic | 卡方统计量

The chi-squared statistic measures how far the observed frequencies are from the expected frequencies. A larger value means a bigger difference from independence.

卡方统计量衡量观测频数与期望频数之间的差距。数值越大,表示与独立性假设的偏离越大。

The formula is:

计算公式为:

χ² = Σ (Oᵢⱼ - Eᵢⱼ)² / Eᵢⱼ

In this formula, the sum is taken over all cells in the table. For each cell, subtract the expected frequency from the observed frequency, square the result, divide by the expected frequency, and then add these values.

在这个公式中,求和遍历表中的所有单元格。对于每个单元格,用观测频数减去期望频数,对结果平方,除以期望频数,然后将这些值相加。

If the observed and expected frequencies are very close, χ² will be small, suggesting independence. If they are far apart, χ² will be large, suggesting association.

如果观测频数和期望频数非常接近,χ² 就会很小,说明两个变量相互独立。如果它们相差很大,χ² 就会很大,说明存在关联。


6. Degrees of Freedom | 自由度

Degrees of freedom for a contingency table are calculated using the number of rows and columns. The formula is:

列联表的自由度通过行数和列数来计算。公式为:

df = (r - 1)(c - 1)

number of rows and c is the number of columns. For a 2 × 2 table, df = (2 - 1)(2 - 1) = 1.

其中 r 是行数,c 是列数。对于 2 × 2 表,df = (2 - 1)(2 - 1) = 1。

The degrees of freedom determine which chi-squared distribution to use when finding the critical value. Using the wrong df is a common exam error.

自由度决定在查找临界值时使用哪一种卡方分布。使用错误的自由度是考试中的常见错误。

For a given significance level, a larger df gives a larger critical value. This reflects the extra flexibility in larger tables.

在给定显著性水平下,自由度越大,临界值也越大。这反映了较大表格中额外的灵活性。


7. Chi-Squared Test for Independence | 独立性卡方检验步骤

The chi-squared test for independence follows a standard hypothesis test structure. The null hypothesis is always that the two variables are independent.

独立性卡方检验遵循标准的假设检验步骤。原假设始终是两个变量相互独立。

Step 1: State the hypotheses.

第一步:陈述假设。

Step 2: Calculate the expected frequency for every cell using Eᵢⱼ = (Rᵢ × Cⱼ) / n.

第二步:使用公式 Eᵢⱼ = (Rᵢ × Cⱼ) / n 计算每个单元格的期望频数。

Step 3: Compute the chi-squared statistic using the formula above.

第三步:使用上述公式计算卡方统计量。

Step 4: Find the critical value from the chi-squared table at the given significance level and df.

第四步:在给定显著性水平和自由度下从卡方分布表查找临界值。

Step 5: Compare the test statistic with the critical value. If χ² is greater than the critical value, reject H₀ and conclude that there is evidence of an association.

第五步:比较检验统计量与临界值。如果 χ² 大于临界值,则拒绝 H₀,得出结论认为存在关联的证据。

You may also use the p-value approach: if p-value is less than the significance level, reject H₀.

也可以使用 p 值方法:如果 p 值小于显著性水平,则拒绝 H₀。


广告 / Sponsored

8. Conditions and Assumptions | 条件与假设

The chi-squared test for independence is based on an approximation, so certain conditions must be met. The most important is that all expected frequencies should be at least 5.

独立性卡方检验基于一种近似分布,因此必须满足某些条件。最重要的一点是所有期望频数都应至少为 5。

If some expected frequencies are below 5, the approximation may not be reliable. In that case, you may need to combine categories or use a different test.

如果某些期望频数低于 5,近似分布可能不可靠。在这种情况下,可能需要合并类别或使用其他检验方法。

The data must also come from a random sample, and the observations must be independent. The variables must be categorical, not continuous measurements.

数据还必须来自随机样本,并且观测值必须相互独立。变量必须是分类变量,而不是连续测量值。

Always use frequencies rather than percentages or proportions in the table. Using percentages will give an incorrect value of n and invalidate the test.

表格中必须使用频数而不是百分比或比例。使用百分比会得到错误的 n 值,从而使检验无效。


9. Worked Example | 例题解析

Example: A survey of 100 students asks whether they enjoy mathematics. The results are shown below. Test at the 5% significance level whether gender and attitude to mathematics are independent.

例题:对 100 名学生进行调查,询问他们是否喜欢数学。结果如下表所示。在 5% 显著性水平下检验性别与数学态度是否相互独立。

Enjoy mathsDo not enjoyRow total
Boys321850
Girls242650
Column total5644100

Hypotheses: H₀: gender and attitude are independent. H₁: gender and attitude are not independent.

假设:H₀:性别与态度相互独立。H₁:性别与态度不独立。

= 28, E₁₂ = (50 × 44) / 100 = 22, E₂₁ = (50 × 56) / 100 = 28, E₂₂ = (50 × 44) / 100 = 22.

期望频数为:E₁₁ = (50 × 56) / 100 = 28,E₁₂ = (50 × 44) / 100 = 22,E₂₁ = (50 × 56) / 100 = 28,E₂₂ = (50 × 44) / 100 = 22。

All expected frequencies are at least 5, so the test is valid.

所有期望频数都至少为 5,因此检验有效。

χ² = (32 - 28)² / 28 + (18 - 22)² / 22 + (24 - 28)² / 28 + (26 - 22)² / 22

χ² = 0.5714 + 0.7273 + 0.5714 + 0.7273 ≈ 2.60

Degrees of freedom: df = (2 - 1)(2 - 1) = 1. The critical value at the 5% level with 1 df is 3.841.

自由度:df = (2 - 1)(2 - 1) = 1。在 5% 显著性水平下,自由度为 1 时临界值为 3.841。

Since 2.60 < 3.841, we do not reject H₀. There is insufficient evidence at the 5% level to suggest an association between gender and attitude to mathematics.

由于 2.60 < 3.841,我们不能拒绝 H₀。在 5% 显著性水平下,没有足够证据表明性别与数学态度之间存在关联。


10. Common Mistakes | 常见错误

One common mistake is using observed frequencies instead of expected frequencies in the denominator of the chi-squared formula. The denominator must be Eᵢⱼ, not Oᵢⱼ.

一个常见错误是在卡方公式的分母中使用观测频数而不是期望频数。分母必须是 Eᵢⱼ,而不是 Oᵢⱼ。

ng degrees of freedom incorrectly. For a 3 × 2 table, df = (3 - 1)(2 - 1) = 2, not 3 or 5.

另一个错误是计算自由度不正确。对于 3 × 2 表,df = (3 - 1)(2 - 1) = 2,而不是 3 或 5。

Students sometimes forget to check that all expected frequencies are at least 5 before carrying out the test. This condition is part of the statistical justification.

学生有时会忘记在检验前检查所有期望频数是否至少为 5。这一条件是统计论证的一部分。

Failing to state a conclusion in context is also a common error. Always refer back to the original variables when rejecting or not rejecting H₀.

未能根据上下文得出结论也是常见错误。在拒绝或不拒绝 H₀ 时,务必回扣原始变量。


11. Exam Tips | 考试技巧

Show all expected frequency calculations clearly. Even if the final chi-squared value is wrong, method marks are often available for correct expected frequencies.

清楚地展示所有期望频数的计算过程。即使最终的卡方值错误,正确的期望频数通常也能得到方法分。

Quote the critical value from the table and write it down before making the comparison. This makes your conclusion easier to follow.

从表格中查得临界值,并在比较之前写下来。这样你的结论更容易被理解。

he degrees of freedom explicitly. Examiners look for df = (r - 1)(c - 1) in your solution.

明确写出自由度。阅卷人会在你的解答中寻找 df = (r - 1)(c - 1)。

Use the correct notation: χ², Oᵢⱼ and Eᵢⱼ. Avoid confusing O and E, as this can cost accuracy marks.

使用正确的符号:χ², Oᵢⱼ 和 Eᵢⱼ。避免混淆 O 和 E,因为这可能扣掉准确度分。

Always write a final conclusion in context, for example "there is evidence at the 5% level of an association between..."

务必根据上下文写出最终结论,例如“在 5% 显著性水平下,有证据表明……之间存在关联”。


12. Summary | 总结

A contingency table is used to test whether two categorical variables are independent. The chi-squared statistic compares observed and expected frequencies, and the test requires all expected frequencies to be at least 5.

列联表用于检验两个分类变量是否相互独立。卡方统计量比较观测频数和期望频数,并且检验要求所有期望频数至少为 5。

The key formulas are Eᵢⱼ = (Rᵢ × Cⱼ) / n, χ² = Σ (Oᵢⱼ - Eᵢⱼ)² / Eᵢⱼ, and df = (r - 1)(c - 1).

关键公式为 Eᵢⱼ = (Rᵢ × Cⱼ) / n、χ² = Σ (Oᵢⱼ - Eᵢⱼ)² / Eᵢⱼ 以及 df = (r - 1)(c - 1)。

If the chi-squared statistic exceeds the critical value, we reject independence and conclude that there is an association. Otherwise, we do not have enough evidence to reject independence.

如果卡方统计量超过临界值,我们就拒绝独立性,并得出存在关联的结论。否则,我们没有足够证据拒绝独立性。

Published by TutorHao | Mathematics Revision Series | aleveler.com

广告 / Sponsored
培生爱德思考试教材 统计数学3 Edexcel International A Level Mathematics S…
数学 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥156.0

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao