1. Learn
  2. /
  3. Courses
  4. /
  5. Beginning Bayes in R

Exercise

The posterior

In our spinner example, Prior contains the prior probabilities (1/2, 1/2) and Likelihood contains the likelihoods (1/2, 1/6) since the result of the spin was blue (3).

To compute the product and posterior probabilities, you can use the bayesian_crank() function, which takes as input a data frame containing Model, Prior and Likelihood.

Instructions

100 XP

The vector of models, Model, is available in your workspace.

  • Create the two vectors Prior and Likelihood using the values provided above.
  • Construct a data frame called bayes_df containing variables Model, Prior, and Likelihood, in that order.
  • Use the bayesian_crank() function to compute the posterior probabilities of Spinner A and Spinner B.