Is the German market 'nervous' before federal elections?

Get the German market data (DAX index) from this website. The DAX (Deutscher Aktien IndeX) is a stock market index of 30 major German companies trading in Frankfurt.

Load and reformate:

library(zoo)
## Attaching package: 'zoo'
## The following object(s) are masked from 'package:base':
## 
## as.Date, as.Date.numeric
setwd("~/Downloads/")
dax <- read.csv("wkn_846900_historic.csv", sep = ";")
dax$Datum <- as.Date(dax$Datum, format = "%Y-%m-%d")

Federal election dates:

elections <- as.Date(c("1994-10-16", "1998-09-27", "2002-09-22", "2005-09-18", 
    "2009-09-27"), format = "%Y-%m-%d")

Compute rolling variance:

dax <- zoo(dax$Schlusskurs, order.by = dax$Datum)
syn <- zoo(x = NA, seq(from = as.Date("2013-01-27", format = "%Y-%m-%d"), to = as.Date("1992-03-02", 
    format = "%Y-%m-%d"), by = -1))
dax <- cbind(syn, dax)
dax$syn <- NULL
rolvar <- rollapply(dax, width = 7, sd, na.rm = T)

Plot it:

par(mar = c(4, 4, 0.2, 0.2), oma = c(0, 0, 0, 0), mfrow = c(2, 1))
plot(index(dax), as.numeric(dax), type = "l", xlab = "Date", ylab = "German DAX")
abline(v = elections, col = "red")
plot(index(rolvar), as.numeric(rolvar), type = "l", xlab = "Date", ylab = "rolling variance (7 days)")
abline(v = elections, col = "red")

plot of chunk unnamed-chunk-4

Zoom in. DAX volatiliy 100 days before and after a federal elections (red line).

par(mar = c(4, 4, 0.2, 0.2), oma = c(0, 0, 0, 0), mfrow = c(2, 3))
for (i in 1:5) {
    plot(index(rolvar), as.numeric(rolvar), type = "l", xlab = "Date", ylab = "rolling variance (7 days)", 
        xlim = c(elections[i] - 100, elections[i] + 100))
    abline(v = elections, col = "red")
    text(elections[i] - 70, 380, paste("Election in\n", format(elections[i], 
        format = "%Y")), cex = 1.5)
}

plot of chunk unnamed-chunk-5

Apparently, the volaitiy of the DAX increased over time but there is no sign that markets are generally more nervous before federal elections.