Professional Documents
Culture Documents
CP2403 - Module 6
CP2403 - Module 6
Not yet
So we use Chi Square Test
Break for probability
Example - Dice
One Die
What is the probability of getting 1?
What is the probability of getting 2?
What is the probability of getting 3?
What is the probability of getting 4?
What is the probability of getting 5?
What is the probability of getting 6?
One Die Example
• A single 6-sided die is rolled. What is the probability of rolling a 2 or a 5?
𝐶𝑜𝑙𝑢𝑚𝑛𝑡𝑜𝑡𝑎𝑙∗𝑅𝑜𝑤𝑇𝑜𝑡𝑎𝑙
𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑𝐶𝑜𝑢𝑛𝑡=
Observed Expected if the hypothesis was true
Gender Yes No Total Gender Yes No Total
Male 77 404 481 Male 72.3 (526*481)/619 481
= 408.7
Female 16 122 138
𝑇𝑎𝑏𝑙𝑒 𝑇𝑜𝑡𝑎𝑙
Female (93*138)/619 (526*138)/619 138
Total 93 526 619 = 20.7 = 117.3
Total 93 526 619
2
(𝑂𝑏𝑠𝑒𝑟𝑣𝑒𝑑 𝐶𝑜𝑢𝑛𝑡 − 𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝐶𝑜𝑢𝑛𝑡)
χ =∑ 𝑎𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
Chi Square Stats
2
𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝐶𝑜𝑢𝑛𝑡
Step 1:
Null hypothesis (Ho):
Rate of smoking in nicotine dependent young person
= Rate of smoking in non-nicotine dependent young person
• 41 people of daily
smoker are not
nicotine dependent
• 27 people of daily
smoker are nicotine
dependent
Hypothesis Testing
• % of nicotine
dependence
3. Assess the evidence (Cross tab - % & χ2 ) increase with
amount of
cigarette
• p < 0.05
Step 4: Draw conclusion
Reject (Rate of smoking in nicotine dependent young person
= Rate of smoking in non-nicotine dependent young person)
• python demo
Post hoc tests
Post hoc tests
• There are significantly more cases of nicotine dependence in young people who
• smoke 14 days a month than those who smoke once a month
• smoke 22 days a month than those who smoke once a month
• smoke 30 days a month than those who smoke once a month
• smoke 30 days a month than those who smoke 2.5 days a month
• smoke 30 days a month than those who smoke 5 days a month
• smoke 30 days a month than those who smoke 14 days a month
• smoke 30 days a month than those who smoke 22 days a month
Summary of Module 6
• Chi-Square Test of Independence
• Post hoc test
Prac 6 Overview