Recently I was asked about this issue in an interview and I am curious about the result. We have a coin, fair or not, and we toss it 100 times. As a result, we get 20 Heads and 80 Tails.

A) What is the expected value of getting a H in the next toss?

I said the expected value should be 20%.

B) What is the confidence interval around that?

Here, I am not sure whether my answer is right. I said:

  • I take the significance level of 5%.
  • That's why I multiply 20% with 97.5% to find the lower and 20% with 102.5% to find the upper level of the confidence interval.

Any suggestions or any comments on the question?

  • 1
    $\begingroup$ 1) Why do you say that? (I think it’s a bad question or at least bad use terminology, though you probably got the answer right.) 2) How would your answer change if you had the same proportion of H and T in 10 tosses or 500 tosses? $\endgroup$
    – Dave
    Commented May 15, 2020 at 20:54
  • 1
    $\begingroup$ I’m still losing my mind over your interviewer calling it expected value. The coin has some expected value; we just don’t know it, and it isn’t different just because we got unlucky in our 100 tosses and observed an unlikely proportion of H and T. So the real right answer is “The expected value is whatever the unobservable p-parameter of this coin’s Bernoulli distribution is. Since we don’t know that value, we have to estimate it, and the typical estimate of a Bernoulli proportion, indeed, an unbiased and maximum likelihood estimator, is the sample proportion. In this case, that’s 20%.” $\endgroup$
    – Dave
    Commented May 15, 2020 at 20:58
  • 1
    $\begingroup$ One (Bayesian) estimate of the unknown proportion $p$ when $k$ successes have been observed on $n$ trials is $\hat{p} = \frac{k+1}{n+2}$ which seems in some ways a better estimate than $\frac kn$, especially around the edges ($k$ is nearly $0$ or nearly $n$). As a particular case, upon observing $2$ tosses resulting in $2$ Heads, it is a bit jarring to say that the estimated probability $p$ is $1$ rather than the Bayesian estimate $\frac 34$ which allows for some leeway, $\endgroup$ Commented May 15, 2020 at 21:25

1 Answer 1


A frequentist confidence interval. A commonly used frequentist 95% confidence interval for $P(\mathrm{Heads}) = p$ due to Agresti and Cooil is of the following form:

The point estimate is $\tilde p = (x+2)/(n+4) = (80+2)/(100+4) = 0.7885.$ Then, the CI is $\tilde p \pm 1.96{\sqrt{\tilde p(1-\tilde p)/(n+4)}}.$ which computes to $(0.71, 0.87).$

[Agresti's idea of artificially adding two Head and two Tails to the data has some theoretical basis, and has been shown to improve the actual coverage of confidence intervals, especially when the number of trials is below a few hundred.]

A Bayesian probability interval. If you take a Bayesian approach, beginning with a prior belief that you have no idea at all wither the coin is really fair, then you might use a prior distribution $p \sim \mathsf{Unif}(0,1) \equiv \mathsf{Beta}(1,1).$ [It is natural to use a beta distribution to model a probability because its support is $(0,1).]$ Then the binomial likelihood function corresponding to 80 heads in 100 would be proportional to $p^{80}(1-p)^{20}.$

Then the Bayesian posterior distribution would be proportional to $p^{81}(1-p)^{21},$ which is the kernel (density without norming constant) of $\mathsf{Beta}(80,20).$ The 95% Bayesian posterior probability interval for $p$ is then obtained by cutting probability 0.25 from each tail of the posterior distribution: from R statistical software, we get $(0.72, 0.87),$ which is numerically much the same as the frequentist CI above.

qbeta(c(.025,.975), 80, 20)
[1] 0.7166324 0.8720153

According to a Bayesian interpretation of this posterior interval, you might say you think the probability the next coin will come up Heads with probability between 72% and 87$.

However, still using a Bayesian approach, suppose you had an opportunity to examine the coin in advance. It looks like a genuine US quarter to you, with not signs of tampering. Then you go into the discussion with a prior coin that the coin is nearly biased. That prior opinion might correspond to the prior distribution $\mathsf{Beta}(10,10)$ with density function proportional of $p^{9}(1-p)^{9},$ and you're pretty sure it it will come up Heads between 29% and 71% of the time. [In effect, your preliminary examination of the coin is equivalent to about 20 tosses.]

qbeta(c(.025,.975), 10,10)
[1] 0.2886432 0.7113568

Then, multiplying the prior density by the binomial likelihood of the observed results, you would have the Bayesian posterior distribution $\mathsf{Beta}(10+80, 10+20),$ and your 95 % posterior probability interval would be $(.67, .82)$.

qbeta(c(.025,.975), 90, 30)
[1]  0.6691131 0.8229970

Note: A hard core probabalist, who thinks all coins are fair, all tosses are independent and doesn't put much faith in experimental data, might ascribe the 100 tosses to a run of unusual luck, and say the $101$st coin toss will be have a 50-50 chance of being Heads.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.