# Finding the posterior pdf

Suppose $X$ has probability density function $$f(x, \theta) = \theta e^{-\theta x}$$ when $x > 0$ and $\theta > 0$, and $0$ otherwise; given $\Theta = \theta$. Suppose the prior probability density function of $\Theta$ is $$h(\theta) = 1$$ when $0 < \theta < 1$, and $0$ otherwise. Find the posterior probability density function of $\Theta$ given $X = x$ (for $x > 0$).

Let $k( \theta | x)$ denote the posterior pdf. We have $k( \theta | x) = \frac{L(x | \theta)h(\theta)}{f_1(x)}$, where $f_1(x)$ is the joint pdf of $X$. We have $L(x | \theta)h(\theta) = (\theta^n e^{ - \theta \sum^{n}_{i=1} x_i})(1) = \theta^n e^{ - \theta \sum^{n}_{i=1} x_i}$.

Let $Y= \sum^{n}_{i=1}$

We also have $f_1(x) = \int^{\infty}_0 \theta^n e^{-\theta Y} d \theta$. But since $\Gamma(n+1) = \int^{\infty}_0 \frac{\theta^{(n+1)-1} e^{-\theta Y}}{(1/Y)^{n+1}} d\theta$, we have $f_1(x) = \int^{\infty}_0 \theta^n e^{-\theta Y} d \theta = \frac{\Gamma(n+1)}{Y^{n+1}}$.

So $k(\theta | x) = \frac{(\sum x_i)^{n+1} \theta^n e^{-\theta \sum x_i}}{\Gamma(n+1)}$ for all $x_i > 0$ and $0< \theta < 1$, and $0$ otherwise.

Do you think my answer is correct?

• Where is $n$ in the problem statement? – Dilip Sarwate Jan 5 '14 at 16:36
The joint density of $X$ and $\Theta$ is $$f_{X,\Theta}(x,\theta)= f_{X\mid \Theta}(x\mid \Theta=\theta)f_\Theta(\theta) = \begin{cases} \theta e^{-\theta x}, & 0 < x < \infty, 0 < \theta < 1,\\ 0, &\text{otherwise.}\end{cases}$$ Thus, for $0 < x < \infty$, the marginal density of $X$ is should be found by integrating the joint density of $X$ and $\Theta$ with respect to $\theta$ over the interval $(0,1)$ instead of $(0,\infty)$ the way you have it. Note that your purported density $\Gamma(n+1)y^{-(n+1)}$ is not a valid density function since it does not integrate to $1$ over $(0,\infty)$ even when $n=1$
• Thanks a lot. So $f_1(x) = \int^1_0 \theta e^{-\theta x} d \theta$. We use integration by parts with $u = \theta$ and $v = e^{- \theta x}/(-x)$. So we have $\int^1_0 \theta e^{-\theta x} d \theta = \theta e^{-\theta x}/(-x) - \int^1_0 \frac{e^{-x \theta}}{-x} d \theta = \theta e^{-\theta x}/(-x) + \frac{1}{x} [ e^{-\theta x}/(-x) ]^1_0$ $= \theta e^{-\theta x}/(-x) + \frac{1}{x}[ \frac{e^{- x}}{-x} + \frac{1}{x}]$. And $k(\theta | x) = \frac{f_{X, \Theta}(x, \theta)}{f_1(x)}$. Is my answer correct? – Artus Jan 5 '14 at 19:20
• I have not checked the details of your calculation but an obvious error is that the purported marginal density of $X$ shows dependence on $\theta$. You need to apply the limits $\theta=0$ and $\theta=1$ to the $\thetae^{-\theta x}/(-x)$ also... – Dilip Sarwate Jan 5 '14 at 21:43
• That last should have been $\theta e^{-\theta x}/(-x)$. – Dilip Sarwate Jan 6 '14 at 15:03