in reply to Fisher's Exact test (probability of 2x2 tables)

I'd like to recommend a non-recursive &fishersexact::fac, for both speed and memory usage. Something like

fac { my ($arg, $res) = ($_[0], 1); die "Negative argument to factorial\n" if $arg < 0; $res *= $_ for 1..$arg; return $res; }

Additionally factorials soon overflow perl int(). An implementation in terms of Math::BigInt, Math::GMP or Math::Pari might be in order. Overflow might be abated by rewriting the formulas in terms of binomial coefficients.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re:{2} Fisher's Exact test (probability of 2x2 tables)
by jeroenes (Priest) on Oct 03, 2001 at 13:04 UTC
    If I look at the code, there is a very lot more to improve. It seems to neglect an indecent number of software design rules. Right now, I'm just happy to have kept to my promise in Re: Fisher exact - one tailed

    Jeroen
    "We are not alone"(FZ)