# Marginal of a uniform distribution

Given $f\left(x|\theta\right)=1/\theta, 0\leq x\leq \theta,L\left(\theta, a\right)=\left(a-\theta\right)^2,$ and $\pi\left(\theta\right)=\theta e^{-\theta},\theta\gt 0$

I've seen Problem calculating joint and marginal distribution of two uniform distributions, but it's not what I'm looking for.

Problem: calculate the marginal density of $x$, i.e., $f\left(x\right)$.

\begin{eqnarray} f\left(x\right) &=& \int f\left(x|\theta\right)\pi\left(\theta\right)d\theta\\\ &=& \int \frac{1}{\theta}\cdot\theta\cdot e^{-\theta}d\theta\\\ &=& \int e^{-\theta}d\theta. \end{eqnarray}

Somehow the last equation should turn out to be $e^{-x}$, according to the book. I don't see how this is true, since I'm integrating over $\theta$. I don't understand why $x$ should end up in the solution since it's nowhere in the original equation. I'm also not sure what the limits of integration are. If $\theta > 0$, then I though maybe they should be $\left[0, \infty\right)$, but that gives $1$ as the solution to the integration.

• I like that [Math Processing Error] in red; it fits in well as a transition between the previous and subsequent paragraphs! Perhaps, however, it is unintentional? – jbowman Feb 26 '12 at 21:59
• Definitely unintentional. Seems to be a site issue because it was working about 10 or so minutes ago. – Phillip Cloud Feb 26 '12 at 22:00
• This isn't an answer to what you're asking, but rather a related aside that is interesting to think about: en.wikipedia.org/wiki/Borel%E2%80%93Kolmogorov_paradox – Daniel Johnson Feb 26 '12 at 22:32
• Hint: Fix a value for $x$, say $x = 1$. Put in limits $\theta=0$ and $\theta=\infty$ on the integral on the first line, and ask yourself the question: When $\theta = 0.5$, what is the value of the integrand $f(1|\theta=0.5)\pi(0.5)$? Similarly, what is the value of $f(1|\theta=0.9)\pi(0.9)$? Then determine whether the limits on the integral on the second line are $0$ and $\infty$, or something else. – Dilip Sarwate Feb 26 '12 at 22:39

You seem to be a little confused about the likelihood function of the $U[0,\theta]$ model.

Let $f(x\mid\theta)=1/\theta$, for $0\leq x\leq\theta$, and $f(x\mid\theta)=0$, otherwise, for $\theta>0$.

For some fixed $x$, what is the graph of $f(x\mid\theta)$ as a function of $\theta$?

To draw the graph, notice -- and this is the key point -- that $x\in[0,\theta]$ if and only if $\theta\in[x,\infty)$.

So, using indicator functions, we have $$f(x\mid\theta)=\frac{1}{\theta}I_{[0,\theta]}(x)=\frac{1}{\theta}I_{[x,\infty)}(\theta)\, .$$

After you understand this, just do the integration: $$f(x)=\int_0^\infty f(x\mid\theta)\pi(\theta)\,d\theta = \int_x^\infty \frac{1}{\theta}\pi(\theta)\,d\theta\, .$$

• You beat me to it! I can't post any math because of a weird error so I didn't write anything. Thanks! :) – Phillip Cloud Feb 27 '12 at 2:38