pukelsheim {proporz} | R Documentation |
Biproportional apportionment with data frames
Description
Method to proportionally allocate seats among parties/lists and districts/regions/entities ('Doppelter Pukelsheim').
Usage
pukelsheim(
votes_df,
district_seats_df,
quorum,
new_seats_col = "seats",
use_list_votes = TRUE,
winner_take_one = FALSE
)
Arguments
votes_df |
data.frame (long format) with 3 columns (actual colnames can differ):
|
district_seats_df |
data.frame with 2 columns (actual colnames can differ):
|
quorum |
Optional list of functions which take the votes_matrix and return a logical
vector that denotes for each list/party whether they reached the quorum (i.e. are
eligible for seats). The easiest way to do this is via |
new_seats_col |
name of the new column |
use_list_votes |
By default ( |
winner_take_one |
Set to |
Details
Each party nominates a candidate list for every district. The voters vote for the parties of their district. The seat allocation is calculated in two steps:
In the so called
upper apportionment
the number of seats for each party (over all districts) is determined.In the so called
lower apportionment
the seats are distributed to the regional party list respecting the results from the upper apportionment.
Parties failing to reach quorums cannot get seats. This function does not handle seat assignment to candidates.
If you want to use other apportion methods than Sainte-Laguë use biproporz()
.
Value
A data.frame like votes_df
with a new column denoting the number seats per
party and district. Party and district divisors stored in attributes in attributes
(hidden from print, see get_divisors()
).
See Also
This function calls biproporz()
after preparing the input data.
Examples
# Zug 2018
votes_df = unique(zug2018[c("list_id", "entity_id", "list_votes")])
district_seats_df = unique(zug2018[c("entity_id", "election_mandates")])
seats_df = pukelsheim(votes_df,
district_seats_df,
quorum_any(any_district = 0.05, total = 0.03),
winner_take_one = TRUE)
head(seats_df)
# Finland 2019
finland19_result = pukelsheim(finland2019$votes_df,
finland2019$district_seats_df,
new_seats_col = "mandates",
use_list_votes = FALSE)
tail(finland19_result[order(finland19_result$mandates),])