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....