Compute the post-hoc power or required number of subjects for the Cochran-Mantel-Haenszel test for association in J stratified 2 x 2 tables.
1 2 3
Vector of proportions of the J case groups.
Vector of proportions of the J control groups.
Vector of odds ratios relating to the J 2 x 2 tables.
Total number of subjects.
Significance level (Type I error probability).
Power of test (1 minus Type II error probability).
Two- or one-sided test. If one-sided, the direction of the association must be defined (less than 1 or greater than 1). Can be abbreviated.
Proportion (weight) of case versus control in J stratum.
Proportion (weight) of total number of cases of J stratum.
Logical indicating whether to apply continuity correction.
This sample size calculation is based on the derivations described in the Woolson et al. (1986). It is designed for case-control studies where one margin is fixed. The method is "based on the Cochran-Mantel-Haenszel statistic expressed as a weighted difference in binomial proportions."
Continuity corrected sample size is described in Nam's 1992 paper. This uses the weighted binomial sample size calculation described in Woolson et al. (1986) but is enhanced for use with the continuity corrected Cochran's test.
Power calculations are based on the writings of Wittes and Wallenstein (1987). They are functionally equivalent to the derivations of the sample size calculation described by Woolson and others and Nam, but have slightly added precision.
Terminology and symbolic conventions are borrowed from Woolson et al.
p1 group is dubbed the Case group and
group is called the Control group.
An object of class
"power.cmh": a list of the original arguments and
the calculated sample size or power. Also included are vectors of n's per
each group, an indicator or whether continuity correction was used, the
original function call, and
The vectors of n's per each group,
n2, are the
fractional n's required to achieve a final total N specified by the
calculation while satisfying the constraints of
However, the effective N, given the requirement of cell counts populated by
whole numbers is provided by
N.effective. By default, the print method
is set to
n.frac = FALSE, which will round each cell n up to the
nearest whole number.
To calculate power, the
power parameter must be set to
NULL. To calculate sample size, the
N parameter must
be set to
J number of groups will be inferred by the maximum length of
Effect size must be specified using one of the following combinations of arguments.
Both case and control proportion vectors, ex.,
theta = NULL.
One proportion vector and an effect size, ex.,
p2 = NULL, or
p1 = NULL.
Paul W. Egeler, M.S.
Gail, M. (1973). "The determination of sample sizes for trials involving several 2 x 2 tables." Journal of Chronic Disease 26: 669-673.
Munoz, A. and B. Rosner. (1984). "Power and sample size for a collection of 2 x 2 tables." Biometrics 40: 995-1004.
Nam, J. (1992). "Sample size determination for case-control studies and the comparison of stratified and unstratified analyses." Biometrics 48: 389-395.
Wittes, J. and S. Wallenstein. (1987). "The power of the Mantel-Haenszel test." Journal of the American Statistical Association 82: 1104-1109.
Woolson, R. F., Bean, J. A., and P. B. Rojas. (1986). "Sample size for case-control studies using Cochran's statistic." Biometrics 42: 927-932.
power.prop.test, mantelhaen.test, BreslowDayTest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
# From "Sample size determination for case-control studies and the comparison # of stratified and unstratified analyses", (Nam 1992). See references. # Uncorrected sample size estimate first introduced # by Woolson and others in 1986 sample_size_uncorrected <- power.cmh.test( p2 = c(0.75,0.70,0.65,0.60), theta = 3, power = 0.9, t = c(0.10,0.40,0.35,0.15), alternative = "greater", correct = FALSE ) print(sample_size_uncorrected, detail = FALSE) # We see that the N is 171, the same as calculated by Nam sample_size_uncorrected$N # Continuity corrected sample size estimate added by Nam sample_size_corrected <- power.cmh.test( p2 = c(0.75,0.70,0.65,0.60), theta = 3, power = 0.9, t = c(0.10,0.40,0.35,0.15), alternative = "greater", correct = TRUE ) print(sample_size_corrected, n.frac = TRUE) # We see that the N is indeed equal to that which is reported in the paper sample_size_corrected$N
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.