Skip to content

Instantly share code, notes, and snippets.

View jonadsimon's full-sized avatar

Jonathan Simon jonadsimon

View GitHub Profile
from scipy.stats import entropy
def jensen_shannon_div(p, q):
m = (p + q) / 2
return (entropy(p, m) + entropy(q, m)) / 2.0
@jonadsimon
jonadsimon / benjamini_hochberg_procedure.py
Created June 12, 2018 23:50
Perform the Benjamini-Hochberg Procedure in Python
from statsmodels.sandbox.stats.multicomp import multipletests
reject, pvals_corrected, alphacSidak, alphacBonf = multipletests(p_values, alpha=0.2, method='fdr_bh')
@jonadsimon
jonadsimon / mann_whitney_u_test.py
Created June 12, 2018 23:32
Perform Mann-Whitney U Test in Python
from scipy.stats import mannwhitneyu
statistic, pvalue = mannwhitneyu(agent_durations, population_durations, use_continuity=True, alternative='two-sided')