7
$\begingroup$

Suppose I have $n$ fair coins, and I mark one of them for identification. Next I flip the $n$ coins without looking. My friend, who is looking on, now informs me that there were at least $k$ heads flipped.

What is the probability that my marked coin was heads?

$\endgroup$
7
  • 2
    $\begingroup$ Is this a question from a course or textbook? If so, please add the [self-study] tag & read its wiki. $\endgroup$ Commented Nov 29, 2017 at 15:05
  • $\begingroup$ @ Stephan Kolassa, The problem is not from a course or textbook, at least not one I know. $\endgroup$
    – user120911
    Commented Nov 29, 2017 at 15:49
  • 1
    $\begingroup$ @Whuber, if I am informed that 10 of 10 were heads, then the probability that the marked coin is heads is 1. If I am informed there were no heads, the probability of the marked coin being heads is 0. So, yes, the observation matters. I am interested in the probability conditional on the observation. $\endgroup$
    – user120911
    Commented Nov 29, 2017 at 16:17
  • 1
    $\begingroup$ Sorry, I overlooked that additional information. In light of it, could your question perhaps be rephrased as "Ten identical (fair) coins have been flipped of which $k$ show heads. My coin could be any one of these ten coins, with equal probability. What is the chance it shows heads?" $\endgroup$
    – whuber
    Commented Nov 29, 2017 at 16:21
  • 1
    $\begingroup$ its k/n if it is exactly k and not "at least k". If it is "at least k" then it can be (k + 0.5(n-k))/n , but I am not sure $\endgroup$ Commented Nov 29, 2017 at 16:32

1 Answer 1

6
$\begingroup$

Let your coin be $X_1$ and denote sum of heads as $S$.

As I have written in the comment the answers seems to be

$$P(X_1 = 1| S \ge k) = \frac{\sum_{i = k}^{n} \binom{n-1}{i-1}}{\sum_{i=k}^{n}\binom{n}{i}}$$

Here is a plot of theoretical vs sample probabilities with $n = 20$ and 1e^7 trials

enter image description here

We can see that with low values of $k$ we get almost no additional information, thus the probability is close to unconditional $0.5$

Partially recreated code as requested by @Maximilian

library(tidyverse)

coin_flips <- function(n, k) {
    # Create n x k matrix of binary outcomes
    flips <- matrix(as.numeric(rbinom(n * k, 1, 0.5)), ncol = k)
    firsts <- flips[, 1]
    flips <- t(apply(flips, 1, sort, decreasing = T)) # i-th column is an indicator value [S >= i]
                                                      # where S is the sum of heads
    flips <- as.tibble(flips)
    f <- function(x) {
        if (sum(x) > 0) {
            return(sum(x * firsts) / sum(x))
        }
        return(1)
    }
    summary <- flips %>%
        summarise_all(.funs = f)
    colnames(summary) <- 1:k
    return(summary)
}
# Example usage
cf <- coin_flips(1000000, 20)
cf %>% gather %>% ggplot(aes(as.numeric(key), value)) + geom_point() + ylim(c(0.48, 1))
$\endgroup$
14
  • $\begingroup$ The left asymptote at $0.5$ looks so unreasonable that you should consider elaborating on the assumptions you have made to derive this formula. In effect, it looks like you are allowing an arbitrary (and unnecessary) prior to dominate the solution when $k$ is small. $\endgroup$
    – whuber
    Commented Nov 29, 2017 at 18:27
  • $\begingroup$ @whuber Hmm, I thought the result is reasonable since for small k the probability of a condition $P(S \ge k)$ is close to 1, thus it brings no new information $\endgroup$ Commented Nov 29, 2017 at 18:31
  • $\begingroup$ There are at least two ways to interpret the question, "probability my marked coin was heads." After a conversation with the OP in comments to the question, I understand it to ask for the probability conditional on observing $k$ heads out of $n$ coins. The exchangeability of the distribution implies the answer is simply $k/n$. Because you are getting values that depart hugely from that number (and it seems they would still be close to $1/2$ even if $n$ were enormous), you must be adopting a very strong prior indeed. $\endgroup$
    – whuber
    Commented Nov 29, 2017 at 18:52
  • 2
    $\begingroup$ This is the answer to the posed question regardless of comments to the contrary. $\endgroup$ Commented Nov 29, 2017 at 20:09
  • 2
    $\begingroup$ @Maximilian Ok I recreated the sample part $\endgroup$ Commented Jan 14, 2018 at 12:11

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.