Académique Documents
Professionnel Documents
Culture Documents
Lesson 12
Chi-square test
McNemars Test
Chi-square test
Contingency Tables
The null hypothesis for this test is that the 2 proportions are equal.
The alternative hypothesis is that the proportions are not equal (test for
a difference in either direction)
PubH 6414 Lesson 12
Level=1 Level=2 .
( x ij e ij ) 2
e ij
Chi-square Test:
Testing for Independence
Racial differences and cardiac arrest.
An Example
~ 2 with df = ( I 1 )( J 1 )
Level=J
Level=I
Chi-square Test:
Testing for Independence
2 =
Chi-square Test:
Testing for Independence
Chi-square Test:
Testing for Independence
Scientific Hypothesis:
An association exists between race (AfricanAmerican/Caucasian) and survival to hospital
discharge (Yes/No) in cases of non-traumatic
out-of-hospital cardiac arrest.
Statistical Hypothesis:
Race
YES NO
Total
Caucasian
84
3123
3207
AfricanAmerican
Total
24
2886
2910
108 6009
6117
Chi-square Test:
Testing for Independence
1.
2.
3.
Chi-square Test:
Testing for Independence
4.
5.
10
2 Distribution
12
16
20
Since the Chi-square distribution is always positive, the rejection region is only in the right tail
PubH 6414 Lesson 12
11
12
13
Chi-squared Test:
Testing for Independence
Chi-square Test:
Testing for Independence
Survival to Discharge
Race
YES
Caucasian
NO
14
Survival to Discharge
Total
Race
YES
84
3123
56.62
3207
Caucasian
84
3123
3207
56.62 3151.43
AfricanAmerican
24
2886
2910
AfricanAmerican
24
2886
2910
51.38 2854.82
Total
108
6009
6117
Total
108
NO
6009
Total
6117
Chi-square Test:
Testing for Independence
(84
( x ij e ij ) 2
e ij
56 . 62
56 . 62
16
Chi-square Test:
Testing for Independence
= 13 . 24 + 0 . 26 + 14 . 59 + . 34 = 28 . 42
17
18
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
Example
Patients with evolving myocardial infarction were assigned
independently and randomly to one of four thrombolytic treatments,
and then followed to determine 30 day mortality.
30 day
outcome
Accelerated t-PA
Streptokinase
Total
with IV Heparin
Survived
9091
9609
9692
9605
37997
Died
705
768
652
723
2848
Total
9796
10377
10344
10328
40845
19
20
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
Example
Example
30 day
outcome
Accelerated t-PA
Streptokinase
Total
with IV Heparin
Survived
9091
9112.95
9609
9692
9605
37997
Died
705
768
652
723
2848
Total
9796
10377
10344
10328
40845
30 day
outcome
Accelerated t-PA
Streptokinase
Total
with IV Heparin
Survived
9091
9112.95
9609
9653.44
9692
9622.74
9605
9607.86
37997
Died
705
683.05
768
723.56
652
721.26
723
720.14
2848
Total
9796
10377
10344
10328
40845
22
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
( x ij e ij ) 2
e ij
~ 2 with df = ( I 1 )( J 1 )
P(2
>
2 =
X 2)
23
( x ij e ij ) 2
e ij
= 10 . 85 with df = ( 2 1 )( 4 1 ) = 3
24
Chi-square Test:
Testing for Equality or Homogeneity
of Proportions
Chi-Square Testing
Independence
Requirements:
25
27
29
28
Requirements:
Chi-Square Testing:
Rules of Thumb
Equality
30
a+b
c+d
a+c
b+d
Probability
0.353
0.0147
18
= 0.132
32
13
18
Pr = 0.0147
II
13
Pr = 0.132
III
18
13
VI
9
9
18
8
13
9
9
18
Pr = 0.132
9
13
2
5
Pr = 0.353
Pr = 0.353
IV
9
9
18
13
Pr = 0.0147
18
34
0.0147
IV
13
0.132
III
0
II
33
0.5
31
0.353
9! 9! 13! 5!
136080
=
18! 1! 8! 4! 5!
1028160
VI
Table
35
36
www.graphpad.com/quickcalcs/contingency1.cfm
PubH 6414 Lesson 12
37
Control
Case
Exposed
Unexposed
Exposed
Unexposed
a
c
b
d
40
39
38
41
42
46
(b c )2
b+c
44
45
2 =
McNemar Statistic
After treatment
+
+
a
b
c
d
McNemars test
43
Before
treatment
47
48
49
Smoking
Twin
Died 2nd
17
Died 1st
Died 2nd
51
2 =
P-value = 0.01
=CHIDIST(6.54, 1)
PubH 6414 Lesson 12
(b c)
(17 5)
=
= 6.54
b+c
17 + 5
2
52
McNemar test
50
Died 1st
53
54
http://www.graphpad.com/quickcalcs/McNemar1.cfm
55
Reading
56
10