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

Exercise

Towards grid approximation

Congratulations! You have just been hired as a data analyst at your government's Department of Health. The cabinet is considering the purchase of a brand-new drug against a deadly and contagious virus. There are some doubts, however, regarding how effective the new drug is against the virus. You have been tasked with estimating the drug's efficacy rate, i.e. the percentage of patients cured by the drug.

An experiment was quickly set up in which 10 sick patients have been treated with the drug. Once you know how many of them are cured, you can use the binomial distribution with a cured patient being a "success" and the efficacy rate being the "probability of success". While you are waiting for the experiment's results, you decide to prepare the parameter grid.

numpy and pandas have been imported for you as np and pd, respectively.

Instructions

100 XP
  • Using np.arange(), create an array of all possible numbers of patients cured (from 0 to 10) and assign it to num_patients_cured.
  • Using np.arange(), create an array of all possible values for the efficacy rate (from 0 to 1, by 0.01) and assign it to efficacy_rate.
  • Combine num_patients_cured and efficacy_rate into a DataFrame called df, listing all possible combinations of the two.
  • Assign ["num_patients_cured", "efficacy_rate"] to df's columns and print it.