# 17 Week Coin Flip Contest - Calculate Probability/Odds For Each Individual To Have The Winning Count Of "Heads"

I'm new to statistics, like WAY new. So green, in fact, I'm scarcely pushing (0,1,0) in the RGB color model.

I'm presently the recordkeeper for our office's 17-week "Coin flip pool". As of right now, 7 weeks have passed and we are in our 8th week, and, therefore, there are 9 weeks remaining. Each contestant has amassed a certain number of points gained by essentially flipping 3 coins a week and for each "head" result, they get 1 point - if they get 3 "heads" in a week, that's 3 points. Current accumulated scores across all 23 contestants ranges from 7 to 15, so each has their own weekly average of success.

One contestant recently asked what his odds of winning were. This obviously necessitates knowing his current score, his current performance, the current score of the other contestants, the average weekly performance of other contestants, and, possibly, the average potential score of 3-coin-flips-resulting-in-heads-a-week.

I've searched and searched and found only betting odds calculators and basic explanations of what the probability of the result of any single series might be, but I don't know enough about this subject nor what keywords to use to possibly narrow down my results to find the right answer.

I can provide a whole spreadsheet's worth of data (if I don't readily know how to share it within Stack Exchange).

As I know next to nothing about this subject, would someone kindly nudge me in the right direction? Especially if this ends up being far to complicated a topic for a Stack Exchange question.

Edit (20181027T08:45-05:00):

