Calculating confidence intervals
Now you will calculate the confidence intervals for the A/B test results.
The four values that have been calculated previously have been loaded for you (cont_conv
, test_conv
, test_size
, cont_size
) as variables with those names.
This exercise is part of the course
Customer Analytics and A/B Testing in Python
Exercise instructions
- Calculate the mean of the distribution of our lift by subtracting
cont_conv
fromtest_conv
. - Calculate the variance of our lift distribution by completing the calculation. You must complete the control portion of the variance.
- Find the standard deviation of our lift distribution by taking the square root of the
lift_variance
- Find the confidence bounds for our A/B test with a value equal to our
lift_mean
, a 0.95 confidence level, and our calculatedlift_sd
. Pass the arguments in that order.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate the mean of our lift distribution
lift_mean = ____ - ____
# Calculate variance and standard deviation
lift_variance = (1 - test_conv) * test_conv /test_size + (____ - ____) * ____ / ____
lift_sd = ____**0.5
# Find the confidence intervals with cl = 0.95
confidence_interval = get_ci(____, ____, ____)
print(confidence_interval)