I have a problem with a coin toss. The exercise is following:

You toss a coin 10 times and it gives 4 heads. What fee would you pay to play a game where you win 1$ if you flip at least 450 heads out of 1000 coin tosses?

My approach: Update an informative prior with the data. Then calculate P(450H). P(450H) = Fee.

x := obtaining a head

  • Prior: assume the belief that pdf(x) follows Beta(20, 20)

Prior probability density function of x=head

Why Beta(20,20)? I want to build a prior with the belief that a head should very probably come with a probability of 0.5... Hence a = b. However, I want the prior to be weak enough to fit the data. Hence relatively low values for a and b.

  • Posterior: updating pdf(x) as Beta(20+4, 20+6)

Posterior pdf(x) as Beta(24,26)

Why Beta(24,26)? We can easily update the prior to obtain the posterior adding the number of heads and tails to a and b. Posterior ∝ Likelihood x Prior

  • Getting the probability P(450 heads)

Now that I have the pdf(x), I am looking for the probability of obtaining at least 450 heads from 1000 tosses. I am not sure how to proceed from here...

If the coin was fair (P[x] = 0.5), we could answer the question easily by calculating the integral from 450 to 1000 of the binomial distribution. However, as I have a posterior pdf of P(X) and not a number, I am not sure what how to proceed...

  1. Could you please give me a hint what to do with the posterior to answer the question?
  2. Also, what would be the correct notation of the sought probability? P(450H | 4heads from 10 tosses)? Not sure how I write down that I used an informative prior...
  3. I suspect that P(450H) will highly depend on the parameters of my prior... Is there a more scientific way to justify the choice of my parameters?

Any help or guidance will be highly appreciated!

  • 1
    $\begingroup$ Welcome to this community, Nicola. The problem is abstract, and therefore leaves many details, which would be very important if the problem was real, to your imagination. For example the pre-data knowledge you might have about the coin and even more about who/what's tossing the coin. $\endgroup$ – pglpm Aug 25 '19 at 23:15
  • $\begingroup$ "1 Could you please give me a hint what to do with the posterior to answer the question?" Knowing that the parameter $p$ follows a beta distribution, you can model the number of heads as a beta-binomial distribution. The distribution of this can be solved computationally (e.g. the package rmutil in R), but you may also note that the number of tosses is so much that you can just as well compute the probability that the parameter is $p$>0.45 rather than probability that the number of heads is $h>450$. $\endgroup$ – Sextus Empiricus Sep 2 '19 at 15:14
  • $\begingroup$ For example computing $\mathbb{P}(h>450)$ by using 1 - pbetabinom(449,1000,24/50,50 gives 0.661 and computing $\mathbb{P}(p>0.45)$ by using 1 - pbeta(0.45,24,26) gives a very close value of 0.663 $\endgroup$ – Sextus Empiricus Sep 2 '19 at 15:21

1&2) You are working on a prediction problem. You need to solve $$\pi(k\ge450|4\text{ success of 10 tries})=1516927277253024\sum_{k=450}^{1000}\int_0^1\binom{1000}{k}p^k(1-p)^{1000-k}(1-p)^{25}p^{23}\mathrm{d}p$$

That is your posterior probability that the next 1000 tosses will result in 450 or more successes. You should gamble no more than the prize times the probability.

3) No, choosing the prior that you believe to be closest to the truth is the most scientific solution. You should use any real information that you have. You can test the sensitivity of your result to your prior, but since you are gambling what you need to do is work out the knowledge that you really have.

If you believe it is a nearly fair coin then $B(20,20)$ as a prior is quite reasonable, though $B(2,2)$ is as well.

EDIT You are solving $$\pi'(k=K|X)=\int_0^1f(k=K|p)\pi(p|X)\mathrm{d}p$$ for each value of $k\ge{450}$, where $f$ is the likelihood function, $\pi$ is the posterior and $\pi'$ is the prediction. You are removing the uncertainty regarding $p$ by marginalizing it out. You have to sum all the cases in your hypotheses space which is $k\ge{450}$.

You are looking at the likelihood of every outcome weighted by the posterior probability over the entire set of all possible parameter values.

