# Method of moments estimator, $P_\theta(X = x) = \frac{1}{\theta}$

I am struggling with finding a method of moments estimator for (seemingly) simple situation: pdf is given by $$P_\theta(X = x) = \frac{1}{\theta}$$, $$x \in$$ {1,2,...$$\theta$$}, where $$\theta \in N$$.

My idea was to find the expectation and then, the first sample moment. I did so far:

$$E(x) = \int_{0}^{\theta}xf(x)dx$$

$$E(x) = \int_{0}^{\theta} \frac{1}{\theta}xdx$$

$$E(x) = \frac{1}{\theta}\int_{0}^{\theta}xdx$$

$$E(x) = \frac{1}{\theta}\int_{0}^{\theta}xdx$$

$$\frac{1}{\theta}\bigl|_{0}^{\theta}(\frac{x^2}{2})$$

Applying the limits, I get:

$$\frac{1}{\theta}(\frac{\theta^2}{2} - \frac{1}{2})$$,

$$\bar{X} = \frac{\theta}{2} - \frac{1}{2\theta}$$.

This does not seem like a correct answer, because the book provides MOM as:

$$2\bar{X} -1$$

But I cannot get the same MOM with the expectation I calculated. I admit that my expectation is wrong, or I misunderstand the further steps of calculation.

I would appreciate if someone can help!

Thank you!

Marina

This is a discrete distribution, so it does not have a density $$f(x)$$ but instead a probability mass function. Its expectation is $$E[X]= 1 \times \frac1\theta + 2 \times \frac1\theta + \cdots + \theta \times \frac1\theta = \frac{\theta(\theta+1)}{2} \times \frac1\theta = \frac{\theta+1}{2}$$
which should not be a surprise as it is the middle of a uniform distribution from $$1$$ through to $$\theta$$.
Solving this for $$\theta$$ gives $$\theta = 2 E[X] -1$$ making the method of moments estimator $$\hat \theta = 2 \bar X -1$$