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}
.
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 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.
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")
#>
#> exact test for one proportion in group testing
#> Alternative hypothesis: true proportion is less than 0.005
#> p-value = 0.04996
#> point estimate = 0.001053
# 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)
#>
#> exact test for one proportion in group testing
#> Alternative hypothesis: true proportion is not equal to 0.0543
#> p-value = 0.05014
#> point estimate = 0.0189
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
method = "exact", p.hyp = 0.0038)
#>
#> exact test for one proportion in group testing
#> Alternative hypothesis: true proportion is not equal to 0.0038
#> p-value = 0.04874
#> point estimate = 0.0189
# Hypothesis test with a group size of 1.
gtTest(n = 24, y = 3, s = 1, alternative = "two.sided",
method = "exact", p.hyp = 0.1)
#>
#> exact test for one proportion in group testing
#> Alternative hypothesis: true proportion is not equal to 0.1
#> p-value = 0.8715
#> point estimate = 0.125
# Further methods:
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
method = "score", p.hyp = 0.0516)
#>
#> score test for one proportion in group testing
#> Alternative hypothesis: true proportion is not equal to 0.0516
#> p-value = 0.05019
#> point estimate = 0.0189
gtTest(n = 24, y = 3, s = 7, alternative = "two.sided",
method = "Wald", p.hyp = 0.0401)
#>
#> Wald test for one proportion in group testing
#> Alternative hypothesis: true proportion is not equal to 0.0401
#> p-value = 0.04988
#> point estimate = 0.0189