So I'm trying to find the conditional posterior distributions of n given $\theta$ and x as well as $\theta$ given n and x.

These are my priors (poisson and beta)

\begin{equation*} \begin{aligned} & \pi (n) = \frac{ \mu^{n} e^{-\mu}}{n!} \\ & \pi (\theta) = \frac{1}{B(\alpha, \beta)} \theta^{\alpha-1} (1 - \theta)^{\beta-1} \end{aligned} \end{equation*}

and the likelihood function of the parameters given the data is binomial

\begin{equation*} \begin{aligned} L(n, \theta | x) = {n \choose x} \theta^{x} (1- \theta)^{n-x} \end{aligned} \end{equation*}

This is what I have for the first conditional distribution

\begin{equation*} \begin{aligned} & \pi(n | x, \theta) = \frac{\pi(n) L(n | x, \theta)}{ \int \pi(n) L(n | x,\theta) dn} \\ & \propto \pi(n) L(n | x, \theta) \\ & = \frac{ \mu^{n} e^{-\mu}}{n!} \frac{n!}{(n-x)!x!} \theta^{x} (1- \theta)^{n-x} \\ & \propto \frac{ \mu^{n} e^{-\mu}}{(n-x)!} (1- \theta)^{n-x} \\ & \propto \frac{ \mu^{n} \mu^{-x} e^{-\mu} e^{-(1- \theta)}}{(n-x)!} (1- \theta)^{n-x} \\ & = \frac{ \mu^{n-x} e^{-(\mu(1- \theta)}}{(n-x)!} (1- \theta)^{n-x} \\ & = \frac{ (\mu(1-\theta))^{n-x} e^{-(\mu(1- \theta))}}{(n-x)!} \\ \end{aligned} \end{equation*}

I know it should be in the form of x + Y where Y is a poisson random variable so I'm not sure where I'm going wrong.

For my second conditional distribution I have

\begin{equation*} \begin{aligned} & \pi(\theta | x, n) = \frac{\pi(\theta) L(\theta | x, n)}{ \int \pi(\theta) L(\theta | x,n) d\theta} \\ & \propto \pi(\theta) L(\theta | x, n) \\ & = \frac{1}{B(\alpha, \beta)} \theta^{\alpha-1} (1 - \theta)^{\beta-1} \frac{n!}{(n-x)!x!} \theta^{x} (1- \theta)^{n-x} \\ & \propto \frac{1}{B(\alpha+x, \beta + n - x)} \theta^{\alpha + x -1} (1 - \theta)^{\beta + n - x -1} \end{aligned} \end{equation*}

which I think is right because I know it should be some kind of beta distribution.


1 Answer 1


Firstly, let's correct some notational mistakes: $L(n,\theta|x)$ is $p(x|n,\theta)$, but in the third line of the derivation of $\pi(n|x,\theta)$, you substitute the expansion of $L(n,\theta|x)$ in place of $L(n|x,\theta)$. However, since in terms of $n$, we have $L(n|x,\theta)=p(x,\theta|n)=p(x|\theta,n)p(\theta|n)=L(\theta,n|x)\pi(\theta)\propto L(\theta,n|x)$ what you've substituted is correct with $\propto$ argument present (not with $=$).

Another typo: $e^{-\mu}e^{-(1-\theta)}$ seems to be equal to $e^{-\mu(1-\theta)}$ in the sixth-line of the same derivation; but it is not. Again, this term doesn't depend on $n$, so $\propto$ argument holds, and we can simply add the term $e^{-\mu(1-\theta)}$ to the multiplication without disturbing anything.

For the final result, i.e. $$\pi(n|x,\theta)\propto \frac{ (\mu(1-\theta))^{n-x} e^{-(\mu(1- \theta))}}{(n-x)!}$$ the PDF (or PMF) is in shifted Poisson form if we let $\lambda=\mu(1-\theta)$, and $n\geq x$, i.e. $n=x+Y$, where $Y$ is Poission.

For the second one, we can substitute the value of $L(n,\theta|x)$ as below, and follow your way to the solution: $$L(\theta | x, n)=p(x,n|\theta)=p(x|n,\theta)p(n|\theta)=p(x|n,\theta)p(n)\propto p(x|n,\theta)=L(n,\theta|x)$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.