# Validity of proportion estimate from finite sample

If I have a batch of 130 parts and I inspect a random sample of 14 parts, either accept or reject the part, and calculate the percent defective in the sample, how confident can I be that the percent defective in the sample represents the percent defective in the batch?

Here's why I need to know: We have a process with very poor capability - generally around 20% defective. We want to pull a sample as soon as a batch of 130 parts is done and be able to predict the yield with some confidence level so we can react by either continuing to run if less than 20% defective would be expected from the batch within our confidence interval or shut down if greater than 20% defective is expected based on the sample. I will be asked how confident am I that the sample yield represents the final batch yield. P.S. I am not a statistician, but I have taken a lot of engineering mathematics.

• Not sure what exactly you are looking for. But if your question is answered by "I'm 95% certain that in 95% of the 130 part samples the number of defective parts will be between x and y" then you need to look up tolerance intervals. Jan 20 '14 at 19:30
• what does the word 'represent' really mean in this context? A precise definition of what kind of statement you want to make might help pin things down. Jan 20 '14 at 20:42

This is more of a comment, but I don't quite have enough reputation points to commend ;)

You'll never get a confidence that the rate is exactly some number - it's actually zero that it will be any particular exact real number (of which there are an uncountably infinite number in any interval).

What you can do with your sample of 14 is create a confidence that the population defect rate is more or less than some threshold. Suppose you want no more than 12% defects. Depending upon how confident you need to be, you can sample fewer or more, and obviously sampling more will give you greater confidence. Furthermore, the more conservative your threshold, the more confidence can be developed for a given sample size. With 14 samples, the defect rate will probably be 0%, maybe 7.14%, hopefully not 14.28% or higher. But since other intermediate probabilities are not possible from a sample size of 14, you can see how much uncertainty exists. Since 14 is not a factor of 130, the probabilities (in the sense of rate, not a chance over a larger population) cannot possibly be precisely equal.

Assuming a 20% defect rate in the batch/population, you can use a binomial to calculate the probabilities of each potential number of defects in the sample. I get: defects prob cum prob

0    0.0440    0.0440
1.0000    0.1539    0.1979
2.0000    0.2501    0.4481
3.0000    0.2501    0.6982
4.0000    0.1720    0.8702
5.0000    0.0860    0.9561
6.0000    0.0322    0.9884
7.0000    0.0092    0.9976
8.0000    0.0020    0.9996

rest of table has very low probabilities

So, if you only find no defects in your sample of 14, you can be 1-0.044 or 95.6% sure that the overall defect rate is less than 20%. However, if you get 2 defects out of 14, the confidence is only about 55% - still probable (>50) which is intuitive since 2/14 <0.2.

However, if you increased you sample to 28, the table would become:

0    0.0019    0.0019
1.0000    0.0135    0.0155
2.0000    0.0457    0.0612
3.0000    0.0990    0.1602
4.0000    0.1547    0.3149
5.0000    0.1856    0.5005
6.0000    0.1779    0.6784
7.0000    0.1398    0.8182
8.0000    0.0917    0.9100
9.0000    0.0510    0.9609

10.0000 0.0242 0.9851 11.0000 0.0099 0.9950 12.0000 0.0035 0.9985 13.0000 0.0011 0.9996 14.0000 0.0003 0.9999 15.0000 0.0001 1.0000

Now a sample defect number of 4 (4/28 is the same rate as 2/14) gives you a better confidence, about 68%, of a population defect rate of less than 20%.

Thanks whuber!

Revised for sample size 14 with they hypergeometric

numDefects prob cumProb

0    0.0364    0.0364
1.0000    0.1455    0.1819
2.0000    0.2570    0.4388
3.0000    0.2653    0.7041
4.0000    0.1785    0.8826
5.0000    0.0827    0.9653
6.0000    0.0271    0.9924
7.0000    0.0064    0.9988
8.0000    0.0011    0.9999
9.0000    0.0001    1.0000
• Thanks for the feedback. I understand pretty much the situation as you desribe it. Maybe this would help clarify - here's my reason for wanting to know: Jan 20 '14 at 19:21
• (1) This is a finite population situation, so a hypergeometric calculation would be more accurate (although the binomial is a decent approximation). For instance, the value for $0$ is $0.0364$ rather than $0.0440$. This has a more profound effect for larger samples. (2) Your answer seems to use "confidence" in the sense of "probability": that is not the usual meaning unless you are performing a Bayesian analysis, but you're not doing that.
– whuber
Jan 21 '14 at 17:33