Estimating the side of a square with random points I have a square with side $\theta$ and origin in $(0,0)$. I simulate some random values inside the square's area. What is the maximum likelihhod estimator, confidence interval and a non-biased estimator for $\theta$?
 A: Are you using the uniform distribution to generate your random numbers? 
If so, then your random variable $X\sim U(0, \theta)$, which means that the likelihood is $L(\theta|\mathbf{x})=\prod_{i=1}^n f(x)=\prod_{i=1}^n \frac{1}{\theta}I_{(x_i\leq \theta)}=\frac{1}{\theta^n}I_{(x_{(n)}\leq\theta)}$, which means that the maximum likelihood estimator must be $x_{(n)}\equiv \max x$. 
It is not unbiased (but consistent), but I don't want to spend time on that if this isn't answering your question.
A: Suppose $n$ points are of the form $(X_i, Y_i)$ with each value independently uniformly drawn from $[0,\theta]$.  Then the probability that all $2n$ values are less than or equal to $k$ (with $0 \le k \le \theta$) is $\left(\frac{k}{\theta}\right)^{2n}$ and so the density is $p(k)=2n\frac{k^{2n-1}}{\theta^{2n}}I_{k \le \theta}.$
So if the maximum of the $2n$ values is $k$ then the likelihood is proportional to  $\frac{k^{2n-1}}{\theta^{2n}}I_{\theta \ge k}$.  This clearly has a maximum likelihood at the lowest possible value of $\theta$, namely $\hat{\theta}=k$.
Suppose you want a two-sided $95\%$ confidence interval: given $\theta$, there is a $95\%$ probability that the maximum of the $2n$ values lies between $\sqrt[2n]{0.025}\theta$ and $\sqrt[2n]{0.975}\theta$.  So if the maximum is $k$, the $95\%$ confidence interval for $\theta$ would between $k/\sqrt[2n]{0.975}$ and $k/\sqrt[2n]{0.025}$.   
Given $\theta$, the expected value of $k$ can be calculated from the density, and is $\displaystyle \int_0^\theta 2n\frac{k^{2n}}{\theta^{2n}}dk$ which is $\frac{2n}{2n+1}\theta$, suggesting that an unbiased estimator of $\theta$ would be $\frac{2n+1}{2n}k$. 
Note that the square of the unbiased estimate of $\theta$ is not an unbiased estimate of $\theta^2$ the area of the square.  
