5

The system:

  1. I have a bag filled with 1,000 balls
  2. All of them are either red or blue

I want to gain some amount of confidence that all the balls are blue, but I'm very lazy and I only want to examine a sample as small as possible.

Question: How large must the sample be to say with P confidence that N balls are blue?

I'm looking for a generic answer, but here are two specific questions:

  1. How large must the sample be to say with 95% confidence that all 1,000 of the balls are blue?
  2. How large must the sample be to say with 95% confidence that 990 (99%) of the 1,000 balls are blue?

It's been a while with no response, so if my question is missing information or just bad for some reason, please let me know how I can improve it.

whuber
  • 281,159
  • 54
  • 637
  • 1,101

2 Answers2

1

Sorry if this answer is incomplete, but I can't fit it all in a comment.

If you specify a level of statistical power you want to achieve, you can use the following formula as an approximation: $n=\frac{1}{2}(b-\sqrt{b^2 + 4b(Z_p + Z_{\alpha})^2})$ where $n$ is your sample size, $b$ is the number of blue balls in the sample, $Z_p$ is the Z score for your power, and $Z_{alpha}$ is the Z score for your confidence level. Note I used $\alpha$ instead of $\alpha/2$ because it's one-tailed.

This comes from the standard power calculation for a difference in means. I just set one of them equal to 1 and ran it in Wolfram Alpha. However, this does not take the finite population into account and I don't know what the error will be like if you're sampling more than a few dozen balls at a time. In this case, "power" means the "probability of finding a red ball given that there is at least one red ball in the bag." More technically, it's the probability of rejecting the null hypothesis that the sample proportion $\hat{p}$ is equal to 1.

This is what Wolfram Alpha gave me when I slapped the finite population correction into the same formula, and it's not pretty. It's no better if you plug in $N=1000$, and no solution exists for n=b (i.e. your entire sample is blue). It reduces a bit if you plug in $N=1000$ and $.99*n=b$. I hope that helps, but I'm sure there's a better way to go about this.

shadowtalker
  • 11,395
  • 3
  • 49
  • 109
1

Condition (2) implies you only need a sample of size 1.

If it is known that all the balls are one color, you only need to observe a single ball to know the color of all of them.

If it is not known that all the balls are one color, you cannot a priori rule out the possibility that exactly one ball is of a different color, in which case you should work on that worst-case -- you will need a very large random sample to be reasonably sure you haven't missed it by chance.

In particular, if you're sampling without replacement, you would need to sample 95% of the balls to be 95% sure that there's not a single ball of a different color there. (If you sample with replacement and only take one ball each time, you need to sample almost 3000 times!)

You should clarify what is known to the person who has to decide how large a sample to take.

Glen_b
  • 257,508
  • 32
  • 553
  • 939
  • To restate the known parameters: 1) The number of balls is known (1,000), and 2) each ball can be only one of two colors (red or blue). The exact number of each color is unknown. There could be 0 red and 1,000 blue or there could be 600 red an 400 blue, etc. In this problem I am sampling without replacement. Although your answer is making me think that I might *need* to make an assumption about the exact number of each color in order to show how likely it is given the outcome of a certain number of randomly drawn balls. – Stephen Crosby Mar 24 '14 at 01:43
  • Okay, thanks. The situation you describe is one of the possibilities covered in my answer (which is that in the worst case you need 95% of the population). – Glen_b Mar 24 '14 at 02:36
  • Starting with your worst-case scenario where one ball is red and 999 are blue, I'd say the chance of drawing the one red ball on the first try is 1/1000. But on the second draw, the odds improve to 1/999, the third is 1/998 and so on. The odds of drawing 100 blue balls in a row out of the bag in this scenario should actually be a little under 90% if you add up the probability of each independent event. The probability of drawing 614 blue balls in a row without drawing the red one should be just under 5% if I did the math right. Am I missing anything? – Stephen Crosby Mar 24 '14 at 05:02
  • You call those events independent, but they aren't; you're forgetting the second draw is conditional on getting a blue ball the first draw. Consider the much simpler case of 3 blue and 1 red, and place them in the first of two adjacent boxes, then draw two and place them in the second box. By your argument, there's a 7/12 chance that the red ball is in the second box and a 5/12 chance it's in the first box... [if that seems fine to you, I have a nice sequence of bets for you which - if you're right - should make you rich in short order.] – Glen_b Mar 24 '14 at 05:45
  • You might like to consider the 4 balls sitting in a row (numbered 1,2,3,4, representing the order we will draw them). Can you see the red has equal chance to be in any of the 4 positions? – Glen_b Mar 24 '14 at 05:48