Steve H. K. Ng
Institute of Vocational Education, Tsing Yi, Hong Kong
Journal of Statistics Education Volume 11, Number 3 (2003), jse.amstat.org/v11n3/ng.html
Copyright © 2003 by Steve H. K. Ng, all rights reserved. This text may be freely shared among individuals, but it may not be republished in any medium without express written consent from the author and advance notification of the editor.
Key Words: Attribute sampling; Binomial distribution; Excel; Hypergeometric distribution.
In this article, a very simple and yet useful feature of Excel called the SPIN BUTTON is used to illustrate two concepts associated with attribute acceptance sampling plans. The first concept is calculating the probability of lot acceptance based on which the operating characteristic (OC) curve of an attribute sampling plan is drawn. The SPIN BUTTON can show, visually, that the exact probability of lot acceptance calculated using the Hypergeometric distribution can be approximated by the Binomial distribution. The second concept is how the probability of lot acceptance changes when either one of the three parameters N, n, c of a sampling plan changes. The SPIN BUTTON can also visually show us how the shape of the OC curve of a sampling plan changes when the parameters vary.
In almost all production processes, the producer must rely on outside sources for both raw material and components. Suppose that the production manager of a personal computer manufacturing company purchases large lots of electronic components from an outside vendor. The components are then built into parts of a computer. Each component can be classified as either good unit or defective according to some specifications. Every time a lot of components is arrives from the vendor, the manager faces a problem. How can the manager be sure that the lot contains a small number of defectives, or no defectives at all? Inspecting every component, that is, 100% inspection, is expensive. Moreover, the effort required is often so overwhelming that it is inevitable the inspection personnel will have inspection fatigue which may cause a defective component be classified as a good one or vice versa. The 100% inspection approach is clearly not feasible if the inspection procedure is destructive. On the other hand, if no inspection is done, and if the incoming lot contains a large number of defective components, many defective parts are bound to be produced. It is expensive to trouble-shoot the problems and rework the defective parts at the later stages of the production process.
It is natural to consider a compromise position. The production manager might select a random sample of units from the incoming lot, then determine the number of defective components found in the sample. If the number of defective components found does not exceed a pre-determined number called the acceptance number, the lot is accepted; otherwise the lot is rejected.
These procedures comprise an attribute acceptance sampling plan or simply an attribute sampling plan. Attribute sampling plans are widely used quality control tools which can be used in any kind of industry. In the context of manufacturing, attribute sampling plans are implemented to make sure that the quality of incoming parts satisfies certain requirements before they are assembled; that the quality of semi-finished products is acceptable before they are passed to the next manufacturing stage; or that the quality of finished products satisfies the customer's specifications before they are shipped to the customer.
Each attribute sampling plan has three parameters (N, n, c) which correspond to lot size, sample size and acceptance number respectively. The quality level of a lot is usually expressed as percentage defective or fraction defective. For instance, a lot which has a quality level p = 10% means that there are 10% defective units in the lot. If p = 0% , all units in the lot are good whereas if p = 100%, all units are defective. It is worth noting that if a lot has a quality level of p = 0%, then the lot will be accepted no matter what sampling plan (N, n, c) is chosen. However, unless the quality level p is 100%, a lot with a high percent defective, say 30%, will still have a chance of being accepted.
The operation of an attribute sampling plan is simple, but there are two types of risk associated with each attribute sampling plan.
The risks associated with a sampling plan can be read from the operating characteristic (OC) curve which is a graph showing the probability of lot acceptance () for different lot quality levels.
There are two ways to calculate the probability of lot acceptance. Suppose that the sampling plan is (N, n, c) and the quality level of the lot is p. The first method is an exact method. The number X of defectives that are found in a sample will follow a Hypergeometric distribution. The probability of lot acceptance is
, c = 0, 1, 2, ..., min(n,Np).
Note that Np is an integer in the Hypergeometric formula above.
The second method is an approximate method. When the ratio n/N is small, the Hypergeometric distribution can well be approximated by the Binomial distribution. The probability of acceptance can be approximated by:
.
It is convenient to calculate the probability of lot acceptance () in Excel using the Binomial distribution because it has a "cumulative" flag. Unfortunately, the Hypergeometric distribution in Excel does not have the "cumulative" flag.
Figure 1 displays the OC curves for plans N = 1000, n = 50, c = 0 and N = 500, n = 25, c = 0. The probability of acceptance is calculated using the Hypergeometric distribution.
Figure 1. OC curves for N = 1000, n = 50, c = 0 and N = 500, n = 25, c = 0.
Using the plan (N, n, c) = (500, 25, 0), a lot with a relatively good quality level of 0.01 will still have about a chance of 0.23 being rejected. That is, the producer’s risk is 0.23. Using the same plan, a lot with a relatively bad quality level of 0.1 will still have a chance of 0.07 being accepted. That is, the consumer’s risk is 0.07. It is worth noting that despite the fact that the two plans (500, 25, 0) and (1000, 50, 0) have the same n/N ratio, their OC curves are different.
It is interesting to find out the effect of the three parameters N, n, and c on the probability of acceptance and hence the shape of the operating characteristic curve. The calculated using either the Binomial or Hypergeometric distribution is a function that depends on more than one variable. It is difficult to understand the effect of N, n and c on analytically because that would require a knowledge of multivariable calculus.
Readers who do not have the prerequisite mathematical skills, they can still understand the above concepts easily using a simple feature in Excel called SPIN BUTTON which involves nothing more than "click" and "drag-and-drop." The SPIN BUTTON feature is available in Excel 95 or above. All the graphs in this article are plotted using Excel 95 (or above) as well.
Below are the steps for creating an Excel spreadsheet with the SPIN BUTTON:
Figure 2 represents the final look of the layout of the spreadsheet. The Hypergeometric distribution is used to calculate the probability of acceptance for any plan (N, n, c) whereas the Binomial distribution is used for any plan (n, c). The same example in the active Excel environment can be downloaded by visiting the Appendix. When the user clicks the SPIN BUTTON n and c, the two OC curves change accordingly. However, when the user clicks the SPIN BUTTON for N, only the OC curve plotted using the Hypergeometric probabilities will move.
As the ratio n/N gets smaller, the OC curve plotted using the Hypergeometric distribution approaches that using the Binomial distribution. It is interesting to notice that the OC curve plotted using the Hypergeometric distribution is neither entirely above nor below that of using the Binomial distribution.
As n or N increases, the slopes of the OC curves become steeper gradually. However, the sample size n has a much greater effect on the OC curve than the lot size N. In fact, when the ratio n/N is small, the lot size N has almost no effect on the OC curve. For this reason, when the lot size N is large in comparison with the sample size n, the sampling plan (N, n, c) can be replaced by (n, c) without affecting the OC curve too much. We can also see that when c decreases, the slope of the OC curve becomes steeper. The acceptance number c has a much greater effect on the OC curve than the sample size n and the lot size N.
Because the function Hypergeometric in Excel does not have the "cumulative" flag, I have done something special to handle this situation. For each level of fraction defective from 0.01 to 0.2, I create a row of Hypergeometric probabilities for each c from 0 to 6. For this reason, the maximum limit of the SPIN BUTTON for c has been set to 6. The table of Hypergeometric probabilities hides behind the chart. Then I use the Excel function IF (logical_test, value_if_true, value_if_false) to produce the cumulative Hypergeometric probability when c is greater than 0. For instance, when the fraction defective is at 0.01 and c = 2, the value_if_true is SUM(E11..G11) which is the cumulative Hypergeometric probability.
Figure 2. Effect of N, n, and c on the OC Curve.
The SPIN BUTTON is a very simple and powerful feature to study the shape of the OC curve when the parameters N, n, and c of a sampling plan vary. We can see that the lot size N has the smallest effect on the OC curve whilst the acceptance number c has the largest. Using the SPIN BUTTON is an excellent practical exercise for the students who can experiment with the data and the graphs associated with the data. In fact, the SPIN BUTTON feature can be used to study the shape of any mathematical and statistical functions which have one or more than one parameters.
Click here to download or open the Excel file JSE_ng_spin_button.xls which contains active demonstrations of the use of the SPIN BUTTON (http://jse.amstat.org/v11n3/JSE_ng_spin_button.xls). The author suggests that the reader select "Don't Update" upon initialization in order to maintain the existing information.
Steve H. K. Ng
Department of Information and Communications Technology
Institute of Vocational Education, Tsing Yi
Hong Kong
Steveng@vtc.edu.hk
Volume 11 (2003) | Archive | Index | Data Archive | Information Service | Editorial Board | Guidelines for Authors | Guidelines for Data Contributors | Home Page | Contact JSE | ASA Publications