# Statistical confidence in voting samples

I'm currently watching the USA elections and I'm wondering how the confidence is calculated.

So let us say we have a state of 500,000 inhabitants; 5,000 votes have been counted and 80% (4,000 votes) are for candidate A. How can I calculate the probability that candidate A won the state (i.e. binomial model probability > 0.5)? I feel I should use a binomial distribution, however this does not account for the population size.

How can I calculate this correctly without using simulations?

• You cannot compute a valid confidence interval from such limited data, because they are never a representative sample of the state. Any approach, including simulation, that does not explicitly account for the biases in the sample will be practically worthless.
– whuber
Nov 9 '16 at 16:30

Given $N$ votes with $N_A$ voting for $A$ and $N_B$ for $B$, the most naive estimate for the standard deviation of the estimate $$\hat \epsilon_A = \frac{N_A}{N}$$ is $$\hat \sigma_A = \sqrt{ \frac{\hat \epsilon_A (1-\hat \epsilon_A)}{N} }$$ For your example, this yields an uncertainty of $\pm 0.6\%$. However, this is an approximation and breaks down when $\hat \epsilon_A$ is near 0 or 1 or when $N$ is small. In general, creating confidence intervals for fractions estimated from data sampled from a binomial distribution is difficult. Bayesian methods can yield superior results. See this good Wikipedia page.

A much bigger issue than the mere statistical uncertainty, however, is the systematic uncertainty involved in making extrapolations to the final results. The earliest results are not iid sampled from the votes as a whole. For example, rural areas and urban areas report at different times. Factors like this end up being much more important than the mere statistical confidence interval, which can be much narrower than reality.

• Do you have any good references for either the Bayesian methods or for extrapolation methods?
– epp
Nov 9 '16 at 8:57
• The Bayesian methods frequently take the form of assuming a prior distribution for the ratio taken from a beta distribution, as described in @MFR's answer. These are also described on Wikipedia. One of the more common prior's is called Jeffrey's prior. Other methods are simply improved approximations to the one showed here (which is based an a gaussian approximation). By "extrapolation methods" I just mean the various sampling and weighting techniques used by pollsters to account for systematic biases. This is not my expertise and I don't know of a good reference. Nov 9 '16 at 19:33

We can estimate based on prior probability by using a Bayesian approach. We have a reasonable expectation that the probability of vote for the candidate A is 0.8 and we and we could have a beta distribution.

Similarly, we have the Beta distribution of Candidate B.

$pA∼Beta(αA,βA)$

$pB∼Beta(αB,βB)$

$Pr(pB>pA)=\sum_{i=0}^{αB−1}\ \frac{ B(αA+i,βA+βB)} {(βB+i) B(1+i,βB)B(αA,βA)}$

We can measure the probability a draw from one beta distribution is greater than a draw from another using the above formula.

Also, we can use a Monte-Carlo Simulation that allows us to sample from the Beta distribution and calculate the probability that A actually win the candidate B.

• This seems at odds without the explicit request to avoid simulation. Nov 9 '16 at 0:54