assign_deputy_seats: Functions that help with the assignment of the Chamber of...

assign_deputy_seatsR Documentation

Functions that help with the assignment of the Chamber of Deputies.

Description

There are 500 seats to be assigned in the Chamber of Deputies in Mexico. The process involves different steps. assign_all_seats: Assigns the total of 500 seats of majority and proportional seats, checking for maximum constraints per assign_majority: Add column defining the majority party of the first 300 seats to each stratum and repetition. add_max_seats: Adds the maximum seats allowed out of the 500 seats to each party and repetition. assign_prop: Assigns n_assign seats to parties using proportional representation in national voting and "resto mayor".

Usage

assign_majority(
  estimates_strata_tbl,
  assignment_tbl,
  party_name,
  candidate_name
)

assign_all_seats(reps_list, assignment_tbl)

add_max_seats(total_tbl, majority_seats_tbl)

assign_prop(total_tbl)

Arguments

estimates_strata_tbl

Tibble with estimates of proportion of votes per party per repetition per stratum (output of bootstrap_diputados)

assignment_tbl

Tibble with party names and corresponding assigned party by stratum.

party_name

Unquoted variable indicating the party name.

candidate_name

Unquoted variable indicating the assigned party.

reps_list

A named list (output of bootstrap_diputados) with elements strata_tbl and total_tbl

total_tbl

Tibble with estimates of proportion of votes per party per repetition (output of bootstrap_diputados) total_tbl must include columns: n_assign seats to allocate, per replication and topped: a logical value whether the party has reached it's maximum number of seats (TRUE)

majority_seats_tbl

Tibble with output from assign_majority. A tibble with columns: rep number of repetition, candidate the party, and n_seats_maj integer, number of seats assigned by majority for each of the parties out of the first 300;

Value

assign_majority returns a tibble with columns: rep number of repetition, candidate the party, and n_seats_maj integer, number of seats assigned by majority for each of the parties out of the first 300;

assign_all_seats returns a tibble with columns: rep number of repetition, party the party, and n_seats_maj integer, number of seats assigned by majority for each of the parties out of the first 300; n_seats_prop integer, is the number of seats assigned by proportionality and "resto mayor", out of the 200, for each of the parties; n_seats_total integer, is the total number of seats, out of the 500, for each of the parties;

add_max_seats returns a tibble with columns: rep number of repetition, party the party, and prop_vot_nal normalised proportion to calculate maximum allowed; n_seats_maj integer, number of seats assigned by majority for each of the parties out of the first 300; n_seats_max integer, is the maximum number of seats allowed per party. If the party reached/passed its maximum with the majority assignment, n_seats_max is set to n_seats_maj; topped logical, indicates if the party has reached its maximum;

assign_prop returns a tibble where : rep is the number of repetition, party is the name of the party, and n_seats_prop integer, is the number of seats assigned by proportionality and "resto mayor" for each of the parties; n_seats_total integer, is the number of seats assigned by majority and proportional; topped logical, indicates if a party has reached its maximum number of seats;


cotecora-team-2/quickcountmx documentation built on July 17, 2025, 5:14 a.m.