methods

appointment.methods includes functions to allocate parliamentary seats based on population or vote shares. Arguments to allow allocation thresholds, minimum allocations per group, tie break conditions, and other election features are also provided. Along with deriving results for visualization and reporting, these functions allow the user to analyze outcomes given systematic or situational changes.

Functions

poli_sci_kit.appointment.methods.largest_remainder(quota_style='Hare', shares=None, total_alloc=None, alloc_threshold=None, min_alloc=None, tie_break='majority', majority_bonus=False)[source]

Apportion seats using the Largest Remainder (Hamilton, Vinton, Hare–Niemeyer) methods.

Parameters:
quota_stylestr (default=Hare)

The style of quota vote-seat quota to use.

Options:

Each defines a divisor from which remainders are defined.

For equations: q is quota, s is total shares, and a is total allocations

  • Hare :

    q &= \frac{s}{a}

    Note: the simplest form of largest remainder quota.

  • Droop :

    q &= int \biggl(\frac{s}{a + 1}\biggr) + 1

    Note: favors larger groups more than the Hare quota.

  • Hagenbach–Bischoff :

    q &= \frac{s}{a + 1}

    Note: favors larger groups more than the Hare quota.

shareslist (default=None)

A list of populations or votes for regions or parties.

total_allocint (default=None)

The number to be allocated.

alloc_thresholdfloat (default=None)

A minimum percentage of the population or votes that must be met to receive an allocation.

min_allocint (default=None)

A minimum number of allocations that each group must receive.

tie_breakstr (default=majority)

How a tie break is done (by majority or random, with a majority tie defaulting to random).

majority_bonusbool (default=False)

Whether the largest group is automatically given 50% of the vote.

Returns:
allocationslist

A list of allocations in the order of the provided shares.

poli_sci_kit.appointment.methods.highest_averages(averaging_style='Jefferson', shares=None, total_alloc=None, alloc_threshold=None, min_alloc=None, tie_break='majority', majority_bonus=False, modifier=None)[source]

Apportion seats using the Highest Averages (Jefferson, Webster, Huntington-Hill) methods.

Parameters:
averaging_stylestr (default=Jefferson)

The style that highest averages are computed.

Options:

Each defines a divisor for each region or party to determines the next seat based on all previous assignments.

For equations: d is divisor, s is share, and a is the number already allocated.

  • Jefferson :

    \textrm{d}_{i} &= \frac{s_{i}}{a_{i} + 1}

    Note: an absolute majority always lead to an absolute majority in seats (favors large groups).

  • Webster :

    \textrm{d}_{i} &= \frac{s_{i}}{(2 \cdot a_{i}) + 1}

    Note: generally the smallest deviation from ideal shares (favors medium groups).

  • Huntington-Hill :

    \textrm{d}_{i} &= \frac{s_{i}}{\sqrt{a_{i} \cdot (a_{i} + 1)}}

    Note: assures that all regions or parties receive at least one vote (favors small groups).

shareslist (default=None)

A list of populations or votes for regions or parties.

total_allocint (default=None)

The number to be allocated.

alloc_thresholdfloat (default=None)

A minimum percentage of the population or votes that must be met to receive an allocation.

min_allocint (default=None)

A minimum number of allocations that each group must receive.

tie_breakstr (default=majority)

How a tie break is done (by majority or random, with a majority tie defaulting to random).

modifierfloat (default=None)

What to replace the divisor of the first quotient by to change the advantage of groups yet to receive an assignment.

Note: modifiers > 1 disadvantage smaller parties, and modifiers < 1 advantage them.

Returns:
allocationslist

A list of allocations in the order of the provided shares.