# How to Mathemetically Derive the AQL Tables given Lot Sizes

M

#### magomago

I (think) I understand how binomial works. I programmed matlab code to derive OC curves for me on the spot, and I get each piece of the equation. I've done this before several times in the past, but because I don't work with these enough, I often go back to get a refresher.

Once I successfully got my OC curves (see 0.jpg), and compared them against examples in the CQE book , I went back to the binomial equation, and thought about accepting zero defects. Reassing the equation, I found it breaks down much more simply into:
n = ln(f) / ln(1-p)​
where f = probability_to_accept_such_a_lot, and p= expected lot defective %.
I then can get a beautiful graph where I have a given inspection sample size for an expected lot defective percentage, where the sample size must have no defective samples. See 1.jpg for this curve, and i pulled out couple common defective lot sizes, and the corresponding sample sizes.

Now I'd love to take it to the next step and derive AQL sampling tables for Attribute Inspection.
I searched online for the mathematics of AQL , but I'm not finding it at all! There isn't a resource that helps me see the math behind it. the most I see is subjective statements similar to "AQL is the maximum defective percentage a producer will accept in a lot. the value is typically an average over several lots".
I've assumed that 1-Pacceptance = AQL, but I'm concerned it might a shaky ground to make that assumption since technically its an average of several lots. Then I realized that I simply can't use the binomial equations because they are for infinite or very large lot sizes.

I was looking around at the hypergeometric equation, since it applies to scenarios where we don't have infinte lot sizes...are AQL tables generated from the hypergeometric equation?

I tried deriving the hypergeometric similarly c =0, but the equation is quite ugly :
Code:
``Probability to Accept = (N-A)!(N-n)! / (N-A-n)! N!``
I then thought that maybe I could at least understand the AQL table for very lot sizes (which should theoretically align nicely with binomial distribution) but I still don't see any alignment in the numbers.
For example, lets say I have a 500k lot, and I'm using AQL-II, that will drive a Code Letter Q. I see that for various AQLs, My accept/reject will vary. But what if I read the table backwards at this point? Rather than set an AQL level and get an accept qty, I pick my accept qty and then look at the corresponding AQL?
Lets say that I want an accept = 0, that would mean my AQL would be 0.01. So, for a lot of 500k, I'd sample about 1250 samples, and for an AQL of 0.01% I would need 0 rejects.
Now, how would it compare against the original binomial distribution? Is such a comparison valid? If I think about how much of the lot I'm sampling, it is 1250/500k = .0025% of the lot. I'd argue that binomial could be used here applying the C=0 case, and I should get a decent estimate of sample size.
However, when I take a look at 1.jpg, I find that my chart doesn't have a condition of 0.01% (I could generate it for more digits of resolution, but I won't, and you'll see why)! The best I have is a condition for 0.1% defective lot, and the sample size is 2994. That is FAR above what the AQL tables are saying...what am I missing? I feel that I'm still fundamentally not understand what AQL actually means, and how its mathmetically expressed.

My ultimate goal is to understand why AQL charts are different from AQL zero acceptance charts. I conceptually get the difference - AQL charts will provide to you the sample size, and the accept/reject qtys, whereas the latter assume accept = 0/reject =1...but that isn't good enough for me. I desperately want to understand but at this point my head will

That said, please don't be confused that I'm asking how to read the tables --I can read them very easily. I'm asking how we construct these tables, mainly because I feel there will be huge insight and learning in doing so. Any help is appreciated...thanks!

#### Attachments

• 48.9 KB Views: 588
• 36.7 KB Views: 415

#### Statistical Steven

##### Statistician
Staff member
Super Moderator
Re: How to Mathemetically Derive the AQL Tables given Lot Sizes ?

AQL is the Percent defective at P(A)=0.95 from your OC curve. LQ is the Percent Defective at P(A)=0.10.

#### Bev D

##### Heretical Statistician
Staff member
Super Moderator
...I searched online for the mathematics of AQL , but I'm not finding it at all! There isn't a resource that helps me see the math behind it.
And you won't find it. The AQL sampling tables that have different sample sizes based on lot size were a result of negotiations, not strict probability calculations. There are correction factors out there for finite populations, but I have found that most production lot sizes are of sufficient quantity that correcting for the finite population results in only a very small change to the sample size. Not enough to bother with given the Probabilities of accepting or rejecting a lot with a given defect rate...fro very special and very small lots I would use the Hypergeometric...

