Package 'apportion'

Title: Apportion Seats
Description: Convert populations into integer number of seats for legislative bodies. Implements apportionment methods used historically and currently in the United States for reapportionment after the Census, as described in <https://www.census.gov/history/www/reference/apportionment/methods_of_apportionment.html>. These methods are also sometimes used for allocating seats by votes in proportional representation systems.
Authors: Christopher T. Kenny [aut, cre] (ORCID: <https://orcid.org/0000-0002-9386-6860>), Cory McCartan [aut] (ORCID: <https://orcid.org/0000-0002-6251-669X>)
Maintainer: Christopher T. Kenny <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-05-29 19:28:27 UTC
Source: https://github.com/christopherkenny/apportion

Help Index


Apportion by the Adams Method

Description

A divisor method that uses ceiling (round-up) rounding, proposed by John Quincy Adams. It was never adopted for US Congressional apportionment.

Usage

app_adams(size, pop)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

Details

The Adams method finds a common divisor dd such that ceiling-rounded quotients sum to the desired house size:

ipid=H\sum_{i} \left\lceil \frac{p_i}{d} \right\rceil = H

where pip_i is the population of unit ii and HH is the total number of seats (size). The divisor dd is adjusted iteratively until this condition is met.

Because every non-zero fractional remainder is always rounded up, the Adams method is the most generous to small units among the classical divisor methods. Any unit with a positive population receives at least one seat, which can over-represent small states or parties relative to their population share.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

Examples

app_adams(size = 435, pop = state_2020$pop)

Apportion by the Balinski-Young Method

Description

A quota method that satisfies the quota property and avoids the Alabama paradox, proposed by Michel Balinski and H. Peyton Young.

Usage

app_balinski_young(size, pop, init = NULL)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

init

A vector or matrix of the same size as pop with the initial number of seats allocated to each unit. Defaults to zero for all units.

Details

Let the exact quota for unit ii be:

qi=piHPq_i = \frac{p_i \cdot H}{P}

where pip_i is the population of unit ii, HH is the total number of seats (size), and P=ipiP = \sum_i p_i is the total population.

The method guarantees the quota property: each unit receives either qi\lfloor q_i \rfloor or qi\lceil q_i \rceil seats, so no unit is over- or under-represented by more than one seat relative to its exact quota. Seats are awarded sequentially using the D'Hondt priority pi/(1+ni)p_i / (1 + n_i), but with an upper quota cap: once a unit has received qi\lceil q_i \rceil seats it is excluded from further consideration. This cap prevents the runaway over-representation that the unconstrained Jefferson/D'Hondt method can produce, while preserving freedom from the "Alabama paradox," in which increasing the total house size can paradoxically cause a unit to lose a seat.

Balinski and Young proved that no apportionment method can simultaneously satisfy the quota property and avoid all paradoxes; this method is a practical compromise that prioritizes the quota property.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

References

Balinski, M. L., & Young, H. P. (2001). Fair Representation: Meeting the Ideal of One Man, One Vote (2nd ed.). Brookings Institution Press.

Examples

app_balinski_young(size = 435, pop = state_2020$pop)

Apportion by the Dean Method

Description

A divisor method that rounds at the harmonic mean of consecutive integers.

Usage

app_dean(size, pop)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

Details

The Dean method finds a common divisor dd and rounds each quotient at the harmonic mean of the two surrounding integers. A quotient pi/dp_i / d that falls between integers nn and n+1n + 1 is rounded up to n+1n + 1 if it exceeds the harmonic mean:

H(n,n+1)=2n(n+1)2n+1H(n,\, n+1) = \frac{2n(n+1)}{2n+1}

and rounded down to nn otherwise. The divisor is adjusted iteratively until the total allocation equals size.

Among the classical divisor methods, the Dean method minimizes the absolute difference in average district population (i.e., pi/sip_i / s_i, where sis_i is the number of seats awarded to unit ii) between any two units. It falls between the Webster and Huntington-Hill methods in its treatment of small versus large units, giving slightly more seats to small units than Webster but fewer than Huntington-Hill.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

Examples

app_dean(size = 435, pop = state_2020$pop)

Apportion by the D'Hondt (Jefferson, greatest divisors) Method

Description

A sequential priority method widely used for proportional representation elections, including in Belgium, Spain, Portugal, the Netherlands, Austria, and many other countries. Mathematically equivalent to the Jefferson method, a procedure described by Thomas Jefferson, and also known as the greatest divisors method. Compared with the Webster/Sainte-Laguë method, D'Hondt/Jefferson tends to give a slight advantage to larger units.

Usage

app_dhondt(size, pop, init = NULL)

app_jefferson(size, pop, init = NULL)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

init

A vector or matrix of the same size as pop with the initial number of seats allocated to each unit. Defaults to zero for all units.

Details

The D'Hondt method allocates seats sequentially. At each step, the next seat is awarded to the unit (party or state) with the highest quotient:

Qi=pini+1Q_i = \frac{p_i}{n_i + 1}

where pip_i is the population or vote total of unit ii and nin_i is the number of seats it currently holds. This process repeats until all size seats have been awarded.

The Jefferson method finds a common divisor dd such that floor-rounded quotients sum to the desired house size:

ipid=H\sum_{i} \left\lfloor \frac{p_i}{d} \right\rfloor = H

where pip_i is the population of unit ii and HH is the total number of seats (size). The divisor dd is decreased iteratively until this condition is met.

The Jefferson method is mathematically equivalent to the D'Hondt method: both produce the same allocation. The Jefferson divisor formulation and the sequential D'Hondt priority pi/(ni+1)p_i / (n_i + 1) are two perspectives on the same apportionment rule.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

Examples

app_dhondt(size = 435, pop = state_2020$pop)

Apportion by the Hamilton-Vinton Method

Description

A largest-remainder quota method used for US Congressional apportionment from 1850 to 1900. Also known as the Hamilton method or the Vinton method. Equivalent to the largest remainder method using the Hare quota.

Usage

app_hamilton_vinton(size, pop)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

Details

The Hamilton-Vinton method first computes the exact quota for each unit:

qi=piHPq_i = \frac{p_i \cdot H}{P}

where pip_i is the population of unit ii, HH is the total number of seats (size), and P=ipiP = \sum_i p_i is the total population. Each unit initially receives qi\lfloor q_i \rfloor seats. Any remaining seats are awarded one at a time to the units with the largest fractional remainders qiqiq_i - \lfloor q_i \rfloor.

The method satisfies the quota property: no unit ever receives fewer than qi\lfloor q_i \rfloor or more than qi\lceil q_i \rceil seats. However, it is susceptible to the "Alabama paradox," in which increasing the total house size can paradoxically cause a unit to lose a seat.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

Examples

app_hamilton_vinton(size = 435, pop = state_2020$pop)

Apportion by the Huntington-Hill (Equal proportions) Method

Description

The current method used for US Congressional apportionment, in continuous use since the Apportionment Act of 1941. Also known as the method of equal proportions.

Usage

app_huntington_hill(size, pop, init = NULL, thresh = 0)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

init

A vector or matrix of the same size as pop with the initial number of seats allocated to each unit. Defaults to zero for all units.

thresh

A population threshold for assigning seats. Units with population below this threshold receive zero seats, by default. Only affects the default value of init; if init is provided, thresh is ignored.

Details

The Huntington-Hill method is a sequential priority method. Starting with one seat allocated to each unit (a constitutional minimum for Congressional apportionment), it repeatedly awards the next seat to the unit with the highest priority value:

Pi(n)=pin(n+1)P_i(n) = \frac{p_i}{\sqrt{n(n + 1)}}

where pip_i is the population of unit ii and nn is the number of seats currently held by unit ii.

This is equivalent to a divisor method that rounds each quotient at the geometric mean of the two surrounding integers: pi/dp_i / d is rounded up to n+1n + 1 if it exceeds n(n+1)\sqrt{n(n+1)}, and down to nn otherwise. Among the divisor methods, Huntington-Hill minimizes the maximum relative difference in representation between any two units.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

References

Huntington, E. V. (1928). The apportionment of representatives in Congress. Transactions of the American Mathematical Society, 30(1), 85–110. doi:10.2307/1989268

Examples

app_huntington_hill(size = 435, pop = state_2020$pop)

Apportion by the Webster (Sainte-Laguë) Method

Description

A divisor method that uses standard arithmetic-mean rounding, used for US Congressional apportionment in 1842 and from 1911 to 1931. Also used in Norway and Sweden for parliamentary seat allocation (where it is known as the Sainte-Laguë method).

Usage

app_webster(size, pop, init = NULL)

Arguments

size

An integer number of seats to apportion across units, or a vector of numbers of seats, one for each column of pop. Must be non-negative.

pop

A vector or matrix of population sizes or proportions for each unit. If a matrix is provided, the apportionment algorithm is applied columnwise: each row is a unit and each column is a replicate. For example, with congressional apportionment, the matrix would have 50 rows and as many columns as hypothetical census population scenarios.

init

A vector or matrix of the same size as pop with the initial number of seats allocated to each unit. Defaults to zero for all units.

Details

The Webster method finds a common divisor dd such that standard-rounded quotients sum to the desired house size:

iround ⁣(pid)=H\sum_{i} \text{round}\!\left(\frac{p_i}{d}\right) = H

where pip_i is the population of unit ii and HH is the total number of seats (size). Quotients are rounded at the arithmetic mean n+0.5n + 0.5 of consecutive integers nn and n+1n + 1.

Among the classical divisor methods, Webster is considered the most statistically unbiased: it does not systematically favor either large or small units. It minimizes the expected absolute deviation from exact quotas when populations are drawn from a wide range of sizes.

Value

An integer vector or matrix of the same dimensions as pop, containing the number of seats apportioned to each unit.

Examples

app_webster(size = 435, pop = state_2020$pop)

2020 State Population Data

Description

tibble with columns:

  • GEOID: Federal Information Processing Standards code

  • name: State name

  • pop: 2020 census population

  • abb: Two-letter postal abbreviation

Examples

head(state_2020)