As the title suggest...I have a very basic question.

I have a case with the following data:

Universe: 18840 balls total
red balls in the universe: 6680
Sample: 382 balls total
red balls in the sample: 160

I would like to estimate if the percentage of red balls in my sample is significantly different from the percentage of reds in universe.

In your opinion is it more correct to utilize a chi-square test or an hypergeometric distribution?


1 Answer 1


Take care to note you're discussing two different statistics here.

Let's set up the sampling situation in detail first so we can be clear:

We have red balls and not-red balls (for simplicity I will call them all 'black', but they could be a mix of non-red colors - it's irrelevant to this set up since they all are simply categorized as not-red).

You have a population (your 'universe') of 18840 balls, 6680 red and 12160 black. You draw a random sample of 382 balls without replacement, and obtain 160 red and 222 black.

That is, your example data are like so:

         Drawn    Not drawn    Total

Red      160        6520        6680
Black    222       11938       12160

Total    382       18458       18840

Looking at the number of reds drawn as a random variable, that has a hypergeometric distribution (though there formulated in terms of white and black balls drawn from an urn rather than red and black balls drawn from a universe).

[Conditioning on the margins gives the hypergeometric - this is also the situation used for Fisher's exact test based on the hypergeometric, and one of the situations for which the usual 2x2 chi-square test of association/test of independence applies. If you don't condition on both margins, you don't have a hypergeometric; but that's what you normally do in the specific balls-in-urns model you describe.]

If $O_{ij}$ is the observed count in cell $(i,j)$ in the above $2\times 2$ table, then your statistics are $O_{11}$ in the first case (assuming red is first) and $X^2 = \sum \sum {(O_{ij} - E_{ij})^2 \over E_{ij}}$ in the second. Both statistics are actually discrete, but you can approximate either by a continuous distribution - the first by a normal approximation, the second by a chi-square.

With random sampling, the distribution of the number of red balls in the sample ($O_{11}$) is hypergeometric - that is, given the usual assumptions it's exactly correct.

Given the universe details and the sample size, the usual 'chi-square' statistic, though discrete, will be quite well approximated by a chi-square distribution when the number of red balls in the sample is hypergeometric. It's not exact, but it will be quite close in this case.

  • $\begingroup$ I don't understand the recommendation for a chi-square statistic, given that the sample distribution is known: why not just compute the p-value directly from the hypergeometric distribution? $\endgroup$
    – whuber
    Feb 28, 2013 at 17:17
  • 2
    $\begingroup$ Although you are correct, as the author of this reply you might not notice that it would be natural for most readers to interpret the phrase "you can construct" as an explicit recommendation of that approach. It seems a little disingenuous to leave it at that unless you really believe this is a good procedure--and so far you still haven't indicated what your stance is. Am I missing something? Is there anything about using the chi-squared distribution in this circumstance that is preferable to the simple, direct, completely accurate solution using the hypergeometric? $\endgroup$
    – whuber
    Feb 28, 2013 at 21:35
  • 1
    $\begingroup$ Of course there are situations where the chi-square may be preferable - but that wasn't in the question, which only addressed correctness. My answer directly addresses that question, by quite explicitly stating that the hypergeometric is "correct" in the intended sense. It is a complete and correct answer to the question that then adds further information about accuracy of the other option. Is there something you are suggesting I should add? I'm not seeking to be obtuse, I just really fail to see what the problem is here. $\endgroup$
    – Glen_b
    Feb 28, 2013 at 21:40
  • 3
    $\begingroup$ I just found the second paragraph confusing, that's all, because (1) putting "correct" in quotation marks in the first paragraph suggests you don't really believe what you wrote, so then (2) following that up with a discussion of the chi-squared test makes it look like you really are recommending it as "most correct." As such, your answer prompted my initial comment looking to clear up that confusion. $\endgroup$
    – whuber
    Feb 28, 2013 at 21:43
  • 2
    $\begingroup$ On scare-quoting "correct" - that I certainly can see could mislead. I had a particular reason for doing so (based on the mismatch between the two statistics under discussion - $O_{11}$ in the first case and $X^2 = \sum \sum {(O_{ij} - E_{ij})^2 \over E_{ij}}$ in the second). However, I didn't clarify that and that is clearly an issue I can deal with. So thanks, I can make my answer better. $\endgroup$
    – Glen_b
    Feb 28, 2013 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.