Swedish Riksdag Mandate Allocation & Electoral Mechanics

Swedish Riksdag Mandate Allocation & Electoral Mechanics

1. Executive Summary

This module implements the deterministic electoral mechanics foundation for the Swedish Riksdag simulator. The implementation adheres strictly to Swedish constitutional and statutory election law (Regeringsformen 1974:152 and Vallagen 2005:837 14 kap.) and has been verified against official certified election data from Valmyndigheten.

The allocator reproduces the certified official seat allocations for the 2018 and 2022 Riksdag elections down to the exact seat for every party across all 29 Riksdag constituencies (0 mismatches).


2. Statutory Framework

2.1 Constitutional Thresholds (Regeringsformen 3 kap. 7 §)

  • National 4.0% Threshold: A party must obtain at least 4.0% of the valid votes cast nationally to participate in the nationwide proportional entitlement and receive adjustment seats (utjämningsmandat).
  • Constituency 12.0% Exception: A party obtaining less than 4.0% nationally but at least 12.0% of the valid votes in a specific constituency is entitled to participate in the allocation of fixed constituency seats (fasta valkretsmandat) in that constituency. It is excluded from the nationwide proportional entitlement and receives no adjustment seats.

2.2 Seat Quantities and Geometry (Vallagen 4 kap. 3 §)

  • Total Seats: 349.
  • Fixed Constituency Seats (Fasta valkretsmandat): 310, distributed among the 29 constituencies prior to each election based on the number of eligible voters as of March 1 using the largest remainder (Hare quota / Hamilton) method.
  • Adjustment Seats (Utjämningsmandat): 39, distributed across the country to restore nationwide proportionality among qualifying parties.

2.3 2026 Decided Fixed-Seat Distribution

Valmyndigheten determined the 2026 fixed seat distribution on April 10, 2026 (published in fasta-valkretsmandat-val-2026.xlsx):

ValkretskodValkretsnamnFasta mandat 2026Förändring vs 2022
01Stockholms kommun29$\pm 0$
02Stockholms län41+1
03Uppsala län12$\pm 0$
04Södermanlands län9$\pm 0$
05Östergötlands län14$\pm 0$
06Jönköpings län11$\pm 0$
07Kronobergs län6$\pm 0$
08Kalmar län7-1
09Gotlands län2$\pm 0$
10Blekinge län5$\pm 0$
11Malmö kommun10$\pm 0$
12Skåne läns västra9$\pm 0$
13Skåne läns södra12$\pm 0$
14Skåne läns norra och östra10$\pm 0$
15Hallands län10$\pm 0$
16Göteborgs kommun18+1
17Västra Götalands läns västra11$\pm 0$
18Västra Götalands läns norra8$\pm 0$
19Västra Götalands läns södra7$\pm 0$
20Västra Götalands läns östra8$\pm 0$
21Värmlands län9$\pm 0$
22Örebro län9$\pm 0$
23Västmanlands län8$\pm 0$
24Dalarnas län9$\pm 0$
25Gävleborgs län9$\pm 0$
26Västernorrlands län7-1
27Jämtlands län4$\pm 0$
28Västerbottens län8$\pm 0$
29Norrbottens län8$\pm 0$
Summa29 valkretsar310310 fasta + 39 utjämningsmandat = 349

3. The Mandate Allocation Algorithm (Vallagen 14 kap.)

