The beta-binomial distribution consists of a finite sum of Bernoulli dependent variables whose probability parameter is random and follows a beta distribution. Assume that we have \(y_j\) a set of variables, \(j=1,...,m\), with m integer, that conditioned on a random variable \(u\), are independent and follow a Bernoulli distribution with probability parameter \(u\). On the other hand, the random variable \(u\) follows a beta distribution with parameter \(p/phi\) and \((1-p)/phi\). Namely,
$$y_j \sim Ber(u), u \sim Beta(p/phi,(1-p)/phi),$$
where \(0<p<1\) and \(phi>0\). The first and second order marginal moments of this distribution are defined as
$$E[y_j]=p, Var[y_j]=p(1-p),$$
and correlation between observations is defined as
$$Corr[y_j,y_k]=phi/(1+phi),$$
where \(j,k=1,...,m\) are different. Consequently, \(phi\) can be considered as a dispersion parameter.
If we sum up all the variables we will define a new variable which follows a new distribution that is called beta-binomial distribution, and it is defined as follows. The variable \(y\) follows a beta-binomial distribution with parameters \(m\), \(p\) and \(phi\) if
$$y|u \sim Bin(m,u), u\sim Beta(p/phi,(1-p)/phi).$$