2025-11-09

Background

  • In manufacturing industries, quality control (QC) are routinely performed to ensure that products are produced to meet certain standards

  • In most circumstances, it is not possible to perform QC inspection over all parts which have been produced (because of $); So, “sampled testing” offers a cost-effective solution

  • Have we ever think about how the sample size (n) for the QC testing could be determined ?

  • We are going to elaborate a way to determine the testing sample size (n), based on the concepts of Binomial Distribution, Confidence Level (C), and Statistical Reliability (R)

  • Let’s first build up the necessary mathematical framework …

  • Then, determination of the testing sample size (n) from desired levels of Confidence (C) and Reliability (R) could be explored via an interactive 3D plot, as powered by a R script

Math Framework

Consider that the probability of having the number of defectives \(d\) to be less than or equal to the accepted number of defects \(c\) in a sample size of \(n\) items (which are collected from a testing lot of products) follows a \(Binomial\) \(Distribution\):

\(\newline\) \(P(\mathrm{\#\ of\ defects\ }d\ \le\ c)=\sum\limits_{d=0}^{c}{\left(\begin{matrix}n\\d\\\end{matrix}\right)(1-R)^d(R)^{n-d}}=P(\mathrm{accepting\ the\ lot})\)

in which

\(R=\mathrm{Fraction\ of\ Good\ /\ Reliable\ Items\ }(\mathrm{i.e. \ Reliability})\)

\(\newline\) If zero defects is considered, \(c=0\) :

\(P(\mathrm{zero\ defects})=\left(\begin{matrix}n\\0\\\end{matrix}\right)(1-R)^0(R)^{n-0}=R^n=P(\mathrm{accepting\ the\ lot})\)

Math Framewark

Also consider

\(P(\mathrm{rejecting\ the\ lot})=1-P(\mathrm{accepting\ the\ lot})\)

\(\newline\) Suppose the sample lot is able to pass the QC inspection, it follows that the lot is conforming with confidence level \(C\geq P\) (rejecting the lot).

\(\newline\) In such case, we have at least: \(C=1-R^n\ \rightarrow\ 1-C=R^n\ \rightarrow\ n=\displaystyle {\frac{ln{(}1-C)}{ln{(}R)}}=\displaystyle {\frac{ln{(}1-\mathrm{Confidence}\ )}{ln{(}\mathrm{Reliability}\ )}}\)

Example

For example, if we target to be 95% confident that at least 90% of our product is reliable (that is, zero allowable defects subjected to QC test), it follows that:

\(\newline\) \[ n=\displaystyle {\frac{ln{(}1-0.95)}{ln{(}0.9)}}=28.4\approx29 \]

\(\newline\) Therefore, the sample size \(n\) for QC testing shall be at least equals to 29. In other words, n=29 will be the minimum testing sample size.

\(\newline\) Interestingly, if one targets for 99% confidence and 99% reliability, the minimum sample size \(n\) for QC testing will be 459 ! (This seem not to be an affordable number though)

Interactive plotly (Min. Sample Size)

ggplot (Min. Sample Size with C = 99%)

ggplot (Min. Sample Size with R = 99%)

ggplot (R Code)

r = 0.99

c = seq(0.5,0.99, by=0.01)

n = log(1-c)/log(r)

my_data <- data.frame(x_values=c, y_values=n)

ggplot(data = my_data, aes(x = x_values, y = y_values)) + geom_line() +

labs(title = “Minimum Sample Size (@ Statistical Reliability = 99%)”,

x = “Confidence Level (C)”, y = “Minimum Sample Size (N)”) +

theme_minimal() + coord_cartesian(ylim = c(0, 500)) + geom_line(color = “deeppink”)

Final Remarks

  • The mathematical model described in this script is developed based on: (1) The use of Binomial Distribution, and (2) The requirement on “zero number of defects” in the batch of testing samples to be classified as “reliable”.

  • In the “more forgiving” scenario that “finite number of defects” is allowed to classify the batch of testing samples as “reliable”, the model described here is needed to be modified mathematically.

  • Thank you : )