Skip to content

Instantly share code, notes, and snippets.

@erykml
Created November 24, 2018 20:23
Show Gist options
  • Save erykml/d208e78319d92993a3af0a5a1144c5fa to your computer and use it in GitHub Desktop.
Save erykml/d208e78319d92993a3af0a5a1144c5fa to your computer and use it in GitHub Desktop.
# power vs. number of observations
fig = plt.figure()
ax = fig.add_subplot(2,1,1)
fig = TTestIndPower().plot_power(dep_var='nobs',
nobs= np.arange(2, 200),
effect_size=np.array([0.2, 0.5, 0.8]),
alpha=0.01,
ax=ax, title='Power of t-Test' + '\n' + r'$\alpha = 0.01$')
ax.get_legend().remove()
ax = fig.add_subplot(2,1,2)
fig = TTestIndPower().plot_power(dep_var='nobs',
nobs= np.arange(2, 200),
effect_size=np.array([0.2, 0.5, 0.8]),
alpha=0.05,
ax=ax, title=r'$\alpha = 0.05$')
fig.subplots_adjust(top = 1.4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment