# Proof verification for calculation of MLE

An intimate question is asked to $n$ persons, $\vartheta \in [0,1]$ is the probability that this question is answered truthfully. Before the question is asked, each person has to roll a dice twice, if the sum is $5$ or $6$ this person answers with 'yes', if the sum is $8$ or $9$ the person will answer with 'no', otherwise he will answer truthfully. I want to find the MLE for $\vartheta$.

My attempt:

$\mathbf P(yes)=0.25+0.5\vartheta$, $\mathbf P(no)=0.25+(1-\vartheta)$.

The statistic model is given by $(\{1,\dots,n\}, P(\{1,\dots,n\}), Bernoulli)$.

Therfore the likelihood function is given by $L_\vartheta(x)=(0.25+0.5\vartheta)^{\sum X_i}(0.25+0.5(1-\vartheta)^{n-\sum X_i}),$ then $$\frac{\partial L}{\partial \vartheta} (x)=(0.5\sum X_i)(0.25+0.5\vartheta)^{\sum X_i -1}(0.75-0.5\vartheta)^{n-\sum X_i}+(0.25+0.5\vartheta)^{\sum X_i}(-0.5)(0.75-0.5\vartheta)^{n- \sum X_i -1}(n-\sum X_i),$$ setting this equal to zero, then dividing by $(0.75-0.5\vartheta)^{n- \sum X_i -1}$ and $(0.25+0.5\vartheta)^{\sum X_i -1}$ leads to $\sum X_i=n(0.5\vartheta +0.25)$, i.e. the MLE is given by $\vartheta=\frac{2\sum X_i}{n}- 0.5$

Is my setting okay and how can I interpret this result now?

• At least the estimate becomes incorrect when $\sum^n_{k=1}X_k=0$ (estimate becomes negative). To edit this recall that you maximize likelihood over $\theta\in [0,1]$ – Georgii Riabov May 4 '18 at 19:29

TL;DR : see the highlighted ending paragraph of the post.

First of all, there are a couple of typos (that don't affect the result). In the first line of your attempt $\mathbf P(no)=0.25 + \color{magenta}{0.5}(1-\vartheta)$, and then for the likelihood $\displaystyle L_\vartheta(x)=\left( 0.25+0.5\vartheta \right)^{\sum X_i}\,\color{magenta}{\big(}0.25 +0.5(1-\vartheta) \color{magenta}{\big)}^{n-\sum X_i}$, the ending exponent should be outside.

At the same time, in the calculation the log-likelihood is correct and the derivative is correct.

In fact, your resut $\hat{\vartheta}=\frac{2\sum X_i}{n}- 0.5$ is correct, and in general for $$\mathbf P(yes)= a + (1-a-b)\vartheta~, \qquad\mathbf P(no) = b + (1-a-b)(1-\vartheta)$$ the MLE as calculated via the same procedure is, denoting $Y \equiv \sum X_i$,$$\hat{\vartheta}=\dfrac{\frac1n Y - a}{1 - a - b}$$ which reduces to your case at $a=b=1/4$.

It is also true that the log-likelihood is always concave at such $\hat{\vartheta}$, that the second derivative is negative for all $0<a<1$, $0<b<1$, and $0<a+b<1$:$$\frac{\partial^2 L}{\partial \vartheta^2}\Bigg|_{\vartheta=\hat{\vartheta}} = -(1-a-b)^2\frac{nY}{ n - Y} \left( \frac{Y}n\right)^{Y-2}\left( 1 - \frac{Y}n\right)^{n-Y}$$

The only amendment you need is to recall that WHEN such zero-derivative $\hat{\vartheta}$ is outside of the domain $\vartheta \in [0,1]$, then the "maximizer" is on the boundary, as close to that $\hat{\vartheta}$ as possible.

In your case, the MLE is $\hat{\vartheta} \equiv 0$ for an observation of $Y = \sum X_i < a\cdot n = 0.25 n$. This situation is indeed possible, and that indicates your sample is not very representative of the population. It happens relatively often when the sample is not "large enough", but the likelihood (both in the technical sense and in daily language) becomes vanishingly small as $n$ increases.

Similarly, $\sum X_i > (1-b)\cdot n = 0.75n~$ is also possible (via "bad luck"), and the corresponding MLE is $\hat{\vartheta} \equiv 1$.

In conclusion, your calculation is correct, and your MLE is $$\hat{\vartheta} \equiv \left\{ \begin{array}{cl} 0 &, & 0 \leq \sum X_i \leq \frac{n}4 \\ \frac{ 2 \sum X_i}n -\frac12 &, & \frac{n}4 < \sum X_i < \frac{3n}4 \\ 1 &, & \frac{3n}4 \leq \sum X_i \leq n \end{array}\right.$$

Note that $\hat{\vartheta}$ is continuous (in $\sum X_i$) at the critical points $n/4$ and $3n/4$.