Last active
June 8, 2020 10:17
-
-
Save erykml/766527af3b5cb6c3940a21a5b926499c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for this part I assume significance level of 0.05 | |
@np.vectorize | |
def power_grid(x,y): | |
power = TTestIndPower().solve_power(effect_size = x, | |
nobs1 = y, | |
alpha = 0.05) | |
return power | |
X,Y = np.meshgrid(np.linspace(0.01, 1, 51), | |
np.linspace(10, 1000, 100)) | |
X = X.T | |
Y = Y.T | |
Z = power_grid(X, Y) # power | |
data = [Surface(x = X, y= Y, z = Z)] | |
layout = Layout( | |
title='Power Analysis', | |
scene = dict(xaxis = dict(title='effect size'), | |
yaxis = dict(title='number of observations'), | |
zaxis = dict(title='power'),) | |
) | |
fig = Figure(data=data, layout=layout) | |
iplot(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment