Implements Bayes' rule for a spinner problem
Computes and plots the posterior distribution of spinners given a sequence of spins
spinner_bayes(list_regions, prior, data, plot=TRUE)
list_regions
: list of vectors of integer areas for the spins 1, 2, ...prior
: a vector containing the prior probabilities for the spinnersdata
: a vector containing the spin values where 1, 2, 3, ... are the possible spinsplot
: if plot=TRUE, a comparative graph of the prior and posterior probabilities is displayedA data frame with variables Spinner, Prior, Likelihood, Product, and Posterior
Jim Albert
regions1 <- c(1, 1, 1) regions2 <- c(2, 1, 2, 1) data <- c(1, 1, 1, 2) spinner_bayes(list(regions1, regions2), prior=c(0.5, 0.5), data)