Title: Contingency Tables
1Contingency Tables
2Basic Concepts
- 2 categories (A (rows) possible outcomes A1,
A2, Ar B (columns) possible outcomes B1, B2
, Bc) - Assume the categories are independent unless it
can be shown otherwise - If categories are independent
- the probability that event ij occurs (that is Ai
and Bj occur simultaneously) P(Ai)P(Bj) - If there are n total observations, the total
expected occurrences of event ij is eij
n(P(Ai)P(Bj))
3Best Estimates for P(Ai) and P(Bj)
- From the sample suppose ni number of times
event Ai occurs and nj number of times Bj
occurs - Then,
- P(Ai) ? ni/n and P(Bj) ? nj/n
- Thus eij n(ni/n)(nj/n) ninj/n or,
4Tables
Suppose there were 524 total observations. 82
were observed to be A2 and 80 were observed to be
B3.
Observations (frequency, fij)
Contingency Table entry e23 if H0 were true
12.51908
5The Chi-Square Test
- H0 Categories A and B are independent
H1 Categories A and B are dependent - ? .05
- Reject H0 (Accept H1) if ?2 gt ?2.05,(r-1)(c-1)
- Check that all eijs ? 5
- Then again,
EXCEL p-value for this test CHITEST(cells
containing the fis, cells containing the eis)
6(No Transcript)
7Step 1 Determine row and column totals
8(No Transcript)
94. Put cursor in cell below Expected Values and
click Paste
105. Highlight entries in new table and click
Delete
11H4C8/H8
6. In first cell put the formula for e11
12(No Transcript)
138. Drag cell C13 down to cell C16 and highlight
cells C13C16.
149. Now drag cells C13C16 across to cells
G1316. This is now the contingency table of
expected values.
1510. Calculate the p-value for the
chi-square test
.009731