...I've assumed that 1-Pacceptance = AQL, but I'm concerned it might a shaky ground to make that assumption since technically its an average of several lots. Then I realized that I simply can't use the binomial equations because they are for infinite or very large lot sizes.
As Statistical Steven said, AQL means the defect rate at which you would accept the lot XX% of the time. the XX% is typically 95% but could take on any other value you desire. It is NOT 1-P(Acceptance); that is the Probability of Rejecting the lot if it were at the AQL defect rate.

#### David-D

##### Involved In Discussions
Also consider that for commonly used standards MIL-STD-105 or ANSI Z 1.4) they employ a common range of sample sizes (... 8,13... 315, 500...) and common ranges of accept/reject criteria (ex 21-22). These are selected to find a best fit to the AQL point, even if slightly different, but non-standard, numbers would curve fit better.

David

#### Proud Liberal

##### Quite Involved in Discussions
I've always avoided using lot sizes based on the section in Grant & Leavenworth's Statistical Quality Control "Fixed Sample Size Tends Toward Constant Quality Protection" (see figures 12-1 and 12-2 in attached excerpt). This greatly simplifies incoming inspection and eliminates "games" being played with lot sizes to effect sample sizes.

Instead, I generate a AOQL plot of the sampling plan (in automotive, it is mandated that c=0) and use the maximum value to determine the worst case condition that my customer should expect (ie: n=35, c=0 yields approx 1% max value).

Am I under-thinking this?

#### Attachments

• 2 MB Views: 520

#### Bev D

##### Heretical Statistician
Staff member
Super Moderator
I've always avoided using lot sizes based on the section in Grant & Leavenworth's Statistical Quality Control "Fixed Sample Size Tends Toward Constant Quality Protection" (see figures 12-1 and 12-2 in attached excerpt). This greatly simplifies incoming inspection and eliminates "games" being played with lot sizes to effect sample sizes.
I understand your point but Grant and Leavenworth are not comparing a 'fixed' sample size to a 'varying' sample size like those in the popular AQL sampling tables that use lot size. the comparison they make is to the misguided use of a "% of the lot" approach to sampling.
I can see how the use of varying sample sizes based on lot size can lead to 'games' about lot sizes and I agree that having varying sample sizes is not a particularly smart things to do form a probability standpoint. (especially knowing that the approach was result of negotiations and not probability)

Instead, I generate a AOQL plot of the sampling plan (in automotive, it is mandated that c=0) and use the maximum value to determine the worst case condition that my customer should expect (ie: n=35, c=0 yields approx 1% max value).

Am I under-thinking this?
I think your approach is essentially solid. I like it.

