Enhanced Lot Acceptance Testing Based on Defect Counts and Posterior Odds Ratios

: Optimal defects-per-unit test plans based on posterior odds ratios are developed for the disposition of product lots. The number of nonconformities per unit is modeled by the Conway– Maxwell–Poisson distribution rather than the typical Poisson model. In essence, a submitted batch is conforming if its posterior acceptability is sufﬁciently large. First, a useful approximation of the optimal test plan is derived in closed form using the asymptotic normality of the log ratio. A mixed-integer nonlinear programming problem is then solved via Monte Carlo simulation to ﬁnd the smallest number of inspected items per lot and the maximum tolerable posterior odds ratio. The methodology is applied to the manufacturing of paper and glass. The suggested sampling plan for lot sentencing provides the speciﬁed protections to both manufacturers and customers and minimizes the needed sample size. In terms of inspection effort and accuracy, the proposed approach is virtually an advantageous extension of the classical frequentist perspective. In many practical cases, it yields more precise assessments of the current consumer and producer risks, as well as more realistic decision rules.


Introduction
Sampling inspection plans for lot acceptance are often designed in industry to suitably discriminate between satisfactory and unsatisfactory batches. In essence, the construction of the best decision rule for lot disposition can be stated as a constrained optimization problem. Generally, proper acceptance test plans must provide the desired protections to both customers and manufacturers, and the required number of items to be sampled should be as small as possible. Many test plans are available in the literature for sentencing lots of incoming or outgoing goods. Papers [1][2][3][4][5][6][7][8][9][10][11][12][13][14] are just a sample of recent references.
The number of minor defects (or nonconformities) per unit is sometimes the quality characteristic of interest; for example, when the inspected units are metal, linoleum, glass, paper or plastic. In such cases, the Poisson model is commonly used for analyzing the observed sample. For instance, Fernández [15] adopted Poisson models to describe the number of blemishes per sheet in inspecting paper. In these situations, the Poisson parameter, λ, is precisely the defect rate per sampled unit. Moreover, the number of events in a specific time period is often modeled by a Poisson distribution. In particular, many studies assume that the stochastic demands follow that distribution; see, e.g., [16][17][18][19][20].
The mean and variance of a Poisson distributed variable are both equal to λ, which could be too restrictive in practice. Evidently, the Poisson distribution is not suitable for fitting dispersed data. Due to this reason, Fernández [21] considers the Conway-Maxwell-Poisson (CMP) distribution with centering parameter λ and dispersion parameter d for modeling the defect count data. The CMP law with parameter (λ, d) is a generalization of the Poisson distribution, where d can reflect under-(d > 1), equi-(d = 1) and over-dispersion (0 ≤ d < 1). Conway and Maxwell [22] introduced this distribution for modeling queuing systems with state-dependent service rates. Samuel et al. [23] studied some statistical and probabilistic properties of the CMP law. An extensive survey of procedures and applications of this model in a wide diversity of areas, including numerous references, can be found in Sellers et al. [24]. Other interesting papers are Francis et al. [25], Zhu [26] and Santarelli et al. [27].
In many practical situations, the combination of available empirical information with a previous objective and subjective knowledge appreciably improves the efficiency of the inferential methods; see, e.g., [28][29][30][31][32][33][34][35][36][37][38]. The presence of prior information is common in most manufacturing processes. In such cases, the incorporation of earlier inspection results and subjective expert opinions is frequently advantageous in acceptance sampling. Fernández [21] studied the construction of acceptance test plans for CMP models using exclusively sample information. In contrast, this paper deals with the determination of optimal lot inspection schemes based on dispersed defect count data and prior knowledge. A constrained minimization problem is solved via Monte Carlo simulation to determine the optimal inspection scheme. The proposed sampling plan provides the demanded protections to both consumers and producers and minimizes the needed sample size. Essentially, a submitted lot is accepted whenever its posterior lot acceptability is large enough. The suggested Bayesian approach is an appealing alternative to the typical frequency-based perspective in terms of accuracy and inspection effort. Controlling the Bayesian risks allows the practitioners to ensure that the rejected and accepted lots are, in fact, rejectable and acceptable at the required confidence levels.
The rest of this paper is structured as follows. Section 2 presents the posterior odds ratio criterion for lot sentencing based on dispersed defect count data and prior information. The design of sampling plans with controlled Bayesian consumer and producer risks and minimum sample size is developed in Section 3. A mixed-integer nonlinear programming problem is formulated in order to find the best inspection scheme. Then, explicit approximations of the Bayesian risks and the optimal plan are deduced in Section 4 by using the asymptotic normality of the test statistic. Next, Section 5 introduces a Monte Carlo simulation approach to calculate the optimal scheme, which is applied in Section 6 to the manufacturing of paper and glass. Finally, Section 7 offers some concluding remarks.

