Sample size for proportions
Real datasets can be messy. As an Analytics Engineer working with data in the real world, you will encounter situations where the variance in the data is too high to be able to capture a meaningful difference in the metrics. This problem is more likely to happen with continuous metrics such as the average order value in the previous exercise. There are several ways to tackle this, but one of the workarounds is finding a metric that has lower variance but still aligns with the business goals.
Here you will look at calculating the sample size for a binary metric; signup rate which represents whether a user signed up for the service or not, as opposed to the paid price which may vary more between users. The homepage
DataFrame and pandas
, numpy
libraries are already loaded for you, as well as proportion_effectsize
from statsmodels.stats.proportion
and power
from statsmodels.stats
.
This exercise is part of the course
A/B Testing in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate the baseline signup rate for group A
p_A = ____
print('Group A mean signup rate:', ____)