# Difference test for beta–binomial variables

Let $X \sim \textrm{Beta–Binomial}(\alpha_1, \beta_1, n)$ and $Y \sim \textrm{Beta–Binomial}(\alpha_2, \beta_2, n)$ and write $\mu_1 = \frac{\alpha_1}{\alpha_1 + \beta_1}$, $\phi_1 = \alpha_1 +\beta_1$, $\mu_2 = \frac{\alpha_2}{\alpha_2 + \beta_2}$, $\phi_2 = \alpha_2 +\beta_2$ for brevity. I have some samples $x_1, x_2, \ldots, x_k$ and $y_1, y_2, \ldots, y_k$ and want to test the null hypothesis $\mu_1 = \mu_2$. I am interested in all of the following cases, especially the third one:

1. We know $\phi = \phi_1 = \phi_2$ in advance.
2. We know that $\phi_1 = \phi_2$ but not the exact value.
3. It is possible that $\phi_1 \ne \phi_2$.

I believe that in the limit $n \to \infty$, $\phi \approx n$, by approximating $X$ and $Y$ with appropriately scaled normal distributions, these situations correspond to the paired difference $Z$-test, Student's $t$-test and Welch's $t$-test, respectively. However, I am more interested in the cases when $n$ and $k$ are small, say $n = k = 10$. It would be very interesting if there was a workable solution for $n = 1$ (beta–Bernoulli distributions), but I doubt that.