# Likelihood Function for the Uniform Density $(\theta, \theta+1)$

Let the random variable X have a uniform density given by

$f(x;\theta)$~$R(\theta,\theta+1)$

What is the maximum likelihood function according to the samples $X_1,\ldots,X_n$?

The question is much like Likelihood Function for the Uniform Density. But there seems no satisfying answer. So far I get $X_{max}-1\le\theta\le X_{min}$ and my guess is $\hat\theta=\frac{X_{max}+X_{min}-1}{2}$. Am I right? I need a theoretical explaination.

Hint: When you say that "So far I get $$X_{max}-1\le\theta\le X_{min}$$" you are actually saying that the likelihood $$L(\theta ; x_1 \cdots x_n)$$ (regarded as a function of $$\theta$$) is zero outside that range. Now, what is the likelihood if $$\theta$$ is inside that range?

Update: you know that the density of each uniform sample is $$f(x;\theta) = 1$$ if $$\theta , $$0$$ otherwise.

Then the likelihood $$L(\theta;x_1 \cdots x_n) =\prod f(x_i;\theta)$$ is $$1$$ if $$\theta $$\forall i$$, $$0$$ otherwise. In terms of $$\theta$$ as variable, this is equivalent to say that $$L(\theta;x_1 \cdots x_n)=1$$ in $$X_{max}-1\le\theta\le X_{min}$$. You need to find the maximum of $$L(\theta;x_1 \cdots x_n)$$ as a function of $$\theta$$. But $$L(\theta;x_1 \cdots x_n)$$ is constant (in that range) (I recommend you to draw it if you don't quite get it). Hence, $$\theta_{ML}$$ is not well defined, we can pick any value in that range. In particular, $$(X_{min}+X_{max})/2$$ is as valid as any other.

• Thanks, "any value" is really beyond my thought... – Frazer Mar 22 '14 at 15:20
• @leonbloy: I have a question. What if for $X_1,\dots,X_n$ are such that $X_{min}<X_{max}-1$ ? In this case $L(\theta) = 0$ for all $\theta$. So, what will mle in this case? – Kumara Dec 17 '18 at 11:49
• Undefined. Anyway, that cannot happen under the assumed model – leonbloy Dec 17 '18 at 14:52

Here a two thoughts

• If any $X_i$ lies outside of $[\theta,\theta+1]$, then the likelyhood function is zero
• If all the $X_i$ lie inside $[\theta_1,\theta_1+1]$ and also inside $[\theta_2,\theta_2+1]$, then the likelyhoods are the same, because $f(x,\theta_1) = f(x,\theta_2)$ for those $x$ which lie in the intersection of the two intervals