2 1 2 0 2 2 2 6

advertisement
/*
This code is stored as
cmh.rabits.sas
/*
2 1 2
1 1 3
2 1 3
1 1 4
2 1 4
1 1 5
2 1 5
RUN;
*/
This program uses PROC FREQ in
SAS to compute the Cochran-Mantel
-Haenszel test of independence for
estimates of a common odds ratio
Enter the table of counts
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
3
3
4
4
5
5
6
0
4
1
0
0
0
PROC SORT DATA=SET1; BY K I J;
run;
for a set of 2x2 tables */
/*
0
6
2
5
6
2
5
*/
PROC PRINT DATA=SET1;
TITLE "Rabbit Suvival Data";
run;
DATA SET1;
INPUT I J K Y @@;
PROC FORMAT; VALUE IFMT 1='Immediate'
2='Delayed';
VALUE JFMT 1='Survive'
2='Died';
VALUE KFMT 1='1/8'
2='1/4'
3='1/2'
4='1.0'
5='4.0';
run;
LABEL I = Delay
J = Survival
K = Dose;
CARDS;
1 1 1 0 1 2 1 6
2 1 1 0 2 2 1 5
1 1 2 3 1 2 2 3
1
2
PROC FREQ DATA=SET1;
TABLES K*I*J / CHISQ ALL NOPERCENT NOROW;
WEIGHT Y;
Table 1 of I by J
Controlling for K=1/8
FORMAT I IFMT. J JFMT. K KFMT.;
RUN;
I(Delay)
J(Survival)
Survive
Died
Total
Immediate
0
6
6
Delayed
0
5
5
Total
0
11
11
Statistics for Table 1 of I by J
Controlling for K=1/8
Row or column sum zero. No statistics
computed for this table except for
the summary calculations.
Sample Size = 11
3
4
Table 2 of I by J
Fisher's Exact Test
Controlling for K=1/4
I(Delay)
Cell (1,1) Frequency (F)
J(Survival)
Survive
Died
3
Total
Left-sided Pr <= F
1.0000
Immediate
3
3
6
Right-sided Pr >= F
0.0909
Delayed
0
6
6
Table Probability (P)
0.0909
Two-sided Pr <= P
0.1818
Total
3
9
12
Estimates of the Relative Risk (Row1/Row2)
Statistics for Table 2 of I by J
Controlling for K=1/4
Statistic
DF
Value
Prob
Type of Study
Value
Cohort (Col2 Risk)
0.5000
95% Confidence Limits
0.2246
1.1129
Chi-Square
1
4.0000
0.0455
One or more risk estimates not computed --- zero
Likeli, Ratio Chi-Square
1
5.1783
0.0229
cell.
WARNING: 100% of the cells have expected counts
Sample Size = 12
less than 5. Chi-Square may not be a valid test.
6
5
Table 3 of I by J
Controlling for K=1/2
Fisher's Exact Test
I(Delay)
J(Survival)
Survive
Immediate
Died
6
Total
0
6
Table Probability (P)
0.0303
Two-sided Pr <= P
0.0606
Rabbit Suvival Data
Delayed
2
4
6
Total
8
4
12
Estimates of the Relative Risk (Row1/Row2)
Statistics for Table 3 of I by J
Type of Study
Value
Cohort (Col1 Risk)
3.0000
95% Confidence Limits
Controlling for K=1/2
Statistic
DF
Value
Prob
Chi-Square
1
6.0000
0.0143
Likeli Ratio Chi-Square
1
7.6382
0.0057
0.9676
9.3017
One or more risk estimates not computed --- zero
cell.
Sample Size = 12
WARNING: 100% of the cells have expected counts
less than 5. Chi-Square may not be a valid test.
7
8
Table 4 of I by J
Controlling for K=1.0
I(Delay)
Fisher's Exact Test
J(Survival)
Survive
Immediate
Died
5
Delayed
Total
Total
1
6
6
0
6
11
1
12
Table Probability (P)
1.5000
Two-sided Pr <= P
1.0000
Rabbit Suvival Data
Estimates of the Relative Risk (Row1/Row2)
Type of Study
Statistics for Table 4 of I by J
Controlling for K=1.0
Value
Cohort (Col1 Risk)
Statistic
DF
Value
Prob
Chi-Square
1
1.0909
0.2963
Likeli. Ratio Chi-Square
1
1.4773
0.2242
95% Confidence Limits
0.8333
0.5827
1.1919
One or more risk estimates not computed --- zero
cell.
Sample Size = 12
WARNING: 50% of the cells have expected counts
less than 5. Chi-Square may not be a valid test.
10
9
Summary Statistics for I by J
Controlling for K
Table 5 of I by J
Controlling for K=4.0
I(Delay)
Cochran-Mantel-Haenszel Statistics
(Based on Table Scores)
J(Survival)
Survive
Died
Total
Immediate
2
0
2
Delayed
5
0
5
Total
7
0
7
Null
Hypothesis
DF
Value
Prob
Nonzero Corr
Row Mean Scores
General Assoc
1
1
1
5.6571
5.6571
5.6571
0.0174
0.0174
0.0174
Estimates of Common Relative Risk (Row1/Row2)
Statistics for Table 5 of I by J
Controlling for K=4.0
Row or column sum zero. No statistics
computed for this table except for
the summary calculations.
Sample Size = 7
11
Type of Study
Method
Value
Case-Control
(Odds Ratio)
Mantel-Haenszel
Logit **
7.0000
4.7648
Cohort
(Col1 Risk)
Mantel-Haenszel
Logit **
1.5526
0.9648
Cohort
(Col2 Risk)
Mantel-Haenszel
Logit **
0.6118
0.4983
12
** These logit estimators use a correction
of 0.5 in every cell of those tables that
#
contain a zero. Tables with a zero row or
#
This code is stored in the file
cmh.rabitts.ssc
a zero column are not included in
computing the logit estimators.
Breslow-Day Test for
Homogeneity of the Odds Ratios
Chi-Square
#
Splus has a built in function for
#
computing the Cochram-Mantel-
#
Haenszel test of conditional
#
independence for a set of 2x2 tables.
#
Enter the data as a 3-dimensional array.
#
These are the data from the exposure
#
of rabbits to streptococci.
8.6273
DF
2
Pr > ChiSq
y.array <- array(c(0, 6, 0, 5,
0.0134
3, 3, 0, 6, 6, 0, 2, 4,
5, 1, 6, 0, 2, 0, 5, 0), c(2,2,5))
Total Sample Size = 54
#
Print the array
y.array
#
Compute the Cochran-Mantel-Haenszel test
mantelhaen.test(y.array)
13
14
, , 1
[,1] [,2]
[1,]
0
0
[2,]
6
5
, , 2
[,1] [,2]
[1,]
3
0
[2,]
3
6
Mantel-Haenszel chi-square test
with continuity correction
, , 3
[,1] [,2]
[1,]
6
2
[2,]
0
4
data:
y.array
Mantel-Haenszel chi-square = 3.9286,
df = 1, p-value = 0.0475
, , 4
[,1] [,2]
[1,]
5
6
[2,]
1
0
, , 5
[,1] [,2]
[1,]
2
5
[2,]
0
0
15
16
Download