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

Exercise

A conditional shortcut

Great, you've now done some Bayesian computation, without doing any simulation! The plot you produced should be similar to the posterior distribution you calculated in chapter 3. However, if you look to the right you see that it required an awful lot of code, isn't there anything we can cut?

Yes, there is! You can directly condition on the data, no need to first create the joint distribution.

Instructions

100 XP
  • Set n_visitors directly to 6, just replace the seq-statement.
  • Now you can remove the line that conditions on the data, and the line after that, that normalizes pars$probability.
  • Take an extra look at the final code and convince yourself that the result of this modified code will be the same as before. :)