View source: R/power.cmh.test.r
power.cmh.test | R Documentation |
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
)
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. |
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.
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.
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
.
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
# 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.