Watch this Author's files
documentation is false, misleading, and old.
line 146: you must use "<=" not "<"
i.e., the line should read:
(You want to sum across all probabilities that are less than or equal to the observed probability)
if you add the following lines:
% filter out bad stuff
bad_rows = logical(sum(Tables < 0,2));
Tables = Tables(~bad_rows,:);
at like, line 108 (immediately before calling "gammaln"), then it does not CRASH.
But just because it does not crash does not mean that it actually computes the correct numbers....
The following produces an error:
myfisher23([ 6 6 9 ; 7 7 9])
The error is:
Error using gammaln
Input must be nonnegative.
Error in myfisher23 (line 112)
zf=gammaln(Tables+1); %compute log(x!)