Function Resource

BidenFraction

Computes the fraction of uncounted votes Joe Biden needs to have a majority in a state

ResourceFunction["BidenFraction"][a,f]

takes an Association a in which the keys are "Trump" and "Biden" and the values are the number of votes they have and f, which is the fraction of ultimate votes already believed to have been case.

ResourceFunction["BidenFraction"][a,f,m]

performs similarly but requires Biden to win by a fraction m of the ultimate votes cast.

Details and Options

By default, the optional m argument is set to zero; Biden is just required to win by one vote.
The Trump fraction, the fraction of uncounted votes Donald Trump needs to have a majority in a state is simply one minus the Biden fraction.

Examples

Basic Examples

Compute the fraction of remaining votes in Georgia that Biden would need to win given the data on the CNN website at :

In[1]:=
ResourceFunction[
 "https://www.wolframcloud.com/obj/schandler/DeployedResources/\
Function/BidenFraction"][<|"Trump" -> 2439800, "Biden" -> 2430265|>, 0.98]
Out[1]=

Compute the fraction of remaining votes in Pennsylvania that Biden would need to win the state by a 1% margin (using data on the CNN website at ) and silence the error:

In[2]:=
Quiet@ResourceFunction[
  "https://www.wolframcloud.com/obj/schandler/DeployedResources/\
Function/BidenFraction"][<|"Trump" -> 3247808, "Biden" -> 3157266|>, 0.93, 0.01]
Out[2]=

Applications

The estimates for the number of votes cast could be incorrect. Plot the fraction of remaining votes Biden needs to win in Pennsylvania by 0% and by 1% given varying estimates as the fraction of votes already cast:

In[3]:=
Legended[Apply[Show][
  Table[Plot[
    Quiet@ResourceFunction[
      "https://www.wolframcloud.com/obj/schandler/DeployedResources/\
Function/BidenFraction"][<|"Trump" -> 3247808, "Biden" -> 3157266|>, cast, (m - 1)*.005], {cast, 0.85, 0.99}, Axes -> False, Frame -> True, FrameLabel -> {"fraction of votes already cast", "Biden fraction"}, PlotStyle -> ColorData[98][m]], {m, 1, 5}]
  ], LineLegend[ColorData[98][#] & /@ Range[5], Range[0, 0.025, 0.005], LegendLabel -> "Biden victory margin"]]
Out[3]=