6
$\begingroup$

In doing a Fisher's exact test, on wikipedia it states that the p-value is calculated as the sum of the probabilities of tables having probability less than or equal to the probability of the observed table. It then states that we use the Hypergeometric distribution to find the probabilities. HOWEVER, in R, the documentation states that a Non-central Hypergeometric distribution is used. Why is there a difference between the two? Thanks!

$\endgroup$
2
  • 1
    $\begingroup$ It is well known that in a 2 × 2 table, any given cell count, conditioned on the total, follows a hypergeometric distribution when the two binary variables are independent. This is the basis of Fisher’s exact test. When the binary variables are not independent, the distribution is the non-central hypergeometric instead (of which the hypergeometric is a special case). $\endgroup$
    – gammer
    Feb 2 '17 at 2:49
  • 1
    $\begingroup$ Much like a t test in which the distribution is the t distribution when the null hypothesis is true and the noncentral t when it is false. $\endgroup$
    – David Lane
    Feb 2 '17 at 17:31
4
$\begingroup$

This is what the R help says.

For 2 by 2 tables, the null of conditional independence is equivalent to the hypothesis that the odds ratio equals one. ‘Exact’ inference can be based on observing that in general, given all marginal totals fixed, the first element of the contingency table has a non-central hypergeometric distribution with non-centrality parameter given by the odds ratio (Fisher, 1935).

So note the two facts in that quote:

  • the null of conditional* independence is equivalent to the hypothesis that the odds ratio equals one

  • the first element of the contingency table has a non-central hypergeometric distribution with non-centrality parameter given by the odds ratio

If you make the odds ratio 1, then that's the central hypergeometric. See, for example the Wikipedia article on Fisher's noncentral hypergeometric distribution which states it explicitly:

The two distributions* are both equal to the (central) hypergeometric distribution when the odds ratio is 1.

* [Fisher's and Wallenius' noncentral hypergeometrics are being discussed; they both give the ordinary hypergeometric when the odds ratio is 1]

So there's no contradiction - under the null, it's the central hypergeometric.

Why the R help didn't add just a few words to make that clear, I don't know.

--

* it's the margins being conditioned on there

$\endgroup$
4
  • $\begingroup$ Thanks, I totally see it now. When they say the "first element" of the contingency table, are they referring to the value on the northwest quadrant? In other words, if I created a $2 \times 2$ table with values $a,b,c,d$ such that $a$ is in the northwest quadrant, $b$ in the northeast, $c$ southwest, and $d$ southeast, are they saying the value of $a$ is governed by a non-central hypergeometric (central under null)? Additionally, since the Odds Ratio is just $\frac{\frac{a}{c}}{\frac{b}{d}} = \frac{ad}{bc}$, under the null do we necessarily then have $ad = bc$? Thank you! $\endgroup$
    – user321627
    Feb 2 '17 at 2:42
  • $\begingroup$ @user321627 Yes they mean the cell in the first row, first column position. Since the ordering of the rows and columns is arbitrary, you can in fact place any of the cells in that position (equivalently, you can simply choose any of the 4 cells you like, it has the hypergeometric distribution under the null given the assumptions). It's just convention that the (1,1) (i.e. top left) cell is used to do the calculations -- the result is the same no matter which you use. $\endgroup$
    – Glen_b
    Feb 2 '17 at 2:46
  • $\begingroup$ Got it! Would I be right to say that is because since the Fisher Exact Test fixes the row and column marginals based on assumption, once I choose one of the 4 cells, the other 3 are instantly determined? Is that also why the test also has 1 degree of freedom? Thanks!! $\endgroup$
    – user321627
    Feb 2 '17 at 3:05
  • $\begingroup$ The other three are determined once you fix one cell, yes. But while the Fisher test statistic (whichever cell you look at) only has that one degree of freedom, we don't really talk about "degrees of freedom" for the fisher test the way we do for the chi-squared test. $\endgroup$
    – Glen_b
    Feb 2 '17 at 4:35
2
$\begingroup$

The noncentral hypergeometric distribution is a generalization of the hypergeometric distribution. The latter is used for the Fisher exact test. However, it frequently seems to be referred to as the hypergeometric distribution as if the question of noncentrality did not exist. I suppose that the thinking for this is that the noncentrality is just the introducing of weighting for the hypergeometric distribution and people sometimes use shorthand and refer to weighted functions by the function name itself, e.g., when the weighting is neutral, is would be exactly that function.

@gammer helpfully suggests that the difference amounts to independent random variables for the hypergeometric case, and the weighted (noncentral) hypergeometric distribution for the not independent random variable case. BTW, (+1) good question.

Note however, that this is not the only numerical approach to problems of the Fisher exact test type, see Given the power of computers these days, is there ever a reason to do a chi-squared test rather than Fisher's exact test? for further information.

$\endgroup$
0
$\begingroup$

As @Glen_b says, under the null hypothesis of an odds ratio of one, Fisher's non-central hypergeometric distribution reduces to a hypergeometric distribution. However the fisher.test function, as well as carrying out Fisher's Exact Test, (1) also calculates the conditional maximum-likelihood estimate of, & confidence intervals for, the odds ratio, & (2) does have an argument to set the odds ratio under the null to values other than 1; explaining the need to bring up non-centrality. It's worth noting, despite the manual's saying "given all marginal totals fixed", that it's Fisher's non-central hypergeometric distribution that's used in these calculations; which can arise from conditioning on marginal totals under several sampling schemes, but which is inapplicable when they are in fact fixed by design. See Fog (2015), "Biased Urn Theory".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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