Estimating population defects from a sample size

2 questions: Question #1: I have a lot size of 240 and have drawn out a sample size of 20. Assuming I test the 20 units for go/no-go (i.e. it's binary, pass/fail) and I have Zero failures. what is the probability that I have a bad unit (i.e. it would fail my go/no-go test) in the lot of 240? Question #2 Say I have the same lot of 240 units. Assuming I want to be 80% confident that 95% of the units are good (i.e. they would pass the go/no-go test), what should my sample size be? Thanks in advance.

asked Jan 23, 2020 at 15:28 23 1 1 silver badge 4 4 bronze badges

$\begingroup$ Welcome to CV. Since you’re new here, you may want to take our tour, which has information for new users. Since this looks like homework (apologies if it's not), please add the [self-study] tag and read its wiki. Then tell us what you understand thus far, what you've tried & where you're stuck. We'll provide hints to help you get unstuck. Please make these changes as just posting your homework & hoping someone will do it for you is grounds for closing. If this is self-study rather than homework, let us know, and. it's still a good idea to show us what you've tried. $\endgroup$

Commented Jan 23, 2020 at 15:50

$\begingroup$ Thanks for the quick feedback. Actually, it's not homework. It real world problems I need to solve and I have no idea what I'm doing. I've explored sample testing via attributes as well as trying to understand whether or not the binomial distribution is applicable here. And to be honest, I'm just really not sure where to even start to answer my questions. Thanks again! $\endgroup$

Commented Jan 23, 2020 at 16:00

$\begingroup$ The only thing I can think of for the first one is Bayes stats. You have an unknown parameter - which is the true defect rate. Your sample has a 0 defect rate. Depending on the prior distribution of your defect rate, your posterior could be different shapes. But since your sample has a 0 defect rate, assuming uniform prior (since I have no other information about your prior), I would imagine your posterior estimate for defect rate is also 0. You can probably do the beta-binomial conjugate for this one if you don't know how to numerically do stuff. $\endgroup$

Commented Jan 23, 2020 at 18:11

$\begingroup$ Try starting on chapter 6 of Krushke's Bayesian book where you infer binomial probability. $\endgroup$

Commented Jan 23, 2020 at 18:16

$\begingroup$ And the second one, I can only think of trial/error finding a sample size that leads to a HDI that contains 80% of your data and where the tail boundary corresponds to 5% or greater defect rate. Maybe others have smarter methods. $\endgroup$

Commented Jan 23, 2020 at 18:28

1 Answer 1

$\begingroup$

Sampling without replacement follows a hypergeometric distribution.

Assuming you have a 5% defect rate. The chances of drawing a passing part on the first pick is equal to 228/240 or 95%, now on the chances of drawing 2 passing parts is 228/240 * 227/239 or about 90% chance of happening. If you continue this out for 20 picks, drawing all passing parts with a 5% defect rate will happen about 34% of the time. Via trial and error with increasing the defect rate, when the defect rates approaches 16% then the chance of drawing 20 out of 20 passing parts drops below 5%. Thus my answer for question #1 is with 20 passes then the defect rate is

For question #2, again performing the progressive hypergeometric calculations with additional draws. With a 5% defect rate, one should be able to draw 29 out of 29 defect free parts, 80% of the time.