########################################### #Accompanying files for article Avoiding Paralysis: The Eastern Enlargement and the Council of the European Union #by M Parízek, MO Hosli, B Plechanovová #in Journal of European Integration 2015 (ahead-of-print), 1-17 ########################################### ##system setup - instaling libraries install.packages("foreign") install.packages("lmtest") install.packages("car") install.packages("data.table") install.packages("stargazer") install.packages("texreg") install.packages("sandwich") library(foreign) library(lmtest) library(car) library(data.table) library(stargazer) library(texreg) library(sandwich) ########################################### #read data, dataset will be called coreper inside R #### FILL OUT own working directory address!!! dir="DRIVER:/path/" #### setwd(dir) coreper<-read.table("parizek_etal_2015_avoiding_paralysis_data.txt", header=T, sep="\t", dec=".") ########################################### #variables description #"year" - year of transmission from Commission to Council of European Union #"transmission" - date of transmission from Commission to Council of European Union #"adoption" - date of adoption by Council #"monthnumber" - number of month of transmission from Commission to Council, using consecutive numbers from 1 (January 2000) to 96 (December 2007) #"nob" - number of B-points for a proposal #"onceb" - binary, scores 1 if proposal received at least one B-point (so nob>0) #"noa" - number of A-points for a proposal #"aplusb" - nob+noa #"nodays" - number of days between transmission and adoption #"case" - constant, only for aggregation #"directive" - binary variable, scores 1 for directives proposals #"regulation"- binary variable, scores 1 for regulation proposals #"decision"- binary variable, scores 1 for decision proposals #"comnumber" - EU Commission proposal ID number ########################################### #monthly aggregate of the data #subset cases with complete data for number of A-points and B-points coreper2<-subset(coreper, (coreper$aplusb!=0)) #coreper coreper2<-data.table(coreper2) #monthly aggregation coreperaggm<-coreper2[,list(nob=sum(nob), onceb=sum(onceb), noa=sum(noa), nodays=mean(nodays, na.rm=T), nodayssum=sum(nodays, na.rm=T), casesinmonth=sum(case), directive=sum(directive), regulation=sum(regulation), decision=sum(decision)), by=c("monthnumber")] #order by monthnumber (date of proposal transmission) corepers<- coreperaggm[order(monthnumber) , ] #create variable with index b/(a+b) corepers$boveraplusb<-corepers$nob/(corepers$noa+corepers$nob) ########################################### #regression models 1 to 5 reg1<-lm(onceb~monthnumber+casesinmonth, data=corepers) reg2<-lm(onceb~monthnumber+casesinmonth+noa+nodays, data=corepers) reg3<-lm(onceb~monthnumber+casesinmonth+noa+nodays+regulation+decision, data=corepers) reg4<-lm(boveraplusb~monthnumber+nodays, data=corepers) reg5<-lm(boveraplusb~monthnumber+nodays+regulation+decision, data=corepers) summary(reg1) summary(reg2) summary(reg3) summary(reg4) summary(reg5) #Calculate robust standard errors for models 1 to 5 reg1rse<-coeftest(reg1,vcovHC(reg1, type="HC0"))[,2] reg1rp<-coeftest(reg1,vcovHC(reg1, type="HC0"))[,4] reg2rse<-coeftest(reg2,vcovHC(reg2, type="HC0"))[,2] reg2rp<-coeftest(reg2,vcovHC(reg2, type="HC0"))[,4] reg3rse<-coeftest(reg3,vcovHC(reg3, type="HC0"))[,2] reg3rp<-coeftest(reg3,vcovHC(reg3, type="HC0"))[,4] reg4rse<-coeftest(reg4,vcovHC(reg4, type="HC0"))[,2] reg4rp<-coeftest(reg4,vcovHC(reg4, type="HC0"))[,4] reg5rse<-coeftest(reg5,vcovHC(reg5, type="HC0"))[,2] reg5rp<-coeftest(reg5,vcovHC(reg5, type="HC0"))[,4] coeftest(reg1,vcovHC(reg1, type="HC0")) coeftest(reg2,vcovHC(reg2, type="HC0")) coeftest(reg3,vcovHC(reg3, type="HC0")) coeftest(reg4,vcovHC(reg4, type="HC0")) coeftest(reg5,vcovHC(reg5, type="HC0")) ########################################### #subset of cases that lasted at least 500days, for models 6 and 7 coreper2s<-subset(coreper, (coreper$aplusb!=0 & coreper$nodays>500)) coreper2s<-data.table(coreper2s) #monthly aggregation coreperaggms<-coreper2s[,list(nob=sum(nob), onceb=sum(onceb), noa=sum(noa), nodays=mean(nodays, na.rm=T), nodayssum=sum(nodays, na.rm=T), casesinmonth=sum(case), directive=sum(directive), regulation=sum(regulation), decision=sum(decision)), by=c("monthnumber")] #order by monthnumber (date of proposal transmission) corepers2<- coreperaggms[order(monthnumber) , ] #create variable with index b/(a+b) corepers2$boveraplusb<-corepers2$nob/(corepers2$noa+corepers2$nob) ########################################### ####regression models 6 and 7 reg6<-lm(onceb~monthnumber+casesinmonth+noa+nodays+regulation+decision, data=corepers2) reg7<-lm(boveraplusb~monthnumber+nodays+regulation+decision, data=corepers2) summary(reg6) summary(reg7) #Calculate robust standard errors for models 6 and 7 reg6rse<-coeftest(reg6,vcovHC(reg6, type="HC0"))[,2] reg6rp<-coeftest(reg6,vcovHC(reg6, type="HC0"))[,4] reg7rse<-coeftest(reg7,vcovHC(reg7, type="HC0"))[,2] reg7rp<-coeftest(reg7,vcovHC(reg7, type="HC0"))[,4] coeftest(reg6,vcovHC(reg6, type="HC0")) coeftest(reg7,vcovHC(reg7, type="HC0")) ########################################### #Produce output - table in doc format, with robust standard errors reported htmlreg(list(reg1,reg2,reg3,reg4,reg5, reg6, reg7), file = "regression_results.doc", inline.css = FALSE, doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE, digits=4, stars = c(0.001, 0.01, 0.05, 0.1),symbol="'", override.se=list(c(reg1rse),c(reg2rse),c(reg3rse),c(reg4rse),c(reg5rse),c(reg6rse),c(reg7rse)), override.pval=list(c(reg1rp),c(reg2rp),c(reg3rp),c(reg4rp),c(reg5rp),c(reg6rp),c(reg7rp)), custom.coef.names=c("Intercept", "Month of adoption", "Cases in month", "Number of A-points","Average length (days)","Regulation dummy", "Decision dummy"), custom.gof.names=c("R2", "Adj. R2", "N"), custom.model.names = c("Model 1 (b-positive)","Model 2 (b-positive)","Model 3 (b-positive)","Model 4 (b/(a+b))","Model 5 (b/(a+b))","Model 6 (b-positive)","Model 7 (b/(a+b))"), caption="Table" )