How to Design Attribute
Sample Plans on a Computer

The best sample plan minimizes your risk of rejecting
an acceptable lot and your customer's risk of receiving bad product.

by William A. Levinson

Instructions for downloading and using the Visual Basic program referenced in this article.

Download must be unzipped before use. Create a new folder and unzip into that folder.

Double click on the setup.exe file to install the Visual Basic program onto your computer.

You should now have a program icon called samplan. Clicking samplan will launch the application.

Be sure to use the Enter key when inputting values into the program.

This program is provided as a courtesy by the author. Neither the author nor Quality Digest accept any liability for the use of this program.

Harris Semiconductor's plant in Mountaintop, Pennsylvania, tests large lots of electronic die (chips) before shipment to Harris' transistor packaging plant in Malaysia. Because the test probe tips are too thin, the die tester cannot test the chips under full power. However, the test can reject die that are obviously bad. Its purpose is to cull these die before the company spends more money to assemble them into complete packages. The end products, the transistor packages, are 100-percent tested under full power loads before shipment to external customers. The entire test operation provides an opportunity to use statistical sampling to reduce costs.

Die lot sizes can exceed 10,000, and 100-percent die testing is expensive and time-consuming. If the lot is mostly (e.g., greater than 98-percent) good, it's usually cheaper to ship it and accept the extra losses after assembly. Otherwise, it is far more economical to rectify it and cull the bad units in Mountaintop.

Sequential sampling plans often allow the decision of whether to pass or reject the lot with a very small sample size. Sequential sampling plans reject very bad lots and pass very good ones quickly. Because the testing equipment can't be programmed to perform sequential sampling, Harris must rely on a single-sample acceptance sampling plan.

samp3Single-sample acceptance plans

Two numbers define single-sample attribute sampling plans: the sample size, n, and the acceptance number, c. The inspector (or test) examines n pieces, and the lot passes if c or fewer are nonconforming. More than c nonconformances results in rejection of the lot. Such lots are usually rectified or detailed: All the pieces are tested or inspected, and the bad ones are discarded (Figure 1). p is the lot's actual nonconforming fraction.

The sampling plan must meet two specifications:

The chance of failing a lot of acceptable quality (acceptable quality level or AQL) must be no greater than a, which is the producer's risk, that is, the manufacturer's risk of having to reject an acceptable lot.

The chance of accepting a lot of rejectable quality (lot tolerance percent defective or LTPD) must be no greater than b, which is the consumer's risk, that is, the customer's risk of getting an unacceptable lot.

Many plans will meet or exceed the requirements PA(AQL) 1 - a and PA(LTPD) b, where PA is the probability of acceptance. Since inspection and testing cost money, the best plan meets these requirements with the smallest possible sample size. An algorithm for finding the most economical sampling plan follows.

Sampling plan economics

 To determine the plan's economic aspects, the planner must know the per-unit inspection cost and the per-unit failure cost. The inspection cost can include the cost of purchasing new inspection or test equipment--existing equipment is a sunk cost even if the accounting system applies its cost to the product under consideration. The failure cost, or penalty cost, is the cost of shipping bad pieces to the next operation. In Harris' application, this is the cost of assembling these units into complete transistor packages before testing and discarding them. The inspection cost is proportional to the plan's average total inspection (ATI), and its penalty cost is proportional to the average outgoing quality (AOQ).


The procedure assumes that the sample is a small portion of the lot, i.e., the binomial approximation to the hypergeometric distribution applies. (The procedure could presumably be modified to use the hypergeometric distribution.) Under the binomial distribution,


 n! causes overflow for large sample sizes even in double-precision computer variables.

The following recursion formula works for such samples:


The algorithm's goal is to find the smallest n for which

PA(noptimal,coptimal,AQL) 1 - a

PA(noptimal,coptimal,LTPD) b.



samp4A single-sample acceptance sampling plan is to have a producer's risk of 6 percent for an acceptable quality level of 0.5 percent nonconforming, and a consumer's risk of 10 percent for a rejectable quality level of 5 percent nonconforming (Juran, 1988, 25.14, Table 25.3). Harris Semiconductor has developed a short Visual Basic program for designing single-sample acceptance sampling plans. Figure 2 shows the user inputs for this problem in the second column under "Plan Design." The results are in the far right column.

Juran's example uses a sample plan with n = 78, c = 1 to develop an operating characteristic curve, and this example works the problem in reverse. For n = 78, the acceptance probability at p = 0.005 is

PA = 0.99578 (the chance of getting no bad pieces)
         + 78 x 0.005 x 0.99577 (the chance of getting one bad piece)

     = 0.9415

So a = 0.0585 0.06. The acceptance probability at p = 0.05 is 0.0934 0.10, so n = 78, c = 1 meets the plan requirements.

The alpha risk goes down as the sample gets smaller, so a sample of 77 (which yields a consumer's risk of 0.097 0.10) is still capable of meeting the consumer's risk requirement. But for n = 76, b rises to 0.101 > 0.10. The program has therefore found the smallest sample size that fulfills the plan specifications (Table 1).


samp5A c = 0 plan cannot fulfill the plan specifications. A sample of 45 is necessary to meet the consumer's risk requirement of b 0.10, but at the acceptable quality level, 0.99545 = 0.798 and a = 0.202.

Figure 3 shows the operating characteristic curve and average outgoing quality (AOQ) for this plan when the lot size, N, is 1,000. (Enter N, n and c into the Plan Specifications table; click Plot OC Curve; click OC Curve tab.) AOQ is for rectification without replacement; that is, bad units are discarded but are not replaced with good ones.


The numerator is the expected number of bad pieces shipped: (N-n)PA is the number shipped, without inspection or testing, times the nonconforming portion. The denominator is the total pieces shipped: bad units shipped plus N(1-p), since all good units are shipped.

ATI is the average total inspection. The plot shows that the average outgoing quality limit (AOQL) is about 1 percent when p 2 percent, and the scrollable OC Curve table shows that the exact value (for p to the nearest 0.1%) is 1.024 percent when the nonconforming fraction is 2.1 percent.


Juran, J. and Frank Gryna. Juran's Quality Control Handbook, 4th edition. McGraw-Hill, 1988.

McWilliams, Thomas P. How to Use Sequential Statistical  Methods. ASQ Quality Press, 1989.

Schilling, Edward G. Acceptance Sampling in Quality Control. Marcel Dekker, 1982.


About the author

William A. Levinson, P.E., is a staff engineer at Harris Semiconductor's plant in Mountaintop, Pennsylvania. He holds ASQ certifications in quality and reliability engineering, quality auditing, and quality management. He co-wrote SPC Essentials and Productivity Improvement: A Manufacturing Approach and edited Leading the Way to Competitive Excellence: The Harris Mountaintop Case Study (ASQ Quality Press).

[QD Online] [Registrars] [DOE] [Sample Plans] [ISO Software] [Federal]

Copyright 1999 QCI International. All rights reserved. Quality Digest can be reached by phone at (530) 893-4095. E-mail: Click Here