Additional clarification that might make this simpler (or not, statistics is not my forte after all): Knowing the absolute chance of winning at the end of Week 17 is not necessary, only a projection based on current performance (maybe that's the same thing?). Some sample data (actual data from my spreadsheet)

Person      Score   Performance Week 1  Week 2  Week 3  Week 4  Week 5  Week 6  Week 7  Week 8
Alpha       2       0.250       2       0       0       0       0       0       0       0
Bravo       10      1.250       2       0       0       2       1       3       2       0
Charlie     12      1.500       3       1       0       2       2       1       3       0
Delta       8       0.875       0       1       1       1       2       1       0       1
Echo        11      1.375       2       0       2       1       1       2       3       0
Foxtrot     13      1.625       1       2       2       2       2       1       3       0
Golf        9       1.125       2       1       1       1       1       1       2       0
Hotel       12      1.500       2       1       1       0       2       3       3       0
India       8       1.000       1       1       0       1       2       1       2       0
Juliett     9       1.125       2       1       1       0       1       2       2       0
Kilo        9       1.125       2       1       0       2       2       0       2       0
Lima        11      1.375       2       1       2       1       1       2       2       0
Mike        15      1.875       1       1       2       3       2       3       3       0
November    9       1.125       2       0       2       1       1       1       2       0
Oscar       12      1.500       1       2       0       2       2       2       3       0
Papa        10      1.250       1       2       1       1       0       2       3       0
Quebec      11      1.375       2       1       2       1       1       1       3       0
Romeo       7       0.875       1       1       1       0       1       1       2       0
Sierra      11      1.375       2       1       2       3       2       0       1       0
Tango       8       1.000       2       2       0       1       1       1       1       0
Uniform     8       1.000       1       1       0       2       0       0       3       1
Victor      11      1.375       2       2       1       1       1       2       1       1
Whiskey     10      1.250       2       0       3       1       1       2       1       0
X-ray       9       1.000       0       1       2       1       1       1       2       0



Performance": average heads (score / 8 at present)
Week #: total "heads" results that week

Edit (20181027T09:52-05:00):

For commentors (commentators?) asking why Week 8 has so few successes: Week 8 is "in progress" and ends Tuesday morning. One coin-flip is performed Thursday, Sunday, and Monday so probability will change as each day's flip occurs. American sports fanatics might start to see where this is headed.

Edit (20181027T14:37-05:00):

As Martijn Weterings and I have discussed in the talk section, this is indeed not exactly a coin-flipping contest. Under my prospective simplification is it the NFL Regular season: 17 games for which there are two outcomes (and their inverse): Team A wins or loses (for which Team B loses or wins). We are using a variant that adjusts the underdog team's score by a positive amount (a handicap, if you will). Based on last year's pool statistics with the inclusion of a handicap the odds of either team winning after score adjustment is 1:1 (50%, yes?) - more accurately 45.824% by averaging the averages on last season's sheet.

This is why I described this problem as a coin-flipping contest. While true betting odds compute all manner of variables, that work has been done for us and for simplification, just went with "the handicap makes it so each team has an equal shot at winning the game". This handicap variant helps immensely because a good majority of our players don't follow the sport at all and would get squarely defeated week after week by those that do. The handicap is an equalizer of sorts.

More accurately each contestant selects three "coins" from a pool of 16 and if any of those "coins" lands as "heads" they get a point - from 0 to 3 points per week. We are presently in Week 8 and as of this writing, only 2 coins have been flipped (the Thursday night game and the Saturday morning game). Which is why the probability can change with time as not all 16 results occur simultaneously. However, for the sake of simplicity (and again I know next to nothing about statistics to say "simplicity" repeatedly) probability of every participant will update as more of these contests are completed.

I apologize for not realizing the true reality was less simple than "contestant flips 3 coins" and more "there is a pool of coins from which each contestant 'bets' will be heads".

• 9 weeks mean 0-27 heads available for each contestant. For 2 contestants, I can generate 28 x 28 probabilities and get who will win. For 3 contestants, it seems still doable. But for 23 contestants, I know how to do it, but it seem too hard even we have high speed computer. Oct 27, 2018 at 1:02
• I was (very likely, wrongly) approaching it as: player's current points + (player's average points * weeks remaining) = estimated final score. Estimated final score "modified by" <some mumbo-jumbo> = "probability" that player will have 1 point more than the current leader, or if player is the leader, 1 point more than 2nd place. The method you outlined is certainly the right way to do it, but the variable space is REALLY large. Can a probability be estimated at the end of each week as with my attempt? Oct 27, 2018 at 1:28
• Are these really 'coin flips' ie. can we safely assume the probability of heads is always $0.5$ and no skill involved? If yes, this is a probability problem (where I think simplifications are available and you don't need to go through $28^{23}$ cases...) If no, this is also a statistics problem of how to model the skills (in which case more information might be needed about the nature of the competition) What's the difference between 'performance' and 'score'? Oct 27, 2018 at 9:57
• No, their true nature is not coin flips, but for the sake of simplicity and for the sake of this calculation I'm treating them as such. Absolute precision is not a necessity and high accuracy isn't necessarily a requirement either. A simple "you've got a good shot (75%)", "you've got a fair shot (50%)", or "you're the long shot (1%)" will suffice. Performance = average "heads" per week, score is total "heads" since the start of the contest. Oct 27, 2018 at 13:02
• But if we assume the shots are coin flips, "performance" matters only through past score. If we assume coin flips, "the average potential score of 3-coin-flips-resulting-in-heads-a-week" is by definition $1.5$. If answerers are supposed to assume coin flips, this should be explicitly mentioned in the question Oct 27, 2018 at 14:05

A relatively simple formula can be obtained, requiring only readily-computed sums and products. The computational effort is proportional to the number of players, times the number of distinct scores they exhibit so far, times the number of remaining rounds, times the number of flips per round.

Let's establish notation:

• Let $$x=(x_1, x_2, \ldots, x_{23})$$ be the current scores.

• Let $$n=17 - 7 = 10$$ be the number of rounds to go.

• Let the number of flips remaining during those rounds be $$m = 3*n = 30.$$

• Let the coin have probability $$p=1/2$$ of coming heads.

There are $$m+1$$ possible scores for player $$j$$ at the end, given by $$x_j+Z_j$$ where $$Z_j\in\{0,1,\ldots, m\}.$$ The chances for $$Z_j$$ follow a Binomial$$(m,p)$$ distribution.

Suppose player $$j$$ ends up with score $$x_j+z$$ with probability $$q$$ (which we can readily compute). In this case the chance this player wins outright is the chance that every other player's final score is less than $$x_j+z.$$ That, too, is readily computed from the Binomial distribution, because the scores of each player are independent, causing the individual chances to multiply.

To be clear,

• Let $$F$$ be the cumulative distribution function for the Binomial$$(m,p)$$ distribution.

• Let $$f$$ be the probability function, $$f(z) = \binom{m}{z}p^z (1-p)^{m-z}.$$

Thus, for each player $$j$$ and any possible number $$z,$$ $$\Pr(Z_j \le z) = F(z).$$ In particular note that $$\Pr(Z_j \lt z) = F(z-1).$$

Finally, let $$\mathcal{W}_j$$ be the event "Player $$j$$ wins outright" and $$\mathcal{T}_j$$ be the event "Player $$j$$ ties for the win." From the foregoing and the axioms of probability it is immediate that

$$\Pr(\mathcal{W}_j \mid Z_j=z) = \prod_{i\ne j} F(x_j - z - x_i - 1)$$

and

$$\Pr(\mathcal{T}_j \mid Z_j=z) = \prod_{i\ne j} F(x_j - z - x_i) - \Pr(\mathcal{W}_j \mid Z_j=z).$$

We obtain the chances of wins and ties by summing over all the possible outcomes $$Z_j,$$

$$\Pr(\mathcal{W}_j) = \sum_{z=0}^m f(z) \Pr(\mathcal{W}_j\mid Z_j=z)$$

(and likewise for the ties).

For the $$24$$ players listed in the question, this calculation produces the following chances of wins and ties (with the nine unique scores given at the top):

    2     7      8      9     10     11     12     13     15
Win 0 4e-04 0.0014 0.0041 0.0106 0.0248 0.0529 0.1038 0.3251
Tie 0 1e-03 0.0026 0.0064 0.0136 0.0259 0.0446 0.0692 0.1215 (Despite the presentation of results by distinct scores, do not forget that the answers depend on how many players currently have each score.)

One can also simulate the game to estimate the chances. This is perfectly straightforward; the details appear in the code at the end.

In a simulation of 10,000 independent continuations, the outcomes were these:

    2     7      8      9     10     11     12     13     15
Win 0 5e-04 0.0015 0.0041 0.0095 0.0261 0.0544 0.1018 0.3282
Tie 0 1e-03 0.0026 0.0063 0.0120 0.0250 0.0391 0.0660 0.1150


The agreement is good, suggesting the original calculations are correct.

It may be worth remarking that (a) the sum of winning chances cannot exceed $$1$$ and indeed will never equal $$1$$ whenever there is any chance of a tie; and (b) the sum of all winning chances plus tieing chances will never be less than $$1$$ and will always exceed $$1$$ whenever there is a chance of any three-way (or more-way) tie.

A better solution would be to weight ties inversely by how many people are in each tie, assuming if the game is tied at the end, winning will be equally distributed among all those tied with the best score. This solution can be obtained using the same techniques, but is combinatorially more involved (it requires applying an inclusion-exclusion approach).

Because such calculations likely need to be repeated after each round, here to help with that is the R code. It is not efficiently written, because it makes repeated calls to compute $$F$$ (with pbinom) and $$f$$ (with dbinom). These calls can all be made once and stored in arrays, thereby speeding up the calculation. This will not change the asymptotic behavior of the algorithm and would be useful only for large numbers of players or games with many coin flips to go.

#
# Inputs.
#
x <- c(2,10,12,8,11,13,9,12,8,9,9,11,15,9,12,10,11,7,11,8,8,11,10,9) # Current scores
n <- 17 - 7            # Number of rounds left
n.flip <- 3            # Flips per round
p <- 1/2               # Chance of success per flip
#
# Derived quantities.
#
n.players <- length(x)        # Number of players
m <- n.flip * n               # Number of flips to go
z <- 0:m                      # Possible outcomes for any player
prob <- dbinom(z, n.flips, p) # Their chances
#
# Compute individual chances of wins and ties.
#
scores <- sort(unique(x))
chances <- sapply(scores, function(score) {
j <- min(which(x == score))
y1 <- sapply(0:m, function(k) {
exp(sum(pbinom(x[j] + k - x[(1:n.players)[-j]], m, p, log.p=TRUE)))
})
y <- sapply(0:n.flips, function(k) {
exp(sum(pbinom(x[j] + k-1 - x[(1:n.players)[-j]], m, p, log.p=TRUE)))
})
c(Win=sum(prob * y), Tie=sum(prob * (y1-y)))
})
#
# Check with a simulation.  It will do a few thousand iterations per second.
#
set.seed(17)
sim <- replicate(1e4, {
Z <- rbinom(n.players, m, p) # The future results
final <- x + Z               # The final scores
scores <- table(final)       # The unique final scores
k <- length(scores)
if (scores[k]==1) {
Win <- final == max(final) # Tally who wins
Tie <- rep(0, n.players)
} else {
Tie <- final == max(final) # Tally who ties
Win <- rep(0, n.players)
}
rbind(Win, Tie)
})
sim <- apply(sim, 1:2, mean)   # Average over the iterations
#
# Display the results.
#
colnames(chances) <- paste(scores)
scores <- sort(unique(x))

sim <- sapply(scores, function(score) sim[, min(which(x==score))])
colnames(sim) <- paste(sort(unique(x)))

print(round(sim, 4))
print(round(chances, 4))

• Your computational algorithm at end seems too explicit to be pseudocode, but it is not one I recognize. I can interpret it's function fairly well (programmer by trade), but the origin of the function "dbinom" and "pbinom" elude me. Might I inquire what language this is? Oct 27, 2018 at 20:08
• Ahh, I see now. 'Tis R. I thought that was another statistical term. Thank you for laying that out. Oct 27, 2018 at 20:48
• Does the above change much if a Tie and a Win can technically be considered a win for the sake of the normal point-scoring contest? If one or more players tie for 1st place, they would then be sub-ranked (tiebroken) via other player statistics like quality of record (number of 3-, 2-, and 1-point weeks). Oct 28, 2018 at 1:25
• It doesn't change at all: because my definitions of "tie" and "win" are mutually exclusive, you can simply add the chances for each person. But note that the sum of these chances over all players exceeds 1.0: these are individual probabilities and not a probability distribution over the players.
– whuber
Oct 28, 2018 at 15:27
• Next, and possibly final point of clarification, with potential visceral reaction: Because I haven't yet built an actual computer application to drive these computations, where the above R code can be replicated - using this answer can the probability of a Win be computed within Microsoft Excel? Perhaps this is a new Stack Exchange question? Would it help/be appropriate to determine only any single individual's chance of beating the contest leader? Oct 29, 2018 at 16:47

### modelling

You can model this as a binomial regression model where the odds/probability are functions of the player and the time (you add the time since there seems to be a time effect).

There are several ways to do this. That is the tricky part and you could first investigate what model would be best. But say you use a logistic model. Then the linear part can be modeled as a polynomial function where you choose the order based on whichever has the highest penalized log likelihood (e.g. aic).

Also, for better predictions you need to treat the effects for the players as some random variable (you could use a mixed model). In this way you get a shrinkage effect (say, you incorporate regression to the mean) which will lead to better predictions.

### predicting

Given the model you can predict new values. This is a bit difficult since you modeled the function that defines a probability for a heads/tails, and not the heads/tails themselves. You could do, to obtain distributions of outcomes at week 17 for each participant:

• monte carlo simulations
• some computational solution of the integral (for every week you need to calculate all possible values for the probability, which is a continuous variable but you could discretize this, and for each of these probabilities you need to solve the probabilities for a particular outcome in number of heads)
• Possibly you may evaluate the functions analytically (I doubt it however, you will get some Poisson binomial distribution with annoyingly many terms and those terms themselves are also distributed according to the error of your model instead of constant )

Or you could find some approximation to the outcome.

Based on the distributions for each individual (and assuming the outcomes for the individuals are independent) you can compute the probability that an individual is gonna win by summing over all outcomes of an individual; summing the probability for that outcome multiplied by the probabilities that the others are not gonna have an equal or higher outcome.

• The final paragraph of this post sketches how to obtain an answer. It's unclear how relevant the other remarks are about models or regression, because this does not appear to be a statistical problem: it is purely a computational exercise in probability.
– whuber
Oct 27, 2018 at 16:48
• @whuber, the other remarks are relevant because underlying this is not the standard coin flipping with known and with constant probabilities. Or at least, it does not appear as such to me, overdispersion (and strong correlation between the score and the individual) and change in time indicate that the problem is not like a static fair coin flip (assumption "Let the coin have probability p=1/2 of coming heads)". The OP simplified the question and wishes an answer of the simplified problem, but if you ask further you get to the fact that it is actually a football pool and not coinflips. Oct 27, 2018 at 17:54
• Thank you. It is annoying that the nature of a question can change so fundamentally, especially after answers have been offered.
– whuber
Oct 27, 2018 at 18:06
• Technically the question did not change (and it is a bit ambiguous what a 'coin flip contest' means, it is not explicitly stated that the probabilities are 50%, I initially thought that this was literally a coin flipping contest where people try, with some technique, to flip heads) But it is a bit of an XYproblem, although the knowledge about the 32.5% probability of a win for the current leader (with 15 points) is very useful. I imagine that his probabilities are somewhat higher since he may also be 'better' and have a higher probability to "flip H", also the p will rise in time away from 0.5 Oct 27, 2018 at 18:28