Posterior Odds Ratio Testing
A random variable X is said to follow the CMP probability model with parameter (λ, d) ∈ Θ, which is denoted by X ∼ CMP(λ, d), if its probability mass function is given by where N * denotes the set of nonnegative integers, Clearly, the i-th moment of the random variable X ∼ CMP(λ, d) is given by where N represents the set of natural numbers. Hence, the mean and variance of X can be expressed as Consider that in a certain production process, the number X of minor defects or nonconformities detected in a given item follows the CMP(λ, d) distribution and also that a large batch of products has been submitted to determine its acceptability. In addition, the experimental information is contained in a simple random sample X = (X 1 , . . . , X n ) of size n from the variable X ∼ CMP(λ, d), where X i represents the number of imperfections observed in the i-th inspected item from the lot for i = 1, . . . , n.
The manufacturer assumes that the CMP(λ 0 , d 0 ) distribution is an acceptable model for X, whereas the customer supposes that the CMP(λ 1 , In other words, the manufacturer considers that the null hypothesis H 0 : (λ, d) = (λ 0 , d 0 ) is admissible, while the customer specifies the alternative hypothesis H 1 : (λ, d) = (λ 1 , d 1 ). In short, (λ 0 , d 0 ) is the acceptable parameter and (λ 1 , d 1 ) is the unacceptable one.
In Bayesian hypothesis testing, the null hypothesis H 0 is accepted whenever its posterior probability Pr(H 0 | X) is large enough. Obviously, it is needed to estimate prior probabilities for H 0 and H 1 before applying Bayes' theorem. Suppose that p 0 = Pr(H 0 ) is a numerical value in the interval (0, 1) representing the decision-maker's prior level of credibility in the acceptability of the submitted batch based on available expert opinions and previous data. Hence, Pr(H 1 ) = 1 − p 0 and r = (1 − p 0 )/p 0 is the prior odds ratio in favor of H 1 versus H 0 .
The submitted lot would be accepted by the Bayesian test whenever the posterior odds ratio of H 1 against H 0 given X, which is defined as Pr(H 1 | X)/ Pr(H 0 | X), is small enough. In our situation, the posterior odds ratio R n ≡ R n (X) based on the available data X is given by where U n = ∑ n i=1 X i and V n = ∑ n i=1 log(X i !). Since the log ratio is given by log(R n ) = T n + log(r) + n log{Z(λ 0 , d 0 )/Z(λ 1 , d 1 )}, where T n = U n log(λ 1 /λ 0 ) + (d 0 − d 1 )V n , it is clear that the posterior odds ratio test would accept H 0 if and only if the test statistic T n is at most the so-called acceptance constant c, i.e., the batch is accepted whenever T n ≤ c. The test statistic T n is based on the sufficient statistic (U n , V n ), which captures all relevant information in the data. The acceptance sampling plan (n, c) based on the posterior odds ratio criterion can be summarized as follows: Step 1: At random, select n items from the submitted batch.
Step 2: Count the number of minor defects in n items, X 1 , . . . , X n , and calculate U n = ∑ n i=1 X i and Step 3: Compute the value of the test statistic T n = U n log( Step 4: Accept the batch if T n ≤ c, and reject it otherwise. Assuming are the mean and variance of Y, respectively. Consequently, the test statistic T n is approximately normally N(nq, ns 2 ) distributed when n is large enough.
It should be noted that the posterior lot acceptability Pr(H 0 | X), which represents the conditional degree of belief in H 0 given the observed sample X, and the posterior odds ratio R n may be revised in light of additional subjective and objective information.

Design of Lot Acceptance Sampling Plans
Sampling inspection schemes for lot acceptance purposes are usually designed in industrial quality control to minimize the needed sample size for lot judgment while ensuring that the so-called producer and consumer risks are sufficiently small; say, at most, α and β, respectively, where 0 < α, β < 0.5. An agreement between the manufacturer and the customer is commonly assumed on the choices of the prior probabilities of the hypotheses, H 0 and H 1 , the acceptable and unacceptable CMP parameters, (λ 0 , d 0 ) and (λ 1 , d 1 ), and the maximum allowable Bayesian producer and consumer risks, α and β, respectively.
Essentially, the Bayesian consumer risk is the probability that an accepted batch has an unacceptable quality level, whereas the Bayesian producer risk is the probability that a rejected batch has an acceptable quality level. These risks provide the assurance that practitioners typically require. The manufacturer wants a small maximum probability α that H 0 is true when the lot is rejected, while the consumer desires a small maximum probability β that H 0 is false when the batch is accepted.
In our situation, the Bayesian producer and consumer risks associated with the inspection scheme (n, c) can be expressed as respectively. Based on Bayes' theorem, the Bayesian producer risk is defined as whereas the Bayesian consumer risk is given by Equivalently, in terms of the prior odds ratio r, the Bayesian risks can be expressed as A suitable Bayesian inspection scheme (n, c) must satisfy the requirements It is assumed that α < p 0 and β < 1 − p 0 because it is natural to consider that Pr(H 0 | T n > c) < Pr(H 0 ) and Pr(H 1 | T n ≤ c) < Pr(H 1 ). That is, biased tests are not admissible. The optimal inspection scheme (n * , c * ) would then be the test plan with a minimal sample size that simultaneously satisfies the conditions (1). The constrained minimization problem to determine the required number of items to test, n * , and the optimal acceptance constant, c * , is a mixed-integer nonlinear programming problem, which can be stated as where R = (−∞, +∞) is the set of real numbers. More compactly, the optimization problem (2) may be formulated as min{n ∈ N : (n, c) ∈ Ω}, where It should be noted that the optimal sample size, n * , is finite because, as n → ∞, which is less than 1. That is, A 0 α;n is less than A 1 β;n if n is sufficiently large. In addition, any value in the nonempty interval (A 0 α;n * , A 1 β;n * ) is a feasible value of the acceptance constant. The midpoint of the above interval is a neutral choice for c * . It is assumed in the present paper that c * = (A 0 α;n * + A 1 β;n * )/2 is the optimal acceptance constant. Generally, A 0 α;n and A 1 β;n cannot be explicitly expressed. Nevertheless, accurate estimates can be computed by Monte Carlo simulation.

Explicit Approximate Risks and Plans
Closed-form approximations of the Bayesian risks and the optimal inspection scheme can be deduced by using the asymptotic normality of T n under the null and alternative hypotheses. For later use, Φ[·] denotes the standard normal cumulative distribution function and z p = Φ −1 [p] for 0 < p < 1.
Assuming that n is large enough, it follows that the distribution of the test statistic T n is approximately N(nq i , In such a case, an approximation of the Bayesian producer risk Pr(H 0 | T n > c) is given by Similarly, the Bayesian consumer risk Pr( Equating the above approximate risks to α and β, respectively, it is derived that where Consequently, it is derived from (3) that is an approximation of the smallest sample size n * , where · stands for the least integer upper bound. Moreover, are approximate estimates of the optimal acceptance constant. A balanced estimation of c * would be c a = (c 0 + c 1 )/2, which is given by In general, the acceptance plan (n a , c a ) is often a satisfactory approximation of the best scheme (n * , c * ) if n * is sufficiently large. Evidently, the approximation is not excellent when n * is small. Anyway, (n a , c a ) is always a convenient initial point in order to find (n * , c * ) via iterative procedures.

Computation of Optimal Inspection Schemes
Monte Carlo methods are widely used in optimization, especially when it is difficult or impossible to apply other approaches. Essentially, their key idea is using randomness to solve complex deterministic problems.
In our situation, it is needed to use Monte Carlo simulation to find the best inspection scheme because the Bayesian risks cannot be assessed in closed forms. The global solution of the minimization program (2) can be practically determined by using repeated random sampling.
Assume that (T i n;1 , . . . , T i n;m ) is a simple random sample of a large size m of the test statistic T n when X ∼ CMP(λ i , d i ) for i = 0, 1. Suppose also that F i n (·) represents the empirical cumulative distribution function of T n based on the corresponding sample for i = 0, 1. That is, for t ∈ R and i = 0, 1, where I(·) denotes the indicator function. Strongly consistent estimations of the Bayesian producer and consumer risks associated with the sampling plan (n, c) are then given by .
An accurate approximation of the best inspection scheme can be obtained by simulation. If m is large enough, the optimal sample size would be precisely are the natural sample estimates of A 0 α;n and A 1 β;n , respectively. In terms of the prior odds ratio r, the estimations A 0 α;n and A 1 β;n can alternatively be expressed as Computationally, it is convenient to use starting values for n * and c * . The approximate plan (n a , c a ) can serve as the initial point in the iterative process to find the best scheme (n * , c * ), which is of vital importance to decrease calculation costs. The size m of the simulated samples is assumed here to be 10 6 with the intention of obtaining accurate results.

Illustrative Examples
An application to glass manufacturing presented in Fernández [39] is first considered in this section to illustrate the methodology developed for the CMP distribution. In this case, an analyst wants to find the optimal inspection scheme to accept or reject large lots of 0.64 m 2 sheets of glass. The number X of blemishes per sheet of glass is the quality characteristic of interest, and the decision rule to determine the lot acceptability is based on a simple random sample from the variable X. Fernández [39] assumes that X has a Poisson model with parameter λ. However, in many cases, the defect count data are under-or over-dispersed with respect to the Poisson distribution. Due to this reason, the number of imperfections occurring on each sheet is assumed here to follow the CMP(λ, d) distribution.
The manufacturer deems that the CMP(λ 0 , d 0 ) model is acceptable when the defect rate per unit is λ 0 = 0.3 and d 0 = 0.8, whereas the customer supposes that the CMP(λ 1 , d 1 ) distribution is rejectable if λ 1 = 0.7 and d 1 = 0.6. Table 1 shows the best inspection scheme, (n * , c * ), and the approximately optimal plan, (n a , c a ), for α = 0.01, 0.05, β = 0.05, 0.10 and p 0 = 0.2, 0.5, 0.8. The Bayesian producer and consumer risks (BPR and BCR) of the schemes (n * , c * ) and (n a , c a ) are also reported. In light of Table 1, the required sample size tends to reduce when α and/or β increase. Likewise, the reduction in sampling inspection effort is clear when Pr(H 0 ) is high.
Assume that the maximum permissible producer and consumer risks are α = 0.05 and β = 0.10, respectively. In the non-informative case, i.e., when p 0 = 0.5 or r = 1, the optimal plan (n * , c * ) is obtained to be (17, 8.6809). Thus, the best decision rule consists of taking 17 sheets of glass at random from the submitted lot and then accepting the whole lot if T n is at most c * = 8.6809; otherwise, the lot is rejected. The proposed approximate plan (n a , c a ) is given by (17, 8.2708). The optimal plan and the Bayesian risks of (n * , c * ) and (n a , c a ) have been obtained by simulating m = 10 6 random samples of size 17 from the CMP(λ 0 , d 0 ) and CMP(λ 1 , d 1 ) distributions. In this balanced situation, the approximate plan (n a , c a ) is nearly optimal because n a = n * , the BCR is lower than 10%, and the BPR is only slightly higher than 5%. Suppose now that the producer and the consumer agreed to assign a prior probability p 0 = 0.8 to the lot acceptability, which implies that the prior odds ratio r is 1/4. Thus, there is a strong prior belief that the lot is acceptable. In this case, the approximate plan (8, 5.8200) is quite different from the optimal scheme (12, 8.5751). Similarly, (n a , c a ) is not a good approximation of the best inspection scheme when p 0 = 0.2. Evidently, the normality of T n is not reasonable when n is small. In all events, however, n a is a useful initial estimate of n * .
According to Fernández [21], the optimal plan under the frequentist perspective is (17, 8.4770), which is quite similar to (n * , c * ) when the prior odds ratio is r = 1. In general, the Bayesian viewpoint produces a significant reduction in sample size when r is small. For example, n * is only 12 when r = 1/4. However, in the non-informative case, the optimal Bayesian and frequentist test plans are often nearly equivalent.
With the aim of studying the effect of the dispersion parameter d on the optimal test plan, Table 2 presents the approximate and optimal inspection schemes, (n a , c a ) and (n * , c * ), and their corresponding Bayesian risks when λ 0 = 0.3, λ 1 = 0.7, d 1 = d 2 = d, α = 0.05 and β = 0.10 for d = 0.5, 1.0, 1.5 and p 0 = 0.2, 0.5, 0.8. In view of Table 2, it is clear that n * is a non-decreasing function of d when λ 0 = 0.3 and λ 1 = 0.7 are fixed. Therefore, the required sample size in the Poisson case is an upper bound of n * when the dispersion parameter is less than 1, and a lower bound of n * when d is greater than 1. Table 2. Optimal and approximate plans, (n * , c * ) and (n a , c a ), and the corresponding Bayesian risks, BPR and BCR, when λ 0 = 0.3, λ 1 = 0.7, α = 0.05, β = 0. 10  As graphical illustrations of the influence of r on the optimal and approximate sampling inspection schemes, Figures 1 and 2 show the values of the approximate and optimal sample sizes and acceptance constants, respectively, versus r when λ 0 = 0.3, λ 1 = 0.7, d 0 = d 1 = 1, α = 0.05 and β = 0.10. Clearly, n a and c a are smaller than n * and c * , respectively, when r is small. Otherwise, (n a , c a ) is a practical estimate of (n * , c * ).  An application to the production of paper is now discussed to exemplify the determination of optimal sampling plans based on prior odds ratio tests. The number of impurities discovered per inspection unit is typically the most important quality characteristic in paper manufacturing. In our case, a practitioner wishes to determine the best decision rule to reject or accept large lots of 0.49 m 2 sheets of paper, assuming that the number X of imperfections per sheet follows a CMP(λ, d) distribution with mean µ.
The maximal Bayesian risks that the consumer and the producer are willing to incur in the development of a test plan for lot acceptance are 10% and 5%, respectively. Furthermore, the presence of sixty-five impurities is considered rejectable by the customer, whereas thirty-five blemishes per hundred sheets is deemed acceptable by the manufacturer. Thus, α = 0.05, β = 0.10, and the acceptable and rejectable means are µ 0 = 0.35 and µ 1 = 0.65. Table 3 reports the optimal and approximate inspection schemes, (n * , c * ) and (n a , c a ), and their corresponding Bayesian risks when µ 0 = 0.35, µ 1 = 0.65, d 0 = d 1 = d, α = 0.05 and β = 0.10 for d = 0.5, 1.0, 1.5 and p 0 = 0.2, 0.5, 0.8. Table 3. Optimal and approximate plans, (n * , c * ) and (n a , c a ), and the corresponding Bayesian risks, BPR and BCR, when µ 0 = 0.35, µ 1 = 0.65, α = 0.05, β = 0. 10  According to Table 3, if the acceptable and rejectable means, µ 0 and µ 1 , are fixed, the optimal sample size n * is reduced when the dispersion parameter d assumed by the manufacturer and customer increases. Therefore, the required sample size in the Poisson case is a lower bound of n * when the dispersion parameter is d < 1 and an upper bound of n * when d > 1. For example, if p 0 = 0.8, the minimal sample size n * = 35 when d = 1 is a lower/upper bound of the value of n * when the dispersion parameter d is less/greater than 1. Clearly, the needed sample size increases when the observed random sample is over-dispersed compared to the Poisson distribution. For instance, if p 0 = 0.5, the optimal sample size is n * = 47 when d = 1, whereas n * = 55 if d = 0.5.
For illustrative and comparative purposes, Figure 3 displays the optimal sample size under the frequentist perspective n f = 47 and the optimal Bayesian sample size n * as a function of the prior odds ratio when µ 0 = 0.35, µ 1 = 0.65, d 0 = d 1 = 1, α = 0.05 and β = 0.10. The corresponding acceptance constants c f = 14.5474 and c * are shown in Figure 4. In view of these figures, it is evident that the Bayesian approach greatly decreases the required sample size and acceptance constant when the prior lot acceptability, p 0 = Pr(H 0 ), is high; i.e., when the prior odds ratio r is low. In the non-informative case, the best frequentist and Bayesian plans are quite similar.

Concluding Remarks
Lot acceptance sampling is widely used in industrial quality control to develop inspection schemes for defects per unit. The CMP model is a plausible generalization of the Poisson law that adds a parameter to represent the dispersion level. Assuming the presence of prior information on the production process, this paper has determined the best test plans for lot acceptance purposes when the number of minor defects per unit has a CMP distribution.
The proposed test plan for screening lots protects the consumer and the producer at the requested confidence levels and minimizes the sampling inspection effort. Mixedinteger nonlinear programming problems were solved through Monte Carlo simulation to determine the best inspection schemes based on posterior odds ratio tests. An explicit asymptotic approximation of the best plan was used as a starting point for iteratively searching the optimal scheme, which is of exceeding importance because the calculation of the optimal plan can be very computer intensive. The presented results were applied to the production of paper and glass.
The suggested approach is practically an extension of the classical frequentist perspective because both are quite similar in the non-informative case. Nonetheless, note that a classical statistician considers a probability is a frequency, whereas a Bayesian views a probability as a degree of belief. Our setting offers some advantages to the decision-maker. In particular, the producer and the consumer may assign different probabilities to the lot acceptability, even if they have identical background knowledge. A convenient way of combining new sample evidence with prior beliefs is also provided. Bayes' rule can be used to continually update the posterior odds ratio as new subjective or objective information is acquired. In general, the inclusion of the dispersion parameter in the underlying probability distribution leads to improved decision rules for lot disposition based on under-or overdispersed samples. Moreover, the incorporation of prior knowledge provides more precise assessments of the actual consumer and producer risks, as well as substantial savings in sample size when the prior lot acceptability is high.

Acknowledgments:
The author thanks the Editor and Reviewers for providing valuable comments and suggestions.

Conflicts of Interest:
The author declares no conflict of interest