The algorithm for finding optimal values of the sample size n and decision rules d1 and d2 for the Binomial model proceeds as follows:
- Start with n=2, d1=0, d2=1
- Calculate delta_L1, which is the CDF of the binomial distribution: delta_L1=1 - CDF(d1, n, L1)
- Calculate delta_U1, which is 1 - (CDF(d2, n, L2) - CDF(d1, n, L2))
- Calculate delta_L2, which is 1 - (CDF(d2, n, U1) - CDF(d1, n, U1))
- Calculate delta_U2, which is 1 - CDF(d2, n, U2)
- If each delta is below its maximum allowed value then the solution is (n, d1, d2), otherwise continue
- Pick one of the following:
- If d1 < d2 and d2 < n then increase d1 by 1
- If d1 = d2 and d2 < n then increase d2 by 1 and set d1=0
- If d1 = d2 and d2 = n then increase n by 1 and set d2=0 and d1=0
- Return to step 2
Source:
Olives, Casey, Joseph J. Valadez, Simon J. Brooker, and Marcello Pagano. Multiple category-lot quality assurance sampling: a new classification system with application to schistosomiasis control. PLoS neglected tropical diseases 6, no. 9 (2012): e1806.