# Distribution of partially observable binominal parameter

I suspect this is a textbook question but I don't seem to have the right textbook.

Anyway I am trying to estimate probability of coin landing on heads, p, by repeatedly flipping it N times, i.e., repeated Bernoulli experiments. In this case when I can directly observe the outcome of the flip I believe p is Beta distributed with parameters a-1 = # heads and b-1 = # tails. Also, since the number of heads is binomial distributed I believe that the expected number of heads is equal to Np.

However, I am trying to understand the scenario when I can't directly observe the outcome of the coin flip. Instead, my friend reports the result to me and he is not always honest. If my friend lies with known probabilities (say he reports heads honestly with probability ph and tails honestly with probability pt) can I estimate a distribution of p (the probability of landing heads)?

There are a couple questions in your question, I am going to separate them out and answer one of them. If you want me to answer others let me know and I'll give it a try. First let's forget about the lying. Model a coin as a Bernoulli distribution with $p =$ probability of heads.

1) If you flip the coin $N$ times and get $h$ heads, $h/N$ is the maximum likelihood estimate (MLE) for the parameter $p$.

2) In a Bayesian setting, a Beta distribution is typically used as a prior for $p$ because Beta is the conjugate prior to Bernoulli. If you use and uninformative prior $B(\alpha=1, \beta=1)$, the posterior distribution after $h$ heads and $t$ tails is $B(\alpha=1+h, \beta=1+t)$.

• Then if we do MAP estimation we predict the mode of the posterior $p=h/(h+t)$. If you begin with a uniform prior the map estimate is always the same as the MLE.

• Or we can do the more robust Bayesian inference and take the expected value of the posterior which is $p = (h+1)/(h+t+2)$

Now let's get back to your lying friend, and at least apply MLE. I will use slightly different notation than you because I think all the $p$'s will get confusing.

• $p$ = Probability the coin lands on heads.

• $q$ = Probability your friend tells the truth when it lands on heads.

• $r$ = Probability your friend tells the truth when it lands on tails.

Then we can compute the probability that we the observer sees heads:

• Probability we see heads $=pq + (1-p)(1-r) = 1 - r + (r+q-1)p.$
• Probability we see tails $=p(1-q) + (1-p)r = r - (r+q-1)p.$

So the log-likelihood of $p$, the log of the probability of seeing the data we saw in that exact order is:

$$f(p) = h\cdot log(1 - r + (r+q-1)p) + t\cdot log(r - (r+q-1)p)$$

We want to maximize $f(p)$, so let's take the derivative with respect to $p$ and set it to zero.

$$f'(p) = \frac{h(r+q-1)}{(1 - r + (r+q-1)p} - \frac{t(r+q-1)}{r - (r+q-1)p} = 0.$$

Solving for $p$ we get:

$$p = \frac{t - tr - hr}{(h+t)(1-r-q)}.$$

Reality check. Note when $r=q=1$ (never lies) this simplifies to $h/(h+t)$. When $r=q=0$ this simplifies to $t/(h+t)$, makes sense. Let me know if you want me t go further than MLE.

• I think this is fantastic and thank you for slowing me down. My original intent was to understand if there is a conjugate prior in the liar scenario (as well as how to construct the inexact-order likelihood). I am still curious about that but the MLE you derived is just as helpful. Thanks again! Commented Aug 31, 2015 at 2:25