Plotting the distribution
In this exercise, you will visualize the test and control conversion rates as distributions. It is helpful to practice what was covered in the example, as this may be something you have not applied before. Additionally, viewing the data in this way can give a sense of the variability inherent in our estimation.
Four variables, the test and control variances (test_var
, cont_var
), and the test and control conversion rates (test_conv
and cont_conv
) have been loaded for you.
This exercise is part of the course
Customer Analytics and A/B Testing in Python
Exercise instructions
- Using the calculated
control_sd
andtest_sd
create the range of x values to plot over. It should be 3 standard deviations in either direction from thecont_conv
andtest_conv
respectively. - Plot the Normal pdf of the test and control groups by specifying the conversion rate as the mean and the standard deviation in that order in
norm.pdf()
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Compute the standard deviations
control_sd = cont_var**0.5
test_sd = test_var**0.5
# Create the range of x values
control_line = np.linspace(cont_conv - 3 * control_sd, cont_conv + 3 * ____, 100)
test_line = np.linspace(test_conv - 3 * ____, test_conv + 3 * ____, 100)
# Plot the distribution
plt.plot(control_line, norm.pdf(control_line, ____, ____))
plt.plot(test_line, norm.pdf(test_line, ____, ____))
plt.show()