-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add "winner take one" method #10
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
always error on ties add tests and examples
error message if district_seats_df is not a data.frame
use internal testdata for Zurich and Aargau
just warn instead of error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the winner take one (WTO) method to
biproportional()
andpukelsheim()
. It adds a condition that the party that got the most votes within a district must get at least one seat in that district ("Majorzbedingung" in German). Literature in English is somewhat sparse, I took the implementation and name mainly from Doppelproporz bei Parlamentswahlen - Ein Rück- und Ausblick (Friedrich Pukelsheim and Christian Schumacher, October 2011).New parameters in biproporz() and pukelsheim()
The method is used by setting the parameters
biproporz(..., method = "wto")
orpukelsheim(..., winner_take_one = TRUE)
. Here's an example:Grossratswahl Graubünden 2022
I tested the method with the cantonal parliament election in the canton of the Grisons 2022. Interestingly, there was a tied majority in one district (Rheinwald), where two parties got 97 votes for one seat. There was some debate on how this should be handled, the election office chose to suspend the WTO condition in this district. Another way would have been to randomly choose a winner in this district.
I generally prefer to throw an error if behavior is undefined, especially with ties. However, in this case it's more complicated to actually model the behavior of said election if
biproporz()
throws an error. If you modify the votes matrix beforehand (to break the tie), the WTO condition in previously-tied districts can lead to ripple effects in other districts which goes beyond simply "breaking a tie". If WTO is not applied in a tied district, the seat actually goes to the party where the lower apportionment satisfies the upper apportionment conditions best. It is unlikely that the seat goes to a third party (i.e. not one of the tied parties).The package handles this issue in each district as follows:
As this is a rather special case, the data set is not exported and only used for unit tests.
Election system in Zug
While working on this I also realized that Zug actually uses the WTO method. However, applying this method does not change the seat distribution for the
zug2018
data set that's why I didn't realize it sooner. I updated the readme and examples accordingly. That way we also don't need an additional exported dataset to illustrate using the method.Minor changes
This PR closes #6. Other changes that came up while working on this:
pivot_to_df()
if row and colnames are set but header names (names(dimnames(...))
) are missinglower_apportionment
now get the district and party names via matrix dimnames. This is necessary to know who the district winner is. That's also why unnamed matrices don't work withmethod="wto"