gtTest {binGroup2}R Documentation

Hypothesis test for one proportion in group testing


Calculates p-values for hypothesis tests of single proportions estimated from group testing experiments against a threshold proportion in the hypotheses. Available methods include the exact test, score test, and Wald test.


gtTest(n, y, s, p.hyp, alternative = "two.sided", method = "exact")



integer specifying the number of groups.


integer specifying the number of positive groups.


integer specifying the common size of groups.


the hypothetical threshold proportion against which to test, specified as a number between 0 and 1.


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


character string defining the test method to be used. Options include "exact" for an exact test corresponding to the Clopper-Pearson confidence interval, "score" for a score test corresponding to the Wilson confidence interval, and "Wald" for a Wald test corresponding to the Wald confidence interval. The Wald method is not recommended. The "exact" method uses binom.test{stats}.


This function assumes equal group sizes, no testing error (i.e., 100 percent sensitivity and specificity) to test the groups, and individual units randomly assigned to the groups with identical true probability of success.


A list containing:


the p-value of the test


the estimated proportion


the threshold proportion provided by the user.


the alternative provided by the user.


the test method provided by the user.


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

See Also

propCI for confidence intervals in group testing and binom.test(stats) for the exact test and corresponding confidence interval.

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


# Consider the following the experiment: Tests are 
#   performed on n=10 groups, each group has a size
#   of s=100 individuals. The aim is to show that 
#   less than 0.5 percent (\eqn{p < 0.005}) of the units
#   in the population show a detrimental trait (positive test).
#   y=1 positive test and 9 negative tests are observed.
gtTest(n = 10, y = 1, s = 100, p.hyp = 0.005, 
       alternative = "less", method = "exact")

# The exact test corresponds to the 
#   limits of the Clopper-Pearson confidence interval
#   in the example of Tebbs & Bilder (2004):
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
       method = "exact", p.hyp = 0.0543)
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
       method = "exact", p.hyp = 0.0038)
# Hypothesis test with a group size of 1.
gtTest(n = 24, y = 3, s = 1, alternative = "two.sided",
       method = "exact", p.hyp = 0.1)         
# Further methods:
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
       method = "score", p.hyp = 0.0516)
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
       method = "Wald", p.hyp = 0.0401)

[Package binGroup2 version 1.1.0 Index]