Home » from me to you

My Wahl-O-Mat Analysis of Germany’s political parties

14 September 2013 1,261 views No Comment

I know this off-topic on this Music Informatics website, but I couldn’t resist some data analysis on, yes!, Germans political parties. This is, of course, because general elections are looming. Where I got the data from? From the Wahl-o-mat website, run by an independent body whose mission is political awareness.

Here’s how it works. Wahl-o-mat have compiled a questionnaire of political statements which you can answer “agree”, “neutral”, “not agree” (in German) on-line. This will then be matched to the answers of 28 political parties (which the parties have officially given to Wahl-o-mat), and you get a score of which party you agree with most.

Crucially, after the exercise you can see the answers of all parties in clear text, and that’s the data I use. I simply entered all parties’ answers as 0, 1, 2 (from disagree to agree) into a data matrix such that every row corresponds to a party and every column corresponds to an answer. Then I did some standard PCA (principal component analysis, without standardisation), which essentially transforms the data into a different space, in which the dimensions are uncorrelated and ordered by their “importance” (maximum variance). In essence this means, the first few dimensions provide an approximate “position” of the parties. And I can plot them!

So that’s what I did: plot the first two dimensions of the PCA-transformed party answers. And what emerges is a landscape of parties. To add a bit of information I plotted the parties’ blobs with an area corresponding to the number of members of that party, which I got from Wikipedia. Also since the dimensions themselves are meaningless, I allowed myself some creativity and inverted the first dimension, which puts the parties in a more traditional left-to-right spectrum.

What is striking though is that the first dimension really does list the big parties in the order you’d expect: Linke, Piraten, Grüne, SPD, FDP, CDU/CSU! Well, it’s not quite a line, but a crescent. The left-wing parties really do cluster around Die Linke, for example the MLPD and Die Frauen. Quite exciting to see the right-wing extremists of NPD quite far away from pretty much everyone, except another right-wing party called pro Deutschland. Republikaner (REP) and Bayernpartei (BP) are in between those and the CDU/CSU. Interesting to see the closeness of the relatively new AfD to CDU/CSU as well.

So far the position of the parties. What came as a surprise to me are the large differences in size between the parties. They range from half a million (SPD and CDU/CSU) to just a couple of hundred for the small parties. Well, I leave that uncommented. Hope you enjoyed the graphics.

Below are the R code and the data.

R code:

names <- c("CDU/CSU",
"SPD",
"FDP",
"DIE LINKE",
"GRÜNE",
"PIRATEN",
"NPD",
"Tierschutzpartei",
"REP",
"ÖDP",
"FAMILIE",
"Bündnis 21/RRP",
"RENTNER",
"BP",
"PBC",
"BüSo",
"DIE VIOLETTEN",
"MLPD",
"Volksabstimmung",
"PSG",
"AfD",
"BIG",
"pro Deutschland",
"DIE FRAUEN",
"FREIE WÄHLER",
"P. d. Nichtwähler",
"P. D. VERNUNFT",
"Die P.")
members <- c(
    472000 + 150000,
    474000,
    58700,
    63800,
    60000,
    31700,
    5400,
    1000,
    5500,
    5900,
    620,
    1200,
    350,
    6000,
    2800,
    1100,
    800,
    1900,
    500,
    260,
    16000,
    400,
    170,
    820,
    230,
    340,
    2000,
    8800
    )
# import data
answers <- t(read.csv('all.csv'))

# get principal components
pca_answers <- prcomp(answers, scale = F)

# plot
dim1 <- -pca_answers$x[,1]
dim2 <- pca_answers$x[,2]

png("party_plot.png", width=400, height=400)
par(bg = 'black', mar=c(0,0,0,0))
plot(dim1, dim2, cex=sqrt(members)/30, pch=20, 
    xlim=range(dim1) * c(1.2,1.4),
    ylim=range(dim2) * 1.2,
    col=rgb(0,.5,1,0.7))
points(dim1, dim2, pch=20, col = rgb(.8,.8,.8))
text(dim1, dim2, names, pos = 3, cex= 0.8, col = rgb(1,1,1,0.8), font = 2)
dev.off()

data file "all.csv":

0,2,0,2,2,2,2,2,0,2,2,2,2,0,2,2,2,2,2,2,0,2,2,2,0,1,0,2
2,0,1,0,0,0,2,0,2,2,2,0,0,2,2,2,2,0,2,0,0,0,1,0,0,0,0,0
0,0,0,2,2,1,0,2,0,2,2,0,0,0,0,0,2,2,1,2,0,0,0,2,0,1,0,0
2,2,2,2,2,2,0,2,0,2,2,2,2,0,2,0,2,1,2,0,0,2,0,1,2,2,0,2
0,2,0,2,1,1,2,2,0,0,2,2,2,2,2,0,2,1,2,2,0,2,2,2,2,2,0,2
2,1,0,0,0,0,1,0,2,0,2,2,2,0,2,0,0,0,2,0,0,0,2,1,2,1,0,0
0,0,0,1,1,2,0,2,0,0,0,0,0,0,0,0,2,1,0,2,0,2,0,1,0,1,0,2
0,1,0,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