Solution (source code)

= Solution

Multiply the <Beta distribution> density of $p_M$, the conditional <binomial distribution> mass of $X$, and the conditional <Beta distribution> density of $p_T$. With $B(a,b)$ the <beta function>, the full joint density, relative to counting measure in $x$ and Lebesgue measure in the two probabilities, is
$$
\boxed{f(p_T,x,p_M)=\frac{\binom nx}{B(\alpha,\beta)B(\alpha+x,\beta+n-x)}
(p_Tp_M)^{\alpha+x-1}[(1-p_T)(1-p_M)]^{\beta+n-x-1}.}
$$
Here $x=0,\ldots,n$ and both probabilities lie in $(0,1)$. \b[The printed joint expression omits the factor $1/B(\alpha+x,\beta+n-x)$.] It is a constant when $x$ is fixed and only the two probabilities vary, but is not a constant for the full <joint probability distribution>. Keeping it is essential when summing over the <latent variable>.