# Method of moment estimator for uniform discrete distribution

Let $X$ be a random variable with uniform discrete distribution on $\{1,\ldots,\theta\}$ where $\theta$ is an unknown positive integer. How to find the method of moment estimator $\widehat{\theta}_{n}$ based on a finite sample $(X_1,X_2,\ldots,X_n)$ of $X$?

Thanks a lot.

According to the method of the moment estimator, you should set the sample mean $\overline{X}_n$ equal to the theoretical mean $μ$. The sample mean is given by $$\overline{X}_n=\frac1n\sum_{i=1}^{n}X_i$$ and the theoretical mean for the discrete uniform distribution is given by $$μ=\frac{1}{θ}\sum_{i=1}^{θ}i=\frac{θ+1}{2}$$ Equating these two gives $$μ=\overline{X}_n \iff \frac{θ+1}{2}=\overline{X}_n \implies \hat{θ}_n=2\overline{X}_n-1=\frac{2}{n}\sum_{i=1}^{n}X_i-1$$ ($-1$ is outside of the summation). A standard point of confusion is that both $θ$ and the $X_i$'s are unknown, but this is not true. The $X_i$'s refer to your sample and therefore will become known as soon as you take the sample.
• You mean $\widehat{\theta}_{n}$ is $\overline{X}_n$ right? Dec 17, 2015 at 11:46
• @user110834 No, I mean $\hat{θ}_n=2\overline{X}_n-1$. Sorry, I had a typo. Dec 17, 2015 at 11:49
• But you wrote $\widehat \theta$, not $\widehat \theta_n$? Dec 17, 2015 at 11:58