Thanks for the detail question, the important point here to realized here is that, you need multiple “observation” in the latent space to capture correlation, this means that X and Y are random variable with shape m (m being the number of trials) that generated from a distribution.
Something like below might work:
with pm.Model() as m:
us = pm.Gamma('u_i', np.ones(5), 1, shape=(len(count), 5))
x = pm.Deterministic('x', (us[..., 0]+us[..., 2])/(us[..., 0]+us[..., 2]+us[..., 3]+us[..., 4]))
y = pm.Deterministic('y', (us[..., 1]+us[..., 3])/(us[..., 1]+us[..., 2]+us[..., 3]+us[..., 4]))
observed = pm.Binomial('obs', np.ones(2)*20, tt.stack([x, y]).T, observed=count)
trace = pm.sample(1000, tune=1000)
_, ax = plt.subplots(1, 1, figsize=(5, 5))
az.plot_kde(trace['x'].mean(axis=0),
trace['y'].mean(axis=0),
ax=ax);
See https://colab.research.google.com/drive/1iloMYZBYyV4AG0_7xXOSpkR7FH2TbDUn for the full code