# Derive method of moments estimator of $\theta$ for a uniform distribution on $(0,\theta)$

Let $$X_1,\ldots , X_n$$ be a random sample (IID) from a Uniform distribution on $$[0, \theta]$$ where $$\theta$$ is unknown. Derive the method of moments estimator of $$\theta$$ and find its expectation and variance. Is this estimator consistent? Justify your answer. Here I got the answer for expectation is $$\frac{\theta}{2}$$, can anyone help with the variance please?

The method of moments estimator is obtained by solving $$E_\theta(X^r) = \frac{1}{n} \sum_{i=1}^n {X_i}^r$$. For $$r=1$$, one gets the expectation equality $$$$E_\theta(X) = \int_0^\theta x\, \frac{1}{\theta} \, dx = \frac{\theta}{2} = \frac{1}{n} \sum_{i=1}^n {X_i} \, ,$$$$ which yields an estimator for $$\theta$$ defined by $$\hat{\theta}_n = \frac{2}{n} \sum_{i=1}^n {X_i}$$ .
By virtue of the expectation's linearity and the sample's identical distribution, the expectation of this estimator is $$$$E_\theta(\hat{\theta}_n) = \frac{2}{n} \sum_{i=1}^n E_\theta({X_i}) = \frac{2}{n}\, n \frac{\theta}{2} = \theta \, .$$$$ Therefore, the estimator is not biased.
Now, let us compute the variance of the estimator (which is also equal to the mean squared error since the estimator is not biased). Using the scaling and summation properties of the variance of uncorrelated random variables, one has $$$$V_\theta(\hat{\theta}_n) = \frac{4}{n^2} \sum_{i=1}^n V_\theta({X_i}) = \frac{4}{n^2}\, n V_\theta({X}) \, .$$$$ Since the variance of the uniform law is $$$$V_\theta(X) = E_\theta(X^2) - E_\theta(X)^2 = \frac{\theta^2}{3} - \left(\frac{\theta}{2}\right)^2 = \frac{\theta^2}{12} \, ,$$$$ one obtains $$V_\theta(\hat{\theta}_n) = \frac{\theta^2}{3\, n}$$ .