Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from scipy.stats import ttest_ind
- # simulated experiments
- # two conditions, 50 observations per condition
- # standardized effect size randomly chosen between 0 and .5
- for i in np.arange(0,10):
- sample_size = 50
- effect_size = np.random.uniform(0,.5,1)
- group_1 = np.random.normal(loc=0.0, scale=1.0, size=sample_size)
- group_2 = np.random.normal(loc=effect_size, scale=1.0, size=sample_size)
- t, p = ttest_ind(group_1, group_2, equal_var=False)
- if p < .05:
- print("p = %g" % (round(p,3)) + '. Statistically significant! #pvalues #nhst #statistics')
- else:
- print("p = %g" % (round(p,3)) + '. Not statistically significant! #pvalues #nhst #statistics')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement