Say I have a poll of 100 people for an upcoming election, which is fairly representative of the population. 45 say they will vote for candidate A, 30 for candidate B, and 25 for candidate C. What is the probability for each of the candidates winning (to win a candidate must have more votes than the other candidates), using just this information?


2 Answers 2


Assumptions and Notation

Let us suppose that the true proportions for the candidates among the actual voters are $p=(p_A,p_B,p_C)$ and that the poll can be viewed as a random sample (without replacement) from all voters. If the poll is a sizable proportion of all voters (more than $10\%$ or so) then we'll need to know the number of voters. Since we don't, let's assume that number is so large that the poll can be analyzed as if it were a random sample with replacement.


Under these assumptions the likelihood of observing $a$ votes for $A$, $b$ votes for $B$, and $C$ votes for $c$ is given by the trinomial probability

$$L(p;a,b,c) = \binom{n}{a\,b\,c} p_A^a p_B^b p_C^c$$

where $n=a+b+c$ is the size of the poll and $\binom{n}{a\,b\,c}=n!/(a!b!c!)$ is the multinomial coefficient that counts all the combinations of $a$ votes for $A$, $b$ votes for $B$, and $c$ votes for $C$. (Because $a$, $b$, and $c$ are constants--the data don't change--it will play no role in the following analysis.)

We may use the theory of Maximum Likelihood to evaluate the possibilities. To this end, as is usual, begin by finding $\hat p$ to maximize $\log L$. Since this function is differentiable, we introduce a Lagrange multiplier $\lambda$ to handle the constraint $g(p)=p_A+p_B+p_C=1$ look for its maximum among its critical points where

$$(0,0,0) = D_p\log (L(p;a,b,c)-\lambda g(p)) =\left(\frac{a}{p_A}-\lambda, \frac{b}{p_B}-\lambda, \frac{c}{p_C}-\lambda\right).$$

The unique solution, which is easily seen to be a local maximum (and therefore the global maximum, since obviously $L$ is not maximal anywhere along the boundary where one or more of the components of $p$ are zero), is

$$\hat p = \left(\frac{a}{n}, \frac{b}{n}, \frac{c}{n}\right).$$

To evaluate the plausibility of any possible value of $p$, compare $\log L(\hat p; a,b,c)$ to $\log L(p;a,b,c)$. When twice the difference exceeds the upper $1-\alpha$ percentile of the $\chi^2(1)$ distribution, we have less than $100\alpha\%$ confidence in such a value of $p$. This is an approximate calculation, but it should give good guidance for a poll this size with such a balanced response.


Ordinarily such a result is complicated to interpret, but this situation with just three candidates admits useful visualizations. We may position $p$ on a ternary diagram (which is an orthogonal projection of the simplex $p_A+p_B+p_C=1$ with all $p_i$ nonnegative) and draw the contours of $\log L(\hat p; a,b,c)- \log L(p;a,b,c)$, distinguishing the three regions where $A$, $B$, or $C$ has a majority (that is, where $p_A$ is largest, $p_B$ is largest, and $p_C$ is largest.)

Figure 1: ternary diagram of log L with four shaded contours

In this ternary diagram, values of $p_A$ plot along the horizontal axis, $p_B$ plots to the up and right, and $p_C$ plots to the left. The value of $\hat p = (45, 30, 25)/100$ is shown as a red dot. The regions corresponding to each of the winners are delineated with the black line segments and labeled accordingly. The red dot, which is safely within $A$'s region, shows $A$ is estimated to be the winner (which is intuitively obvious: $A$ won in this poll).

The contours correspond to confidence levels of $0.92, 0.984, 0.999,$ and $0.9999$, radiating outward from the estimate. The region where $B$ wins is first encountered at the confidence contour of $0.9178$, where $p=(3/8,3/8,1/4)$. This confidence--about $92\%$--is sufficiently far from $100\%$ to suggest $B$ could be the winner, but the corresponding value $\alpha=100-92=8\%$ is small enough to indicate that's a little unlikely. Specifically: if the true proportions were $(3/8,3/8,1/4)$ (or very slightly more for $B$) then $B$ would barely win, but there is some chance--about $100-92 = 8\%$--that this particular poll could have favored $A$ as much as it did, thereby deceiving us.


Figure 2: Three simulations superimposed on the ternary diagram

To illustrate this interpretation, I have created three simulations of $1000$ such polls each.

In the first simulation (at the left), the simulation was from a voting population with $p=\hat p = (0.45, 0.30, 0.25)$. Like the poll itself, it obtained $100$ opinions and plotted their proportions here as individual dots. (The dots are partially transparent so that they grow darker where they overlap.) Those $1000$ proportions are scattered around $\hat p$ and lie within the smaller confidence contours, as expected.

For the second simulation the voting population had parameters $p=(3/8,3/8,1/4)$. This on the border between where $A$ and $B$ win, where the $92\%$ contour contacts it. The simulated poll values are of course scattered randomly around it. You can see that several tens, perhaps 50 or more, of the dots favor $A$ even more than the actual poll. This shows why we cannot have high confidence that $B$ will not win.

For the third simulation (at the right) the voting population had parameters $p=(0.35, 0.3, 0.35)$. This is a situation where $C$ can (just barely) win. It's at the $0.984$ contour. This time there are few points that favor $A$ or $B$ as much as the real poll did. This shows why we have little confidence that $C$ will be the winner: there simply are no possible values of $p$ for which a random sample would, by chance, favor $A$ and $B$ over $C$ as much as the actual poll did.


This is a classical interpretation of the maximum likelihood results. It invites you to contemplate possible voting populations, covering the entire ternary diagram, and consider how likely such populations might be to produce poll results like the observed ones. It makes no assumptions about the probabilities of any of these voting populations.

We could proceed further to use this likelihood information to update a prior distribution for the likelihood of winning. This would be an approach akin to those taken by poll aggregators. Unless the prior clearly favors one of the candidates, though, the posterior results should not look much different than shown in the left hand simulation. In simulations using $10^5$ polls with $\hat p$ as the parameter, four percent of the results fall $B$'s winning region and only $0.7$ percent into $C$'s winning region. These numbers could, in a Bayesian interpretation (with a "noninformative prior"), be thought of as the chances that each candidate will win, given the information in the poll and the assumptions that it accurately reflects the voting.

  • $\begingroup$ Is $n \choose abc$ a binomial coefficient? Since $n = a + b + c$, it seems that in general $abc$ will be greater than $n$ and hence ${n \choose abc} = 0$. $\endgroup$ Sep 6, 2017 at 23:02
  • 2
    $\begingroup$ @Kodiologist It's a multinomial coefficient, equal to $n!/(a!b!c!)$. Usually I explain that in a post but I forgot--I'll add it in. $\endgroup$
    – whuber
    Sep 7, 2017 at 13:51
  • $\begingroup$ Thanks. I understand your answer now, but it does seem far more complex than necessary. As soon as you have the MLE, you can conduct the simulation in the final paragraph to compute a posterior probability that each candidate will win. $\endgroup$ Sep 7, 2017 at 14:33
  • $\begingroup$ @Kodiologist If you want the Bayes solution, yes you could move directly to the simulation. (Actually you don't need the simulation because you can compute the posterior directly). But the point of this answer is to show how to obtain the classical solution, which is not easy: how exactly does one develop and interpret a confidence interval (or test a hypothesis) for the events "$A$ wins," "$B$ wins," and "$C$ wins?" I believe there is no post on this site that addresses such a question. I'm pretty sure the use of ternary diagrams is new to this site, too. $\endgroup$
    – whuber
    Sep 7, 2017 at 15:08
  • $\begingroup$ it would certainly be interesting if the other approaches were discussed, as well as having the code used for simulations provided. $\endgroup$
    – baxx
    Feb 2, 2020 at 17:19

I ran an excel simulation with 10K rows assuming a margin of error of 9.3%. The simulation used norminv with the probability parameter randomized. The simulation indicated approx 83.5% for the 45%, 11.5% for the 30% and 4.5% for the 25% candidate. While straight math gives a single number, as noted in the "Flaw of averages" the average result is overly narrow.

  • 1
    $\begingroup$ This answer cannot possibly be correct for the simple reason that the question itself has no definite answer unless you add more information to it, such as your (Bayes) prior distribution for the voting. Moreover, we have no way of knowing what implicit assumptions you have made in order to arrive at this answer because you haven't provided the details of the simulation. $\endgroup$
    – whuber
    Sep 6, 2017 at 14:24
  • $\begingroup$ Of course it can be correct, you just need to plug-in the assumptions, which can be implied from the result. Since it is a simulation there is no claim that the answer is exact, just that it is likely close to the "true" result. The questioner seemed to want a reasonable answer (hence the qualifier "approx"), not the specifics of the math that produced the answer. The simulation provided that. The questioner is free to assess the validity of the answer. $\endgroup$
    – Tom
    Sep 6, 2017 at 20:17
  • $\begingroup$ This is not a concern about approximation: it's a matter of revealing what additional facts you might have assumed in order to do a simulation in the first place and of demonstrating that the results can reasonably be expected to tell us anything useful about reality. If you require the reader to guess what those facts might be, then your answer can scarcely be viewed as objective or even correct. $\endgroup$
    – whuber
    Sep 6, 2017 at 20:25
  • 1
    $\begingroup$ (-1) I have to agree that an answer isn't complete without some sort of argument why it's true, when that isn't obvious. $\endgroup$ Sep 6, 2017 at 22:58
  • 1
    $\begingroup$ After reading the last answer, which is certainly impressive, I have to say I never saw an answer! The response is so statistically sophisticated that to comprehend it implies an understanding of statistics that would have avoided the question at the start. Does that actually help the questioner? It seems to me far less practical to posit an explanation without answer than to posit an answer without an explanation. Here providing a correct answer is -1, but providing an answer unusable to the questioner is 1. It must be in the statistics! $\endgroup$
    – Tom
    Sep 6, 2017 at 23:40

Your Answer

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

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