# Determining sample size for inspection to achieve x% confidence re defects

S

#### Stabby

I apologize in advance for a very basic question and am a little embarrassed that I cannot dig into my memory banks and figure this one out. Also, if this is the wrong place for such a question, please refer me to where you feel it would be more appropriate.

We have 6 shipping containers containing 585 items / boxes each of the same item for a total of 3510 items / boxes. We strongly suspect a high rate of defective products but assume the high defect rate is limited to 1 or 2 batches (therefore only present in 1 or 2 containers).

If this assumption is correct, how many items / boxes do we need to open and inspect for each shipping container to give us 98% confidence that that container has an acceptable amount of defects (2% defect rate as opposed to 30% defect rate)?

Thanks for any and all help or referrals.

#### Stijloor

Staff member
Super Moderator
A Quick Bump!

Can someone help?

Thank you very much!

#### Steve Prevette

##### Deming Disciple
Staff member
Super Moderator
A difficulty is your statement: We strongly suspect a high rate of defective products but assume the high defect rate is limited to 1 or 2 batches (therefore only present in 1 or 2 containers).

Random sampling and associated sample size calculations assume that there is an equal chance that ANY item may be defective, and that if one item is defective, it does not affect those items around them.

However, if we ignore that worry for the moment, if you have a population size of 3515 and want a 98% probability that no more than 2% are defective, you would need to sample 190 with no defects found. This is calculated using the hypergeometric formula in Excel. By the way, if we simply assume a 'very large' population size and use the binomial, you get a sample size of 194.

=BINOMDIST(0,194,0.02,TRUE) gives you 0.98.

#### UncleCrazyHorse

##### Registered
I second Steve's comments. If there is a portion of the population that is known (or suspected) to contain a significantly higher defect rate, random sampling may provide an x% Confidence of y% Conformance result, but it would be invalid.

With a known (or suspected) higher failure rate within one or two lots, it would be important to sample each lot independently based on quantity and calculate a Confidence/Conformance interval lot-by-lot.

Please let us know what path you take and the outcome. You've piqued my interest!
Good luck.

#### Mark Meer

Trusted Information Resource
if you have a population size of 3515 and want a 98% probability that no more than 2% are defective, you would need to sample 190 with no defects found. This is calculated using the hypergeometric formula in Excel.
Hi Steve,
Could you elaborate a bit on how this is done?
I know the Excel formula works as follows:

HYPGEOMDIST(Sample_s, Number_sample, Population_s, Number_pop), where
• Sample_s = the number of successes in the sample
• Number_sample = the size of the sample
• Population_s = the number of successes in the population
• Number_pop = the size of the population

...So how did you use this, when it is Number_sample that is the unknown? A solver of some sort?

#### Steve Prevette

##### Deming Disciple
Staff member
Super Moderator
...So how did you use this, when it is Number_sample that is the unknown? A solver of some sort?
Exactly. It is a trial and error process. I wrote my own macro / solver in the attached file.

Usual caveats on "free" software - to the best of my knowledge, this software works, but I would expect any recipient of it to do their own independent V&V that it works (such as test against know statistical textbook problems).

#### Attachments

• 44 KB Views: 228

#### Mark Meer

Trusted Information Resource
Oooo. Custom Excel macros. Excel just got a million times more complicated!

Thanks Steve. I'll take a look....

Two initial questions:

1. In the hypergeometric sheet, your calculation for "C" (num successes) is:

INT((A2*C2)+0.5), where A2 is the defect probability; and C2 is the population size.

Why the "+0.5"?

2. Your use of the HYPGEOMDIST formula is:
=HYPGEOMDIST(0,\$D\$8,\$C\$8,\$C\$2)-(1-B2)

Why do you subtract "1-B2" (B2 = Confidence Level)?

#### Steve Prevette

##### Deming Disciple
Staff member
Super Moderator
I add +0.5 to make the INT function round properly. For example, INT of 6.7 is 6. But I really want it to round to 7, so by adding 0.5, INT of 7.2 gives me 7.

I subtract the confidence level from 100%, because the statement that I want to be 95% confident that no more than 2% are defective, really means that the probability of detecting NO failures when there are 2% defects must be less than 5%.

