Calculates point estimates and confidence intervals for a single proportion with group testing data. Methods are available for groups of equal or different sizes.
propCI(
x,
m,
n,
pt.method = "mle",
ci.method,
conf.level = 0.95,
alternative = "two.sided",
maxiter = 100,
tol = .Machine$double.eps^0.5
)
integer specifying the number of positive groups when groups are of equal size, or a vector specifying the number of positive groups among the n groups tested when group sizes differ. If the latter, this vector must be of the same length as the m and n arguments.
integer specifying the common size of groups when groups are of equal size, or a vector specifying the group sizes when group sizes differ. If the latter, this vector must be of the same length as the x and n arguments.
integer specifying the number of groups when these groups are of equal size, or a vector specifying the corresponding number of groups of the sizes m when group sizes differ. If the latter, this vector must be of the same length as the x and m arguments.
character string specifying the point estimate to compute. Options include "Firth" for the bias-preventative, "Gart" and "bc-mle" for the bias-corrected MLE (where the latter allows for backward compatibility), and "mle" for the MLE.
character string specifying the confidence interval to compute. Options include "AC" for the Agresti-Coull interval, "bc-skew-score" for the bias- and skewness-corrected interval, "Blaker" for the Blaker interval, "CP" for the Clopper-Pearson interval, "exact" for the exact interval as given by Hepworth (1996), "lrt" for the likelihood ratio test interval, "score" for the Wilson score interval, "skew-score" for the skewness-corrected interval, "soc" for the second-order corrected interval, and "Wald" for the Wald interval. Note that the Agresti-Coull, Blaker, Clopper-Pearson, and second-order corrected intervals can only be calculated when x, m, and n are given as integers (equal group size case).
confidence level of the interval.
character string defining the alternative hypothesis, either "two.sided", "less", or "greater".
the maximum number of steps in the iteration of confidence limits, for use only with the "exact" method when group sizes differ.
the accuracy required for iterations in internal functions, for use with asymptotic intervals when group sizes differ only.
A list containing:
a confidence interval for the proportion.
the point estimator of the proportion.
the method used for point estimation.
the method used for confidence interval estimation.
the confidence level of the interval.
the alternative specified by the user.
the number of positive groups.
the group sizes.
the numbers of groups with corresponding group sizes m.
Confidence interval methods include the Agresti-Coull (ci.method = "AC"), bias- and skewness-corrected (ci.method = "bc-skew-score"), Blaker (ci.method = "Blaker"), Clopper-Pearson (ci.method = "CP"), exact (ci.method = "exact"), likelihood ratio test (ci.method = "lrt"), Wilson score (ci.method = "score"), skewness-corrected (ci.method = "skew-score"), second-order corrected (ci.method = "soc"), and Wald (ci.method = "Wald") intervals. The Agresti-Coull, Blaker, Clopper-Pearson, and second-order corrected intervals are available only for the equal group size case.
Point estimates available include the MLE (pt.method = "mle"), bias-corrected MLE (pt.method = "Gart" or pt.method = "bc-mle"), and bias-preventative (pt.method = "Firth"). Only the MLE method is available when calculating the Clopper-Pearson, Blaker, Agresti-Coull, second-order corrected, or exact intervals.
Computation of confidence intervals for group testing with equal group sizes are described in Tebbs & Bilder (2004) and Schaarschmidt (2007).
While the exact method is available when group sizes differ, the algorithm becomes computationally very expensive if the number of different groups, n, becomes larger than three. See Hepworth (1996) for additional details on the exact method and other methods for constructing confidence intervals in group testing situations. For computational details and simulation results of the remaining methods, see Biggerstaff (2008). See Hepworth & Biggerstaff (2017) for recommendations on the best point estimator methods.
Biggerstaff, B. (2008). “Confidence intervals for the difference of proportions estimated from pooled samples.” Journal of Agricultural, Biological, and Environmental Statistics, 13, 478–496.
Hepworth, G. (1996). “Exact confidence intervals for proportions estimated by group testing.” Biometrics, 52, 1134–1146.
Hepworth, G., Biggerstaff, B. (2017). “Bias correction in estimating proportions by pooled testing.” Journal of Agricultural, Biological, and Environmental Statistics, 22, 602–614.
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.
Tebbs, J., Bilder, C. (2004). “Confidence interval procedures for the probability of disease transmission in multiple-vector-transfer designs.” Journal of Agricultural, Biological, and Environmental Statistics, 9, 75–90.
propDiffCI
for confidence intervals for the
difference of proportions in group testing, gtTest
for
hypothesis tests in group testing, gtPower
for power
calculations in group testing, and binom.test
for an exact
confidence interval and test.
Other estimation functions:
designEst()
,
designPower()
,
gtPower()
,
gtTest()
,
gtWidth()
,
propDiffCI()
# Example from Tebbs and Bilder (2004):
# 3 groups out of 24 test positively;
# each group has a size of 7.
# Clopper-Pearson interval:
propCI(x = 3, m = 7, n = 24, ci.method = "CP",
conf.level = 0.95, alternative = "two.sided")
#>
#> 95 percent Clopper-Pearson confidence interval:
#> [ 0.003838, 0.05432 ]
#> Point estimate (Maximum Likelihood): 0.0189
# Clopper-Pearson interval with the bias-corrected
# MLE (\kbd{pt.method = "Gart"}).
propCI(x = 3, m = 7, n = 24, pt.method = "Gart",
ci.method = "CP", conf.level = 0.95,
alternative = "two.sided")
#>
#> 95 percent Clopper-Pearson confidence interval:
#> [ 0.003838, 0.05432 ]
#> Point estimate (Gart's Correction): 0.01854
# One-sided Clopper-Pearson interval:
propCI(x = 3, m = 7, n = 24, ci.method = "CP",
conf.level = 0.95, alternative = "less")
#>
#> 95 percent Clopper-Pearson confidence interval:
#> [ 0, 0.04819 ]
#> Point estimate (Maximum Likelihood): 0.0189
# Blaker interval:
propCI(x = 3, m = 7, n = 24, ci.method = "Blaker",
conf.level = 0.95, alternative = "two.sided")
#>
#> 95 percent Blaker confidence interval:
#> [ 0.005056, 0.0513 ]
#> Point estimate (Maximum Likelihood): 0.0189
# Wilson score interval:
propCI(x = 3, m = 7, n = 24, ci.method = "score",
conf.level = 0.95, alternative = "two.sided")
#>
#> 95 percent Wilson score confidence interval:
#> [ 0.006325, 0.05164 ]
#> Point estimate (Maximum Likelihood): 0.0189
# Calculate confidence intervals with a group size of 1.
# These match those found using the binom.confint()
# function from the binom package.
propCI(x = 4, m = 1, n = 10, pt.method = "mle",
ci.method = "AC")
#>
#> 95 percent Agresti-Coull confidence interval:
#> [ 0.1671, 0.6884 ]
#> Point estimate (Maximum Likelihood): 0.4
propCI(x = 4, m = 1, n = 10, pt.method = "mle",
ci.method = "score")
#>
#> 95 percent Wilson score confidence interval:
#> [ 0.1682, 0.6873 ]
#> Point estimate (Maximum Likelihood): 0.4
propCI(x = 4, m = 1, n = 10, pt.method = "mle",
ci.method = "Wald")
#>
#> 95 percent Wald confidence interval:
#> [ 0.09636, 0.7036 ]
#> Point estimate (Maximum Likelihood): 0.4
# Example from Hepworth (1996, table 5):
# 1 group out of 2 tests positively with
# groups of size 5; also,
# 2 groups out of 3 test positively with
# groups of size 2.
propCI(x = c(1,2), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.05172, 0.5533 ]
#> Point estimate (Maximum Likelihood): 0.2435
# Bias-preventative point estimate (\kbd{pt.method = "Firth"})
# with an exact confidence interval.
propCI(x = c(1,2), m = c(5,2), n = c(2,3),
pt.method = "Firth", ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.05172, 0.5533 ]
#> Point estimate (Firth's Correction): 0.2194
# Recalculate the example given in
# Hepworth (1996), table 5:
propCI(x = c(0,0), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0, 0.2059 ]
#> Point estimate (Maximum Likelihood): 0
propCI(x = c(0,1), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.001581, 0.2667 ]
#> Point estimate (Maximum Likelihood): 0.06459
propCI(x = c(0,2), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.01726, 0.3532 ]
#> Point estimate (Maximum Likelihood): 0.134
propCI(x = c(0,3), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.05125, 0.5003 ]
#> Point estimate (Maximum Likelihood): 0.2094
propCI(x = c(1,0), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.002521, 0.3387 ]
#> Point estimate (Maximum Likelihood): 0.0722
propCI(x = c(1,1), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.01842, 0.4435 ]
#> Point estimate (Maximum Likelihood): 0.1523
propCI(x = c(1,2), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.05172, 0.5533 ]
#> Point estimate (Maximum Likelihood): 0.2435
propCI(x = c(1,3), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.1084, 0.7072 ]
#> Point estimate (Maximum Likelihood): 0.3516
propCI(x = c(2,0), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.03161, 0.4991 ]
#> Point estimate (Maximum Likelihood): 0.1781
propCI(x = c(2,1), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.06237, 0.6967 ]
#> Point estimate (Maximum Likelihood): 0.2979
propCI(x = c(2,2), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.1147, 0.9084 ]
#> Point estimate (Maximum Likelihood): 0.4699
propCI(x = c(2,3), m = c(5,2), n = c(2,3), ci.method = "exact")
#>
#> 95 percent Exact confidence interval:
#> [ 0.209, 1 ]
#> Point estimate (Maximum Likelihood): 1
# Example with multiple groups of various sizes:
# 0 out of 5 groups test positively with
# groups of size 1 (individual testing);
# 0 out of 5 groups test positively with
# groups of size 5;
# 1 out of 5 groups test positively with
# groups of size 10; and
# 2 out of 5 groups test positively with
# groups of size 50.
x1 <- c(0, 0, 1, 2)
m1 <- c(1, 5, 10, 50)
n1 <- c(5, 5, 5, 5)
propCI(x = x1, m = m1, n = n1, pt.method = "Gart",
ci.method = "skew-score")
#>
#> 95 percent Skew-Corrected score (Gart) confidence interval:
#> [ 0.002806, 0.02879 ]
#> Point estimate (Gart's Correction): 0.01027
propCI(x = x1, m = m1, n = n1, pt.method = "Gart",
ci.method = "score")
#>
#> 95 percent Wilson score confidence interval:
#> [ 0.00351, 0.02804 ]
#> Point estimate (Gart's Correction): 0.01027
# Reproducing estimates from Table 1 in
# Hepworth & Biggerstaff (2017):
propCI(x = c(1, 2), m = c(20, 5), n = c(8, 8),
pt.method = "Firth", ci.method = "lrt")
#>
#> 95 percent Likelihood Ratio Test Inversion confidence interval:
#> [ 0.004033, 0.04142 ]
#> Point estimate (Firth's Correction): 0.01548
propCI(x = c(7, 8), m = c(20, 5), n = c(8, 8),
pt.method = "Firth", ci.method = "lrt")
#>
#> 95 percent Likelihood Ratio Test Inversion confidence interval:
#> [ 0.109, 0.3515 ]
#> Point estimate (Firth's Correction): 0.1866