You are on page 1of 4

Use chi-square to test for association between categorical variables Example: Is a drug effective at curing a disease?

Outcome observed (cells C12:D13): Drug Placebo Cured 50 0 Not cured 0 50

In this case, we observe that all the patients who received the drug were cured, while none of the patients who received the placebo were cured, If there were no assocation between drug and cure, we'd expect half of each group to be cured, and half not to be cured Outcome expected by chance (cells C21:D22): Cured Not cured Drug 25 25 Placebo 25 25

The chi-squared test examines the difference between the observed outcome and the outcome expected by chance, and tells us the probability that the observed outcome would have occurred in the absence of any true association (between durg and cure in this case). Use the Excel workbook CHITEST function: The chitest function requires that we specify the observed data (C12:D13) and the expected values (C21:D22) =CHITEST(C9:D10,C18:D19) p-value = 1.52397E-23

How to calculate the expected value in each cell and get the p-value using chi-square 1. Calculate the row totals, column totals, and grand total for the observed data Cured Not cured Row Total Drug 30 13 43 Placebo 11 30 41 Column Total 41 43 84 <= Grand total 2. Calculate expected value for each cell as (row total * column total / grand total) Cured Not cured Row Total Drug 20.988095 22.01190476 43 Placebo 20.011905 20.98809524 41 Column Total 41 43 84 <= Grand total 3. Calculate the p-value for the chi-square test p-value= =CHITEST(C36:D37,C42:D43) p-value= 8.3076E-05

values (C21:D22)

Stanton Glantz. Primer of Biostatistics Chapter 5. How to analyze rates and proportions Example: efficacy of low-dose aspirin in preventing blood clots (thrombus) Outcome observed (cells C12:D13): Thrombus No thrombus Placebo 18 7 Aspirin 6 13 In this case, we observe that all the patients who received the drug were cured, while none of the patients who received the placebo were cured, If there were no assocation between drug and cure, we'd expect half of each group to be cured, and half not to be cured Outcome expected by chance (cells C21:D22): Thrombus No thrombus Placebo 13.6 11.4 Aspirin 10.4 8.6

The chi-squared test examines the difference between the observed outcome and the outcome expected by chance, and tells us the probability that the observed outcome would have occurred in the absence of any true association (between durg and cure in this case). Use the Excel workbook CHITEST function: The chitest function requires that we specify the observed data (C12:D13) and the expected values (C21:D22) =CHITEST(C9:D10,C18:D19) p-value = 0.007647977

How to calculate the expected value in each cell and get the p-value using chi-square 1. Calculate the row totals, column totals, and grand total for the observed data Thrombus No thrombus Row Total Placebo 18 7 25 Aspirin 6 13 19 Column Total 24 20 44 <= Grand total 2. Calculate expected value for each cell as (row total * column total / grand total) Thrombus No thrombus Row Total Placebo 13.6 11.4 25 Aspirin 10.4 8.6 19 Column Total 24 20 44 <= Grand total 3. Calculate the p-value for the chi-square test p-value= =CHITEST(C36:D37,C42:D43) p-value= 0.007647977

values (C21:D22)

You might also like