0

I have two samples of binary data. I'm performing a one tailed hypothesis test if one of the samples success rate is significantly higher than the other's. I'm using statsmodels proportions_ztest. I was wondering how I could calculate the power for this type of test? (two binary samples.) does anyone know if there's a built in funciton in statsmodels I could use, or else suggest the calculation or code?

code:

from statsmodels.stats.proportion import proportions_ztest


number_of_successes = [5481, 195]
total_sample_sizes = [81530, 135779]
# Calculate z-test statistic and p-value
test_stat, p_value = proportions_ztest(number_of_successes, total_sample_sizes, alternative='larger')

print(str(test_stat))
print(str(p_value))

93.10329278601503
0.0
user3476463
  • 3,967
  • 22
  • 57
  • 117
  • `power_proportions_2indep`, `samplesize_proportions_2indep_onetail` https://stats.stackexchange.com/questions/605466/how-to-get-python-statsmodels-to-match-evan-millers-famous-ab-test-sample-size/605540#605540 – Josef Feb 23 '23 at 14:54

0 Answers0