from __future__ import division import numpy as np from t_test import two_sample_t
mu,sigma = 10,3 m,n = 2,4 alpha = 0.05
N = 10000 tmax = -N for i in range(5): counter = 0 for j in range(N): A = np.random.normal(mu,sigma,m) B = np.random.normal(mu,sigma,n) t,p = two_sample_t(A,B) if p < alpha: counter += 1 if t > tmax: tmax = t print '%3.4f' % (counter/N), print round(tmax,3) |