



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A contingency table is a place where a joint distribution of two categorical variables, say X and Y , where X has I levels and Y has J levels, can be summarized ...
Typology: Slides
1 / 5
This page cannot be seen from the preview
Don't miss anything!




A contingency table is a place where a joint distribution of two categorical variables, say X and Y , where X has I levels and Y has J levels, can be summarized. It is usual to consider an X variable to be an explanatory variable, and a Y variable a response variable. Both marginal distributions and conditional distributions can be of interest. Data that is used can either be offered in raw form (Format 1) or in summarized form (Format 2) in SPSS.
Example 1 The file HockeyGenderRaw contains two variables. The response variable WatY (Yes-1, No-2) records whether or not an individual watches hockey and appears in column 1 and the explanatory variable GenX (Male -1, Female-2) records gender and appears in column 2. The file WatchHockeyGenderSummarized summarizes the counts of observations for the (GenX, WatY) pairs (1,1), (1,2), (2,1) and (2,2).
Format 1 WatY GenX 1 1 1 1 .. .
Format 2 WatY GenX Count 1 1 33 1 2 9 2 1 11 2 2 36
When working with raw data with columns of categorical variables, one should create a summary cross-tab table that counts the groupings. Here are the SPSS commands and output to do so for the hockey watching and gender raw data.
It is usual to have X in the row, and Y in the column in a contingency table. Here nij represents the count of observations in the ij-th cell, i = 1, 2 and j = 1, 2, while ni+ is the count in row i, n+j is the count in column j, and n is the total number of observations.
1 2 Total X 1 n 11 n 12 n1+ 2 n 21 n 22 n2+ Total n+1 n+2 n
Conditional Probabilities: P (Y = 1|X = 1) = π 1 with ˆπ 1 = p 1 = n 11 /n1+ P (Y = 1|X = 2) = π 2 with ˆπ 2 = p 2 = n 21 /n2+
Difference in probabilities π 1 and π 2 :
Wald (1 − α) × 100% confidence interval for π 1 − π 2 : (p 1 − p 2 ) ± zα/ 2
p 1 (1 − p 1 ) n 1
p 2 (1 − p 2 ) n 2
Relative Risk rr = π 1 /π 2 , ˆrr = p 1 /p 2 :
(1 − α) × 100% confidence interval for ln(rr): ln(p 1 /p 2 ) ± zα/ 2
1 − p 1 n 1 p 1
1 − p 1 n 1 p 1 Convert (exponentiate) the endpoints to find a CI for rr.
Odds Ratio Odds of success(=1) in row i = πi/(1 − πi) Odds Ratio= ϑ = odds 1 /odds 2 MLE for ϑ is ϑˆ = n 11 n 22 /n 12 n 21
(1 − α) × 100% confidence interval for ln(ϑ): ln( ϑˆ) ± zα/ 2
n 11
n 12
n 21
n 22 Convert (exponentiate) the endpoints to find a CI for odds ratio.
Example 2 From class PCR Relapse Count 1 1 30 1 2 45 2 1 8 2 2 95 PCR can be considered to the explanatory variable, and Relapse the response
SPSS commands and output:
[from output). With 95% confidence we find that the probability of a relapse is between 2.5 and 10. times higher for children with a positive PCR than a negative PCR. Note that 1 is not in the 95% CI, we have sufficient evidence that the probability of a relapse is significantly higher for PCR positive children.
Estimated odds ratio = ϑˆ = n 11 n 22 /n 12 n 21 = (30x95)/(8x45) = 7. 95% CI for odds ratio of a relapse for PCR positive versus PCR negative children falls between (3.361, 18.648) [from output]. With 95% confidence we find that the odds of a relapse is between 3.4 and 18.6 times higher for children with a positive PCR than a negative PCR. Note that 1 is not in the 95% CI, we have significant evidence that a relapse is associated with PCR. The odds of a relapse is 3.361 to 18.648 times higher for the PCR+ group than for the PCR- group.
Mantel-Haenzel Odds Ratio Test SPSS commands and output: