def bootstrap_ttest_multi(bfg, tails='two'): st = [] for d1 in bfg: for d2 in bfg: diff = bfg[d1] - bfg[d2] pct = scipy.stats.percentileofscore(diff, 0, kind='mean') / 100. p = min(pct, 1 - pct) if tails == 'two': p *= 2 star = stats.get_star(p) st.append([d1, d2, np.mean(diff), p, star]) st = pandas.DataFrame(st, columns=['var1', 'var2', 'mean', 'p', 'sig']) return st
def bootstrap_ttest_multi(bfg, tails='two'): st = [] for d1 in bfg: for d2 in bfg: diff = bfg[d1] - bfg[d2] pct = scipy.stats.percentileofscore(diff, 0, kind='mean') / 100. p = min(pct, 1-pct) if tails == 'two': p *= 2 star = stats.get_star(p) st.append([d1, d2, np.mean(diff), p, star]) st = pandas.DataFrame(st, columns=['var1', 'var2', 'mean', 'p', 'sig']) return st
def bootstrap_ttest_grouped(self, bf, tails="one"): bfg = bf.groupby(["depth", "iter"]).mean() bfg = bfg.unstack(level="depth").bootstrap st = [] for nd1, d1 in enumerate(bfg): for d2 in bfg.iloc[:, nd1 + 1 :]: diff = np.squeeze(bfg[d1].values - bfg[d2].values) pct = scipy.stats.percentileofscore(diff, 0, kind="mean") / 100.0 p = min(pct, 1 - pct) if tails == "two": p *= 2 star = stats.get_star(p) st.append([d1, d2, np.mean(diff), p, star]) st = pandas.DataFrame(st, columns=["depth1", "depth2", "mean", "p", "sig"]) print(st) return st
def bootstrap_ttest_grouped(self, bf, tails='one'): bfg = bf.groupby(['depth', 'iter']).mean() bfg = bfg.unstack(level='depth').bootstrap st = [] for nd1, d1 in enumerate(bfg): for d2 in bfg.iloc[:, nd1 + 1:]: diff = np.squeeze(bfg[d1].values - bfg[d2].values) pct = scipy.stats.percentileofscore(diff, 0, kind='mean') / 100. p = min(pct, 1 - pct) if tails == 'two': p *= 2 star = stats.get_star(p) st.append([d1, d2, np.mean(diff), p, star]) st = pandas.DataFrame(st, columns=['depth1', 'depth2', 'mean', 'p', 'sig']) print(st) return st