Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyranker/ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ def perform_permutation_test(self) -> None:
if permuted_diff >= observed_diff:
count_extreme += 1

# Check if count_extreme is still zero, which would create pval=0.
# A p-value of 0 implies absolute certainty, which is unrealistic given the finite
# number of permutations. To avoid this, we adjust count_extreme to ensure a
# conservative estimate of the p-value, aligning with standard statistical practices.
if count_extreme == 0:
count_extreme += 1
# calculate the p-value
pval = count_extreme / self.n_iterations
self.pvals[i, j] = pval
Expand Down