Carrying Out a Two-Way Chi-Square Test
Introduzido
7:48
Inferência para Dados Categóricos: Qui-Quadrado
Jogue um dado justo sessenta vezes. Cada face deve sair dez vezes. Mas nunca acontece — oito aqui, treze ali. As lacunas sempre estão lá. Então jogue outra…
Narração em inglês · legendas em inglês e 中文 que você pode alternar
Nesta aula
| English | Significado |
|---|---|
| independent random samples | |
| chi-square test for a two-way table | |
| variable/ˈveərɪəbl/ | A characteristic recorded for each individual, such as height or eye colour. |
| test for homogeneity/test fɔː ˈhɒməʊdʒneɪti/ | A chi-square test of whether several populations share one distribution. |
| distribution/ˌdɪstrɪˈbjuːʃn/ | The pattern of values or outcomes and their frequencies or probabilities. |
| population/ˌpɒpjʊˈleɪʃn/ | The entire set of individuals, items or outcomes about which a statistical study seeks information. |
| test for independence/test fɔː ˌɪndɪˈpendəns/ | A chi-square test of whether two variables are associated in one population. |
| association/əˌsəʊsɪˈeɪʃn/ | A relationship between two variables. |
| expected counts/ekˈspektɪd kaʊnts/ | |
| hypotheses | |
| Large counts | |
| cells/selz/ | |
| p-value/piː ˈvæljuː/ | |
| categories | |
| right-tail area |
Calcular a estatística
- A estatística qui-quadrado é a mesma soma sobre todas as células da tabela:
-
$$\chi^2 = \sum \frac{(\text{observed} - \text{expected})^2}{\text{expected}}$$
- Use a contagem observada de cada célula e sua contagem esperada de 8.4.
- Some todos os termos das células em um único $\chi^2$.

Encontrar o p-valor
- Use a distribuição qui-quadrado com $df = (\text{rows}-1)(\text{columns}-1)$.
- O p-valor é a área da cauda direita além do seu $\chi^2$.
- Um grande $\chi^2$ → pequeno valor-p → forte evidência contra $H_0$.
- Obtenha o $df$ correto da forma da tabela, não do tamanho da amostra.

Distribuição qui-quadrado: o valor-p é a cauda direita além do estatístico de teste
A school surveys one random sample of 300 students and records each student's year group and favourite sport. Which test fits?
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
One sample with two categorical variables per student → independence. Separate samples from each year group would be homogeneity.
Este cartão foi corrigido, por isso aparece em inglês até que a tradução seja atualizada.
Worked test: State and Plan
State. $H_0$: the distribution of main news source is the same for adults under 40 and adults aged 40 or older in this city. $H_a$: the distributions differ. $\alpha=0.05$.
Plan. Chi-square test for homogeneity.
- Random: independent random samples from each age group.
- 10%: Assume each age group in the city has at least 1,000 adults, so 100 is no more than 10% of each group.
- Large counts 大频数条件: expected count $=\dfrac{\text{row total}\times\text{column total}}{\text{table total}}$. Each row total is 100, so the expected counts are $\frac{100\times60}{200}=30$, $\frac{100\times115}{200}=57.5$, $\frac{100\times25}{200}=12.5$ in each row; all at least 5.
In a two-way table with total 400, a row total is 160 and a column total is 90. Find the expected count for that cell.
Dificuldade 2/5 · Moedas 140 + pequeno bônus na primeira conclusão hoje
(row total × column total) ÷ table total = 160 × 90 ÷ 400 = 36.
Concluir no contexto
- Para homogeneidade: "evidências convincentes de que as distribuições diferem entre os grupos" (se rejeitado).
- Para independência: "evidências convincentes de que as duas variáveis estão associadas" (se rejeitado).
- Nomeie as variáveis/grupos e o contexto real.
- Não rejeitar nunca prova que os grupos são iguais / variáveis independentes.
χ² ≈ 13.10 with df = 2
$df=(r-1)(c-1)$
Read the worked test's p-value as the right-tail area beyond 13.10 on the df = 2 curve, about 0.0014. Change df to see why the curve must match the table.
With χ² = 6.0 at df = 1, the p-value ≈ 0.014. At α = 0.05, the decision is...
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
0.014 ≤ 0.05 → reject H0.
The p-value for a two-way chi-square test is a right-tail area.
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Chi-square is always right-tailed.
For a 3×4 two-way table, find the degrees of freedom (r−1)(c−1).
Dificuldade 2/5 · Moedas 140 + pequeno bônus na primeira conclusão hoje
(3−1)(4−1) = 2×3 = 6.
Redija a conclusão para corresponder ao teste. Rejeitar em um teste de homogeneidade → as distribuições dos grupos diferem; rejeitar em um teste de independência → as variáveis estão associadas. Não diga "as variáveis estão relacionadas" para um desenho de homogeneidade, ou "os grupos diferem" para um desenho de independência — a matemática é compartilhada, mas a afirmação não é.

In the news-source test, which statement best describes the difference between the age groups?
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
The TV cells give the largest terms (3.33 each). Observational data show a difference, not a cause.
Um teste de independência $2\times2$ resulta em $\chi^2 = 6.0$, $df = 1$, $\alpha = 0.05$.
- p-valor: área da cauda direita além de $6.0$ em $df=1 \approx 0.014$.
- Decidir: $0.014 \le 0.05$ → rejeite $H_0$.
- Concluir: evidências convincentes de que as duas variáveis estão associadas (no contexto).
Rejecting H0 in a test of INDEPENDENCE means...
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Independence: reject → the variables are associated.
Rejecting H0 in a test of HOMOGENEITY means...
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Homogeneity: reject → the group distributions differ.
A chi-square test for independence of "owns a pet" and "exercises daily" in a random sample of adults gives p = 0.31 (α = 0.05). Write the conclusion.
A large p-value means weak evidence, not proof of independence.
Calcule $\chi^2 = \sum \frac{(\text{observed}-\text{expected})^2}{\text{expected}}$ sobre todas as células, encontre o p-valor da cauda direita em $df = (\text{rows}-1)(\text{columns}-1)$, e compare com $\alpha$. Redija a conclusão para corresponder ao desenho: distribuições diferem (homogeneidade) ou variáveis associadas (independência), no contexto.
Escreva a partir de 4 graus de liberdade
- Um teste qui-quadrado usa uma tabela 3 por 3.
- O estatístico da lição 6 é um valor qui-quadrado calculado, não os graus de liberdade desta tabela.
Este cartão é novo, por isso aparece em inglês até que a tradução esteja pronta.
- The design decides the test, not the table. The same table could come from one sample (independence) or several samples (homogeneity).
- df uses rows and columns of categories 类别, not the totals row or column: a $2\times3$ table has $df=2$.
- Expected counts are usually not whole numbers (57.5 is fine). Never round them to make the check pass.
Este cartão é novo, por isso aparece em inglês até que a tradução esteja pronta.
A two-way chi-square test compares observed and expected counts in every cell: $\chi^2=\sum\frac{(\text{O}-\text{E})^2}{\text{E}}$, with $\text{E}=\frac{\text{row total}\times\text{column total}}{\text{table total}}$ and $df=(r-1)(c-1)$; the p-value is the right-tail area 右尾面积. Several samples → homogeneity (distributions differ?); one sample, two variables → independence (association?). Conclude in context and use the largest terms to say where the difference lies.
O que deu errado? Somente a equipe do site vê isso.