# Maximum Likelihood Estimator for $\theta$ when $X_1,\dots, X_n \sim U(-\theta,\theta)$

Exercise :

Calculate a Maximum Likelihood Estimator for the model $X_1,\dots, X_n \; \sim U(-\theta,\theta)$.

Solution :

The distribution function $f(x)$ for the given Uniform model is :

$$f(x) = \begin{cases} 1/2\theta, \; \; -\theta \leq x \leq \theta \\ 0 \quad \; \; , \quad\text{elsewhere} \end{cases}$$

Thus, we can calculate the likelihood function as :

$$L(\theta)=\bigg(\frac{1}{2\theta}\bigg)^n\prod_{i=1}^n\mathbb I_{[-\theta,\theta]}(x_i)= \bigg(\frac{1}{2\theta}\bigg)^n\prod_{i=1}^n \mathbb I_{[0,\theta]}(|x_i|)$$

$$=$$

$$\bigg(\frac{1}{2\theta}\bigg)^n\prod_{i=1}^n \mathbb I_{[-\infty,\theta]}(|x_i|)\prod_{i=1}^n \mathbb I_{[0, +\infty]}(|x_i|)$$

$$=$$

$$\boxed{\bigg(\frac{1}{2\theta}\bigg)^n\prod_{i=1}^n \mathbb I_{[-\infty,\theta]}(\max|x_i|)}$$

Question : How does one derive the final expression in the box from the previous one ? I can't seem to comprehend how this is equal to the step before.

Other than that, to find the maximum likelihood estimator you need a $\theta$ sufficiently small but also $\max |x_i| \leq \theta$ which means that the MLE is : $\hat{\theta} = \max |x_i|$.

• Indeed, $\hat\theta = \max_i|x_i|$. Consider that the density of a uniform distribution is not differentiable - so the usual approach of differentiating the (log)-likelihood function is not applicable. – Math1000 May 25 '18 at 7:52
• @Math1000 Yes, I know that. But how do you derive the board expression from the formula one step before ? This is the question. – Rebellos May 25 '18 at 8:00
• I think the indicator variables over the two sets in the penultimate step are multiplied to form the intersection of the sets in the final step. Since $\mathbf 1_A\times \mathbf 1_B=\mathbf 1_{A\cap B}$. – StubbornAtom May 25 '18 at 8:11
• In any case I don't think the penultimate step is needed. If $-\theta<x_i<\theta$, then $0<|x_i|<\theta$ which implies that $(-\infty<)\max(|x_i|)<\theta$. – StubbornAtom May 25 '18 at 8:23

I don't understand your solution, so I'm doing it myself here.

Assume $$\theta > 0$$. Setting $$y_i = |x_i|$$ for $$i = 1, \dots, n$$, we have

\begin{align} L(\theta)=\prod_{i=1}^{n}f_{X_i}(x_i)&=\prod_{i=1}^{n}\left(\dfrac{1}{2\theta}\right)\mathbb{I}_{[-\theta, \theta]}(x_i) \\ &=\left(\dfrac{1}{2\theta}\right)^n\prod_{i=1}^{n}\mathbb{I}_{[-\theta, \theta]}(x_i) \\ &= \left(\dfrac{1}{2\theta}\right)^n\prod_{i=1}^{n}\mathbb{I}_{[0, \theta]}(|x_i|) \\ &= \left(\dfrac{1}{2\theta}\right)^n\prod_{i=1}^{n}\mathbb{I}_{[0, \theta]}(y_i)\text{.} \end{align} Assume that $$y_i \in [0, \theta]$$ for all $$i = 1, \dots, n$$ (otherwise $$L(\theta) = 0$$ because $$\mathbb{I}_{[0, \theta]}(y_j) = 0$$ for at least one $$j$$, which obviously does not yield the maximum value of $$L$$). Then I claim the following:

Claim. $$y_1, \dots, y_n \in [0, \theta]$$ if and only if $$\max_{1 \leq i \leq n}y_i = y_{(n)} \leq \theta$$ and $$\min_{1 \leq i \leq n}y_i = y_{(1)}\geq 0$$.

I leave the proof up to you. From the claim above and observing that $$y_{(1)} \leq y_{(n)}$$, we have $$L(\theta) = \left(\dfrac{1}{2\theta}\right)^n\prod_{i=1}^{n}\mathbb{I}_{[0, \theta]}(y_i) = \left(\dfrac{1}{2\theta}\right)^n\mathbb{I}_{[0, y_{(n)}]}(y_{(1)})\mathbb{I}_{[y_{(1)}, \theta]}(y_{(n)}) \text{.}$$ Viewing this as a function of $$\theta > 0$$, we see that $$\left(\dfrac{1}{2\theta}\right)^n$$ is decreasing with respect to $$\theta$$. Thus, $$\theta$$ needs to be as small as possible to maximize $$L$$. Furthermore, the product of indicators $$\mathbb{I}_{[0, y_{(n)}]}(y_{(1)})\mathbb{I}_{[y_{(1)}, \theta]}(y_{(n)})$$ will be non-zero if and only if $$\theta \geq y_{(n)}$$. Since $$y_{(n)}$$ is the smallest value of $$\theta$$, we have $$\hat{\theta}_{\text{MLE}} = y_{(n)} = \max_{1 \leq i \leq n} y_i = \max_{1 \leq i \leq n }|x_i|\text{,}$$ as desired.

• 𝕀[0,𝜃](𝑦𝑗)=0 May I ask what this notation means? Thanks! – Edamame Jul 8 at 18:21
• @Edamame $\mathbb{I}_{[0, \theta]}(y_j)$ is $1$ if $y_j \in [0, \theta]$ and $0$ otherwise. – Clarinetist Jul 8 at 21:57

We have:$$\bigg(\frac{1}{2\theta}\bigg)^n\prod_{i=1}^n \mathbb I_{[-\infty,\theta]}(|x_i|)\prod_{i=1}^n \mathbb I_{[θ, +\infty]}(|x_i|)$$ and no $$\bigg(\frac{1}{2\theta}\bigg)^n\prod_{i=1}^n \mathbb I_{[-\infty,\theta]}(|x_i|)\prod_{i=1}^n \mathbb I_{[0, +\infty]}(|x_i|)$$ before the final expression in the box. So as we can see $$\prod_{i=1}^n \mathbb I_{[θ, +\infty]}(|x_i|)=0$$