Skip to content

Instantly share code, notes, and snippets.

@lylayang
Last active October 2, 2019 10:00
Show Gist options
  • Save lylayang/c7fb38e6dc3bc527c95756a58901c165 to your computer and use it in GitHub Desktop.
Save lylayang/c7fb38e6dc3bc527c95756a58901c165 to your computer and use it in GitHub Desktop.
import statsmodels.stats.api as sms
effect_size = 0.1
alpha = 0.05 # significance level
power = 0.8
sample_size = sms.TTestIndPower().solve_power(effect_size = effect_size, power = power, alpha = alpha)
print('Required sample size ~ {0:.1f}'.format(sample_size) + ' per group')
#Output:
#Required sample size ~ 1570.7 per group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment