Sample Size under Inverse Negative Binomial Group Testing for Accuracy in Parameter Estimation

Background The group testing method has been proposed for the detection and estimation of genetically modified plants (adventitious presence of unwanted transgenic plants, AP). For binary response variables (presence or absence), group testing is efficient when the prevalence is low, so that estimation, detection, and sample size methods have been developed under the binomial model. However, when the event is rare (low prevalence <0.1), and testing occurs sequentially, inverse (negative) binomial pooled sampling may be preferred. Methodology/Principal Findings This research proposes three sample size procedures (two computational and one analytic) for estimating prevalence using group testing under inverse (negative) binomial sampling. These methods provide the required number of positive pools (), given a pool size (k), for estimating the proportion of AP plants using the Dorfman model and inverse (negative) binomial sampling. We give real and simulated examples to show how to apply these methods and the proposed sample-size formula. The Monte Carlo method was used to study the coverage and level of assurance achieved by the proposed sample sizes. An R program to create other scenarios is given in Appendix S2. Conclusions The three methods ensure precision in the estimated proportion of AP because they guarantee that the width (W) of the confidence interval (CI) will be equal to, or narrower than, the desired width (), with a probability of . With the Monte Carlo study we found that the computational Wald procedure (method 2) produces the more precise sample size (with coverage and assurance levels very close to nominal values) and that the samples size based on the Clopper-Pearson CI (method 1) is conservative (overestimates the sample size); the analytic Wald sample size method we developed (method 3) sometimes underestimated the optimum number of pools.


