in Elections, English, Turkish Politics, Visualization

Vote Transitions in Turkish General Elections (2011-2015)

Vote Transitions in Turkish General Elections (2011-2015)

Vote Transitions in Turkish General Elections (2011-2015)

**EDIT** : Ran the analysis on district (ilce) level data and updated the transition diagram accordingly.

In this project I collect election results data and analyze vote transitions in Turkish general elections.

On the right, you see inter-party vote transitions in Turkish General Elections (2011-2015) estimated by exploiting province-level district-level election results. To read more on the technique used for ecological inference see Andreadis et al., and to get the exact transition values you can mouse-over the links in the interactive Sankey diagram at the bottom of this post.

The codes and the data used in this project are available on gitHub.

Data Collection

Province Level

Interestingly enough, I could not find a public XLS, CSV or JSON file of the election results, and I still think there was none on the web till I publish mine on around 11.59pm on June 8th, i.e. the day after the elections held (I asked for a dataset by tweeting but there were no positive responses). So, I attempted to collect it. Both Kimono and failed me (once again). Luckily enough, I found an online newspaper (Yenisafak) webpage that lists all the province level vote shares of the election results,.

According to github commit time-stamps it took about an hour for me to get the results into a CSV and share it with the world:TR2015.csv (and the code:

Then, I found a hidden gem (was hidden to me at least !), a great dataset of past Turkish elections on Gunes Murat Tezcur’s website. I downloaded the dataset TEPLWeb.xlsx , opened in MS Excel and saved it as CSV without having a single modification on the original file.

District Level

Indeed, 81 records/provinces for the vote transition analysis is not good when we high heterogeneity among districts. For example, Istanbul has districts such as Kadikoy and Sultanbeyli whose voting behaviors are extremely different: While CHP got 58% of the votes in Kadikoy, it was AKP with 57% vote share who won at the latter district (Respectively, HDP got 10% and 20% of the votes in these two districts).

So, I collected the district-level 2015 election results from website and all that is now available here as CSV. And to be able to compare this results with the past elections, I needed district-level results of 2011, thankfully, Mert Nuhoglu had posted it on gitHub not long time ago. One big issue hindering the analysis was the mismatching district names. I had to identify and take care of the districts whose names have been changed (and the mismatches due to typos) in the last four years:

# 2011 ile 2015 arasinda ismi degisen ilceler
df11 = df11.apply(lambda x: x.replace('Merkez',kodil[]),axis=1)
df11 = df11.replace('Didim (Yenihisar)','Didim')
df11 = df11.replace('Devrakani','Devrekani')
df11 = df11.replace('Aydın','Efeler')
df11 = df11.replace('Denizli','Merkezefendi')
df11 = df11.replace('Mardin','Artuklu')
df11 = df11.replace('Aydınlar','Tillo')
df11 = df11.replace('Trabzon','Ortahisar')
df11 = df11.replace('Akköy','Pamukkale')
df11 = df11.replace('Ordu','Altınordu')
df11 = df11.replace('Bahşılı','Bahşili')
df11 = df11.replace('Mihalıçcık','Mihalıççık')
df11 = df11.replace('Samandağı','Samandağ')
df11 = df11.replace('Muğla','Menteşe')
df15 = df15.replace('19.May','19 Mayıs')

# iki veya daha cok parcaya bolunen ilceler
df11 = ilce_updater(df11,df15,'Van',['İpekyolu','Tuşba'])
df11 = ilce_updater(df11,df15,'Balıkesir',['Altıeylül','Karesi'])
df11 = ilce_updater(df11,df15,'Hatay',['Antakya', 'Arsuz', 'Defne', 'Payas'])
df11 = ilce_updater(df11,df15,'Kahramanmaraş',['Dulkadiroğlu', 'Onikişubat'])
df11 = ilce_updater(df11,df15,'Manisa',['Şehzadeler', 'Yunusemre'])
df11 = ilce_updater(df11,df15,'Tekirdağ',['Ergene', 'Kapaklı', 'Süleymanpaşa'])
df11 = ilce_updater(df11,df15,'Şanlıurfa',['Eyyübiye','Haliliye', 'Karaköprü'])
df11 = ilce_updater(df11,df15,'Zonguldak',['Zonguldak','Kilimli', 'Kozlu'])
df11 = ilce_updater(df11,df15,'Fethiye',['Fethiye','Seydikemer'])

# 2011'de olup 2015'te olmayip (veya tersi) analize dahil edilmeyen ilceler
df11[~df11['ilce'].isin(df15['ilce'])]['ilce'].unique() #'Kargı'
df15[~df15['ilce'].isin(df11['ilce'])]['ilce'].unique() #['Bahçelievler', 'Fatih', 'Malatya']

Finally, got the all 2011-2015 districts combined CSV ready for analysis.

Parties-2015 Compared with 2011-Self

I first created matplotlib plots with ggplot style (see the original charts here). But noticed that some cities got too much clustered in some places that makes hard if not impossible to explore (e.g. HDP got less than 20% vote share in too many cities). So, I created interactive plotly graphs where you can zoom in-out the charts and view them in full-screen, and colored the cities based on their geographic regions. Click on the legend to hide/show the cities in particular regions. This feature enables one to easily view the voting pattern changes at regional level. For example, you’ll notice that AKP lost a great amount of its vote shares from the cities in Eastern and South Eastern regions of the country (see that by clicking & re-clicking on the region names in the legend).

Vote Transitions

I used an algorithm that estimates the vote transitions in multi-party settings using a recursive method (developed by Andreadis). Here you can find the code and the results in HTML, generated by R (Knitr). To visualize this data nicely (similar but not as polished as Cilek Agaci’s prior work), I did a quick search for Sankey Diagram drawers. Among several attempts, I found Google’s to be the most stylish and developer friendly (first tried a D3 based Sankey diagram generator but it did not work for me). Finally thankfully, JSFiddle helped me embed this JavaScript in a WP post:

And here now here is the entire vote share (absolute point) transitions contingency table.

**UPDATE**: Comparing the results of province-level and district-level regarding to the source of new HDP votes, votes from AKP decreased by 0.80% (to 4%) and CHP increased by  0.63% (to 1.46%) when we did the analysis at a higher granularity (i.e. district-level).

Having town-level data if not ballot box-level would lead to more accurate results (i.e. higher confidence). Though I’m not sure how reliable it is, the result suggest what Erik Meyersson found in his analysis, as he put in his blog post:

Much of the boost to HDP’s political clout instead seem to be coming from former AKP voters…