1. Learn
  2. /
  3. Courses
  4. /
  5. Fundamentals of Bayesian Data Analysis in R

Connected

Exercise

Calculating a joint distribution

The parts of the code we developed in the last video is displayed. It defines a grid over the underlying proportions of clicks (proportion_clicks) and possible outcomes (n_visitors) in pars. It adds to it the prior probability of each parameter combination and the likelihood that each proportion_clicks would generate the corresponding n_visitors.

Instructions

100 XP
  • Add the column pars$probability: The probability of each proportion_clicks and n_visitors combination. As in the video, this should be calculated by multiplying the likelihood by the prior
  • Make sure the column pars$probability sums to 1.0 by normalizing it, that is, by dividing pars$probability by the total sum of pars$probability.