Determining sample size for device sterility Inspection, Prints (Drawings), Testing, Sampling and Related Topics 3
Determining of sample size for 'Operational Qualification' AQL - Acceptable Quality Level 5
Determining Sample Size for Medical Device Component Validation Inspection, Prints (Drawings), Testing, Sampling and Related Topics 0
Surveillance Sampling Test - Determining Sample Size Inspection, Prints (Drawings), Testing, Sampling and Related Topics 5
S Determining Sample Size - AQL & LQ AQL - Acceptable Quality Level 10
Bayes Success-Run on Attribute Data - Determining Sample Size Statistical Analysis Tools, Techniques and SPC 2
Determining Sample Size in Design V&V activities 21 CFR Part 820 - US FDA Quality System Regulations (QSR) 44
G Determining Sample Size for Equipment Qualification Studies Qualification and Validation (including 21 CFR Part 11) 10
Determining Sample Size for Capability in Six Sigma Project Six Sigma 5
H Determining the Correct Sample Size when AQL points to two Sample Sizes AQL - Acceptable Quality Level 7
L Determining Cpk based on a given Sample Size, Confidence Level, & Reliability Inspection, Prints (Drawings), Testing, Sampling and Related Topics 2
M Determining Sample Size needed for Operational Qualification (OQ) Inspection, Prints (Drawings), Testing, Sampling and Related Topics 24
Determining the appropriate Sample Size using an AQL Table Inspection, Prints (Drawings), Testing, Sampling and Related Topics 29
J Functional Test Sampling - Determining Sample Size to eliminate 100% Testing Inspection, Prints (Drawings), Testing, Sampling and Related Topics 2
W Sampling Plan problem - Determining Sample Size for both Attribute and Variables Data ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 2
S Determining the Total Sample Size using AQL - AQL Lot Quantity question AQL - Acceptable Quality Level 8
1 Determining AQL and Sample Plan - Batch size is from 1-500 AQL - Acceptable Quality Level 24
E Determining Sample Size for Design Verification and Design Validation Other Medical Device and Orthopedic Related Topics 20
N Auditing Proof of Delivery signed by the customer - Determining Sample Size General Auditing Discussions 6
P Determining Sample Size - Filling a bag with three different types of candy Inspection, Prints (Drawings), Testing, Sampling and Related Topics 31
Q Determining Sample Size for FDA Verification and Validation Activities Inspection, Prints (Drawings), Testing, Sampling and Related Topics 41
D Determining sample size required based on a 95% confidence level Reliability Analysis - Predictions, Testing and Standards 7
B Determining sample size for drop test and waterproof testing Inspection, Prints (Drawings), Testing, Sampling and Related Topics 6
T Determining Receiving Inspection Sample Size Inspection, Prints (Drawings), Testing, Sampling and Related Topics 1
N Determining Sample Size for Attribute Data Inspection, Prints (Drawings), Testing, Sampling and Related Topics 3
C Internal Audit Sampling Plans - Determining Internal Audit Sample Size Internal Auditing 45
Q Determining the Appropriate Sample Size for Process Validation/Qualification Inspection, Prints (Drawings), Testing, Sampling and Related Topics 13
T Using Cpk for the purpose of determining sample size/frequencies Capability, Accuracy and Stability - Processes, Machines, etc. 2
G Determining Sample Size and Frequency for Features on Control Plans FMEA and Control Plans 8
R Determining Sample Sizes for Testing (Chemistry or Microbiology) Inspection, Prints (Drawings), Testing, Sampling and Related Topics 6
Selecting a Sample and Determining the Reference Value for a Bias Study Gage R&R (GR&R) and MSA (Measurement Systems Analysis) 2
Determining the the maximum number of reprocessing cycles of attachments CE Marking (Conformité Européene) / CB Scheme 2
Determining Uncertainty from Gage R&R Gage R&R (GR&R) and MSA (Measurement Systems Analysis) 1
IATF 16949 4.3.1 - Determining the scope of the quality management system - supplemental IATF 16949 - Automotive Quality Systems Standard 9
ISO 9001:2015 4.3 Determining the Scope of the QMS ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 3
Determining SPC tolerance Statistical Analysis Tools, Techniques and SPC 21
Determining SAT Offsets vs TUS Offsets per SAE AMS 2750E AS9100, IAQG, NADCAP and Aerospace related Standards and Requirements 0
Question on determining defective units - I am not recording fixture to part rejected Statistical Analysis Tools, Techniques and SPC 5
Clause 8.2.2 Determining the requirements for products and services ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 5
Determining Calibration Frequency schedule for items used in production Manufacturing and Related Processes 2
Determining if Maintenance Contractor is an External Service subject to ISO 9001 Clause 8.4 ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 43
AS9100D PEAR - Examples for organization's method for determining process results? AS9100, IAQG, NADCAP and Aerospace related Standards and Requirements 5
Determining Calibration Tolerance of a Measurement Device General Measurement Device and Calibration Topics 2
ISO 17025 Documented Procedure for 6.2.5 - Determining competency ISO 17025 related Discussions 4
Determining FDA 820 (registration) vs ISO 13485 - Supplier gives us the kit ISO 13485:2016 - Medical Device Quality Management Systems 1
ISO 9001 8.4.1 - Determining controls applied to externally provided processes ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 8
Determining what is good and what is bad can be subjective - when is it a quality issue? ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 9
Determining what type of scrap to include in my internal PPM calculation Quality Manager and Management Related Issues 5
Determining number of employees within the "Scope" of the QMS ISO 9000, ISO 9001, and ISO 9004 Quality Management Systems Standards 9
Determining the Scope of the QMS during Stage 1? Registrars and Notified Bodies 11