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.

power.cmh.test(
  p1 = NULL,
  p2 = NULL,
  theta = NULL,
  N = NULL,
  sig.level = 0.05,
  power = 0.8,
  alternative = c("two.sided", "less", "greater"),
  s = 0.5,
  t = 1/J,
  correct = TRUE
)

Arguments

p1

Vector of proportions of the J case groups.

p2

Vector of proportions of the J control groups.

theta

Vector of odds ratios relating to the J 2 x 2 tables.

N

Total number of subjects.

sig.level

Significance level (Type I error probability).

power

Power of test (1 minus Type II error probability).

alternative

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.

s

Proportion (weight) of case versus control in J stratum.

t

Proportion (weight) of total number of cases of J stratum.

correct

Logical indicating whether to apply continuity correction.

Value

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 N.effective.

The vectors of n's per each group, n1 and n2, are the fractional n's required to achieve a final total N specified by the calculation while satisfying the constraints of s and t. 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.

Details

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. (1986). The p1 group is dubbed the Case group and p2 group is called the Control group.

Arguments

To calculate power, the power parameter must be set to NULL. To calculate sample size, the N parameter must be set to NULL.

The J number of groups will be inferred by the maximum length of p1, p2, or theta.

Effect size must be specified using one of the following combinations of arguments.

  • Both case and control proportion vectors, ex.,

    • p1 and p2 with theta = NULL.

  • One proportion vector and an effect size, ex.,

    • p1 and theta with p2 = NULL, or

    • p2 and theta with p1 = NULL.

References

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.

Author

Paul W. Egeler, M.S.

Examples

# 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)
#> Power and sample size calculation for the Cochran Mantel Haenszel test
#> 
#>                  N = 171
#>        Effective N = 174
#> Significance level = 0.05
#>              Power = 0.9
#>        Alternative = greater
#> 
#> CALL: 
#> power.cmh.test(p2 = c(0.75, 0.7, 0.65, 0.6), theta = 3, power = 0.9, 
#>     alternative = "greater", t = c(0.1, 0.4, 0.35, 0.15), correct = FALSE)

# We see that the N is 171, the same as calculated by Nam
sample_size_uncorrected$N
#> [1] 170.7412


# 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)
#> Power and sample size calculation for the Cochran Mantel Haenszel test
#> 
#>                  N = 191.538
#>        Effective N = 196
#> Significance level = 0.05
#>              Power = 0.9
#>        Alternative = greater
#> 
#> Number of subjects per each group:
#> ______________________________________________
#> Group   |       1        2        3        4 
#> ==============================================
#> Case    |    9.58    38.31    33.52    14.37 
#> Control |    9.58    38.31    33.52    14.37 
#> 
#> CALL: 
#> power.cmh.test(p2 = c(0.75, 0.7, 0.65, 0.6), theta = 3, power = 0.9, 
#>     alternative = "greater", t = c(0.1, 0.4, 0.35, 0.15), correct = TRUE)

# We see that the N is indeed equal to that which is reported in the paper
sample_size_corrected$N
#> [1] 191.538