![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: Algorithm for cancelling common factors between two lists of multiplicandsby tlm (Prior) |
on Aug 10, 2005 at 02:32 UTC ( #482495=note: print w/replies, xml ) | Need Help?? |
From looking at the code you have posted I get the impression that you misunderstand the Fisher's Exact Test. What you are computing in your various implementations is only one term of the sum that makes up the FET statistic. The definition of the FET statistic I'm referring to here is entirely standard (though there is some variability as to whether the one-sided or two-sided version of this sum is used). The test says, if we assume the null hypothesis (independence between the two categorical variables), what is the probability of getting a sampling that is at least as far from the expected value (under the null hypothesis) as the actual data being tested; unless one of the cells is empty, this formulation entails computing a sum of terms. If you look at the code I posted, I don't compute a single ratio of factorials, but a whole sum of them. The value of this sum can be considerably larger than the value of a single term; in fact it can be 1, depending on the hypothesis being tested and the data at hand. Update: Here's the relevant passage from the MathWorld page whose formula you cited elsewhere (my emphasis): To compute the P-value of the test, the tables must then be ordered by some criterion that measures dependence, and those tables that represent equal or greater deviation from independence than the observed table are the ones whose probabilities are added together. the lowliest monk
In Section
Seekers of Perl Wisdom
|
|