Skip to content

Commit

Permalink
correct bugs in cauchy_combination
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonSong1995 authored Feb 21, 2025
1 parent 17ac26f commit 8510f2c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gsMap/cauchy_combination_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ def acat_test(pvalues, weights=None):
elif any(i < 0 for i in weights):
raise Exception("All weights must be positive.")
else:
weights = [i / len(weights) for i in weights]
weights = [i / np.sum(weights) for i in weights]

pvalues = np.array(pvalues)
weights = np.array(weights)

if not any(i < 1e-16 for i in pvalues):
if not any(i < 1e-15 for i in pvalues):
cct_stat = sum(weights * np.tan((0.5 - pvalues) * np.pi))
else:
is_small = [i < (1e-16) for i in pvalues]
is_large = [i >= (1e-16) for i in pvalues]
is_small = [i < (1e-15) for i in pvalues]
is_large = [i >= (1e-15) for i in pvalues]
cct_stat = sum((weights[is_small] / pvalues[is_small]) / np.pi)
cct_stat += sum(weights[is_large] * np.tan((0.5 - pvalues[is_large]) * np.pi))

Expand Down

0 comments on commit 8510f2c

Please sign in to comment.