The algorithm executes sequentially with exact rational arithmetic (fractions.Fraction):

                        [ Constituency Votes ]
                                  │
                                  ▼
             ┌──────────────────────────────────────────┐
             │ Step 1: Threshold & Eligibility Check    │
             │  - National >= 4.0% (inclusive)          │
             │  - Constituency >= 12.0% (inclusive)     │
             └──────────────────────────────────────────┘
                                  │
                                  ▼
             ┌──────────────────────────────────────────┐
             │ Step 2: Fixed Constituency Seats (310)   │
             │  - Modified Sainte-Laguë (1.2, 3, 5...)  │
             │  - Allocated within each 29 constituency │
             └──────────────────────────────────────────┘
                                  │
                                  ▼
             ┌──────────────────────────────────────────┐
             │ Step 3: National Entitlement (349 - L)   │
             │  - Deduct fixed seats won by <4% parties │
             │  - Modified Sainte-Laguë (1.2, 3, 5...)  │
             │  - Allocated nationally across >=4%      │
             └──────────────────────────────────────────┘
                                  │
                                  ▼
             ┌──────────────────────────────────────────┐
             │ Step 4: Overhang Check & Återföring      │
             │  - Excess fixed seats (F_p > E_p)        │
             │  - Retracted from lowest winning comp    │
             │    (excluding const with <3 fixed seats) │
             │  - Reallocated to eligible parties in c  │
             └──────────────────────────────────────────┘
                                  │
                                  ▼
             ┌──────────────────────────────────────────┐
             │ Step 5: Adjustment Seats Placement (39)  │
             │  - U_p = E'_p - F'_p                     │
             │  - Placed into constituency c with max   │
             │    comparison number:                    │
             │    * Divisor = 1.0 if party has 0 fixed  │
             │    * Divisor = 2*s + 1 if party has s>=1 │
             └──────────────────────────────────────────┘
                                  │
                                  ▼
                   [ Exact 349 Seat Allocation ]

3.1 Step-by-Step Rules

  1. Modified Sainte-Laguë Divisors:
    • First divisor: $d_1 = \mathbf{1.2} = \frac{6}{5}$ (effective since Jan 1, 2015 via SFS 2014:1384; applies to 2018, 2022, 2026).
    • Subsequent divisors: $3, 5, 7, 9, \dots = 2k + 1$.
  2. Fixed Constituency Seats Allocation (Vallagen 14 kap. 3 §):
    • In each constituency $c$, participating parties compete for $F_c$ seats based on comparison numbers $J_{c, p} = \frac{V_{c, p}}{d_k}$.
  3. National Proportional Entitlement (Vallagen 14 kap. 4 §):
    • Fixed seats won by parties below 4% nationally ($L$) are deducted: $T’ = 349 - L$.
    • The remaining $T’$ seats are allocated among $\ge 4\%$ parties nationally using modified Sainte-Laguë ($d_1 = 1.2$).
  4. Excess Fixed Seats & Return / Reallocation (Återföring - Vallagen 14 kap. 4a–4c §§):
    • If party $p$ won $F_p > E_p$ fixed seats, excess seats are retracted from the constituency where $p$ won a seat with the lowest comparison number (prohibited from constituencies with $<3$ fixed seats, e.g. Gotland).
    • Returned seats are reallocated globally among candidate parties in affected constituencies in descending order of comparison quotient. Sub-4% parties with $\ge 12\%$ locally are eligible to receive returned fixed seats in that constituency.
    • National proportional entitlements are updated to guarantee strict 349-seat conservation.
  5. Adjustment Seats Placement (Vallagen 14 kap. 5 §):
    • Each nationally qualifying party $p$ is entitled to $U_p = E’_p - F’_p$ adjustment seats.
    • Each adjustment seat is assigned to the constituency where party $p$ has the highest comparison quotient: \(J_{c, p} = \begin{cases} \frac{V_{c, p}}{1.0} & \text{if party } p \text{ holds 0 fixed seats in constituency } c \\ \frac{V_{c, p}}{2(\text{seats held in } c) + 1} & \text{if party } p \text{ holds } \ge 1 \text{ seats in constituency } c \end{cases}\)
  6. Tie Breaking (Vallagen 14 kap. 2 §):
    • Resolved by lottery (TieBreaker protocol / DeterministicLotteryTieBreaker). Ties are never resolved alphabetically or by party ID.

