Basic Examples (2)
Compute the Banzhaf power index where player 1 has 1 vote, player 2 has 2 votes and player 3 has 3 votes:
Compute the Banzhaf power index where you have not "named" the players:
Compute the Banzhaf power index for five players, assuming 11 votes are needed to win:
Scope (5)
Use All to obtain an Association containing information on the power index and the number of votes needed to win (the "quota"):
The additional All argument can be used even if the user explicitly sets the quota size:
The additional All argument can be used where the votes are structured as an Association between player name and vote:
BanzhafPowerIndex can handle a 100 player scenario in about one second on a typical 2022 laptop:
Going to a 200-player scenario increases the computation time by a factor of ≈ 6:
Compute the Banzhaf power index for votes amongst US states with different voting powers:
Reproduce the result from the original Banzhaf paper, suggesting that three communities effectively had no power:
Reproduce the result from the paper by Bilbao, Fernandez and Jiménez Losada:
Options (2)
TieResult (1)
Compare the results of whether a tie should be treated as a loss or win:
WinningFraction (1)
Find the Banzhaf power index assuming 2/3 of the votes are needed to win:
Applications (3)
Show how the power of each player changes as the quota needed to win changes:
Compute the power of each state in the United States electoral college assuming that electors from each state vote as a block:
Assume that the allocation of electors in most states is considered known but the allocation of electors in Florida, Pennsylvania, Ohio, North Carolina, and Wisconsin are considered "in play." Of the 92 electoral votes those states have, a candidate needs 58 of them to win. Compute the Banzhaf power index of the remaining five states:
The other candidate needs 34 votes to win. Compute the Banzhaf power index of the remaining five states:
See how the power distribution changes as we alter the winning fraction:
An alternative view:
Neat Examples (2)
This example explores how coalition formation affects the Banzhaf power index. The idea is to let individuals form coalitions which pledge themselves to aggregate the votes of the members and vote as a block in a certain way. One then computes the Banzhaf power index of the coalitions. Each coalition then distributes its power equally over its members. Start by taking 5 people with different numbers of votes:
Compute the Banzhaf power index of the members:
Take every set partition of the voters with the idea being that every grouping represents a coalition of voters. In the first example, everyone is in a single coalition. In the second example, a stands by itself and everyone else is in a coalition. In the third example, {a,b} is one coalition and {c,d,e} is the other. And so on for the 52 possible set partitions. (The number of partitions is equal to BellB[Length[s]]):
Compute the total vote of each coalition:
Associate each coalition with its total number of votes:
Compute the Banzhaf power index of each coalition (given the other coalitions):
Distribute the power of the coalitions equally over each of its members such that we end up with an Association between partitions of the sets of players and the power of each player after equal distribution:
Show which set partitions give player “a" the most power:
Take 30,000 voters in a business entity, each with a different number of votes with the distribution of votes determined by a Pareto distribution. Bin the voters and compute each bin's power index:
Show the distribution of voting power:
Bin the voters into 10 groups ("deciles") each with the same number of voters:
Get the total number of votes in each decile:
Get the ranges of votes within each decile:
Find the Banzhaf power index of each decile:
Change the rules so that each voter received the square root of the number of votes that they possess: