Skip to content

Instantly share code, notes, and snippets.

@hrpunio
Created October 26, 2011 14:49
Show Gist options
  • Save hrpunio/1316567 to your computer and use it in GitHub Desktop.
Save hrpunio/1316567 to your computer and use it in GitHub Desktop.
# Corrupt countries were more likely to support the OOXML document format
# Kirjoittaja: Kai Puolamäki, Syyskuu 5, 2007 - 08:22.
# http://www.effi.org/blog/kai-2007-09-05.en.html
#
# Read in the data table:
B <- read.csv("http://www.effi.org/system/files?file=ooballot_0.txt")
# CPI indices of the countries that voted for approval:
capp <- B[!is.na(B[,"CPI"]) & (B[,"Vote"]=="Approval" |
B[,"Vote"]=="Approval with comments"),"CPI"]
# CPI indices of the countries that voted for disapproval:
cdis <- B[!is.na(B[,"CPI"]) & B[,"Vote"]=="Disapproval","CPI"]
# Is there a relation between the CPI index and voting behaviour of a country?
wilcox.test(capp,cdis)
# W = 281.5, p-value = 0.01944
# Make a nice figure of the result, containing votes of all national bodies
# (except Fiji which has no CPI index):
x <- matrix(c(table(factor(floor(capp),levels=2:9)),
table(factor(floor(cdis),levels=2:9))),
nrow=2,ncol=8,byrow=TRUE,
dimnames=list(c("approval","disapproval"),2:9));
barplot(x, main='"18 negative votes out of 69"',
xlab="lots of corruption - CPI - little corruption",
ylab="national body votes (except Fiji)",
legend.text=c("approval","disapproval"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment