Update February 5, 2018
In March 2017, I posted a graph which shows how the AfD’s Facebook posts moved away from euroscepticism and Greece-bashing towards immigration and Islamophobia.
But trends can change, and local regression smoothers have a habit of behaving strangely at the borders. So I downloaded another year’s worth of Facebook posts and reran the scripts:
Somewhat unsurprisingly, the new graph confirms for 2017 what we have seen for 2016: Muslims and immigrants are all the rage, whereas the Euro crisis is so 2014. I leave the old graph/post below as is for comparison.
Almost exactly four years ago, the “Alternative für Deutschland” party (AfD) began its life as a moderately eurosceptic outfit that brought together right-wingers of various stripes. Even back in 2014, the party did not qualify as radical right-wing populist. Quite to the contrary: The leadership went to great lengths to present a “civic” front of professors, business persons, and concerned citizens. However, their 2015 de facto split was a critical juncture in the young party’s history. The part’s most prominent face, economist and former CDU member Bernd Lucke, and many of his supporters left the party.
The AfD’s central command is very active on Facebook, and so a quantitative analysis of their posts is a reasonable means for tracking their ideological trajectory. For a presentation I gave last week, I have updated and somewhat streamlined my 2015 analysis of their social media activities. I’m only looking at posts by the AfD on their own (federal) fan page. Over the last four years, the party has accumulated no less than 3482 of them. Their text is lightly normalised and stemmed, and I’m looking for substrings pertaining to four issues: Europe and the Euro, Greece, Islam/Muslims, and Migration/Refugees. Obviously, a post can refer to two or more of these issues, so the numbers may sum up to more than 100%. The result is this:
It’s quite clear that in 2013 and early 2014 (think European elections), a large chunk of their posts made reference to the Euro, the EU, and so forth. In the first half of 2015, Greece (remember the long nights and that funny finance minister) and Euroscepticism were back on the agenda. But when the economic liberals left the AfD around June and the refugees emerged as a dominant issue in European politics later that year, Greece was forgotten. In 2016, the AfD was all about migrants, refugees, and Muslims. I really need to find the time to dig deeper into this.
Update May 14, 2018
Last weekend, this post created a bit of a stir on twitter, partly for the wrong reasons:
I never realised that the default colours in ggplot2 are inaccessible. After some playing with
RColorBrewer et al., I found a palette in
ggthemes that claims to be accessible and has reasonable contrast for me (I personally struggle with viridis’ brigth yellow on white). So by simply adding
+ scale_color_colorblind(), this graph hopefully becomes a little better:
Another issue with the issue graph that people spotted is this:
<<dons anorack>> how sensitive is this to your smoothing parameters, ie could the data really reject the view that the underlying time series processes has remained the same
— Amanda Gosling (@AmandaGosling3) May 13, 2018
Again, fair point: I’m doing some slick smoothing here, again using ggplot2’s defaults. What could possibly go wrong? One common problem with smoothing is over-smoothing: you fill the black box with some random zig-zag, and the output is a wonderfully clean line. In this application, however, that would be conservative: overs-smoothing would underestimate any real change. Another problem with smoothers is that they do not work well at the left and the right margin of a distribution. Intuitively, smoothers pick up local trends, i.e. they replace a point by a weighted average of the data in its neighbourhood. At the margins, this neighbourhood gets smaller and smaller, and also single-sided: there are no data before March 2013 or after December 2017.
Could this mean that the AfD’s attention to the four issues at hand – migration, Islam, Greece, and everything Euro* – is constant, and that the apparent movement is the result of some random variation at the margins that is over-emphasised by the smoother? A simple approach to this question is to use a very pedestrian, less black-boxy “smoother”. So I aggregated the daily data by years and got this:
Each point represents a year worth of daily posts, and as you can see, the year-to-year differences are too big to be the result of random fluctuation. One could formally test this assertion with e.g. a linear regression that has a dummy term for pre-/post the 2015 party conference, but the findings are really clear.
Nonetheless, it’s certainly worth to have a look ggplot2’s defaults. As far as smoothers are concerned, I was socialised in a world were there was LOESS/LOWESS, and not much else, which essentially works by running very many local linear regressions. LOESS is the default in ggplot2’s
geom_smooth(), but if you have more than 1,000 observations (as I do), ggplot2 switches to an alternative – cubic spline regression. Smoothing splines make for lovely curves, but they are known to get too squiggly, i.e. exaggerate local trends. So I re-run the whole thing with the LOESS smoother and requested confidence intervals (as it turns out, even with several thousand observations that is hardly a burden on a modern CPU). For good measure, I also re-run the original plot with confidence intervals overlaid.
As it turns out, the results are broadly similar. As expected, LOESS (with the default span of 0.75) is more sensitive to values at the margins. LOESS also smoothes away more of the smaller fluctuations. This is most obvious for migration. But importantly, both plots agree that attention to the Euro* issues was significantly higher in 2013/2014 than it was later, and that Islam and migration were non-issue until 2015. However you look at it: the AfD’s profile has changed considerably.