Random variables X and N have joint distribution, defined up to a constant of proportionality,
$f(x,n) \propto \frac{e^{-3x}x^n}{n!}$ for $n=0,1,2,...$ and $x>0$. Note that X is continuous and N is discrete.
The question is implement a Gibbs sampler to sample from this distribution.
But I don't understand the solution :
The conditional distribution of $N$ given $X = x$ is proportional to $x^n/n!$, which is a Poisson distribution with parameter $x$.
The conditional distribution of $X$ given $N = n$ is proportional to $e^{−3x}x^n$, which is a gamma distribution with parameters $r = n + 1$ and $\lambda = 3$.
How to get the two above conditional distribution?
The solution also said
$$p(x,n)=\frac{e^{−3x}x^n}{n!} / \int_0^\infty \Sigma_{n=0}^\infty \frac{e^{−x}x^n}{n!} dx= 2 \frac{e^{−3x}x^n}{n!}$$
I don't understand above. Where does 2 come from?
I can only recognize that $f(x,n)$ has the kernel of Poisson ($3x$).
Note $$p(x,n)=f(x,n)/\int_{\mathbb{R}}\sum_{n\in \mathbb{Z}_{>0}}f(x,n)dx$$ just normalizes $f(x,n)$ so that it represents a valid joint mass-density and integrates to one.
The conditional mass function of $N$ given $X=x$ is proportional to
$${f(x,n) \over \sum_{n\in \mathbb{Z}_{>0}}f(x,n)}\propto f(x,n)\propto x^n/n!,$$
where $\propto$ in this context only accounts for terms depending on $n$ (taken $X=x$ as fixed).
The conditional density of $X$ given $N=n$ is proportional to
$${f(x,n) \over \int_{\mathbb{R}}f(x,n)dx}\propto f(x,n)\propto e^{-3x}x^n,$$
where $\propto$ in this context only accounts for terms depending on $x$ (taking $N=n$ as fixed).