Python package for this power analysis calculator I would like to use the following power analysis formula into a python notebook
https://clincalc.com/stats/samplesize.aspx
Any idea which python package would replicate the same results ?
Edit:
I tried the following function from statsmodel module but can't seem to get anything close to the numbers in the webpage. Also , the formula in the webpage doesn't require a standard deviation . Why ?
statsmodels.stats.power.tt_ind_solve_power¶


​The initial implementation of power and sample size calculation followed Cohen's effect size tradition, with examples as @num_39 shows.
Recent versions of statsmodels provide more specialized function for binomial proportions and poisson rates.
Example:
https://www.statsmodels.org/dev/generated/statsmodels.stats.proportion.samplesize_proportions_2indep_onetail.html
https://www.statsmodels.org/dev/generated/statsmodels.stats.proportion.power_proportions_2indep.html
from statsmodels.stats.proportion import samplesize_proportions_2indep_onetail
​
prop1 = 0.0105
prop2 = 0.01
diff = prop1 - prop2
power = 0.8
samplesize_proportions_2indep_onetail(diff, prop2, power, ratio=1, alpha=0.05, value=0, alternative='larger')
501772.20733602205

The difference between the effect size approach as num_39 showed and the distribution specific approach is in the assumption on the variance.
Cohen's d approach includes the standard deviation and assumes that the standard deviation is the same under the null and under the alternative hypothesis.
However, for GLM families like Binomial and Poisson, the variance depends on the mean, so the variance will be different in the alternative hypothesis from the variance under the null.
The distribution specific power and sample size functions take this into account.
This is mainly relevant if there are large effect sizes and smaller sample sizes, otherwise the approximation based on effect size computation is close to the distribution specific results.