D Percent - Formula to derive Numbers from Percent Calculation Statistical Analysis Tools, Techniques and SPC 1
LTPD, AQL, Ppk and Cpk validation sampling plan table Inspection, Prints (Drawings), Testing, Sampling and Related Topics 0
AQL, Consumer Risk and MA Statistical Analysis Tools, Techniques and SPC 2
AQL - How to count samples with defects for each defect class AQL - Acceptable Quality Level 17
Defining sampling plan for different AQL AQL - Acceptable Quality Level 3
ARMY AQL - Requirements which don't have an AQL associated with them Manufacturing and Related Processes 2
AQL table - I need to sample 1250pcs AQL - Acceptable Quality Level 3
Sampling plan for a customer who wants AQL 1.0 (per ANSI Z1.4) AQL - Acceptable Quality Level 5
How to interpret AQL sampling tables AQL - Acceptable Quality Level 5
AQL sampling bags of parts Inspection, Prints (Drawings), Testing, Sampling and Related Topics 5
Sampling processes - Who must define the AQL level? AQL - Acceptable Quality Level 9
AQL for Effectiveness Check - What AQL tiers to use on this type of sampling? Nonconformance and Corrective Action 9
AQL Inspector's Rule - bring into CQE Exam? Professional Certifications and Degrees 5
The question asks about sampling plans and AQL Reliability Analysis - Predictions, Testing and Standards 5
Defining Acceptance Quality Level, I need clarity on AQL 1.5, 2.5, 4.0 AQL - Acceptable Quality Level 5
Receiving Inspection AQL - Am I allowed to just pick a AQL? Inspection, Prints (Drawings), Testing, Sampling and Related Topics 10
Established a c=0 "AQL" or "RQL" table AQL - Acceptable Quality Level 5
AQL Sampling Plan SOP / WI - Medical Device Industry Inspection, Prints (Drawings), Testing, Sampling and Related Topics 14
Example Work Instruction/Procedure for AQL (Acceptable Quality Level) AQL - Acceptable Quality Level 4
L How to calculate the Probability of Deficiency of the AQL of an Inspection AQL - Acceptable Quality Level 16
Setting Acceptance Quality Limits (AQL) for New Medical Devices ISO 13485:2016 - Medical Device Quality Management Systems 4
K AQL for Sterile Product - Laminate Tubes 21 CFR Part 820 - US FDA Quality System Regulations (QSR) 5
L AQL ANSI z1.4 & z1.9 - What are the differences between these 2 standards? AQL - Acceptable Quality Level 5
P RQL/AQL from Attribute Data Six Sigma 1
B Designing a Sampling Plan - AQL AQL - Acceptable Quality Level 19
S Determining Sample Size - AQL & LQ AQL - Acceptable Quality Level 10
V AQL for Component Level and Assembled Finished Product AQL - Acceptable Quality Level 1
AQL and Sampling Size for Components Solderability Test Statistical Analysis Tools, Techniques and SPC 3
A Inspection Plans - How to choose AQL (MIL STD 105E) Excel .xls Spreadsheet Templates and Tools 1
U AQL, Lot Size vs Sampling Plans AQL - Acceptable Quality Level 8
Formula to tie together - Confidence/Reliability Level AQL? LTPD? Reliability Analysis - Predictions, Testing and Standards 3
Which Sampling Tables for AQL? Statistical Analysis Tools, Techniques and SPC 6
K Can I use ANSI/AQL for the Total Number of Containers for the entire Lot? Inspection, Prints (Drawings), Testing, Sampling and Related Topics 1
M Determining c=0 AQL numbers Misc. Quality Assurance and Business Systems Related Topics 3
Who and when to determine AQL for our product inspection AQL - Acceptable Quality Level 1
K Verification Sampling vs. AQL - Sampl Sizes Inspection, Prints (Drawings), Testing, Sampling and Related Topics 1
E Translating AQL to a Production Line Inspection Plan AQL - Acceptable Quality Level 14
S Class III Sampling Plan - Explain AQL vs. 95%C & 90%R Inspection, Prints (Drawings), Testing, Sampling and Related Topics 1
Training the absolute beginner to understand AQL Training - Internal, External, Online and Distance Learning 1
S What are typical Acceptable Quality Levels (AQL) adopted in Food industry? Food Safety - ISO 22000, HACCP (21 CFR 120) 1
D What AQL level to use to test LEDs Inspection, Prints (Drawings), Testing, Sampling and Related Topics 5
B AQL Sampling Tables Question Inspection, Prints (Drawings), Testing, Sampling and Related Topics 4
C Constructing an AQL matrix for our QC operators in a flexographic printing outfit AQL - Acceptable Quality Level 4
N Visible particles inspection in powders for injections. Approaches to AQL level Pharmaceuticals (21 CFR Part 210, 21 CFR Part 211 and related Regulations) 1
S Justifying the AQL for a Zero (C=0) Acceptance Plan (Medical Device) AQL - Acceptable Quality Level 6
W Application of AQL (Acceptable Quality Level) Concept AQL - Acceptable Quality Level 15
P Deviating from AQL in a small Retail Apparel Company AQL - Acceptable Quality Level 5
M AQL (Acceptable Quality Level) for Mixed Part Defect IATF 16949 - Automotive Quality Systems Standard 1
AQL (Acceptable Quality Level) Report Form example wanted AQL - Acceptable Quality Level 1
H Determining the Correct Sample Size when AQL points to two Sample Sizes AQL - Acceptable Quality Level 7