Skip to content

emagar/elecRetrns

Repository files navigation

Last revision: 2024-02-29


Recent news

2024-04-12 Changed nl2018aymu, mex2021aymu, and mic2021aymu in source to reflect voided stations. Two victors changed in aymu1989-on.incumbents (in General Zuazua and Angangueo). Thanks to Juan Pablo Figueroa for pointing this.

2024-02-29 Completes municipal listas nominales for the study of turnout.

2023-11-11 Codebook updated, with a printable flier.

2023-05-26 v.hat and alpha regressions, summaring each unit's electoral history, migrated from https://github.com/emagar/mxDistritos. Despite relying on electoral maps to maintain unit geography longitudinally constant, these are statistics directly relevant to this repository's content.

2023-03-10 Inspect election returns online in Google sheets here (Beta)

New script code/extract-state-yr-mu-returns.r exports municipal election returns. Focus in a single state-year allows votes received by each party across municipalities grouped in one column each — easier to describe.


Description of Recent Mexican Election Vote Returns repository

The repository contains voting data for recent Mexican elections for certain offices at different levels of aggregation. Data has been compiled from many sources. More recent years tend to be coded from official vote returns. Earlier elections tend to be from secondary sources (see Souces section). Data includes district-level federal deputy vote returns since 1979 and district-level presidential vote returns since 2006; and municipality-level municipal president vote returns (except in the state of Nayarit, votes cast for municipal president also elect a municipal council in a fused ballot).

Important note: older incarnations of this repository contain LFS (Large File System) files. Make sure to install LFS in your machine before checking out older commits of the repository.

How to cite the data

This repository is under the MIT license (see the LICENSE document for details). You are free to download and modify the data and code provided you give proper credit to this source. Unless otherwise noted in the file descriptor, the cite is Eric Magar (2018) Recent Mexican election vote returns repository, https://github.com/emagar/elecReturns.

File naming conventions

In general, file names identify the office elected (i.e., df, se, pr, dl, go, ay for diputados federales, senadores, presidente, diputados locales, gobernador, and ayuntamiento, respectively), followed by the unit of observation (i.e., ed, df, dl, mu, de, se, ca for estado, distrito federal, distrito local, municipio, demarcación, sección electoral, and casilla, respectively), then the years included.

So, for example aymu1970-on.csv are ayuntamiento votes at the municipio level since 1970.

Files in the repository

Municipal office election returns

Municipal election data updated to 2022. Other than in the states of Chihuahua and Nayarit, municipal ayuntamientos are elected in fused ballots for a presidente municipal and a variable fraction of the municipal council (regidores and síndicos). The other fraction of the municipal council is allocated by proportional representation.

Chihuahua since 1998 also concurrently elects one síndico per municipality in a separate ballot. The election is by plurality in the municipality at large.

Nayarit since 2008 elects a fraction of municipal council members in single-member plurality districts called demarcaciones, the other fraction by proportional representation (ballot fused with the municipal president).

Two versions of municipal election returns are included: one with votes reported by candidate, another reported by party (they may differ whenever coalitions competed). The script code/ay.r was used for these manipulations:

Non-fused ballots (Chihuahua and Nayarit)

Inspect data online in Google sheets

Basic instructions here; data split by approximate decades or groups of states to comply with spreadsheet size limits (400k cells); files have identical columns to ease appending one another off Google drive:

Congressional election returns

Congressional election data updated to 2021. A mixed majority system is in place since 1979 for the chamber of deputies, since 1997 for the senate (Weldon 2001 describes the system well). 300 deputy seats are elected by plurality rule in single member districts. Two versions of federal deputy returns are included: one with district votes aggregated by candidate, another by party (the script code/df.r was used for these manipulations):

Citation for Congressional election data: Eric Magar, Alejandro Trelles, Micah Altman, and Michael P. McDonald (2017) Components of partisan bias originating from single-member districts in multi-party systems: An application to Mexico, Political Geography 57(1):1-12.

Presidential election returns

Presidential election data updated to 2018. Presidents elected by plurality in a nationwide race every six years.

Citation for the presidential dataset: Eric Magar (2012) Gubernatorial Coattails in Mexican Congressional Elections, The Journal of Politics 74(2):383-399.

Gubernatorial election returns

Citation for the gubernatorial dataset: Eric Magar (2012) Gubernatorial Coattails in Mexican Congressional Elections, The Journal of Politics 74(2):383-399.

Other

  • code/extract-state-yr-mu-returns.r = script exports municipal coalition-aggregates election returns. Select one state and year to get csv file with votes received by each party across municipalities grouped in one column each.
  • datosBrutos/ = directory containing selected primary sources. Files for state elections were kept out from the repository due to sizes exceeding github's limit… e-mail me if you need any of these.

Back to top

Historical party performance statistics

