gtPower {binGroup2}R Documentation

Power to reject a hypothesis for one proportion in group testing


This function calculates the power to reject a hypothesis in a group testing experiment, using confidence intervals for the decision. This function also calculates the bias of the point estimator for a given n, s, and true, unknown proportion.


  conf.level = 0.95,
  method = "CP",
  alternative = "two.sided"



integer specifying the number of groups. A vector of integers is also allowed.


integer specifying the common group size. A vector of integers is also allowed.


the absolute difference between the true proportion and the hypothesized proportion. A vector is also allowed.


the proportion in the hypotheses, specified as a value between 0 and 1.


confidence level required for the decision on the hypotheses.


character string specifying the confidence interval method (see propCI) to be used.


character string defining the alternative hypothesis, either "two.sided", "less", or "greater".


The power of a hypothesis test performed by a confidence interval is defined as the probability that a confidence interval excludes the threshold parameter (p.hyp) of the null hypothesis, as described in Schaarschmidt (2007). Due to discreteness, the power does not increase monotonely for an increasing number of groups n or group size s, but exhibits local maxima and minima, depending on n, s, p.hyp, and conf.level.

Additional to the power, the bias of the point estimator is calculated according to Swallow (1985). If vectors are specified for n, s, and (or) delta, a matrix will be constructed and power and bias are calculated for each line in this matrix.


A matrix containing the following columns:


a vector of the total sample size, n*s.


a vector of the number of groups.


a vector of the group sizes.


a vector of the delta values.


the power to reject the given null hypothesis.


the bias of the estimator for the specified n, s, and the true proportion.


This function was originally written as bgtPower by Frank Schaarschmidt for the binGroup package. Minor modifications have been made for inclusion of the function in the binGroup2 package.


Schaarschmidt, F. (2007). “Experimental design for one-sided confidence intervals or hypothesis tests in binomial group testing.” Communications in Biometry and Crop Science, 2, 32–40. ISSN 1896-0782.

Swallow, W. (1985). “Group testing for estimating infection rates and probabilities of disease transmission.” Phytopathology, 75, 882–889. doi: 10.1094/Phyto-75-882,

See Also

propCI for confidence intervals and gtTest for hypothesis tests for one proportion from a group testing experiment.

Other estimation functions: designEst(), designPower(), gtTest(), gtWidth(), propCI(), propDiffCI()


# Calculate the power for the design
#   in the example given in Tebbs and Bilder(2004):
#   n=24 groups each containing 7 insects
#   if the true proportion of virus vectors
#   in the population is 0.04 (4 percent),
#   the power to reject H0: p>=0.1 using an
#   upper Clopper-Pearson ("CP") confidence interval
#   is calculated with the following call:
gtPower(n = 24, s = 7, delta = 0.06, p.hyp = 0.1,
        conf.level = 0.95, alternative = "less", method = "CP")

# Explore development of power and bias for varying 
#   n, s, delta. How much can we decrease the number of 
#   groups (costly tests to be performed) by pooling the same 
#   number of 320 individuals to groups of increasing size 
#   without largely decreasing power?
gtPower(n = c(320, 160, 80, 64, 40, 32, 20, 10, 5), 
        s = c(1, 2, 4, 5, 8, 10, 16, 32, 64), 
        delta = 0.01,  p.hyp = 0.02)
# What happens to the power for increasing differences
#   between the true proportion and the threshold proportion?
gtPower(n = 50, s = 10, delta = seq(from = 0, to = 0.01, by = 0.001),
        p.hyp = 0.01, method = "CP")
# Calculate power with a group size of 1 (individual testing).
gtPower(n = 100, s = 1, delta = seq(from = 0, to = 0.01, by = 0.001),
        p.hyp = 0.01, method = "CP")

[Package binGroup2 version 1.1.0 Index]