Upload
loreen-oconnor
View
214
Download
1
Embed Size (px)
Citation preview
1
If we live with a deep sense of gratitude, our If we live with a deep sense of gratitude, our life will be greatly embellished.life will be greatly embellished.
2
Categorical Categorical Data AnalysisData Analysis
Chapter 10: Tests for Chapter 10: Tests for Matched Pairs Matched Pairs
3
Meta AnalysisMeta Analysis• Also known as stratified analysis • Section 6.3.2: Cochran-Mantel-Haenszel test; test
for conditional independence
Situation: When another variable (strata Z) may “pollute” the effect of a categorical explanatory variable X on a categorical response Y
Goal: Study the effect of X on Y while controlling the stratification variable Z without assuming a model
4
Example: Respiratory Example: Respiratory Improvement Improvement (SAS textbook, P. 46)(SAS textbook, P. 46)
Center Treatment Yes No Total
1 Test 29 16 45
1 Placebo 14 31 45
Total 43 47 90
2 Test 37 9 45
2 Placebo 24 21 45
Total 61 29 90
5
SAS OutputSAS Output
Summary Statistics for trtmnt by response Controlling for center
Cochran-Mantel-Haenszel Statistics (Based on Table Scores)
Statistic Alternative Hypothesis DF Value Prob ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 1 Nonzero Correlation 1 18.4106 <.0001 2 Row Mean Scores Differ 1 18.4106 <.0001 3 General Association 1 18.4106 <.0001
What to Do if DependentWhat to Do if Dependent• (Section 6.3.5) When X and Y are NOT
conditionally independent given Z, we would like to test for homogeneous association
• (Section 6.3.6) If X, Y, Z have homogeneous association, we would like to estimate the common conditional odds ratio for X, Y given Z
6
7
SAS OutputSAS Output Estimates of the Common Relative Risk (Row1/Row2)
Type of Study Method Value 95% Confidence Limits ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Case-Control Mantel-Haenszel 4.0288 2.1057 7.7084 (Odds Ratio) Logit 4.0286 2.1057 7.7072
Cohort Mantel-Haenszel 1.7368 1.3301 2.2680 (Col1 Risk) Logit 1.6760 1.2943 2.1703
Cohort Mantel-Haenszel 0.4615 0.3162 0.6737 (Col2 Risk) Logit 0.4738 0.3264 0.6877
Breslow-Day Test for Homogeneity of the Odds Ratios ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Chi-Square 0.0002 DF 1 Pr > ChiSq 0.9900
Total Sample Size = 180
8
Matched-pair DataMatched-pair Data• Comparing categorical responses for two
“paired” samplesWhen either• Each sample has the same subjects (or
say subjects are measured twice)Or• A natural pairing exists between each
subject in one sample and a subject from the other sample (eg. Twins)
9
Example: Rating for Prime MinisterExample: Rating for Prime Minister
Second Survey
First Survey Approve Disapprove
Approve 794 150
Disapprove 86 570
10
Marginal HomogeneityMarginal Homogeneity• The probabilities of “success” for
both samples are identical (The data table shows “symmetry” across the main diagonal)
• Eg. The probability of approve at the first and 2nd surveys are identical
11
Estimating Differences of Estimating Differences of ProportionsProportions
• Sample estimate: P+1-P1+
• Standard error of P+1-P1+ (based on the multinomial distribution of data):
• Asymptotical (1- confidence interval:
n
pppppppp )(2)1()1( 211222111111
)()( 112/11 ppSEZpp
12
McNemar Test (for 2x2 Tables McNemar Test (for 2x2 Tables only)only)
• See SAS textbook Sec 3.7 (p. 40)
• Ho: marginal homogeneityHa: no marginal homogeneity
• A special case of C-M-H test; an approximate test (when n*=n12+n21>10)
• Exact test (when n*=n12+n21<10)
Level of Agreement: Kappa Level of Agreement: Kappa CoefficientCoefficient
• The larger the Kappa coefficient is; the stronger the agreement is
• The difference between observed agreement and that expected under independence compared to the maximum possible difference is called Kappa coefficient
13
14
SAS OutputSAS Output McNemar's Test Statistic (S) 17.3559 DF 1 Asymptotic Pr > S <.0001 Exact Pr >= S 3.716E-05
Simple Kappa Coefficient Kappa 0.6996 ASE 0.0180 95% Lower Conf Limit 0.6644 95% Upper Conf Limit 0.7348
Sample Size = 1600Level of agreement
15
Chi-square Test for Square Chi-square Test for Square TablesTables
Consider a IxI table• Marginal homogeneity:
• Symmetry: for all pairs of cells,
Symmetry => marginal homogeneity
<=
Iiii ,...,1,
jiij
16
Chi-square Test for Square TablesChi-square Test for Square Tables
Ho: symmetry vs. Ha: not symmetry
• Fitted values:
• Standardized Pearson residuals:
• Pearson Chi-square Test statistic:
X^2 follows approximately Chi-square with df = I(I-1)/2
2/)(ˆˆ jiijjiij nn
)(/)( jiijjiijij nnnnr
jiijrX 22
17
Example: Coffee PurchaseExample: Coffee Purchase2nd purchase
1st purchase
High point
Taster’s Sanka Nescafe Brim
High point
93 17 44 7 10
Taster’s 9 46 11 0 9
Sanka 17 11 155 9 12
Nescafe 6 4 9 15 2
Brim 10 4 12 2 27
18
Example: Coffee PurchaseExample: Coffee Purchase• X^2 = 20.4 and df is 5(5-1)/2=10
lack of fit (reject Ho: symmetry) which pairs of cells cause the lack of fit? Examine their standardized Pearson residuals The pair (1,3) and (3,1) contribute the most; other pairs are fine (rij^2 is around 1 or less)