Upload
letitia-wright
View
215
Download
0
Embed Size (px)
Citation preview
The Chi-Square Test
Used when both outcome and exposure variables are binary (dichotomous) or even multichotomousAllows the researcher to calculate a p-value associated with relative risks (RR) and odds ratio (OR)Simplest for is a 2 x 2 contingency tableObtain a set of expected values and compare observed to expected
How does chi-square work?
Compares the observed 2 x 2 table to a theoretical table (“expected”) that would occur if the null hypothesis (H0) were true
Diseased Not diseased
Exposed O11 O12
Not exposed O21 O22
Diseased Not diseased
Exposed E11 E12
Not exposed E21 E22
?
i i
iiobs E
EO 22 )(
Observed Expected under H0
Calculating the “expected” table
Diseased Not diseasedExposed O11 O12
Not exposed O21 O22
O11 + O12 = R1
O21 + O22 = R2
O12 + O22 = C2O11 + O21 = C1 ΣOi = N
Start with observed table
Diseased Not diseasedExposed E11 = R1C1/N E12 = R1C2/N
Not exposed E21 = R2C1/N E22 = R2C2/N
Calculate the expected table
Chi-square test from breast cancer study
Set alpha value: let’s use 0.05State H0 and HA.H0: There is no association between race and breast cancer status.(The proportion of Whites is the same in cases and controls)
pcases = pcontrolswhere p = proportion white
Null and alternate hypotheses
Null hypothesis (H0):There is no association between race and breast cancer status.(The proportion of Whites is the same in cases and controls.)
pcases = pcontrols
Alternate hypothesis (HA):There is an association between race and breast cancer status.(The proportion of Whites is the different in cases and controls.)
pcases ≠ pcontrols
Calculating expected table
Cases ControlsWhite 677 905Black 272 619
Start with observed table
Calculate the expected table
1582
Cases ControlsWhite 1582*949/2473 = 607.1 1582*1524/2473 = 974.9Black 891*949/2473 = 341.9 891*1524/2473 = 549.1
891
1524949 2473
Calculate chi-square statistic
i i
iiobs E
EO 22 )(
Cases ControlsWhite 677 905Black 272 619
Cases ControlsWhite 607.1 974.9Black 341.9 549.1
χ2 = (677-607.1)2/607.1 + (905-974.9)2/974.9+ (272-341.9)2/341.9 + (619-549.1)2/549.1
χ2 = 36.2
( O11 – E11 )2 / E11
Chi-square distributions
Test statistic = 36.2Compare to a known χ2 distribution to get p-valueNeed to know degrees of freedom
= (rows – 1)*(columns – 1) In this case, d.f. = (2 – 1)(2 – 1) = 1*1 = 1
Chi-square value
Prob
abili
ty
2 4
Critical value for 1 d.f. = 3.84 (where alpha = 0.05) Rejection
region for H0
Our chi square statistic = 36.2
Chi-square table and interpretation
Examine the list of values and associated p-values from column with 1 degree of freedomFor an observed χ2 of 36.2, the associated p-value is < 0.001.
Since p < α, we reject H0 and conclude that there is an
association between race and outcome (case/control) status.
Chi-square caveat #1
What about tables that are larger than 2x2?
If there is a statistically significant association (i.e. p < α), we don’t know among which group(s) the association(s) occur(s).Need to conduct individual 2 x 2 χ2 analyses to determine if/where the association(s) exist.
(…which is < α)
What about very small sample sizes?Answer: Chi-square is not an appropriate test if 20% or more of the cells (i.e. 1 or more cells in a 2x2 table) have expected counts of less than 5.Solution: Use Fisher’s exact test
Based on permutations, not on a theorized distribution
Chi-square caveat #2