Two Categorical Variables · 两个分类变量
| English | 中文 | Pinyin · 拼音 |
|---|---|---|
| categorical/ˌkætɪˈɡɒrɪkl/ | 分类 | fēn lèi |
| two-way table/tuː weɪ ˈteɪbl/ | 双向表 | shuāng xiàng biǎo |
| contingency table/kənˈtɪndʒənsi ˈteɪbl/ | 列联表 | liè lián biǎo |
| conditional relative frequency/kənˈdɪʃənl ˈrelətɪv ˈfriːkwənsi/ | 条件相对频率 | tiáo jiàn xiāng duì pín lǜ |
| segmented bar chart/seɡˈmentɪd bɑː tʃɑːt/ | 分段条形图 | fēn duàn tiáo xíng tú |
Two categories at once
- Sometimes both variables are categorical 分类 — like gender and favorite subject.
- Organize them in a two-way table 双向表 (also called a contingency table 列联表).
- Rows are the categories of one variable; columns are the categories of the other.
- Each cell holds the count of individuals in that row-and-column combination.
同时看两个类别
- 有时两个变量都是分类的——比如性别和最喜欢的科目。
- 把它们组织进一张双向表(也叫列联表)。
- 行是一个变量的类别;列是另一个变量的类别。
- 每个单元格装着落在该行该列组合里的人数。
Marginal and joint
- The margins (row and column totals) give marginal frequencies — one variable, ignoring the other.
- A single inner cell gives a joint frequency — both categories at once.
- Divide by the grand total to get relative frequencies (proportions).
- Marginal relative frequency = a total ÷ grand total; joint = a cell ÷ grand total.
边际频率与联合频率
- 边际(行合计与列合计)给出边际频率——只看一个变量,忽略另一个。
- 单个内部单元格给出联合频率——同时看两个类别。
- 除以总计数即得相对频率(比例)。
- 边际相对频率 = 某个合计 ÷ 总计数;联合 = 某个单元格 ÷ 总计数。
Conditional relative frequency
- A conditional relative frequency 条件相对频率 restricts attention to one group, then finds a proportion inside it.
- "Of the girls, what fraction chose science?" — divide that cell by the girls' row total.
- The key is the denominator: a row total (or a column total), not the grand total.
- Conditionals are how we compare groups fairly, even when the groups differ in size.
条件相对频率
- 条件相对频率只把注意力限制在一个组内,再在其中求一个比例。
- “在女生中,选科学的占多少?”——把那个单元格除以女生这一行的合计。
- 关键是分母:用行合计(或列合计),而不是总计数。
- 条件频率让我们公平地比较各组,即使各组人数不同。
Showing it as bars
- A side-by-side bar chart puts each group's bars next to each other for comparison.
- A segmented bar chart 分段条形图 stacks the proportions within each group into one full bar.
- Segmented bars are ideal for comparing conditional distributions — each bar sums to $100\%$.
- If the segments line up the same in every bar, the variables look unrelated.
用条形展示
- 并排条形图把每组的条形并排放在一起以便比较。
- 分段条形图把每组内部的比例堆成一整根条。
- 堆叠条最适合比较条件分布——每根条都合计为 $100\%$。
- 如果每根条里的分段排布都一样,这两个变量看起来就是不相关的。
The three "frequencies" differ only in their denominator. Joint = cell ÷ grand total. Marginal = a row/column total ÷ grand total. Conditional = cell ÷ that row (or column) total. Mixing them up is the classic two-way-table mistake — always ask "a fraction of what group?" before you divide.
这三种“频率”只在分母上不同。联合 = 单元格 ÷ 总计数。边际 = 某个行/列合计 ÷ 总计数。条件 = 单元格 ÷ 那个行(或列)合计。把它们弄混是双向表的经典错误——除之前先问一句“是哪个组的比例?”。
$100$ students: of $60$ girls, $36$ chose science; of $40$ boys, $16$ chose science.
- Joint (girl and science): $36/100 = 36\%$.
- Marginal (science overall): $(36+16)/100 = 52\%$.
- Conditional (science given girl): $36/60 = 60\%$ — note the denominator is the girls' total.
$100$ 名学生:$60$ 名女生中有 $36$ 人选科学;$40$ 名男生中有 $16$ 人选科学。
- 联合(女生且科学):$36/100 = 36\%$。
- 边际(总体选科学):$(36+16)/100 = 52\%$。
- 条件(在女生条件下选科学):$36/60 = 60\%$——注意分母是女生的合计。
A two-way (contingency) table cross-classifies two categorical variables. Joint and marginal relative frequencies divide by the grand total; a conditional relative frequency divides a cell by its row or column total. Display the relationship with a side-by-side or segmented bar chart.
双向表(列联表)把两个分类变量交叉分类。联合与边际相对频率都除以总计数;条件相对频率把单元格除以它的行或列合计。用并排或分段条形图来展示这种关系。
A categorical breakdown · 一个分类的构成
Each slice is one category's share of the whole. · 每一块是某一类别在整体中所占的份额。
A table that cross-classifies two categorical variables is a ___ table (two words, first word). · 把两个分类变量交叉分类的表叫做 ___ 表(两个词,填第一个词)。
A two-way (contingency) table. · 双向表(列联表)。
Of 60 girls, 36 chose science. What is the conditional relative frequency of science given girl (as a decimal)? · 60 名女生中有 36 人选科学。在“女生”条件下选科学的条件相对频率是多少(用小数)?
36 ÷ 60 = 0.60 — divide by the girls' row total. · 36 ÷ 60 = 0.60——除以女生这一行的合计。
A joint relative frequency divides a single cell by the ___. · 联合相对频率是把单个单元格除以 ___。
Joint = cell ÷ grand total; conditional uses a row/column total. · 联合 = 单元格 ÷ 总计数;条件才用行/列合计。
In a segmented bar chart comparing groups, each bar sums to 100%. · 在比较各组的堆叠条形图中,每根条都合计为 100%。
Segmented bars show conditional distributions, each totaling 100%. · 堆叠条展示条件分布,每根合计为 100%。
Match each frequency to its denominator. · 把每种频率与它的分母配对。
Only conditional uses a group (row/column) total as the denominator. · 只有条件频率用某组(行/列)合计作分母。