Given $X_1,\ldots,X_n$, where $X_i\sim U(-\theta,\theta)$, what the MLE for $\theta$? Apparently the answer is $\max\{|X_1|,\dots,|X_n|\}$ but I can't figure out why.
The density function is $$f(x,\theta) = \begin{cases} \frac{1}{2\theta}, & x\in[-\theta,\theta] \\ 0, & \text{else} \end{cases}$$
I get a likelihood function that may decrease or increase for $\theta<0$, depending on the parity of $n$. I'm not sure if that's the way to solve this.
I am assuming the $X_i$ are independent.
The likelihood of $\theta$ given your observations is $$ \mathcal L(\theta|X_1, \dots, X_n)=\prod_{i=1}^{n}f(X_i, \theta). $$ This equals $=(2\theta)^{-n}$ if $\theta \geq |X_i|$ for all $i$, and $0$ otherwise. In addition, the larger $\theta$, the smaller the above quantity.
In other words, in order to maximize the likelihood you need the smallest value of $\theta$ such that the above quantity is not $0$, and that is $\max\{|X_i|;i=1,\dots, n\}$.