Introduction
To detect the presence of a rare event, thousands of individuals need to be tested, and the cost of such testing usually exceeds the available budget and staff. The pooling methodology (Dorfman method) was first proposed to save a significant amount of money when detecting soldiers with syphilis [1]. Significant cost savings were achieved by first testing a sample created by mixing blood from several people. If the sample tested positive, the blood from each individual in that pool would be retested; if the sample tested negative, all individuals in that pool were declared free of the disease [1]. Currently the Dorfman method is used for detecting and estimating the proportion of positive individuals in fields such as medicine [2,3,4,5], agriculture [6], telecommunications [7], and science fiction [8]. Most applications for detecting and estimating a proportion are developed using binomial sampling; however, Pritchard and Tebbs [9] have suggested that inverse (negative) binomial pooled sampling may be preferred when prevalence p is known to be small, when sampling and testing occur sequentially, or when positive pool results require immediate analysis-for example, in the case of many rare diseases. Unlike binomial sampling, in this model the number of positive pools to be observed is fixed a priori, and testing is complete when the rth positive pool is reached [10].
George and Elston [11] recommended using geometric sampling when the probability of an event is small; they gave confidence intervals for the prevalence based on individual testing. Also, according to Haldane [12], using a binomial distribution may not provide an unbiased and precise estimate of p when p is small (pƒ0:1). Lui [13] extended George and Elston's work [11] on the confidence interval (CI) by considering negative binomial sampling and showed that as the required number of successes increased, the width of the CI decreased. However, this extension was also under individual testing. Using negative binomial group testing sampling, Katholi [14] derived point and interval estimators of p, obtained by both classical and Bayesian methods, and investigated their statistical properties.
Recently Pritchard and Tebbs [9] used maximum likelihood as a basis for developing three point and interval estimators for p under inverse pooled sampling; they compared its performance with Katholi's [14] proposed point and interval estimators. Pritchard and Tebbs [10] extended their work to Bayesian point and interval estimation of the prevalence under negative binomial group testing. They used different distributions to incorporate prior knowledge of disease incidence and different loss functions, and derived closed-form expressions for posterior distributions and point and credible interval estimators [10]. However, until now sample size procedures under inverse (negative) binomial sampling for group testing have not been proposed.
In practice, pooling is a simple process; for example, if 40,000 plants are collected from the field, they could be tested one at a time for detecting unwanted transgenic plants (AP). If each test takes 15 minutes and costs US$12, then this project will take 10,000 hours and cost US$480,000. A shorter approach would be to smash 10 plants together and test this pooled sample [15]. This approach would take 1000 hours and cost US$48,000. Even greater savings are achieved with larger pool sizes. However, because the maximum likelihood estimator (MLE) of p under binomial [16] and negative binomial [9,10] group testing is biased to the right, then, on average, the MLE of p overestimates the true prevalence for any pool size (assuming a perfect diagnostic test); however, this bias is usually small when p is small (p,0.1) [17]. In addition, if the diagnostic test is imperfect, a high rate of false positives is very likely. Thus, there are benefits and risks attached to the use of pooling methodology [15]. For this reason, it is important to choose the pool size with care in order to guarantee precision in the estimation process.
Under binomial group testing, some authors have proposed methods for determining the required sample size (number of required pools) to guarantee a certain level of power and/or precision [18,19,20,21]. Yamamura and Hino [18] and Hernández-Suárez et al. [19] developed sample size methods in terms of power considerations. This approach is consistent with the emphasis on hypothesis testing for inference, with results reported in terms of p-values. Montesinos-López et al. [20,21] developed sample size procedures under the accuracy in parameter estimation (AIPE) framework that guarantee narrow confidence intervals for estimating the parameter. The use of this approach is increasing, not only because the CIs ensure that the magnitude of the effect can be better assessed, but also because the effect in question can be readily identified by the reader. Furthermore, CIs also convey information about how precisely the magnitude of the effect can be ascertained from the data at hand [22]. Another advantage of the AIPE approach is that it treats the estimates (from pilot studies or literature review) used to determine the required sample size as random to guarantee that the desired CI width for estimating the parameter of interest is achieved, as originally planned [23].
However, under binomial group testing sampling when the prevalence is low, the calculated sample size sometimes does not contain any pools with the trait of interest (i.e., failure to detect and estimate AP). For this reason, inverse (negative) binomial sampling is a good alternative because each sample will contain the desired number of rare units and also the sample size is not a fixed quantity [12,9,10]. In binomial group testing, the number of required pools is treated as a fixed quantity, whereas under inverse (negative) binomial group testing, the pools are drawn one by one until the sample contains exactly r positive pools (here the number of positive pools is fixed).
Based on the previous findings, the purpose of the present study is to develop methods for determining sample size (number of positive pools) under inverse (negative) binomial group testing with the objective of increasing accuracy in the estimation of the population proportion. This research proposes methods for determining the required number of positive pools, with the aim of estimating the proportion of AP (p) using inverse (negative) binomial group testing with a perfect test and fixed pool size (k) that will assure a narrow CI. Accuracy in the estimation of p is achieved because CI width is considered stochastic and thus treated as a random variable. The methods used for achieving the objectives of the present research are: point and interval estimation for the population proportion, delta method, and central limit theorem. We provide an R program that reproduces the results presented in this study and makes it easy for the researcher to create other scenarios.

