How to perform Gibbs sampling for this distribution? I tried to sample this equation by Gibbs sampling.

$
P\{X=i,y \le Y \le y+dy,N=n\}\propto C^n_iy^{i+\alpha-1}(1-y)^{n-i+\beta-1}e^{-\lambda}\frac{\lambda^n}{n!}dy
$

I know I should generate X given $(y,n)$, Y given $(x,n)$ and N given $(x,y)$ step by step.
But I don't know how to generate them because I don't know the $\lambda$ and what $dy$ does mean. Please help me!!
 A: Some clarifications:

*

*I guess that you have the constraints $n\ge i$, $i \ge 0$ and $0\le y \le1$.

*$dy$ is just an indication that $Y$ is a continuous variable and that reported is a probability density.

*$n$ and $i$ indicate instead integer valued random variables

*$\lambda$ is just a positive real parameter

As you noticed, to apply Gibbs sampling you need to be able to sample the conditional distributions. Notice that:

*

*$P(Y=y|X=i,N=n) \propto \beta(i-\alpha,n-i+\beta)$
where you have the $\beta$-distribution.
Then:


*$P(X=i|Y=y,N=n) \propto Binom(y)$
where you have the binomial distribution:
and finally:


*$P(N=n|X=i,Y=y) \propto i+P$, where:

$P \propto Poisson((1-y)\lambda)$
where it enters the Poisson distribution.
The third result is maybe the not immediate one. Notice that the conditional distribution in that case is:
$P(N=n|X=i,Y=y)\propto (1-y)^n \binom n i \lambda^n/n! \propto (\lambda(1-y))^n/(n-i)!$
Now define $P=N-i$ and realize that $P$ has the correct Poisson density from which you can derive result number 3 .
You have all your ingredients now. You should be able to sample these standard distributions using your preferred computational framework (Python/R).
