Question: Given a Simple Random Sample $X_1=x_1,X_2=x_2,...X_n=x_n $ taken with replacement, find the maximum likelihood estimator for each of the parameters of the distributions below.
- The parameter $p$ of $X\sim Binomial(5,p)$
- The parameter $\sigma$ of $X\sim Normal(0,\sigma)$
Answer $$\boxed{\Large\widehat p = \frac{\sum_{i=1}^nx_i}{5n}}$$
My Try
I tried doing the problem:
$$L(X_1, X_2, ..., X_n) = \prod_{i=1}^n p^{x_i}(1-p)^{1-x_i}$$
$$\frac {dL}{dp} = \frac {d}{dp}\bigg[\prod_{i=1}^n p^{x_i}(1-p)^{1-x_i}\bigg] = \frac {d}{dp}p^{(\sum_{i=1}^n x_i)}(1-p)^{(\sum_{i=1}^n (1-x_i))}$$
$$\frac {d}{dp}p^{(\sum_{i=1}^n x_i)}(1-p)^{n- (\sum_{i=1}^n x_i)} = \frac {d}{dp}p^{(k)}(1-p)^{n- (k)} $$
After deriving, let $k=\sum_{i=1}^n x_i$ and the derivative equal to $0$
$$0 = kp^{k-1}(1-p)^{k} + (1-k)(1-p)^{-k} $$ Then solving for $p$, $$ \widehat p = \frac{k}{2k-1}$$ $$ \widehat p = \frac{\sum_{i=1}^n x_i}{2(\sum_{i=1}^n x_i)-1}$$
What went wrong?
The MLE is given by $$\sf{L:=\prod_{i=1}^np^{x_i}(1-p)^{5-x_i}=p^{\sum\limits_{i=1}^n x_i}(1-p)^{\sum\limits_{i=1}^n(5-x_i)}=p^{n\bar x}(1-p)^{5n-n\bar x}},$$ since $\sf{\bar x=\frac1n\sum\limits_{i=1}^n x_i}$, whereas you have written $\sf{(1-p)^{1-x_i}}$ instead - this is not correct as $\sf{X_i\sim Bin(5,p)}$. Note that due to the power products, it is much easier to maximise $$\sf{\log L=n\bar x\log p+(5n-n\bar x)\log(1-p)}$$ and thus we require $$\sf{\frac{\partial\log L}{\partial\hat p}=\frac{n\bar x}{\hat p}-\frac{n-n\bar x}{1-\hat p}=0\implies n\bar x(1-\hat p)=n\hat p(5-\bar x)}$$ which yields $$\sf{n\bar x-n\hat p\bar x=5n\hat p-n\hat p\bar x\implies\boxed{\sf{\hat p=\frac{\bar x}5=\frac{\sum\limits_{i=1}^n x_i}{5n}}}}.$$