4. Verification & Acceptance Results

4.1 Official Phase-by-Phase Mandate Decomposition

The allocator matches the certified 2018 and 2022 Riksdag results across the tested phases (initial fixed seats, post-return fixed seats, adjustment seats, and final seats):

2018 Riksdag Election (Certified Official vs Allocator Output):

| Parti | Fasta valkretsmandat | Återförda / Nyfördelade | Utjämningsmandat | Slutliga mandat | |—|—|—|—|—| | S | 94 | 0 | 6 | 100 | | M | 66 | 0 | 4 | 70 | | SD | 61 | 0 | 1 | 62 | | C | 31 | 0 | 0 | 31 | | V | 25 | 0 | 3 | 28 | | KD | 16 | 0 | 6 | 22 | | L | 12 | 0 | 8 | 20 | | MP | 5 | 0 | 11 | 16 | | Summa | 310 | 0 | 39 | 349 |

Note on 2018 fixed seat configuration: In 2018, Västra Götalands läns norra had 8 fixed seats and Västra Götalands läns östra had 9 fixed seats.

2022 Riksdag Election (Certified Official vs Allocator Output):

| Parti | Fasta valkretsmandat | Återförda / Nyfördelade | Utjämningsmandat | Slutliga mandat | |—|—|—|—|—| | S | 104 | 0 | 3 | 107 | | SD | 69 | 0 | 4 | 73 | | M | 67 | 0 | 1 | 68 | | V | 16 | 0 | 8 | 24 | | C | 23 | 0 | 1 | 24 | | KD | 13 | 0 | 6 | 19 | | MP | 10 | 0 | 8 | 18 | | L | 8 | 0 | 8 | 16 | | Summa | 310 | 0 | 39 | 349 |

4.2 Statutory Verification Matrix

The test suite in tests/test_mandate_allocation.py validates all statutory branches:

Verification TargetTest DescriptionStatus
2022 Certified ElectionFull 29-constituency $\times$ 8-party phase reproductionPASS (0 mismatches)
2018 Certified ElectionFull 29-constituency $\times$ 8-party phase reproductionPASS (0 mismatches)
349 Seats InvariantTotal seats strictly equals 349 across all branchesPASS
4.0% National ThresholdExact inclusive $\ge 4.0\%$ boundaryPASS
12.0% Constituency ThresholdExact inclusive $\ge 12.0\%$ local party qualificationPASS
Sub-4% / Above-12% FixtureSub-4% party wins local fixed seat, 0 adjustment seats, deducted from national poolPASS
Adjustment Divisor = 1.0Divisor is 1.0 (pure votes) when party has 0 fixed seats in constituencyPASS
Gotland Return ProhibitionConstituencies with $<3$ fixed seats cannot have seats retractedPASS
Overhang & ÅterföringExcess fixed seats retracted and reallocated correctlyPASS
Multi-Constituency ReturnsMulti-constituency global quotient ranking and updatePASS
Sub-4% Return RecipientSub-4% local party eligible for returned fixed seat in constituencyPASS
Exact Fraction ArithmeticZero floating-point rounding or precision drift across all calculationsPASS
Injected TieBreakerPluggable lottery interface invoked upon exact equalityPASS

The official Valmyndigheten Manual Example 5 is archived verbatim in tests/fixtures/valmyndigheten_example_5_valkoping.json. It is a three-constituency, 75-seat municipal example, not a 29-constituency Riksdag fixture; the production Riksdag allocator therefore records it as an external fixture limitation rather than transforming it into a synthetic oracle. Synthetic Riksdag return scenarios are labelled separately in the tests and freeze audit.


5. Usage & Makefile Commands

# Fetch raw official files from Valmyndigheten into data/raw/mandates/
make fetch-mandate-data

# Process raw files into normalized CSVs in data/processed/mandates/
make process-mandate-data

# Run the mandate allocation test suite
make test-mandate-allocation