Created
November 18, 2015 09:10
-
-
Save andreas-wilm/8382586743c6abd8ac60 to your computer and use it in GitHub Desktop.
Fisher's method for combining p-values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import log | |
from scipy import stats | |
def fisher_comb(pv1, pv2): | |
""" | |
Fisher's method for combining p-values: | |
https://en.wikipedia.org/wiki/Fisher's_method | |
See for example breseq-0.18b:polymorphism_statistics.r | |
For CDF use see http://stackoverflow.com/questions/11725115/p-value-from-chi-sq-test-statistic-in-python | |
""" | |
comb_log = -2.0 * (log(pv1) + log(pv2)) | |
comb_pv = 1.0 - stats.chi2.cdf(comb_log, 4) | |
return comb_pv |
Author
andreas-wilm
commented
Nov 20, 2015
- This function is limited to two pvalues
- just use scipy.stats.combine_pvalues()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment