Estimating beta-binomial distribution

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 β?

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.

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.

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.