Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bootstrap_test(higher, lower, n=100000):
- xs = higher
- ys = lower
- m = np.mean(xs) - np.mean(ys)
- zs = np.concatenate((xs,ys))
- boots = np.random.choice(ys, size=(n,len(zs)))
- return np.sum(np.mean(boots[:,0:len(xs)], 1) - np.mean(boots[:,len(xs)+1:], 1) > m)
- # test whether the mean of the array `higher` is higher than the mean of the array `lower`
- def bootstrap_pvalue(higher, lower, n=100000):
- return bootstrap_test(higher, lower, n=100000) / n
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement