Results: Monte Carlo Simulation of Acceptance Sampling Plan

reynald

Quite Involved in Discussions
I have been meaning to do this for personal reference so it feels good to finally have the results. I'm posting it here for everyone's reference and for my future me since I'm sure I would misplace the file later so to make sure I could at least search it on the internet, here it goes.
--------------------------------------------------------------------------
Monte Carlo Simulation of Acceptance Sampling Plan

Background:
Sometimes people get confused why their acceptance sampling plan somehow did not capture a defective item and was shipped to the customer. Here is my take on that matter.

Objective:
To examine using Monte Carlo simulation approach the performance of attribute acceptance sampling plan given batch size of 3200 items, sample size of 125 (MIL-STD-105E: General Inspection Level 2, AQL = 0.1).

Methods:
1. Random numbers were generated using SAS's JMP random number utility. 1,000 columns each having 3200 rows were generated containg a random events pass/fail that follows a Bernoulli distribution with parameter P. This generated table would represent the Population Data where each column representing a distinct period in time.

2. From the generated table above, a random sample of 125 rows will be taken. Each row will be then summarized as either containing a "fail" entry or not. For those columns where "fail" were sampled, a judgment of "batch failed" will be given. For those columns where "fail" were not sampled, a judgement of "batch passed" will be given.

3. Of the interest of this simulation is the examine the response of percent batch_failure as a function of the Bernoulli distribution parameter P.

4. The simulation would be run for the following Bernoulli distribution parameter P = { 0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1}. For each value of P, three runs would be made to be able to have a feel on the standard deviation of the results.

Results:
Here are the results of the Simulation
Screen Effectiveness Results
(Percent Trapped* by the Sampling Plan given True Defective Level P):
P************ Trial1************ Trial2************ Trial3
0.0001************ 0.8%************ 1.4%************ 1.5%
0.0005************ 5.7%************ 6.1%************ 5.3%
0.001************ 12.6%************ 12%************ 10.9%
0.005************ 49%************ 45.8%************ 47.3%
0.01************ 71.4%************ 70.7%************ 72.3%
0.05************ 99.8%************ 99.9%************ 100%
AQL= 0.1************ 100%************ 100%************ 100%
*(This means Escapee = 100% - Percent Trapped)


Conclusion:
As has been mentioned many times in several threads in this Forum, Acceptance Sampling assures only that no more than a level P = AQL would reach the customer. Below that level of P, just live with the fact that escapees are inevitable.


Reference:
JMP Code that was used to Generate the Results
PHP:
dt = New Table("Population Data");
p = 0.0001;     //--->You can change this value
i = 1;
fail=0;
end_column = 1000; //----->I will be generating 1000 columns of random numbers
For( i = 1, i <= end_column, i++,
	dt << New Column( Char( i ), formula( If( Random Uniform() < ::p, 1, 0 ) ) )
); //---> 1 means Defective, 0 means Good



dt << add rows( 3200 );       //------------->Each column would have 3200 rows

dt_samples = dt << Subset( Output Table( "Samples" ), Sample Size( 125 ) );


j=1;
For( j = 1, j <= end_column, j++,
if(
	Col Max( column(dt_samples,j))>0, fail=fail+1,print(fail)
	//Note: If I see at least 1 Defective, the sampling plan fails the batch
	)
);


print("There are " ||  char(fail) || " samples that failed. That is "||char(round(100*fail/end_column,1))|| "% failure rate.");
 

Bev D

Heretical Statistician
Leader
Super Moderator
Well, I'm not really sure hwo teh actul analysis was done, but the following statement is not accurate:
"Acceptance Sampling assures only that no more than a level P = AQL would reach the customer"

The definition of AQL (Acceptable Quality Level) is actually the level that if present would be ACCEPTED and therefore shipped to the Customer 95% of the time (or some other % dependign on how you specify Alpha or the Producer's risk.)

So you can have a defect rate higher than the AQL that will routinely be missed and therefore reach the customer, at lesser and lesser probability as the defect rate increases unitl it reaches the RQL (aka LTPD) level. At which point the chance of accepting the lot is less than 5% (or 10% dependign on how you specifiy Beta also known as the Consumer's risk)

The names say it all. AQL protects the producer from over rejecting lots with an ACCEPTABLE defect rate. RQL protects the Customer from lots with an unacceptable defect rate.


Reynald has capured the essence of the 'fallibility' of sampling in that no sample plan can guarantee that no defects will reach the customer.

seems the model he used may be wrong?
 
S

supreecha

:agree:Acceptance Sampling by Attributes

Measurement type: Go/no go
Lot quality in percent defective
Lot size: 3200
Use binomial distribution to calculate probability of acceptance


Acceptable Quality Level (AQL) 0.1
Rejectable Quality Level (RQL or LTPD) 10


Compare User Defined Plan(s)

Sample Size 125
Acceptance Number 0

Accept lot if defective items in 125 sampled <= 0; Otherwise reject.


Percent Probability Probability
Defective Accepting Rejecting AOQ ATI
0.1 0.882 0.118 0.085 486.5
10.0 0.000 1.000 0.000 3200.0

Average outgoing quality limit (AOQL) = 0.282 at 0.794 percent defective.
 

Attachments

  • AQL 0-1.docx
    39.4 KB · Views: 281
Top Bottom