Skip to content
Analysis of vote transfer between two elections
Python
Branch: master
Clone or download
harelc Move to Frobenius norm on residuals (converges much faster), add perc…
…entage of votes correctly explained (in analyzed ballots).
Latest commit e7f059c Sep 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md Fixes, update readme, add sample result. Sep 20, 2019
analyze_linear_transfer.py Move to Frobenius norm on residuals (converges much faster), add perc… Sep 21, 2019
ballot21.csv Add initial code, three different methods to solve for least square r… Sep 20, 2019
ballot22.csv Add initial code, three different methods to solve for least square r… Sep 20, 2019
result.png Fixes, update readme, add sample result. Sep 20, 2019

README.md

elections-vote-transfer

Analysis of vote transfer between two elections

Harel Cain, September 2019

The code analyzes the ballot results for ~10,000 polling stations with the same identity (locale and polling station number) between the elections for the 21st and the 22nd knesset.

It assumes there is a linear transfer matrix $M$ such that $V_21 * M ~ V_22$.

It solves for the matrix M (argmin_M |V_21*M-V_22|) in one of three ways:

  1. Closed-form least linear squares. This way M is not constrained and may contain negative numbers as well as numbers > 1, also its columns don't sum up to 1.
  2. Non-negative least squares. This handles the non-negative constraint but still doesn't guarantee stochasity.
  3. Convex optimization with the SCS solver, with constraints on 0<M<1 and M.sum(axis=1) = 1.

There is an option of treating the non-participating voters as an additional party.

The motivation and idea came from Itamar Mushkin. See https://www.themarker.com/techblogs/ormigoldstein/BLOG-1.6567019.

The elections results are taken from https://votes21.bechirot.gov.il/ and https://votes22.bechirot.gov.il/ ( 20/09/2019 02:37 version).

You can’t perform that action at this time.