| cite | improve this answer | |
  • $\begingroup$ Thanks a lot Dave. What you write here I assume, is the binomial distribution with, say r=0.5 for an unbiased coin, substituting r with the integral of the posterior. How would one explain this formula to a layman? I find it difficult to picture it... $\endgroup$ – Nicola Aug 25 '19 at 23:00
  • $\begingroup$ @Nicola The $p$ in the formula can be interpreted as the long-run relative frequency of successes (that is, if you could peek into the future and see the outcomes of, say, the next $10^12$ tosses or more). Your belief distribution about this frequency is expressed by your updated beta, which is the part proportional to $(1-p)^25\;p^23$ within the integral. $\endgroup$ – pglpm Aug 25 '19 at 23:25
  • $\begingroup$ Now if you knew the long-run frequency $p$ exactly, your belief that the next 1000 tosses have a specific sequence of 450 successes (and 750 failures) would be $p^{450}\;(1-p)^{750}$, and then the belief for any sequence with 450 successes has a binomial factor $\binom{1000}{450}$ to count how many such sequences there are. These are the remaining terms within the integral. Next, you consider the fact that you actually don't know the long-run frequency $p$, so your belief in the 450 heads is the integral $P(450H | p)\times P(p)$ over all possible values of $p$. $\endgroup$ – pglpm Aug 25 '19 at 23:29
  • $\begingroup$ Finally, you must consider not only the case with 450 heads, but also 451, 452, and so on up to 1000 (since the problem says "at least"). This is done by redoing the integral for all these values and summing up the result. This is what the sum in $k$ from 450 to 1000 does. Hope this clarifies the formula a little. $\endgroup$ – pglpm Aug 25 '19 at 23:33
  • $\begingroup$ Ah I see that Dave explained the formula while I was writing this :) $\endgroup$ – pglpm Aug 25 '19 at 23:35
  1. A pdf is a pdf. Just as you could integrate the binomial pdf from 450 to 1000 based on 1000 coin flips, you can integrate the Beta(24,26) from p = 0.45 to p = 1, based on your posterior, to get the probability of 450 or more out of 1000.

  2. I don't know that there is any single "correct notation" for the probability that you seek. You specified quite nicely in your question what you did: specified an intelligently thought-out prior, updated based on the limited data available, and are estimating the probability of 450 or more heads out of 1000 based on that posterior. If that is clear to the reader I wouldn't worry too much about the notation.

  3. You have identified a major issue in Bayesian approaches: posterior distributions can depend heavily on prior distributions, particularly when data are limited. It would be a useful exercise to try several priors (e.g., uniform over [0,1], different Beta priors than what you used) and see how much the posteriors (and your associated willingness to bet) might change.

| cite | improve this answer | |
  • $\begingroup$ I don't see why point 3. is an issue, and why it should only be an issue of Bayesian approaches. It's obvious that if we don't have any data at all, our "posterior" guess is simply our initial guess – we don't have data. And this changes gradually the more data we have. The Bayesian approach brings this common-sense fact to the open and tries to quantify it. Other approaches can't avoid this, even if they may try to conceal it. $\endgroup$ – pglpm Aug 25 '19 at 23:09
  • $\begingroup$ @pglpm , when you don't start with the true probability (or something reasonably close) of the joint distribution of parameters and data then the computed distribution of parameters conditional on data (the posterior) will be a bad expression of the true probability because it's expression of probabilities is overshadowed by the uncertainty in the method itself. In the case of the coin experiment here (just 10 tosses) the updating has little effect on P(H>=450), as it changes from 73% to (only) 66%. The approach may quantify it indeed, but that isn't always acknowledged (such as in this case). $\endgroup$ – Sextus Empiricus Sep 2 '19 at 14:50
  • $\begingroup$ So the common sense fact would be to say that the initial coin toss of 4 heads out of 10 should have no influence at all on the posterior and the strategy to follow (unless one expects some decent amount of false coins, but I would say that a Beta[20,20] is not realistic). If the prior beta has smaller overdispersion then one should expect much more fair coins and more often a result above 450. $\endgroup$ – Sextus Empiricus Sep 2 '19 at 15:02
  • $\begingroup$ @MartijnWeterings Sorry but I don't understand what you mean with "the true probability of the joint distribution of parameters and data". What do you mean by "probability" here? and what do the parameters physically represent? $\endgroup$ – pglpm Sep 2 '19 at 20:33
  • $\begingroup$ The crux of the matter is that we don't know the future frequencies of heads/tails of the coin. If we knew them, we wouldn't be here guessing. Our goal is to guess them. The Bayesian calculus takes our initial guess about the future frequencies, based on whatever information we may have, and improves it by considering the tosses we then observe. If we observe few tosses, the improvement is meagre. If we observe many tosses, the improvement is greater, to the point of making our initial guess irrelevant. This is not a problem of the Bayesian calculus: any method would have this problem. $\endgroup$ – pglpm Sep 2 '19 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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