Download presentation
Presentation is loading. Please wait.
Published byDangelo Lynde Modified over 10 years ago
1
Contingency Tables
2
Basic Concepts 2 categories: (A (rows): possible outcomes A 1, A 2, … A r ; B (columns): possible outcomes B 1, B 2 …, B c ) Assume the categories are independent unless it can be shown otherwise If categories are independent – the probability that event ij occurs (that is A i and B j occur simultaneously) = P(A i )P(B j ) –If there are n total observations, the total expected occurrences of event ij is e ij = n*(P(A i )P(Bj))
3
Best Estimates for P(A i ) and P(B j ) From the sample suppose n i = number of times event A i occurs and n j = number of times B j occurs Then, –P(A i ) n i /n and P(B j ) n j /n Thus e ij = n(n i /n)(n j /n) = n i n j /n or,
4
Tables Suppose there were 524 total observations. 82 were observed to be A 2 and 80 were observed to be B 3. Contingency Table entry e 23 if H 0 were true 82*80/524 Rowi Total Column j Total Observations (frequency, f ij ) 12.51908
5
The Chi-Square Test H 0 : Categories A and B are independent H 1 : Categories A and B are dependent =.05 Reject H 0 (Accept H 1 ) if 2 > 2.05,(r-1)*(c-1) Check that all e ijs 5 Then again, EXCEL: p-value for this test: =CHITEST(cells containing the f i s, cells containing the e i s)
7
Step 1: Determine row and column totals =SUM(C4:G4) Drag down =SUM(C4:C7) Drag across
8
2. Type Expected Values 3. Highlight the Frequency Table and Select Copy
9
4. Put cursor in cell below Expected Values and click Paste
10
5. Highlight entries in new table and click Delete
11
6. In first cell put the formula for e 11 =H4*C8/H8
12
7. In the formula bar for this cell: Highlight the denominator (H8) and click the F4 function key to add $s. Since there is now a $ in front of the H and the 8, Put another $ in front of the other H (H4===> $H4) And put another in front of the other 8 (C8 ====> C$8)
13
8. Drag cell C13 down to cell C16 and highlight cells C13:C16.
14
9. Now drag cells C13:C16 across to cells G13:16. This is now the contingency table of expected values.
15
10. Calculate the p-value for the chi-square test =CHITEST(Highlight C4:G7, Highlight C13:G16).009731
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.