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.

gtPower(
  n,
  s,
  delta,
  p.hyp,
  conf.level = 0.95,
  method = "CP",
  alternative = "two.sided"
)

Arguments

n

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

s

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

delta

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

p.hyp

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

conf.level

confidence level required for the decision on the hypotheses.

method

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

alternative

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

Value

A matrix containing the following columns:

ns

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

n

a vector of the number of groups.

s

a vector of the group sizes.

delta

a vector of the delta values.

power

the power to reject the given null hypothesis.

bias

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

Details

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 monotonically 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.

References

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.

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()

Author

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.

Examples

# 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")
#>    ns  n s delta     power         bias
#> n 168 24 7  0.06 0.8821248 0.0008405368

# Explore development of power and bias for varying n,
#   s, and 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)
#>        ns   n  s delta       power         bias
#>  [1,] 320 320  1  0.01 0.169575200 3.122502e-17
#>  [2,] 320 160  2  0.01 0.153984506 4.775749e-05
#>  [3,] 320  80  4  0.01 0.171809348 1.485202e-04
#>  [4,] 320  64  5  0.01 0.172465973 2.017053e-04
#>  [5,] 320  40  8  0.01 0.138488643 3.737105e-04
#>  [6,] 320  32 10  0.01 0.175933578 4.999685e-04
#>  [7,] 320  20 16  0.01 0.102452816 9.486069e-04
#>  [8,] 320  10 32  0.01 0.062895913 1.090916e-02
#>  [9,] 320   5 64  0.01 0.001819794 4.455608e-01

# 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")
#>        ns  n  s delta      power         bias
#>  [1,] 500 50 10 0.000 0.02509474 9.556995e-05
#>  [2,] 500 50 10 0.001 0.02045901 1.056338e-04
#>  [3,] 500 50 10 0.002 0.02240288 1.157943e-04
#>  [4,] 500 50 10 0.003 0.03154284 1.260525e-04
#>  [5,] 500 50 10 0.004 0.04988657 1.364095e-04
#>  [6,] 500 50 10 0.005 0.08170390 1.468667e-04
#>  [7,] 500 50 10 0.006 0.13481479 1.574252e-04
#>  [8,] 500 50 10 0.007 0.22262947 1.680863e-04
#>  [9,] 500 50 10 0.008 0.31313453 1.788510e-04
#> [10,] 500 50 10 0.009 0.37280062 1.897208e-04
#> [11,] 500 50 10 0.010 0.43351536 2.006969e-04

# 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")
#>        ns   n s delta        power         bias
#>  [1,] 100 100 1 0.000 1.837404e-02 1.734723e-17
#>  [2,] 100 100 1 0.001 1.299201e-02 1.908196e-17
#>  [3,] 100 100 1 0.002 8.743140e-03 2.081668e-17
#>  [4,] 100 100 1 0.003 5.525839e-03 2.081668e-17
#>  [5,] 100 100 1 0.004 3.216655e-03 2.602085e-17
#>  [6,] 100 100 1 0.005 1.673268e-03 2.775558e-17
#>  [7,] 100 100 1 0.006 7.394374e-04 2.775558e-17
#>  [8,] 100 100 1 0.007 2.524704e-04 2.775558e-17
#>  [9,] 100 100 1 0.008 5.382635e-05 3.122502e-17
#> [10,] 100 100 1 0.009 3.631682e-06 3.122502e-17
#> [11,] 100 100 1 0.010 0.000000e+00 3.469447e-17