Skip to content

Month: November 2012

Hedging the bets: The US election outcome in the Dutch press

This is a guest post by Markus Haverland, Professor at Erasmus University Rotterdam and author of a recent book on research methods. *** Causal knowledge about the world proceeds by testing hypotheses. The context of discovery precedes the context of justification. We all know that journalists and pundits often do it the other way around: providing for an explanation after the fact. A particularly hilarious example can be found in today’s issue of “Spits”, a Dutch daily newspaper. Anticipating that the result of the elections for the president of the US would arrive after the newspapers went to press, the newspaper prepared for both situations. It has turned the backpage into a second frontpage. Depending on the results the reader is advised to either read the frontpage or the backpage. On both pages the well-known  Dutch journalists, a former correspondent in Washington, Charles Groenhuijsen analyses the results. On the “Obama wins” page he explains that it was evident that Obama would win, because he is a better campaigner and Romney’s economic program is inconsistent. On the “Romney  wins”  page he explains this outcome, by stating that, ultimately, the US is a conservative country, that voters were afraid of a turn to the left, laws against gun possession, and tolerance towards gay marriage, and that voters thought he was not effectively dealing with the economic crisis.

Network visualization in R with the igraph package

In this post I showed a visualization of the organizational network of my department. Since several people asked for details how the plot has been produced, I will provide the code and some extensions below. The plot has been done entirely in R (2.14.01) with the help of the igraph package. It is a great package but I found the documentation somewhat difficult to use, so hopefully this post can be a helpful introduction to network visualization with R. Here we go: # Load the igraph package (install if needed) require(igraph) # Data format. The data is in ‘edges’ format meaning that each row records a relationship (edge) between two people (vertices). # Additional attributes can be included. Here is an example: # Supervisor Examiner Grade Spec(ialization) # AA BD 6 X # BD CA 8 Y # AA DE 7 Y # … … … … # In this anonymized example, we have data on co-supervision with additional information about grades and specialization. # It is also possible to have the data in a matrix form (see the igraph documentation for details) # Load the data. The data needs to be loaded as a table first: bsk<-read.table(“http://www.dimiter.eu/Data_files/edgesdata3.txt”, sep=’t’, dec=’,’, header=T)#specify the path, separator(tab, comma, …), decimal point symbol, etc. # Transform the table into the required graph format: bsk.network<-graph.data.frame(bsk, directed=F) #the ‘directed’ attribute specifies whether the edges are directed # or equivelent irrespective of the position (1st vs 2nd column). For directed graphs use ‘directed=T’ # Inspect the data:…