# Calculemus (2)

In my blog post of yesterday I assumed that all still uncounted ballots would either go to Biden or to Trump. That was an unwarranted simplification, for in all states that are still contested there is a third candidate who attracts around 1 percent of the votes. The presence of this third candidate matters quite a bit for the computation of the percentage that is needed to flip the vote.

To see why this is so, consider the example where there are 1000 ballots left to count and the leading candidate leads the second one by only 1 vote. If there is no third candidate, then to flip the outcome, 501 of the ballots have to go to the second candidate, creating a margin of 501 - 499 = 2 votes. Now suppose there is a *third* candidate who draws 1 percent of the votes. Then to flip the outcome to the second candidate, 49.6 percent of the 1000 ballots are enough, for we would have: 496 votes for the second candidate, 10 for the third, and 1000 - (496 + 10) = 494 for the first candidate, creating a margin of 2 votes which is just enough to flip the outcome from candidate one to candidate two.

The example makes clear why the presence of Jo Jorgensen matters for the calculations. So, let us calculate again, taking the presence of the third candidate into account, and assuming that Jorgensen will draw the same percentage of the uncounted ballots as in the ballots that were already counted.

Here are my current numbers (taken from The Guardian, afternoon of Nov 5, Amsterdam time):

Georgia has 50000 ballots left to count, with margin 18148 for Trump, and with Jo Jorgensen drawing 1.2 percent of the votes. If there were no third candidate, Biden would need to get 68.2 percent of the remaining ballots voting for him. Taking the presence of Jorgensen into account, he just needs 67.6 percent of the remaining ballots voting for him. This assumes that 1.2 percent of the 50000 remaining ballots are votes for Jorgensen.

North Carolina has 348000 ballots left to count, with a lead for Trump of 76701 votes. Jorgensen draws 0.9 percent of the votes here. Without taking Jorgensen into account, Biden needs 61.1 percent of the remaning ballots voting for him. Assuming that 0.9 percent of the votes go to Jorgensen, Biden needs 60.6 of the remaining ballots for him to flip the outcome.

Pennsylvania has 954000 uncounted ballots left, with a lead of 135704 votes for Trump. Without a third candidate, Biden would need 57.2 percent of the remaining ballots for him. But Jorgensen draws 1.2 percent of the votes here. Taking this fact into account, Biden needs just 56.6 percent of the remaining ballots to flip the outcome to him.

Nevada has 398000 ballots left to count, with a lead for Biden of just 7647 votes. Jorgensen draws 0.9 percent of the votes here. Without taking Jorgensen into account, Trump needs 51 percent of the remaining ballots voting for him to flip the outcome. Taking Jorgensen into account he would need 50.6 percent of the remaining votes for a win.

Given that we may assume that the remaining ballots to be counted are skewed towards Biden, we can be fairly confident that Biden will be the next president of the US.

Here is the Haskell script that I used for the calculations:

```
margin n p = p*n - (1-p)*n
gmargin n gap p = p*n - (1-p-gap)*n
lst = take 1000 (iterate (+0.001) 0.4900)
predict n = zip lst (map (margin n) lst)
gpredict n gap = zip lst (map (gmargin n gap) lst)
calc n m = head [ (x,y) | (x,y) <- predict n, y > m ]
gcalc n m gap = head [ (x,y) | (x,y) <- gpredict n gap, y > m ]
georgia = calc 50000 18148 -- 0.682,18200
ggeorgia = gcalc 50000 18148 0.012 -- 0.676,18200
penn = calc 954000 135704 -- 0.572,137376
gpenn = gcalc 954000 135704 0.012 -- 0.566,137376
ncarol = calc 348000 76701 -- 0.611,77256
gncarol = gcalc 348000 76701 0.009 -- 0.606,76908
nevada = calc 398000 7647 -- 0.51,7960
gnevada = gcalc 398000 7647 0.009 -- 0.506,8358
```