Measures of recent electoral history, that this blog entry describes, offer indicators of party competitiveness at different units of aggregation. This includes quantities of substantive interest, such as parties' predicted vote share in the unit (v.hats) based on their performance in the previous five congressional elections, and how sensitive the party's vote share in the unit is to national vote swings (alphas) between 1994 and 2021.

Level 2009 2012 2015 2018 2021 2024
District csv view csv view csv view csv view csv view csv view
Municipio csv view csv view csv view csv view csv view csv view
Sección electoral csv csv csv csv csv csv

Backwards predictions

Vote returns prior to 1991 are unavailable at lower units of aggregation. Pre-2009 v.hats are obtained by using same general approach, but backwards, "predicting" from subsequent party performance. Year t's predicted vote (up to 2006) is a linear projection of the unit's vote in the next five elections (years t+15, t+12 … t+3).

Level 1988 1991 1994 1997 2000 2003 2006
District csv view csv view csv view csv view csv view csv view csv view
Municipio csv view csv view csv view csv view csv view csv view csv view
Sección electoral csv csv csv csv csv csv

Back to top

Codebook

Most variables are included in all files. Refer here for guidance. Printable codebook here.

Unit IDs

  • edon = state numeral 1:32.

  • edo = state abbreviation (may differ from commonly used abbreviations, eg. Chiapas is `cps' instead of `chis', so that sorting alphabetically preserves the order set by edon).

  • disn = district identifier = edon * 100 + two digit district numeral.

  • cab = cabecera, district's administrative center.

  • inegi, ife = municipal identifier codes used by the INEGI and the IFE/INE, respectively.

  • mun = municipality's name.

  • emm = unit's identifying code. It concatenates the state's edo abbreviation (then a hyphen) two sequential digits for the election cycle (then a period) and, depending on the level of observation, the inegi or district identifier. Using emm as sort criterion returns a state-time-unit ordering.

  • demar = demarcación identifier = inegi + 1/100 demarcación numeral (used for Nayarit municipal elections only).

  • seccion = voting precinct identifier = edon * 10000 + sección electoral numeral (as set by IFE/INE).

  • casilla = polling station identifier (as set by IFE/INE). There are four types of stations, coded B for Básica, C for Contigua, E for Extraordinaria, and S for Especial. See IFE's own description here.

  • latitude, longitude = coordinates indicating a polling booths's north–south and east–west position in a map. Available for federal casilla-level returns in the 2006, 2009, 2015, and 2018 elections.

Temporal IDs

  • yr, mo, dy = year, month, day of the election.
  • date.el, date.in = date of the election and start of term, respectively.
  • dextra = dummy equal 1 for special elections (elección extraordinaria), 0 otherwise.
  • danul = dummy equal 1 for voided elections, 0 otherwise.

Voting

  • v01, v02, … = raw vote for candidate 1, 2, etc.

  • l01, l02, … = label of candidate 1's, 2's, … party or coalition.

  • c01, c02, … = candidate 1's, 2's, … name.

  • efec = effective vote total, the sum of raw votes minus votes for write-in candidates minus invalid ballots. It is the denominator to compute vote shares.

  • lisnom = unit's total eligible voters (lista nominal).

  • nr = votes for write-in candidates (candidatos no registrados, void in Mexican election law).

  • nul, nulos = invalid ballots (votos nulos).

  • tot = total raw votes.

  • win = winner's party or coalition.

  • ncand = number of candidates running.

  • ncoal = number of candidates who ran on multi-party pre-electoral coalitions.

  • dfake = indicates an attempt to complete missing hegemonic era races (mostly in the 1960s and 70s) for the purpose of computing vote lags, made up of press reports and best guesses about what happened in the state's race.

Historical performance

  • d.pan, d.pri, d.left = first difference in the party's federal deputy vote share from last to present election.
  • vhat.pan, vhat.pri, vhat.left = predicted federal deputy vote share in the unit for the current election, a linear projection of the last five races.
  • bhat.pan, bhat.left = slope estimate of the party's autoregressive linear model for the unit. The PRI used as reference vote and has no slope estimate.
  • alphahat.pan, alphahat.pri, alphahat.left = party's alpha estimated for the unit.
  • betahat.pan, betahat.left = party's beta estimate for the unit. The PRI used as reference vote and has no beta estimate.
  • dbackward = dummy equal 1 if prediction with autoregressive model performed backwards, 0 otherwise.

Candidates and incumbents

  • incumbent, runnerup = winning and runner-up candidates' names.
  • propietario, suplente = primary and substitute candidate's name, respectively.
  • part, pty = incumbent/candidate's party or coalition.
  • part.2nd = runner-up party or coalition.
  • mg = winner's margin = winner's vote share minus runner-up's vote share.
  • dmujer = dummy equal 1 if candidate/incumbent is a woman, 0 otherwise.
  • race.after = incumbent's status in the next consecutive race. See this for categories and coding procedure (aquí la versión en castellano del procedimiento codificador).
  • dreran = dummy equal 1 if incumbent ran again in the next consecutive race for the same office.
  • dreelected = dummy equal 1 if incumbent won the next consecutive race for the same office.
  • dcarta = dummy equal 1 if member of Congress filed a letter of intent with the chamber's Junta to run for office again; 0 otherwise. Inapplicable before 2018. See this.
  • lista = candidate's rank in senate two-member party lists. Top member of runner-up vote-getting list wins the state's third senate seat.
  • drp = dummy equal 1 if candidate ran for a PR seat, 0 otherwise.
  • ddied = dummy equal 1 if incumbent died in office, 0 otherwise.
  • prior.inc.part = if an incumbent was on the ballot in the race immediately prior to the current observation, this reports its electoral party or coalition.
  • inc.part.after = if an incumbent was on the ballot in the race immediately after the current observation, this reports its electoral party or coalition.

Other

  • nota = observations possibly relevant for analysis.
  • fuente, source = sources.

Back to top

Coding procedure for the incumbent's status

In files data/aymu1985-on.incumbents.csv and data/dfdf1997-on.incumbents.csv, variable race.after reports what occured at the end of the incumbent's term. It takes one of the following categories:

  1. `Reran-beaten' = the incumbent re-ran and lost;
  2. `Reelected' = the incumbent re-ran and won;
  3. `Dead' = the incumbent died in office;
  4. `Hi-office' = the incumbent ran for higher office in the next cycle;
  5. `Out' = the incumbent withdrew or was not renominated in the next cycle;
  6. `Term-limited' = incumbent ineligible for reelection due to a term limit;
  7. `Uyc' = municipio quit the popular election of authorities in the next cycle, appointing offices according to community rules (usos y costumbres);
  8. A year numeral = still early to know the incumbent's status (and the year of the next race).

In categories other than the first two above, a suffix may be present:

  • Suffix '-p-lost' indicates that the party lost the subsequent race (or, in case of incumbents elected by a multi-party coalition, that none of them won or was part of the winning coalition).
  • Suffix '-p-won' indicates that the party won the subsequent race (or, in case of incumbents elected by a multi-party coalition, that one of them won or at least one of them was in the winning coalition).

Back to top

Procedimiento para codificar el estatus del ocupante

En el archivo data/aymu1985-on.incumbents.csv, la variable race.after indica el estatus del ocupante en la elección subsecuente. El estatus puede ser una de las categorías siguientes:

  1. `Reran-beaten' = el ocupante volvió a contender y perdió;
  2. `Reelected' = el ocupante volvió a contender y ganó;
  3. `Dead' = el ocupante falleció durante su mandato;
  4. `Hi-office' = el ocupante contendió el siguiente ciclo por otro cargo de elección (p.ej. gobernador o senador);
  5. `Out' = el ocupante se retiró o no fue repostulado por el partido;
  6. `Term-limited' = el ocupante estaba constitucionalmente impedido para aspirar a reelegirse consecutivamente;
  7. `Uyc' = el muicipio abandonó en el siguiente ciclo la elección popular de sus autoridades, nombrándolos según usos y costumbres;
  8. Un número de año = aún es prematuro conocer el estatus (y el año de la próxima elección).

En las categorías 3 en adelante, un sufijo puede estar presente:

  • El sufijo '-p-lost' indica que el partido perdió la elección subsecuente (o, para ocupantes electos por una coalición multi-partidista, que ninguno de esos partidos ganó o fue parte de la coalición ganadora).
  • El sufijo '-p-won' indica que el partido ganó la elección subsecuente (o, para ocupantes electos por una coalición multi-partidista, que uno de esos partidos ganó o que por lo menos uno fue parte de la coalición ganadora).

Back to top

Basic instructions to inspect data online:

You can open election returns in online spreadsheet form.

a. To use this feature, you must first log into a Google account. Then click the desired file's link, and confirm you wish a copy. A Google spreadsheet will open in your browser.

b. If you wish to manipulate the data (eg. re-sorting rows by year or keeping a subset of the observations only), or save the file to your hard drive, you must unlink the data from the repository. To do this type CTRL+A (ie., select all) then CTRL+SHIFT+V (ie., paste values only).

c. Linked data updates about every hour. If a refresh were needed sooner, erase the function in cell A1 and undo the change. Back to top

Sources

Work in progress

  • Fuente = iee/ife/ine indicates data obtained from the primary source, the state/federal election board's web site.
  • Fuente = tesis Melissa
  • Fuente = Magar 1994
  • Fuente = Mexico Electoral Banamex
  • Fuente = Toledo Patiño paper
  • Fuente = UAM Iztapalapa for older state races
  • Fuente = voz y voto

Acknowledgements

Eric Magar acknowledges financial support from the Asociación Mexicana de Cultura A.C., and is fully responsible for mistakes and shortcomings in the data and code.

Many students over the years have provided research assistance, retrieving and systematizing some of the information reported here.

Back to top

About

Recent Mexican Election Vote Returns

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages