Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBug in p-value calculations in adonis #120
Comments
adonis rounded permuted statistics, but did not round observed statistic before it was used, and tied values were not correctly recognized in assessing P-values. Reported as issue #120 in github by user fra-gh
|
Confirmed: this is a bug. Fixed in commit f727b58. Thanks for reporting this. |
|
thanks for the very prompt reply. keep up the good work! |
|
PR #136 has a better fix for this issue. |
|
Do we always need to calculate p-value separately or it goes automatically fixed? |
The p-value calculated by adonis is sometimes wrong.
For example, the following code
returns
The p-value is wrong (only 24 permutations with high f instead of 39). The correct p-value can be computed from the definition to be
which correctly returns
It looks like the bug is due to rounding. When comparing f.perms and F.mod, the value of f.perms is rounded but the value of F.mod is not (although it is rounded afterwards). This makes the >= comparison fail in this example because the value of f.perms is rounded down.