# Math Help - Method of moments

1. ## Method of moments

X is a discrete RV with P(X=1) = p , P(X=2)=1-p; three independent observations of X are made x1=1, x2=2,x3=2.
a)find the method of moments estimate of p

In order to find the method of moments estimate of p, I know I need to find the 1st moment and the 2nd moment.
What I did is.... E(p) = 1/3 p +2/3 (1-p) ...am I on the right track? when I continue to find the 2nd moment E(p square)...it turns out weird... the final answer for this question is 1/3.

d) if p has a prior distribution that is uniform on [0,1], what is its posterior density?
Actually, I have difficulty in finding the posterior density. If anyone could do it as an exmaple for me. That would be perfect. Thanks!

2. First of all, p is a probability.
You want the expected value of X.
For MOM you set the expected value equal to the sample mean.

$(1)(p)+(2)(1-p)={1+2+2\over 3}$

yup, I get $\hat p={1\over 3}$

3. Originally Posted by cm917
X is a discrete RV with P(X=1) = p , P(X=2)=1-p; three independent observations of X are made x1=1, x2=2,x3=2.
a)find the method of moments estimate of p

In order to find the method of moments estimate of p, I know I need to find the 1st moment and the 2nd moment.
What I did is.... E(p) = 1/3 p +2/3 (1-p) ...am I on the right track? when I continue to find the 2nd moment E(p square)...it turns out weird... the final answer for this question is 1/3.

d) if p has a prior distribution that is uniform on [0,1], what is its posterior density?
Actually, I have difficulty in finding the posterior density. If anyone could do it as an exmaple for me. That would be perfect. Thanks!
$f(p | data) \propto f(p) \cdot f(data | p)$ where $f(p)$ is the prior distribution of $p$, $f(p | data)$ is the posterior distribution and $f(dtat | p)$ is the likelihood function.

Therefore $f(p | data) \propto 1 \cdot p(1 - p)^2$.

Therefore $f(p | data) = k p(1 - p)^2$ where $k$ is a normalising constant whose value is easily found to be 12.

Therefore $f(p | data) = 12 p(1 - p)^2$.

Note that $E(p) = \frac{2}{5}$.

4. Originally Posted by matheagle
First of all, p is a probability.
You want the expected value of X.
For MOM you set the expected value equal to the sample mean.

$(1)(p)+(2)(1-p)={1+2+2\over 3}$

yup, I get $\hat p={1\over 3}$
But are we supposed to find E(x)?? I think we should find the E(p).... need more explaination..THANKS!

5. $E(X)= (1)(p)+(2)(1-p)$

$\bar X={1+2+2\over 3}$

The idea is to set these equal.
As I said yesterday, p is a number, NOT a random variable in the first part.

E(3)=3, same with p, E(p)=p.
YOU don't want E(p).

6. Originally Posted by mr fantastic
$f(p | data) \propto f(p) \cdot f(data | p)$ where $f(p)$ is the prior distribution of $p$, $f(p | data)$ is the posterior distribution and $f(dtat | p)$ is the likelihood function.

Therefore $f(p | data) \propto 1 \cdot p(1 - p)^2$.

Therefore $f(p | data) = k p(1 - p)^2$ where $k$ is a normalising constant whose value is easily found to be 12.

Therefore $f(p | data) = 12 p(1 - p)^2$.

Note that $E(p) = \frac{2}{5}$.
Thanks for your reply. But I don't understand how do you get the constant value 12. and how to get the E(P) = 2/5. since p is uniform distribution [0,1], the E(P) = a+b/2 ...?? is it?

Thanks.

7. Originally Posted by cm917
Thanks for your reply. But I don't understand how do you get the constant value 12. and how to get the E(P) = 2/5. since p is uniform distribution [0,1], the E(P) = a+b/2 ...?? is it?

Thanks.

The mean of a beta density is alpha over (alpha +beta).... 2/(2+3)

8. Originally Posted by cm917
Thanks for your reply. But I don't understand how do you get the constant value 12. and how to get the E(P) = 2/5. since p is uniform distribution [0,1], the E(P) = a+b/2 ...?? is it?

Thanks.
Since f(p | data) is a pdf, $\int_{0}^{1} f(p | data) \, dp = k \int_0^1 p(1 - p)^2 \, dp = 1$. Therefore ....

$E(p) = \int_0^1 p f(p | data) \, dp = ....$