A or B, and how sure are we?

You have just discovered that clothes ads are likely to have a higher click ratio than sneakers ads. But what is the exact probability that this is the case? To find out, you will have to calculate the posterior difference between clothes and sneakers click rates. Then, you will calculate a credible interval for the difference to measure the uncertainty in the estimate. Finally, you will calculate the percentage of cases where this difference is positive, which corresponds to clothes click rate being higher. Let's get on with it!

arviz, seaborn, and matplotlib.pyplot have been imported for you as az, sns, and plt, respectively. Also, clothes_posterior and sneakers_posterior which you have calculated in the previous exercise are available in your workspace.

This exercise is part of the course

Bayesian Data Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Calculate posterior difference and plot it
diff = ____
sns.kdeplot(diff, shade=True, label="diff")
plt.show()