Mexican electoral quick count night with R

In Mexico the elections take place on a Sunday, and the official results are presented a week later.

Mexican electoral quick count night with R

February 4, 2020

In Mexico the elections take place on a Sunday, and the official results are presented a week later. To prevent unjustified victory claims during that period the electoral authority organizes a quick count the same night of the election. The quick count consists in selecting a random sample of the polling stations and estimating the percentage of votes in favor of each candidate. With highly competitive electoral processes the quick count has become very important, the rapidity and precision of its results auspicious an environment of trust, and it serves as a tool against fraud. In this application reproducibility is very important. On the scientific side, it is crucial to examine the veracity and robustness of the conclusions of the methodologies. However, in this case, reproducibility is more important still, as it helps to achieve transparency in the electoral procedure. Anyone can download the sample and compute the same results that were announced the night of the election. This transparency fosters trust in institutions and gives legitimacy to the outcome of the quick count. We believe that developing an R package with detailed vignettes made the procedure accessible for the public. The package also facilitated code development and estimation on the election night, when the models were run with partial samples every five minutes, for three different state elections and for the presidential election. Our models were one of 9 different approaches to do the estimation and yet our code is the only publicly available, we are championing for more openness on procedures by sharing our experience. As for the model we developed Bayesian hierarchical models that include demographic and geographic covariates, the purpose of the models is to reduce the biases associated to such covariates due to the fact that complete samples are rarely available to publish the results in a timely manner hence the results are announced using partial samples which have biases.


A 5-minute presentation in our Lightning Talks series

About the speaker

Maria Ortiz Mancera

I studied applied Mathematics at ITAM (Mexico), after working for two years in marketing research I moved to Ann Arbor to get a master degree in Statistics at the University of Michigan, with the support of a Fulbright scholarship. As a master student I received the Outstanding Applied Masters Student in Statistics Award (2012-2013) and a tuition waiver to attend the Summer Program for Survey Statisticians at the Institute of Social Research, where I also worked as research assistant with professor James Lepkowski. Upon completing my degree I returned to Mexico and joined Mexico's government agency for biodiversity where I do data analysis using R on a daily basis. I also work as lecturer in Statistics at ITAM's master's in Data Science. Finally, I am an active member of the Mexican R community, I am co-founder and co-organizer of R-Ladies Mexico City, we started in 2017 and we keep growing! I also volunteer in R events of the Mexican Bioinformatics Community.