How can this be done in python?
- Calculate sample size for a given power and alpha?
- Calculate power for a given sample size and alpha?
Note: I am totally confused :( with the functions that python gives for (statistical) power function calculation.
Can someone help me to make an order here?
There are two functions under statsmodels:
from statsmodels.stats.power import ttest_power, tt_ind_solve_power()
We have:
tt_ind_solve_power(effect_size=effect_size, alpha=alpha, power=0.8, ratio=1, alternative='two-sided')
And we have also:
ttest_power(0.2, nobs=sampleSize, alpha=alpha, alternative='two-sided')
There is also this peice of code:
import statsmodels.stats.api as sms
es = sms.proportion_effectsize(prop1, prop2, method='normal')
n = sms.NormalIndPower().solve_power(es, power=0.9, alpha=0.05, ratio=2)
I found this example somewhere but it does NOT explain what are prop1 and prop2!
Each one is giving me different values.
thanks
