Professional Documents
Culture Documents
2x2 Contingency Tables: Handy Reference Sheet - Hrp/Stats 261, Discrete Data
2x2 Contingency Tables: Handy Reference Sheet - Hrp/Stats 261, Discrete Data
2x2 Contingency Tables: Handy Reference Sheet - Hrp/Stats 261, Discrete Data
HANDY REFERENCE SHEET HRP/STATS 261, Discrete Data 2x2 Contingency Tables
Exposed (E) Unexposed (~E) Measures of Association Risk Ratio = Disease (D) a c No Disease (~D) b d
a /( a + b) c /(c + d )
1 a /( a + b ) 1 c /( c + d ) + 1.96 a c 1 a /( a + b ) 1 c /( c + d ) + +1.96 a c
95% CI:
RR * exp
, RR * exp
Odds Ratio =
ad bc
1 1 1 1 + + + 1.96 a b c d 1 1 1 1 + + + + 1.96 a b c d
95% CI:
OR * exp
, OR * exp
SAS CODE: proc freq data=yourdata; tables yourExposure*yourOutcome /measures cl; weight counts; *if you have grouped data; run;
Notation: outcome=d; predictor=e; categorical covariate=k Steps 1. Calculate crude ORd-e (or RRd-e) 2. Calculate stratum-specific ORs: ORd-e/k=K 3. If crude OR and stratum-specific ORs are all similar STOP. k is unlikely to be a confounder or an effect modifier, and you may use usual methods for 2x2 table (see page i), ignoring k. 4. If crude OR and stratum-specific ORs differproceed to (a) or (b) below: a) If stratum-specific ORs are similar to each other suspect confounding (i) Apply Cochran-Mantel-Haenszel test of conditional independence: H0: e and d are conditionally independent. Test Statistic:
Disease Exposed Unexposed No Disease b d
(a
i =1 k
E(a k ))] 2 ~ 1
k 2 E(a k ) =
a
c
Var (a
i =1
Var (a k ) =
(ii) Calculate Mantel-Haenszel (MH) summary OR (adjusted for confounding by k). If you rejected the null in (i), then MH OR should be 1.0. If you did not reject null in (i), then MH OR should be 1.0.
OR d e / k =
i =1 i =1 k
ai d i Ti bi ci Ti
For RR:
RRd e / k =
i =1 i =1 k
a i (c i + d i ) Ti ci ( ai + bi ) Ti
b) If stratum-specific ORs differ from each other suspect interaction (effect modification) (i) Apply Breslow-Day test of homogeneity of the ORs: H0: stratum-specific ORs are equal (homogenous) Test Statistic: complex use computer software If you reject null effect modification is present. Report stratumspecific ORs If you fail to reject null insufficient evidence of effect modification; calculate Mantel-Haenszel summary OR, as above. SAS CODE: proc freq data=yourdata; tables yourCovariate*yourExposure*yourOutcome /cmh; weight counts; *if you have grouped data; ii
run;
iii
Log-Linear Model
log(counts ) = + x x + y y + z z + interactions if appropriate
ad ) = ( + d + e + d *e ) + ( ) ( + d ) ( + e ) = d *e bc OR = e d *e
SAS CODE: Chi-square test proc freq data=yourdata; tables yourX*yourY*yourK / chisq; weight counts; *if you have grouped data; run; Log-linear models proc genmod data=yourdata; model total = yourX yourY yourK YourInteractions / dist=poisson link=log pred; run;
iv
Logistic Regression
Model:
p ln( ) = + 1 x1 + 2 x 2 + .... 1 p
) a x(
1 1+ e
+e
) b x(
e c 1 d ) x( ) 1 + e 1 + e
Exposed Unexposed
Disease a c
No Disease b d
Likelihood Ratio Test: where full model has n parameters and reduced model has n-p
2 ln L( reduced ) = L( full )
Interpretation of Estimated Coefficients in Odds and Probabilities: OR interpretation: ORexposure= e exp OR interpretation in the presence of interaction (two binary predictors): ORexposure/interacting factor present = e e + k + ek ORexposure/interacting factor absent = e e
Pair-Matched Data
Case Exposed Unexposed Odds Ratio Matched-control Exposed Unexposed a b c d
OR =
b c
McNemars Test H0: exposure and disease are independent Test Statistic:
(b c) 2 ~ 12 b+c
1:M Matched Data Conditional Logistic Regression:
e ORinterpretation: 1 )exposure= e exp OR c l( ) = ( )b x (
e
proc logistic data = yourData ; model YourOutcpme_c (event= "Yes") = YourPredictor1 YourPredictor2 YourPredictor3...; strata MatchingVariable1 MatchingVariable2 / info; output out = OutDataset p = Predicted; run;
vi