Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose that I culture cancer cells in n different dishes g₁, g₂, … , gn and observe the number of cells ni in each dish that look different than normal. The total number of cells in dish gi is ti. There is individual differences between individual cells, but also differences between the populations in different dishes because each dish has a slightly different temperature, amount of liquid, and so on.

I model this as a beta-binomial distribution: ni ~ Binomial(pi, ti) where pi ~ Beta(α, β). Given a number of observations of ni and ti, how can I estimate α and β?

share|improve this question

To fit the model you can use JAGS or Winbugs. In fact if you look at the week 3 of the lecture notes at Paul Hewson's webpage, the rats JAGS example is a beta binomial model. He puts gamma priors on alpha and beta.

share|improve this answer

You don't necessarily have to go Bayesian on your model, plain maximum likelihood estimation works just fine (though has no explicit solution). Multiple R packages (eg. aod or VGAM) will fit the distribution for you.

Alternatively, you can use the quasi-likelihood based overdispersed binomial model that does not assume a beta-binomial distribution, just adjusts for the overdispersion. The glm function with the quasibinomial family will fit this model in R.

share|improve this answer

You have a hierarchical bayesian model. Brief details below:

Likelihood Function:

$$f(n_i | p_i, t_i) = (t_i n_i) p_i^{n_i} (1-p_i)^{(t_i - n_i)}$$

Priors on $p_i, \alpha, \beta$:

$$pi \sim Beta(\alpha, \beta)$$

$$\alpha ~ N(\alpha_{mean}, \alpha_{var}) I(\alpha > 0)$$

$$\beta ~ N(\beta_{mean}, \beta_{var}) I(\beta > 0)$$

Posteriors are:

$$p_i \sim Beta(\alpha + n_i, \beta + t_i-n_i)$$

$$\alpha \propto I(\alpha > 0) \prod p_i^{(\alpha-1)} exp(-(\alpha-\alpha_{mean})^2) / (2 \alpha_{var})$$

$$\beta \propto I(\beta > 0) \prod (1-p_i)^{(\beta-1)} exp(-(\beta-\beta_{mean})^2) / (2 \beta_{var})$$

You can then use a combination of Gibbs and Metropolis-Hastings to draw from the posterior distributions.

share|improve this answer
I guess you can put $$ now ? – robin girard Aug 11 '10 at 12:51
@robin: done. might need to be checked. – naught101 Nov 15 '12 at 6:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.