Methodology and data
Sources, versions, calculations and reproducibility criteria, including the comparative electoral indices.
Principles
The portal separates three things that are often mixed: data, interpretation and opinion. Every figure states its source, dataset version and calculation method. When a series cannot be reproduced, the text says so.
Main sources
- V-Dem Dataset v16 (March 2026), published under CC BY-SA 4.0. Used for the democracy indices and the Regimes of the World classification.
- GDELT Project, event data and documentation. Used in the analyses of protest and repression, with the reporting-bias caveats explained in each piece.
- Published studies cited in the analyses. Figures that do not come from our own calculation are attributed to their source.
Calculations
V-Dem visualizations are generated with scripts/build-vdem-data.R from the dataset downloaded by scripts/fetch-vdem.sh. The resulting JSON files are stored in public/data/ and versioned with the repository.
- The global series is a population-weighted average.
- V-Dem stops publishing
e_popafter 2019; the last available value is carried forward and documented in the metadata. - The radar uses 2024 scores for five selected countries.
- The RoW distribution uses the 2025 classification and population weights.
Comparative electoral indices
This section explains the concepts and formulas behind the electoral comparator. The comparator is at politicacomparada.org/datos/indices-electorales/ and its data can be downloaded from the dataset page.
What an electoral index is, and what it is not
An electoral index summarises a property of the electoral system or of electoral behaviour in a comparable number. It is not a single measure of “democratic quality” or a normative ranking. Turnout, fragmentation, disproportionality, competitiveness, nationalisation and volatility are different dimensions: a system can be very proportional and very fragmented, or have high turnout and low competitiveness.
Every index is published with its formula, unit, scope and limits. When two indices seem contradictory, we explain what each measures rather than choosing one.
Units of analysis
| Unit | Use |
|---|---|
| District or municipality | Calculation of indices within the unit where seats are allocated. |
| Province, region or state | Aggregates for comparing territories and levels. |
| Party family | Aggregation that absorbs mergers, splits and territorial brands. |
| Polling station | Participation and vote detail; not used to allocate seats. |
Comparisons across levels must state the electorate and the district. Municipal registers may include resident EU citizens; regional and national registers do not. Cross-level turnout gaps are therefore descriptive, not a causal measure of “mobilisation”.
Turnout, invalid and blank ballots
| Indicator | Formula | Unit | Reading |
|---|---|---|---|
Turnout (turnout) |
voters / electorate | ratio | Share of the electorate that votes. |
Invalid votes (null_rate) |
invalid / (valid + invalid) | ratio | Weight of invalid ballots among ballots cast. |
Blank votes (blank_rate) |
blank / valid | ratio | Weight of blank ballots among valid ballots. |
These are not measures of abstention: the denominator changes. Blank ballots can affect electoral thresholds; invalid ballots affect validity. In small municipalities, a handful of votes can move a percentage substantially.
Party system
The effective number of parties (ENP) of Laakso and Taagepera is:
ENP = 1 / Σ v_i²
where v_i is each party’s vote or seat share. The more dispersed the support, the higher the ENP. Vote ENP and seat ENP are published separately: their difference shows how the electoral system concentrates or disperses representation. In municipalities with no seats allocated, seat ENP is marked not applicable.
Family-level ENP applies the same formula to aggregated family shares. It is more stable across mergers and splits, but depends on the classification.
Representation and distortion
| Indicator | Formula | Unit | Reading |
|---|---|---|---|
| Gallagher | √(½ Σ (v_i − s_i)²) × 100 |
pp | Quadratic distance between vote and seat shares. |
| Loosemore–Hanby | ½ Σ abs(v_i − s_i) × 100 |
pp | Share of seats that would need to change to match votes and seats. |
| Seat bonus | (s_i − v_i) × 100 |
pp | A candidacy’s advantage or disadvantage. |
| Wasted votes | Σ V_i (S_i = 0) / V_total × 100 |
pp | Votes for candidacies that win no seats. |
Gallagher and Loosemore–Hanby are not interchangeable: the former penalises large deviations more heavily; the latter is a linear sum. Both are published. The seat bonus is a party-level index; summaries show the largest candidacy. “Wasted votes” is not a broad measure of “wasted” support: it only counts candidacies with no seat.
Malapportionment measures the deviation between each district’s seat share and its electorate or population share: ½ Σ abs(s_d − p_d) × 100. It only applies where seats are allocated across districts; it uses the register and states so. It does not measure party-level disproportionality, but territorial distortion.
Competitiveness
- Vote margin:
(V_1 − V_2) / V_total × 100percentage points between the two most-voted candidacies. - Seat margin:
(S_1 − S_2) / S_total × 100percentage points between the two candidacies with most seats. - Competitive districts: share of districts with a vote margin below 5 pp. The threshold is a convention, not a natural boundary.
A small margin does not guarantee an uncertain outcome: it depends on the system, territorial distribution and seats at stake.
Nationalisation
Nationalisation measures whether a party receives homogeneous support across the territory. We use the weighted Gini of vote shares across districts, in the Bochsler family:
nationalisation = 1 − weighted Gini(party shares)
Weights use each district’s electoral size. A party that does not run in a district scores zero there and may look less nationalised; it is therefore published alongside territorial coverage (districts with a candidacy / total). Party-system nationalisation is the vote-weighted average of party nationalisations.
Absolute dispersion is not used because it would make small parties look almost perfectly nationalised. The weighted Gini corrects that problem but still depends on the territorial unit.
Volatility
Pedersen volatility between two elections is:
Pedersen = ½ Σ |v_i,t − v_i,t−1| × 100
It is calculated by party and by family, in votes or seats. The family version is more robust to mergers, splits and rebranding; the party version preserves the detail of those changes. A new party enters at 0 and a disappeared one exits at 0. Volatility is not a measure of government change or individual preference change.
Quick reference to published indices
| Index | What it measures | Unit |
|---|---|---|
turnout |
Turnout over the electorate | ratio |
null_rate |
Invalid over valid + invalid | ratio |
blank_rate |
Blank over valid | ratio |
enp_votes |
Effective parties by votes | count |
enp_seats |
Effective parties by seats | count |
gallagher |
Quadratic vote–seat distance | pp |
loosemore_hanby |
Linear vote–seat distance | pp |
seat_bonus |
A candidacy’s bonus or penalty | pp |
margin_votes |
Distance between the two most-voted candidacies | pp |
margin_seats |
Distance between the two largest seat winners | pp |
wasted_votes |
Votes for candidacies with no seat | pp |
malapportionment |
Seat–electorate deviation across districts | pp |
party_nationalization |
Territorial homogeneity of a party | ratio |
party_system_nationalization |
Weighted average nationalisation | ratio |
coverage |
Districts with a candidacy | ratio |
competitive_districts |
Districts with a margin < 5 pp | ratio |
pedersen |
Aggregate volatility by party | pp |
pedersen_family |
Aggregate volatility by family | pp |
women_elected |
Women among elected people | ratio |
Family variants (enp_family_votes, enp_family_seats, gallagher_family, loosemore_hanby_family, margin_family_votes, margin_family_seats and wasted_family) apply the same formulas to aggregated family shares. The municipal database adds seat_total (seats awarded in the municipality), vote_coverage (candidacy votes / ballot votes in the minutes; a diagnostic that can exceed 100% because of minute differences) and candidate_vote_enp (ENP of candidate votes in municipalities with 250 inhabitants or fewer).
Multilevel indices
Multilevel indices compare the same municipality in local, regional and general elections:
- turnout difference across levels;
- vote ENP difference across levels.
They are useful for studying second-order elections and the territorial structure of the vote. They are not a causal explanation: registers, districts and electoral offers differ.
Party families
Families make it possible to compare parties across elections and countries when brands change. The project uses:
- Conservative, Social democratic, Liberal / centre, Radical right, Left, Green left, Regionalist and Local / other.
- European Parliament groups and Rokkan cleavages are supporting signals, not an automatic rule.
- In municipal elections, local lists without identification with a state or regional party remain in Local / other. No family is inferred from candidate names.
- Every assignment keeps its source, confidence and note. The audit of the 5,423 municipal candidacies in 2023 is published as a CSV on the dataset page.
The classification is a revisable methodological decision. A family is not a complete ideology: it groups parties to make comparisons explicit and auditable. The Madrid tab and the municipal database share the classification: Más Madrid-Verdes Equo, Comuns and En Comú are green-left.
Municipal elections, 2023
The municipal database contains 8,087 municipalities, 57,681 polling stations, 5,423 candidacies, 66,976 seats and 27,209 women elected. It computes 21 indices per municipality plus family variants.
In municipalities with 250 inhabitants or fewer, the source distinguishes:
- ballots for the candidacy: support for the list;
- candidate votes: the sum of individual marks in open lists.
They are not equivalent and are not added without saying so. Candidate-vote ENP is published where available. In addition, 63 seats in the minutes of those municipalities have no candidate marked as elected in file 12; seat indices use the seats awarded in the results. Polling-station totals for 13 large municipalities differ slightly from the municipal total because of minutes/CERA, and the sum of candidacy votes exceeds the ballot total in the minutes by 564 votes. These differences are preserved and documented; totals are not forced.
The full database is not published: the compact download excludes individual candidates and polling-station detail. The municipal tab loads its own JSON so the landing page stays light.
Sources and reproducibility
- 29N 2026 and 23J 2023: official results portal of the Spanish Ministry of the Interior.
- Madrid 2023: Community of Madrid open data and Ministry candidate files for women elected.
- Valencian Community 2023: Generalitat Valenciana open data.
- Municipal 2023: fixed-width files from the Ministry’s Electoral Results Database (
nnxxaamm.DAT).
Code, catalogues, family rules and verifiers are in the repository. Main commands:
npm run indices:comparator:build
npm run municipales:all
npm run municipales:public
npm run municipales:public:check
Checksums, sizes and citations are on the dataset pages. Technical reports document each process: docs/indices-29n.md, docs/indices-23j-29n.md, docs/indices-madrid-2023.md, docs/indices-valencia-2023.md, docs/municipales-db.md and docs/indices-municipales-2023.md.
General limits
- The 29N is provisional; the 23J is final.
- There is no single index of electoral quality.
- Indices depend on territorial units and aggregation.
- Families are an auditable draft, not a definitive truth.
- Cross-level and cross-time comparisons are descriptive, not causal.
- The data do not replace the official count or the minutes.
Reproducibility
The code and scripts are in the project repository. Every figure includes a downloadable data table. V-Dem updates can change absolute scores; different versions are not compared without a warning.
Corrections
If you find a data error, an incomplete citation or a methodological problem, report it with the piece and the source. Write to .