1

Suppose there are 1 million parts which have 1% defective parts i.e 1 million parts have 10000 defective parts. Now suppose we are taking different sample sizes from 1 million like 10%, 30%, 50%, 70%, 90% of 1 million parts and we need to calculate the probability of finding maximum 5000 defective parts from these sample sizes. As 1 million parts has 1% defective parts so value of success p is 0.01 and failure q is 0.99. Now the issue is when we r calculating probability of sample sizes below 50% of 1 million parts, value of probability for finding maximum 5000 defective parts is always 0, at 50% of 1 million parts it is 0.5 and sample sizes of more than 50% give probability equal to 1. It means we only get three probability values in all sample sizes i.e 0, 0.5, 1. Now the issue is that there are no intermediate values between 0-0.5 or 0.5-1 although sample size is changing linearly. Can someone plz mention the issue in this problem. I will be very gratful

irum
  • 41
  • The probability assertions are not correct, except for the sample of $500000$ case. So there is nothing to explain. Do you want the probability that the number of defective parts in the sample is $\le 5000$? That's what "a maximum of $5000$ defective parts" means. But you may want to say "at least $5000$ defective parts." – André Nicolas Jul 05 '13 at 07:37
  • yes i want probability of having ≤ 5000 defective parts in each sample. so where i m wrong? – irum Jul 05 '13 at 07:59
  • Can u please tell me why probability assertions are wrong? because I have to consider different fractions of 1 million population and find 5000 defective parts in each fraction. I m IT person and not good in statistics so can u help me plz, its urgent – irum Jul 05 '13 at 08:06
  • Don't know where you are wrong, since you have not shown your calculation. Of course if sample size is $\le 5000$, the probability is $1$. After that it is $\lt 1$, but not much less for quite a while. Going to sleep now, if I get more detail will get back to you tomorrow, unless someone else has answered. – André Nicolas Jul 05 '13 at 08:08
  • :-( well i was using binomial distribution to calculate the probability. here n is 900000 in case of 90% of population, r=5000, p=0.01 and q=0.99. all values remain same. only value of n changes according to fraction value. I just want to have intermediate values between 0-0.5 or 0.5-1 as well. anyway if you have any clue about it, do reply and thnx in advance – irum Jul 05 '13 at 08:13

1 Answers1

1

The problem: First we state what we understand to be the problem. The probability that a randomly chosen item is defective is $0.01$. We take possibly very large samples, samples that are enormous by essentially all sampling standards. We want to find the probability that the number of defectives in the sample is $\le 5000$,

A comment mentions the binomial distribution. It is not clear that this is the appropriate distribution. If the number of defectives is exactly $10000$, then we are dealing with the hypergeometric distribution. However, for the kinds of calculations we are making, for all practical purposes it doesn't matter.

The normal approximation: Let random variable $X$ be the number of bads in a sample of size $n$. We want $\Pr(X\le 5000)$.

The random variable $X$ has mean $n(0.01)$ and variance $n(0.01)(0.99)$. So the standard deviation is $\sqrt{n}\sqrt{(0.01)(0.99)}$. For most practical purposes this is $\sqrt{n}/10$. (This number would require modification for another probability of a bad.)

The probability that $X\le 5000$ is extremely well approximated by $$\Pr\left(Z\le \frac{5000-(0.01)n}{\sqrt{n}/10}\right),\tag{1}$$ where $Z$ is standard normal.

Some calculations: We do some calculations, for the various huge sample sizes mentioned in the OP.

$10$ percent: By (1), we want the probability that $Z\le 126.5$. This is $1$ for all practical and impractical purposes.

$30$ percent: By (1), we want the probability that $Z\le 36.5$. Again, this is $1$ for all practical purposes.

$40$ percent: Our probability is approximately the probability that $Z\le 15.8$. Again this is $1$ for all practical purposes.

$50$ percent: We want the probability that $Z\le 0$. This is $0.05$.

$60$ percent: We want the probability that $Z\le -15.8$. This is virtually equal to $0$.

Higher percentages give the same result, essentially $0$.

More calculations: The probability that $X\le 5000$ was virtually $1$ for the various percentages we calculated, up to but not including $50\%$, became $0.5$ at $50\%$, and had already dropped to virtually $0$ at $60\%$. We do some exploration of the fine stucture around $50\%$.

Look for example at $49\%$. Again by (1), the probability that $X\le 5000$ is approximately the probability that $Z\le 1.428$. This is about $0.92$, significantly away from $1$. By symmetry, with a sample size of $51\%$, we have $\Pr(X\le 5000)\approx 0.08$.

Finally, let's do the computation for $49.5\%$. We get $\Pr(X\le 5000)\approx 0.76$.

Remark: So interesting stuff happens only if we are looking at samples near the $50\%$ range. The phenomenon around $50\%$ is almost a "$0$-$1$ phenomenon, though on closer examination the transition turns out to be smooth.

Note that the normal approximation is not always appropriate for problems like this. For example, with the same probability $0.01$ of bad, To find the probability of exactly $3$ bad in a sample of $500$ I would suggest either the Poisson approximation to the binomial, or direct calculation of the binomial.

Generalities: We look at a more general situation. Let the population size be $N$, with $N$ large (in your case $N$ is $10^6$). Let the probability of a bad be $p$, where $p$ is small (in your case $p=0.01$.) If $X$ is the number of bads in a sample of size $n$, then the standard deviation of $X$ is $\sqrt{np(1-p)}$.

The mean number of bads in the population is $pN$. Let $n=\alpha N$. We are looking at very large sample sizes $n$. The number $\alpha$ is the ratio $\frac{n}{N}$. For instance, if we are looking at a $40\%$ sample, then $\alpha=0.4$.

The expected number of bads in the population is $Np$. Your problem is to find the probability that $X\le \frac{1}{2}Np$. Note that $$\Pr(X\le \frac{1}{2}Np)=\Pr\left(\frac{X-np}{\sqrt{np(1-p}}\le \frac{\frac{1}{2}Np-np}{\sqrt{np(1-p)}}\right).\tag{2}$$

The random variable $\frac{X-np}{\sqrt{np(1-p)}}$ is close to standard normal. Replace $n$ by $\alpha N$. After some simplification we find that we want $$\Pr\left(Z \le \frac{1}{\sqrt{\alpha}\sqrt{p(1-p)}}\left(\frac{1}{2} -\alpha\right)\sqrt{N}\right).\tag{3}$$
We can do further simplification. For large $N$ and small $p$, the probability will be nearly one for $\alpha \lt 1/2$ but not too close to $1/2$, and nearly $0$ for $\alpha \gt 1/2$ but not too close to $1/2$. And $\sqrt{1-p}$ is close to $1$. So our probability is well approximated by $$\Pr\left(Z\le\left(\frac{1}{2}-\alpha\right)\sqrt{2pN}\right).\tag{4}$$

This formula is easy to work with. As an example, from the normal tables we find that $\Pr(Z\le 4)\approx 0.999$. Let $p=0.01$ and $N=10^6$. Let's find out what $\alpha$ should be so that $\Pr(X\le 5000)\approx 0.999$. Calculation gives $\alpha=0.472$, about a $47\%$ sample.

Conclusion: Unless the sample size proportion is quite close to half the population size, the probability is for all practical purposes fully determined. There is not, however, a sudden shift at $50\%$. The shift is indeed rapid. With your numbers, for all practical purposes the only interesting interval is the one from about $47\%$ to $53\%$. For similar situations with different numbers (but $N$ still large, and $p$ small), Formula (4) should give very good quality estimates.

Perhaps the simplest general explanation of the phenomenon is that for $p$ of the size we have been looking at, or smaller, the variance of $X$ is relatively low. For $p=0.01$, it is about one-tenth of what the variance would be for $p=1/2$. Thus even for the $40\%$ case, $4000$ is a lot of standard deviation units away from $5000$.

André Nicolas
  • 507,029
  • well I have also done calculation using Poisson distribution but answer is same. and you have rightly understood the problem. So is this result fine? I mean it is ok to get 0 probability for all sample below 50% of 1 million parts and 1 for all sample above 50%? Actually I need this result for my research work so I need valid reason for this result. So plz give me mathematical logic for this result – irum Jul 06 '13 at 03:56
  • I did the calculations in some detail. But you may not have read some of it. The probabilities are not $1$ and $0$ (for some reason you are reversing them). They are ridiculously close to $1$ and ridiculously close to $0$. Also, please look at the More calculations part. At $49%$, we are at $0.92$, which is fairly far from $1$. At $49.5%$, we are quite a bit further from $1$. The distribution is very peaked in a narrow interval between effectively say $48%$ sample size and $52%$ sample size. – André Nicolas Jul 06 '13 at 04:07
  • thnx but can you please tell me reason for this result. I mean why we are getting this result and is this result ok? – irum Jul 06 '13 at 06:24
  • It can be viewed as having to do with the distribution of the mean $\frac{X}{n}$. This has standard deviation $\frac{\sqrt{(0.01)(0.99)}}{\sqrt{n}}$, which is quite small when $n$ is large. So $\frac{X}{n}$ is nearly normal by CLT, with a very sharp peak, rapid decay. Can add more tomorrow (it is late again!). Just need to express the equation (1) of the post in a slightly different but equivalent way. – André Nicolas Jul 06 '13 at 06:59
  • one more thing is that I was taking samples of 1 million parts which have 1% defective parts. Another case is that suppose 100,000 parts are more added in 1 million parts and from this 1,100,000 parts I need to calculate probability of finding at most 5000 parts. Now what will be the value of p and q? how I will calculate probability of defective parts from 1,100,00 parts; where added 100,000 parts have no defective parts. plz also guide me for this situation – irum Jul 06 '13 at 19:43
  • The calculations have the same structure as before, but the calculated numbers could change substantially. We now work with $p=\frac{10000}{1100000}$. Again there will be a fairly narrow transitione zone between probability nearly $1$ and probability nearly $0$. If you have a concrete question, perhaps you could ask an entirely separate question. My answer to this one is already rather long. If you do ask a new question, I will hold off answering it for a while, to give others the opportunity for a perhaps different style of explanation. – André Nicolas Jul 06 '13 at 19:56
  • I have asked this question separately but no one replied. Can u plz reply my question. According to your answer if I am adding more 10% of 1 million parts which have no defective parts then value of p is 10000/1100000 from these 110000 parts. It means if I am adding 20%, 30%, 40%, 50% till 90% parts, value of p will be 10000/1200000, 10000/1300000, 10000/1400000, 10000/1500000 to 10000/1900000 accordingly. Now the issue is when I am calculating probability of finding 5000 defective parts in each sample, value of probability is same for all 10%-90% samples. Where I am wrong? – irum Jul 10 '13 at 05:58
  • still waiting for reply but no one replied :-( – irum Jul 11 '13 at 23:10
  • @irum: I replied to your other question. – André Nicolas Jul 12 '13 at 00:28