Professional Documents
Culture Documents
2
𝑜𝑏𝑠𝑒𝑟𝑣𝑒𝑑 # − 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 #
𝜒2 =
𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 #
Chi-square test for statistical independence
• The null hypothesis is always “the two variables/outcomes are not
related”
• 𝐻0 : 𝑡ℎ𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑜𝑏𝑠𝑒𝑟𝑣𝑎𝑡𝑖𝑜𝑛𝑠 𝑖𝑛 𝑡ℎ𝑒 𝑖𝑛𝑡𝑒𝑟𝑠𝑒𝑐𝑡𝑖𝑜𝑛 =
𝑡ℎ𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑡ℎ𝑎𝑡 𝑤𝑜𝑢𝑙𝑑 𝑏𝑒 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑖𝑓 𝑡ℎ𝑒 𝑡𝑤𝑜 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝑎𝑟𝑒 𝑖𝑛𝑑𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑡
• 𝐻1 : 𝑡ℎ𝑒 𝑡𝑤𝑜 𝑛𝑢𝑚𝑏𝑒𝑟𝑠 𝑎𝑟𝑒 𝑛𝑜𝑡 𝑒𝑞𝑢𝑎𝑙
• The Chi-square distribution is always positive, and its shape depends
on the degrees of freedom. As the degree of freedom increases, the
Chi-square distribution gets closer to the normal distribution
• The degrees of freedom are the number of rows – 1 times the
number of columns – 1 ([rows – 1] X [cols – 1])
Chi-square distribution
Chi-square test for statistical independence
• We then pick our level of significance,
𝛼, and obtain the critical value from
the Chi-square table using the degrees
of freedom and 𝛼
• We reject the null hypothesis if our 𝜒 2
is greater than the critical value
𝑜𝑏𝑠𝑒𝑟𝑣𝑒𝑑 # − 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 # 2
𝜒2 =
𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 #
Example
• The degrees of freedom =([rows
– 1] X [cols – 1])= (2-1)*(2-1) = 1
• The critical value for 𝛼 = .05 is
3.84
• We cannot reject the null
hypothesis that gender and birth
weight are independent
Using Stata
List of Stata commands
• Tests for two means
• ttest var, by(groupvar)
• Chi-square test for independence
• Tabulate var1 var2, chi
Assignments
• Read about two-sample inference and chi-square test for
independence
• Smith: 8, 10; and
• Shaefer & Zhang: 9, 11.1, or OpenIntro: 5.2, 5.3, 5.4, 6.2, 6.4, 6.6.1
• (Optional) Practice on these problems
• OpenIntro: 5.27, 5.29, 5.35*, 6.25, 6.27, 6.35