1. Learn
  2. /
  3. Courses
  4. /
  5. Bayesian Data Analysis in Python

Connected

Exercise

Updating posterior belief

Well done on estimating the posterior distribution of the efficacy rate in the previous exercise! Unfortunately, due to a small data sample, this distribution is quite wide, indicating much uncertainty regarding the drug's quality. Luckily, testing of the drug continues, and a group of another 12 sick patients have been treated, 10 of whom were cured. We need to update our posterior distribution with these new data!

This is easy to do with the Bayesian approach. We simply need to run the grid approximation similarly as before, but with a different prior. We can use all our knowledge about the efficacy rate (embodied by the posterior distribution from the previous exercise) as a new prior! Then, we recompute the likelihood for the new data, and get the new posterior!

The DataFrame you created in the previous exercise, df, is available in the workspace and binom has been imported for you from scipy.stats.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Assign posterior_prob from df to a new column called new_prior.
  • Calculate the new_likelihood using binom.pmf() based on the new data and assign it as a new column to df.