Skip to content

Instantly share code, notes, and snippets.

@ruescasd
Created December 29, 2015 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruescasd/5f11220088f45e80d422 to your computer and use it in GitHub Desktop.
Save ruescasd/5f11220088f45e80d422 to your computer and use it in GitHub Desktop.
Modeling a binomial process with the beta binomial
Case 1: You have no information
This requires using a non-informative prior for the beta distribution. Normally this is done
with a uniform prior for all values of p, which corresponds to alpha = beta = 1.
Case 2: You have some prior information in terms of the mean and variance of p
You calculate alpha and beta, like in this post: http://stats.stackexchange.com/questions/12232/calculating-the-parameters-of-a-beta-distribution-using-the-mean-and-variance
That gives you a beta prior which reflects your prior information.
Case 3: You have information from previous binomial events, in the form ok k successes out of n trials:
Given that the beta is conjugate to the binomial, the posterior takes the form of the previous beta like this:
Beta(alpha, beta) => Beta(alpha + k, beta + n - k)
Thus, if you started with a uniform prior and have info on binomial events, you get this prior:
Beta(alpha, beta) => Beta(1 + k, 1 + n - k)
The process is, prior + evidence = posterior, which becomes the new prior for your new distribution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment