Tutorial 4: More on thresholds

In this tutorial we will specify restrictions that requires results on certains nodes.

Several ways on restricting parties are found in Spanish regional elections, so we will try to replicate three regional electoral systems: Valencia, Extremadura and Islas Canarias. These systems are similar to Spain - Andalusian regional election from the previous tutorial.

Spain - Comunitat Valenciana (regional election)

In Comunitat Valenciana, parties must reach 5% of the total vote in the whole region (invalid vote included) or else they will be excluded from apportionments.

 1name: Cortes Valencianas 2011
 2key: comunitat
 3type: group
 4method: highest_averages
 5method_params:
 6    divisor_f: dhondt
 7exclude: "comunitat.alliance_total_votes < 5% => id"
 8divisions:
 9- name: Alicante
10  seats: 35
11- name: Castellón
12  seats: 24
13- name: Valencia
14  seats: 40

We can see 4 differences from previous examples:

  1. In line 2, a short and unique key is defined for the root node. When no key is explicitly defined, the node name will be used as key.

  2. The vote threshold is referencing the root node (with key comunitat), so in each leaf node, each party will be evaluated against the vote visible at the root node.

  3. The threshold comparison is made against alliances, not parties: some parties change their names depending on the province, but they concur as an alliance on the regional level. If an alliance is excluded, all parties in that alliance will be excluded.

  4. The threshold defines a candidate transformation:

    1. Candidates from the 3 provinces are gathered. In the root node, a party identified by (name, alliance) inside a province is now identified by (name, alliance, district).

    2. Candidates from that list are compared against the threshold.

    3. Because the threshold is computed for each province, candidates need to recover their original identifiers, so they are transformed by id and once again, they are identified by (name, alliance).

Spain - Extremadura (regional election)

In Extremadura, the same threshold than Spain - Andalusian regional election is used (5% of valid votes). However, parties that reach the 5% of all the valid votes in the region are allowed to contend to the apportionments.

 1name: Asamblea de Extremadura - 2011
 2key: comunidad
 3type: group
 4method: highest_averages
 5method_params:
 6    divisor_f: dhondt
 7exclude: valid_votes < 5%
 8include: "comunidad.alliance_valid_votes >= 5% => id"
 9divisions:
10- name: Badajoz
11  seats: 36
12- name: Cáceres
13  seats: 29

Spain - Islas Canarias (regional election)

In Islas Canarias (before 2019), any party must reach 30% of the valid votes in the district, but that threshold is ignored:

  • if a party is the most voted at least one of the islands,

  • or if a party reaches the 6% of valid votes in the whole archipelago

 1name: Parlamento de Canarias 2011
 2key: archipielago
 3type: group
 4method: highest_averages
 5method_params:
 6    divisor_f: dhondt
 7exclude: valid_votes < 30%
 8include: any{rank <= 1 | archipielago.alliance_valid_votes >= 6% => id}
 9divisions:
10- name: El Hierro
11  seats: 3
12- name: Gran Canaria
13  seats: 15
14- name: Fuerteventura
15  seats: 7
16- name: Lanzarote
17  seats: 8
18- name: La Gomera
19  seats: 4
20- name: Tenerife
21  seats: 15
22- name: La Palma
23  seats: 8

In line 7, the exclusion restriction is implemented.

In line 8, the operator any{} indicates that a party which comply to any of the rules will be added to the list (the inclusion list in this case)

  • rank <= 1: any party whose vote rank is #1 in a district

  • archipielago.alliance_valid_votes >= 6% => id: any party whose alliance has at least 6% of the archipelago valid votes