\(Y=(y_1, \ldots, y_d)\) are the \(d\) category count vectors. Given the parameter vector \(\alpha = (\alpha_1, \ldots, \alpha_{d-1}),
\alpha_j>0\), and \(\beta=(\beta_1, \ldots, \beta_{d-1}), \beta_j>0\),
the generalized Dirichlet multinomial probability mass function is
$$
P(y|\alpha,\beta)
=C_{y_1, \ldots, y_d}^{m} \prod_{j=1}^{d-1}
\frac{\Gamma(\alpha_j+y_j)}{\Gamma(\alpha_j)}
\frac{\Gamma(\beta_j+z_{j+1})}{\Gamma(\beta_j)}
\frac{\Gamma(\alpha_j+\beta_j)}{\Gamma(\alpha_j+\beta_j+z_j)} ,
$$
where \(z_j = \sum_{k=j}^d y_k\) and \(m = \sum_{j=1}^d y_j\).
Here, \(C_k^n\), often read as "\(n\) choose \(k\)",
refers the number of \(k\) combinations from a set of \(n\) elements.
The \(\alpha\) and \(\beta\) parameters can be vectors, like the results from the
distribution
fitting function, or they can be matrices with \(n\) rows,
like the estimate
from the regression function multiplied by the covariate matrix
\(exp(X\alpha)\) and \(exp(X\beta)\)