Materials and Methods
Suppose that Y i~yi represents the number of pools tested until the first positive pool is detected and Y 1 ,Y 2 , . . . , Y r are observed to obtain the rth positive pool. Therefore, Y i has a geometric distribution. Therefore, the overall number of pools that are tested to find r positive pools is equal to T~P r i~1 Y i . In what follows, we shall denote the size of the pools collected as k and assume equal pool size; the prevalence of infection is denoted by p, the number of pools tested to find one positive pool is Y i~yi , and the number of times this experiment is carried out is denoted by r. It is important to mention that in this paper we consider that: (i) the sample size is the value of r that represents the number of positive pools required to stop the sampling and testing process, and (ii) the overall number of pools tested is the value of T~P r i~1 Y i . If the prevalence of infection is p, then the probability that a pool of size k tests positive is P~1{(1{p) k Â Ã . Therefore, the sufficient statistics T~P r i~1 Y i follows a negative binomial distribution (nib) with waiting parameter r and success probability P~1{(1{p) k [9,10,14]. According to Pritchard and Tebbs [9,10] and Katholi [14], the maximum likelihood estimate (MLE) of p using inverse (negative) binomial group testing iŝ where k is the pool size and r is the fixed required number of positive pools. This MLE of p for inverse (negative) binomial group testing with groups of equal size assumes a perfect diagnostic test. On the other hand, the variance ofp p according to Pritchard and Tebbs [9,10] and Katholi [14] is given by V (p p)~1 According to Pritchard and Tebbs [9], the corresponding Wald CI is as follows: where Z 1{a=2 is the 1{a=2 quantile of the standard normal distribution, andp p is the MLE estimated from Eq. (1). This approximation of the CI is easy to calculate and allows deriving closed-form sample size formulas. However, when r is small, the normal approximation for MLE is doubtful; in such cases, the Waldtype CI often produces negative endpoints. In addition, the coverage probability of the CIs constructed by Wald-type CIs is often smaller than 100(1{a)%.

Derivation of the sample size formula for detecting transgenic plants
The quantity Z 1{a=2 ffiffiffiffiffiffiffiffiffif V V (p p) q (added and subtracted from the observed proportion,p p) in Eq. (2) is defined as W/2 (where W is the full width of the CI; W or W/2 can be set a priori by the researcher depending on the desired precision). The observed CI width for any realization of a confidence interval (from Eq. 2) can be expressed as: Let v be the desired CI width; then the basic AIPE approach seeks to find the minimum sample size so that the expected CI width is sufficiently narrow [24,25]. In other words, the AIPE approach seeks the minimal sample size so that E(W )ƒv. The problem is that the expected CI width is an unknown quantity, although it can be approximated. AsP P~1= . Since the distribution of h( T T r ) is unknown, it is not possible to obtain an analytic solution for E(W ). An alternative is to use the delta method to derive the asymptotic distribution of h( T T r ). From Result 1 in Appendix S1, we have that . Therefore, the expected value of W is s . Now if we set the E(W ) to the desired width of the CI, v: Solving for r, Eq. (4) yields the following formulation: Note that if k~1, Eq. (5) reduces to the formula derived by Lui [13] r p~4 . However, Eq. (5) requires the population value of p, which is unknown and in practice is replaced by an estimation of the true proportion. Eq. (5) finds the required sample size for achieving an expected CI width, E(W ), that is sufficiently narrow for estimating the proportion of AP using pools; however, this does not guarantee that for any particular CI, the observed expected CI width, E(W ), will be sufficiently narrow, because the expectation only approximates the mean CI width. Kelley and Rausch [25] state that this issue is similar to the case where a mean is estimated from a normal distribution; although the sample mean is an unbiased estimator of the population mean, the sample mean will almost certainly be smaller or larger than the population value. This is because the sample mean is a continuous random variable, as is the CI width, due to the fact that both are based on random data.
Thus, approximately half of the time, the computed confidence interval will be wider than the desired (specified) width [25]. Since Eq. (3) uses an estimate of p , the CI width (W) is a random variable that will fluctuate from sample to sample. This implies that, using r p from Eq. (5), less than 50% of the sampling distribution of W will be smaller than v (see the third column in Table 1). To demonstrate this, we need to calculate the probability of obtaining a CI width that is smaller than the specified value (v). This can be computed as: where I(w t ,t) is an indicator function showing whether or not the actual CI width calculated using Eq. (3 ) is #v, p is the true population proportion and r p is the sample size obtained using equation (5). To avoid possible computer limitations, the above probability can be approximated by the following: where t~r p , r p z1, r p z2, . . . , t Ã , and W is considered a random variable because the exact value of p is not known and t Ã is the value that satisfies P(Tƒt Ã )~0:9999; we use this value of t Ã because in the R package summing to infinity is not possible.
Degree to which the sample size is underestimated using Eq. 5 To show the degree to which r p is underestimated using Eq. (5), we give an example (Table 1A) in which Eq. (6) is used to calculate P(W ƒv), that is, the probability that W will be smaller than, or equal to, the desired CI width (v) for a given value r p (number of positive pools) obtained using Eq. (5). The numerical example in Table 1 is given for several values of the population proportion (p) for a CI of 95%, k~25, and for a desired width of v~0:007. Table 1A presents the preliminary sample size r p computed with Eq. (5), and three other increments computed as r m10~rp z10, r m20~rp z20, and r m40~rp z40. For each sample size, the probability that W is smaller than the specified value (v~0:007), P(W ƒv), is calculated using Eq. (6). This is done to show that the required number of positive pools for the proportion (r p , second column in Table 1A) computed using Eq. (5) has a probability of around 0.50 that W ƒv~0:007 (third column in Table 1A). For example, when p~0:0125, the preliminary sample size (r p ) is 49 and the probability of obtaining a Wƒv~0:007 is 0.4825564. With p~0:02, r p~1 26, we can only be 49.235% certain that W will be ƒv~0:007. When the number of pools increases by 10 (r m10 , fourth column, Table 1A) or by 20 (r m20 , sixth column, Table 1A), the probability P(W ƒv~0:007) increases. For example, when p~0:0125, there are r m20 = 69 units (pools) in the sample with P(W v0:007)~0:9091713; for r m40 = 89 pools in the sample, the P(W v0:007)~0:9962656. Thus, results of Table 1A show that in order to ensure a high P(W ƒv~0:007), a bigger sample size (number of positive pools) than the preliminary one (r p ) calculated using Eq. (5), is required. Also, we see in Table 1A that 8 times out of 9 the preliminary sample size (number of positive pools) resulting from using Eq. (5) produces a P(W ƒv)v0:50, that is, 88.89% of the time P(Wƒv~0:007) was lower than 50%.
For p~0:005, and a different combination of values of k and r that produces 40,000 samples, Table 1B shows that for larger values of r, the percentage of times that the MLE of p is larger than the population proportion is lower. These results also show that the level of underestimation of the required number of pools (r p ) caused by the use of Eq. (5) is important and is mainly due to the fact that half of the time the population proportion p will be lower than the estimated proportionp p (Table 1B) ; thus the obtained CI width (W) will be larger than the specified v about more than half of the time. However, the expected value of the computed W is the value specified a priori (v), provided the correct value of the population variance is used. Therefore, the use of Eq. (5) will ensure that the desired width (v) for the CI will be obtained less than 50% of the time, that is, P(W ƒv)v0:5. The values of the Mean Square Error (MSE) for p~0:005 and different combinations of k and r (Table 1C) indicate MSE increases for lower values of r, however, no values of k seem to guarantee low bias.
Since Eq. (5) underestimates the required number of pools, in the following section, we propose three new methods to estimate the optimum sample size (two computational and one analytic).

Computational optimum sample size estimation-methods 1 and 2
The optimal sample size is the smallest integer value (r m ) such that where r m will start with a minimal sample size, say r 0~1 , and I(w t ,t) is an indicator function showing whether or not the actual CI width (W) is #v. The CI width will be calculated as w t~pU {p L . We determined that method 1 is when an exact 100(1{a)% CI for p is used, and method 2 is when the CI is computed using the Wald CI (Eq. 2) and Eq. (7), which we call the computational Wald procedure. The CI used for the exact method (method 1) is the Clopper-Pearson CI, as explained in the following. When equal pool sizes k Table 1. Underestimation of the sample size given by using Eq. (5) (  Table 1A. Preliminary sample size (r p , number of required positive pools) for estimating the population proportion, computed with Eq. (5) and three sample size increments (r m10~rp z10, r m20~rp z20, and r m40~rp z40) with their corresponding probability that the confidence interval width (W ) is smaller than the specified value (v~0:007), P(W ƒv) computed with Eq. (6). For a 95% CI and k~25, v~0:007 is the desired CI width. P(W vv) is the probability that (W) is smaller than the specified value (v~0:007) calculated using Eq. (6). Table 1B. Proportion of times the MLE of p is greater than the population proportion p~0:005 for different combinations of values of k and r that produce simulated 40, 000 samples. are used, T*nib(r m ,P), where P~1{(1{p) k . Using the relationship between the negative binomial distribution and the incomplete beta function, Lui [13] derived an exact interval for P. The lower and upper confidence limits are P L~B1{a=2, rm, t{rm z1 and P U~Ba=2, rm, t{rm , respectively, where t~P r i~1 y i and B a, a, b denotes the a quantile of the two-parameter beta distribution [9]. Thus an exact 100(1{a)% CI for p can be obtained by suitably transforming the endpoints of the P interval, i.e., p U~1 { 1{B a=2, rm, t{rm À Á 1=k and p L~1 { 1{B 1{a=2, rm, t{rm z1 À Á 1=k [9]. Also, this interval for p can be formed using the relationship between the negative binomial and F distribution, in this case P L~1 z tz1 rm F 1{a=2, 2(tz1), 2rm , where F a, a, b denotes the upper a quantile of the two-parameter F distribution. Again, an exact . This last version of the Clopper-Pearson CI has the advantage that the exact CI for p can be calculated by hand using standard F tables.
In methods 1 and 2, we start with a minimal sample size, say r 0 , and increase the initial number of pools (r m ) by one unit, recalculating Eq. (7) each time, until the desired degree of certainty (c) is achieved; this will produce a modified number of pools (r m ) that assures, with a probability §c, that the W will be no wider than v. In other words, r m ensures that the researcher will have approximately 100c percent certainty that the computed CI will have the desired width or smaller. For example, if the researcher requires 90% confidence that the obtained W will be no larger than the desired width (v), (1{c) would be defined as 0.10, and there would be only a 10% chance that the CI width, aroundp p, would be larger than specified (v) [24,27].
Contrary to Eq. (5) above, the computational sample size proposed by Eq. (7) with methods 1 and 2 considersp p as a random variable and gives a non-closed-form solution for computing a minimum sample size (r m ) that guarantees that W is smaller than, or equal to, v with a probability of at least c. In the following section, we propose a closed-form analytic method for determining the optimal sample size (number of positive pools required) that uses a single formula which assures the estimation of a narrow confidence interval.

Analytic optimum sample size estimation-method 3
The CI width using the Wald interval for p is , and W must be smaller than a specified value (v) with probability (c). Therefore, the optimal sample size is defined as being the smallest integer value (r m ) such that From Result 2 in Appendix S1, for fixed v, the number of required positive pools with method 3 is given by where c represents the desired degree of certainty (required probability) of achieving a CI width (W) for p that is no wider than the desired value (v). Z c is the c quantile of the standard normal distribution. P~1{ 1{p ð Þ k is the probability of a positive pool. Note that if c~0:5, Z c~0 (because the 50% quantile of a standard normal distribution is required), then Eq. (9) reduces to Eq. (5), that is, the formula determines the required number of pools assuming that the proportion of the population p is known and fixed; this means, as already anticipated, that the required width W will be achieved only 50% of the time approximately. On the other hand, if k~1, Eq. (9) reduces to which is appropriate for determining the sample size without grouping (without making pools) (individual testing because k = 1) and guarantees that W will be smaller than, or equal to, v with a probability c. In other words, only (1{c) of the time will W be larger than the desired CI width, v. Also note that when c~0:5, Eq. (10) [individual inverse (negative) binomial sample size] reduces to the formula proposed by Lui [13] under individual inverse (negative) binomial sampling, r~4 Z 2 1{a=2 p 2 (1{p) v 2 when the stochastic nature of the CI width is not considered. It is important to point out that Eq. (7) and the proposed formulas Eq. (9) and (10) determine a minimum sample size (r m ) that guarantees that W will be smaller than, or equal to, v with a probability of at least c. In contrast to Eq. (5), Eqs. (7), (9), and (10) account for the stochastic nature of the random variablep p via the desired degree of certainty (c). It should be pointed out that r p is what we call the sample size obtained from Eq. (5) or from Eq. (9) or (7) using c~0:5, and r m is the sample size obtained with Eq. (9) or (7) when cw0:5. For this reason, the level of assurance would be c §0:5. When using Equations (9) or (7), we suggest three ways of specifying the value of p: (1) perform a pilot study, (2) use the value of p reported in the literature of similar studies, and (3) use the upper bound for p that was reported. The upper bound should be chosen carefully to avoid estimators with high bias and high MSE; also, the upper bound needs to be used when the study was performed under group testing and when the value of r is not small [9]. In addition, if the value of p reported in the literature was not obtained using group testing (but rather individual testing), then using an upper bound for sample size determination is not recommended. On the other hand, it is important to point out that the sample size from Equation (5) or from Equation (7) or (9) when using c~0:5 will be called preliminary sample size in order to distinguish it from the sample size obtained from Equations (7) or (9) when level cw0:5.

Results
Sample sizes are shown for k values of 40 (Table 2), p values ranging from 0.005 to 0.025, and v values from 0.007 to 0.010 by 0.001 for each method. Within this table, we delineated three subtables with the modified number of pools (r m ) and c values of 0.50, 0.80, and 0.90, each for a CI coverage of 95%. Each condition is crossed with all other conditions in a factorial manner; thus there are a total of 108 different cases for planning an appropriate sample size for each proposed method. To examine the results shown in Table 2, a simulation study was performed to examine the coverage and assurances of the samples as compared with the nominal coverage and assurances [ Table 3 for the analytic procedure (method 3); Table 4 for the computational Wald procedure (method 2), and Table 5 for the exact Clopper-Pearson procedure (method 1)].
Comparing the proposed analytic formula with two exact computational procedures using group size k = 40 Although the Clopper-Pearson CI is conservative, it is regarded as the gold standard reference method. First the sample size of methods 2 (computational Wald procedure) and 3 (analytic formula Eq. 9) are compared with the sample size resulting from using the exact Clopper-Pearson CI (method 1). For example, when c~0:5 and 0.8, the analytic method (method 3; Eq. 9) underestimates the sample size from 1 to 10 pools (Table 2), while the computational Wald procedure (method 2) underestimates the sample size from 1 to 9 pools with regard to the Clopper-Pearson (method 1) sample size. When c~0:9, the underestimation is from 3 to 13 pools using the analytic method (method 3; Eq. 9) and from 1 to 10 pools using the computational Wald procedure (method 2). It is important to point out that the level of underestimation increases for bigger values of the proportion (p); when the proportion is less than 0.01, the underestimation can be considered negligible because it is less than 5 pools and decreases for smaller values of p.
On the other hand, comparing the analytic method (method 3; Eq. 9) with the computational Wald procedure (method 2), the analytic method (method 3; Eq. 9) produces at most 5 pools less than the exact Wald procedure (Table 2), which shows that the difference between these two methods is not important. For the analytic method (method 3; Eq. 9), the level of underestimation can be considered irrelevant when pƒ0:01 and of little relevance when pw0:01, given that the Clopper-Pearson method (method 1) produces a considerable overestimation due to the use of a conservative CI procedure.
Suppose a researcher is interested in estimating p for AP maize in the region of Oaxaca, Mexico, where AP maize was reported to be found. With this information and after doing a literature review, it is considered that p = 0.01, with a CI of 95%, and k = 40, and it is assumed that the final CIW is W t~( p U {p L )ƒv~0:008. The application of the proposed methods leads to the required number of preliminary pools of r p~2 4, 26, and 25, each of size k = 40, using the analytic (method 3; Eq. 9), Clopper-Pearson (method 1; Eq.7), and computational Wald methods (method 2; Eq.7), respectively. These sample sizes are contained in the first sub -table of Table 2 (r p with c&0:5, where k = 40, p = 0.01, and v~0:008).
Realizing that r p~2 4, 26, and 25 will lead to a sufficiently narrow CI only about 50% of the time, the researcher incorporates an assurance of c = 0.90, which implies that the width of the 95% CI will be larger than the required width (i.e., 0.008) no more than 10% of the time. From the third sub -table  of Table 2 (r m with c~0:90), it can be seen that the modified sample size procedure yields the necessary number of pools r m~3 6, 39, and 38 for the analytic method (method 3), Clopper-Pearson method (method 1), and computational Wald procedure Table 3. Simulation study of the coverage and assurance for method 3 (analytic formula) c .     These coverages and these levels of assurance are for sample sizes obtained with the analytic formula (method 3) presented in Table 2, for a CI of 95%, k~40, four desired widths (v~0:007, 0:008, 0:009, 0:010), and three values of assurance (c~0:5, 080, and 0:90): doi:10.1371/journal.pone.0032250.t003 (method 2), respectively. Using these sample sizes (36, 39, and 38) will provide 90% assurance that the CI obtained for p will be no wider than 0.008 units. This sample size is contained in the third sub -table of Table 2 (r m with c&0:90, where k = 40, p = 0.01, and v~0:008).

An example using the proposed formula (method 3)
In this subsection, we will illustrate the use of the developed formula (Eq. 9) called method 3. Assume that a researcher is interested in estimating p and she/he hypothesizes that p = 0.02, and wants a CI of 95%, pool size k = 40, and a desired error equal to W x~( p U {p L )ƒv~0:008, with an assurance level of 99% (c~0:99 because it is assumed that the assurance level is 99% (c~0:99), v~0:008, k~40. Therefore, With Eq. (9), the optimum number of positive pools is calculated with a 99% probability that the CI width will be smaller than Table 4. Simulation study of coverage and assurance for method 2 d .     0.008, the desired error. Note that for calculating r m~1 44, the double precision format was used; otherwise, a slight overestimation would have occurred. It should be pointed out that if c~0:5, the value of Z c~0 and the required number of pools reduces to Eq. (5), that is, 99 pools. Appendix S2 provides information for implementing the proposed methods and for obtaining sufficiently narrow CIs for any combination of k, p, v, c, and a using the R package [28]. The R package computes the sample size using the proposed formula, Eq. (9), and the two proposed computational sample size methods.

Coverage and assurance levels-simulation study
In this subsection we will examine whether the three sample size procedures [analytic (method 3), computational Wald (method 2) and exact Clopper-Pearson (method 1)] achieve: (1) the coverage probabilities of the nominal (1-a)100% CI used to calculate the CIs, and (2) the nominal levels of assurance, because this sample size formula (Eq. 9) and the two computational methods were derived under the AIPE approach.
For each sample size (number of positive pools, (r p or r m ) from each combination of p, v, r, c, k reported in Table 2 and obtained from Equations (7) or (9), we took 40,000 random samples of size , to examine the coverage and assurance levels for each sample size (r p ,r m ). First we obtained the corresponding CI from the 40,000 random samples, and then we counted the proportion of CI that contains the true value of p, and the proportion of CI that has a CI width narrower than the desired CI width (v). In Table 3, we can see that the coverage of the confidence intervals corresponding to the sample sizes for the analytic method (method 3) obtained from Table 2 is very similar to the nominal level (95%) and in most cases is slightly greater than 95%. These results are not in agreement with other studies that showed that the coverage of small sample sizes using the Wald CI is poor. The Wald CI performed very well here perhaps due to the relatively large sample sizes and also because the parameter P~1{(1{p) k in the cases studied here is around 0.5, which causes less skewing in the distribution of T; consequently, the normal approximation is Table 5. Simulation study of coverage and assurance for method 1 e .      better. Also, the coverage of the sample sizes in Table 4 [for the computational Wald (method 2)] and in Table 5 [exact Clopper-Pearson (method 1)] is in most cases slightly greater than the nominal level (95%). Concerning the level of assurance, we can see in Table 3 [for the analytic procedure (method 3)] that for the three levels studied (c~0:5, 0:8, 0:9) the obtained assurances are smaller than the specified nominal values. The results for c~0:5 are consistent with the results in Table 1, which indicates that sample sizes with no assurance (c~0:5) guarantee a desired CI width around 50% of the time and, in most cases, less than 50%. Also, when the assurance is 80% or 90%, the achieved levels of assurance are smaller than the nominal levels. For the computational Wald procedure (Table 4), we can see that the assurance levels in most cases are slightly greater than the specified nominal level (c~0:5, 0:8, 0:9). Finally, for the exact Clopper-Pearson procedure (Table 5), the levels of assurance reached are larger than the nominal values in all cases, and we can say that there is an evident overestimation of the specified nominal values (c~0:5, 0:8, 0:9).

Discussion
This paper presented three methods for determining the optimal sample size for estimating the proportion of transgenic plants in a population, assuming perfect sensitivity and specificity, which must be taken into account when designing a study. The proposed methods guarantee that the desired CI width (v) will be achieved with a probability c, because they take into account the stochastic nature of the confidence interval width. Of the three methods presented, two are computational and one is analytic. According to the Monte Carlo study, the computational Wald procedure (method 2) is the best option because its corresponding coverage and assurance levels are very close to the nominal specified values. On the other hand, the exact Clopper-Pearson procedure (method 1) is conservative (overestimates the required sample size) because the coverage (in most cases) and assurance levels (in all cases) are larger than the nominal values; the analytic procedure (method 3) slightly underestimates the required sample sizes because in most cases the observed levels of assurance are smaller than the nominal values, even though in most cases the coverage reached is slightly greater than the nominal level (95%).
The main advantage of the analytic procedure (method 3) is that a simple formula (Eq. 9) was derived which, within a certain range of k, p, and c, is very precise and produces similar results to the two computational methods proposed. However, the proposed formula underestimated the optimum number of positive pools, mainly for c §0:90, for k.75 at p.0.01. However, if the number of pools given by the formula (Eq. 9) of the analytic method increases to 6, the resulting sample size will be very close to the computational Wald CI, which produces, on average, 5 pools more than the analytic procedure (method 3).
The three proposed methods are good approximations for determining the optimal sample size under negative binomial group testing, because they were derived using two types of confidence intervals (Wald and Clopper-Pearson). Although the Clopper-Pearson CI is considered the gold standard, its corresponding sample size (method 1) is conservative (overestimates the sample size) and it is not possible to compute it analytically. For this reason, we recommend using the sample size resulting from the computational Wald procedure (method 2). A disadvantage of method 2 is that it does not have an analytic solution.
These methods using group testing are an excellent option under the assumption that AP concentration is low, pv0:1. Pool size can be an important consideration, since from an economic perspective, it is always better to have a large pool size and a smaller number of pools than vice versa. However, pool size should be chosen carefully to avoid a high rate of false negatives. On the other hand, an important point to take into account when using the negative binomial group testing sampling method is that the sample size (r m ) given by Equations (7) and (9) represents the number of positive pools required to stop the sampling and testing process. The sampling and testing process is performed pool by pool using simple random sampling until we find the required number of positive pools (r m ). That is, sampling and testing will stop when the number of positive pools, r m , is reached and we need to record the observed data Y 1 , Y 2 , . . . , Y r , to get the overall number of pools tested T~P r i~1 Y i . Note that the sample size formula developed by Montesinos-López et al. [21] under binomial group testing looks similar to those developed in this study; however, here we derived the three procedures under inverse negative binomial group testing sampling, that is, using negative binomial distribution. In the method of Montesinos-López et al. [21], the required sample size is a fixed quantity (g m : number of pools to study, which represents the number of laboratory tests to be performed); under negative binomial group testing, the number of positive pools (r m ) is the quantity that is fixed in advance, whereas the overall number of pools tested is a random variable, because the sampling and testing process stops when the rth positive pool is found. The methods proposed here give the value of the required number of positive pools (r m ).
The R program (see Appendix S2) developed using the R package [28] allows the user to quickly and simply plan the sample size according to her/his requirements or needs using the three proposed methods [the analytic (method 3), exact Clopper-Pearson (method 1) and computational Wald methods (method 2)]. However, if the researcher does not have access to the R program, the best practical solution is the analytic procedure using Eq. (9).

Supporting Information
Appendix S1