################################################################################### # Replication file for "Experimental evidence for a pure collaboration effect" # # Figure 1 # # author: Mary McGrath (mary.mcgrath@northwestern.edu) ORCID: 0000-0002-8437-4039 # # created: 10/25/2018 R version 3.3.2 # ################################################################################### library(foreign) library(grDevices) setwd("[insert directory where you've saved the datasets]") data<-read.dta("Collab_3-5.dta") pdf(file="Fig1.pdf", width=3.47, height=5.12, pointsize=7) par(mfrow=c(3,2), oma=c(1,3,0,0), mar=c(4,4,3,2)) ## Experiment 1 ## dat<-data[data$rd==3,] sep<-hist(dat$given[dat$Collab==0], breaks=20, plot=F) sep$counts sum(sep$counts) sep$density <- sep$counts/sum(sep$counts) plot(sep, freq=F, axes=F, ylim=c(0,1), col="black",xlab="Cents given to partner", ylab="Proportion of respondents", main=NA) text(.06, 341/498, round(341/498,2)) text(.31, 99/498, "0.20") #round(99/498,2)) ##typed out to retain second decimal 0 axis(side=1, at=c(0,.10,.25,.4,.50)) axis(side=2, at=seq(0,1,by=.25)) mtext(side=3, "Separate", line=-2) mtext(side=3, "N = 498", cex=.75,line=-3) mtext(side=2, "Experiment 1", line=5) collab<-hist(dat$given[dat$Collab==1], breaks=20, plot=F) collab$counts sum(collab$counts) collab$density <- collab$counts/sum(collab$counts) plot(collab, freq=F, axes=F, ylim=c(0,1), col="black",xlab="Cents given to partner", ylab=NA, main=NA) text(.06, 298/510, round(298/510,2)) text(.31, 150/510, round(150/510,2)) axis(side=1, at=c(0,.10,.25,.4,.50)) axis(side=2, at=seq(0,1,by=.25)) mtext(side=3, "Collaborative", line=-2) mtext(side=3, "N = 510", cex=.75,line=-3) ## Experiment 2## dat<-data[data$rd==4,] sep<-hist(dat$given[dat$Collab==0], breaks=20, plot=F) sep$counts sum(sep$counts) sep$density <- sep$counts/sum(sep$counts) plot(sep, freq=F, axes=F, ylim=c(0,1), col="black",xlab="Cents given to partner", ylab="Proportion of respondents", main=NA) text(.06, 300/516, round(300/516,2)) text(.31, 93/516, round(93/516,2)) axis(side=1, at=c(0,.10,.25,.4,.50)) axis(side=2, at=seq(0,1,by=.25)) mtext(side=3, "Separate", line=-2) mtext(side=3, "N = 516", cex=.75,line=-3) mtext(side=2, "Experiment 2", line=5) collab<-hist(dat$given[dat$Collab==1], breaks=20, plot=F) collab$counts sum(collab$counts) collab$density <- collab$counts/sum(collab$counts) plot(collab, freq=F, axes=F, ylim=c(0,1), col="black",xlab="Cents given to partner", ylab=NA, main=NA) text(.06, 212/539, round(212/539,2)) #round(213/539,2)) ##R counts one person who gave $.01 as giving $0, but I count them as having given text(.31, 194/539, round(194/539,2)) axis(side=1, at=c(0,.10,.25,.4,.50)) axis(side=2, at=seq(0,1,by=.25)) mtext(side=3, "Collaborative", line=-2) mtext(side=3, "N = 539", cex=.75,line=-3) ## Experiment 3## dat<-data[data$rd==5,] sep<-hist(dat$given[dat$Collab==0], breaks=20, plot=F) sep$counts sum(sep$counts) sep$density <- sep$counts/sum(sep$counts) plot(sep, freq=F, axes=F, ylim=c(0,1), col="black",xlab="Cents given to partner", ylab="Proportion of respondents", main=NA) text(.06, 256/569, round(256/569,2)) text(.31, 119/569, round(119/569,2)) axis(side=1, at=c(0,.10,.25,.4,.50)) axis(side=2, at=seq(0,1,by=.25)) mtext(side=3, "Separate", line=-2) mtext(side=3, "N = 569", cex=.75,line=-3) mtext(side=2, "Experiment 3", line=5) collab<-hist(dat$given[dat$Collab==1], breaks=20, plot=F) collab$counts sum(collab$counts) collab$density <- collab$counts/sum(collab$counts) plot(collab, freq=F, axes=F, ylim=c(0,1), col="black",xlab="Cents given to partner", ylab=NA, main=NA) text(.06, 200/566, round(200/566,2)) text(.31, 190/566, round(190/566,2)) axis(side=1, at=c(0,.10,.25,.4,.50)) axis(side=2, at=seq(0,1,by=.25)) mtext(side=3, "Collaborative", line=-2) mtext(side=3, "N = 566", cex=.75,line=-3) dev.off()