The second round of group games ended last night (sadly with Sweden’s elimination). Here is what the last number of days has done to the plots.

# Category Archives: Football

# Visualizing Euro 2012: First Group Games

Now that every team has played a match it will be interesting to see how this has affected the (inverse) odds of victory. Since the plot in my last post was a bit ‘busy’, I have decided to use the facet_wrap function in gglplot2 to stratify by group.

Also, re-producing the ‘busy’ plot from the last post yields the following.

Germany, despite not playing well, has gained, while the Netherlands, despite playing quite well, have declined. These two countries will play each other in the next round, so it will be interesting to see how a victory for the Netherlands would change these graphics.

Data and code:

# after loading data as object called eur n <- dim(eur)[1] eur <- t(eur[1:n,]) dat <- NULL for(i in 1:n){dat <- data.frame(rbind(dat,cbind(eur[-1,i],names(eur[-1,i]),i)))} dat$V1 <- 1/as.numeric(as.character(dat$V1)) dat$V3 <- as.character(dat$V2) dat$V3[dat$i!=n] <- c("") dat$group <- ifelse(dat$V2 %in% c("RUS","GRE","POL","CZE"),"Group.A","Group.D") dat$group <- ifelse(dat$V2 %in% c("GER","NED","POR","DEN"),"Group.B",dat$group) dat$group <- ifelse(dat$V2 %in% c("IRL","CRO","ITA","ESP"),"Group.C",dat$group) dat$i <- as.numeric(as.character(dat$i)) ggplot(dat, aes(x=i, y=V1, colour = V2, group=V2, label=V3)) + geom_line(size=0.8) + geom_point(size=4, shape=21, fill="white") + #theme_bw() + geom_text(hjust=-0.3, vjust=0) + scale_x_continuous('Day',limits=c(1,(n+0.4)),breaks=1:n) + scale_y_continuous('1/Odds') + theme_bw() + opts(title = expression("Euro 2012, Inverse Odds of Victory"), legend.position=c(80,80)) ggplot(dat, aes(x=i, y=V1, colour = V2, group=V2, label=V3)) + geom_line(size=0.8) + geom_point(size=4, shape=21, fill="white") + #theme_bw() + geom_text(hjust=-0.3, vjust=0.4) + scale_x_continuous('Day',limits=c(1,(n+0.8)),breaks=1:n) + scale_y_continuous('1/Odds') + facet_wrap( ~ group, ncol = 2, scales="free_y") + theme_bw() + opts(title = expression("Euro 2012, Inverse Odds of Victory"), legend.position=c(80,80))

# Visualizing Euro 2012 with ggplot2

After scanning this paper by Zeileis, Leitner & Hornik, I thought it would be interesting to see how the victory odds for each team changes as Euro 2012 progresses. To do this, I am going to collect the daily inverse odds of a tournament victory offered by a popular betting site for each team.

Here is the first plot. Day one corresponds to the pretournament odds as given in the aforementioned paper for the popular betting site. These odds were obtained on the 9th of May, while day two’s odds were collected this morning.

I’ll update this in a week.