I am Matthew and I have to solve an exercise for my Econometrics2 course.
I am having a hard time finding the likelihood function and then deriving the maximum likelihood estimator of a sample. The information given in the question is somewhat confusing to me, hence I am not sure if my approach is correct.
The question is the following:
*Let Yi , i = 1, ..., n denote an i.i.d. sample and suppose that Yi = 1 with probability p and Yi = 2 with probability 1 − p. You want to estimate p.
- Construct the likelihood function for p.
- Derive the maximum likelihood estimator of p.*
Thanks for your suggestions in advance!
First Method
Your density is the following
$$\mathbb{P}[Y=y]=p^{2-y}(1-p)^{y-1}$$
$y=\{1;2\}$
Your likelihood is
$$L(p)=p^{2n-\Sigma_i Y_i}(1-p)^{\Sigma_i Y_i-n}$$
take its log, derivate w.r.t. $p$, set =0 and solve in $p$ obtaining
$$\hat{p}_{ML}=2-\overline{Y}_n$$
Second Method
You can transform you rv in the following
$$Y-1 =Z= \begin{cases} p, & \text{if $z=0$ } \\ 1-p, & \text{if $z=1$ } \end{cases}$$
Now your Z is a bernulli with parameter $\pi=(1-p)$
It is well known that
$$\hat{\pi}_{ML}=\frac{\Sigma_i Z_i}{n}=\overline{Y}_n-1$$
Now using invariance property you get immediately
$$\hat{p}_{ML}=1-\hat{\pi}_{ML}=1-\overline{Y}_n+1=2-\overline{Y}_n$$
As you can see, the two results are the same.