#Figure 1 for "Collaboration induces debt-motivated altruism" setwd(" [set to where CollabMech.csv is saved] ") data<-read.csv("CollabMech.csv") z<-qnorm(1-(.05/2)) #pdf(file="Fig1_DoubAmt.pdf", width=9, height=6) # create an empty plot plot(NULL, xlim = c(0,4.1), ylim = c(.07,.231), axes = F, xlab = NA, ylab = NA ) box() ## Standard giving, Round 1 ## dat<-data[data$Exp==1, ] #No Doub - Ctl# Ctl<-dat$given[dat$matchgrant==0 & dat$Collab==0] length(Ctl) Ac<-mean(Ctl) Ac.se<-sqrt((var(Ctl)/length(Ctl))) Ac.l95<- Ac - z*Ac.se Ac.u95<- Ac + z*Ac.se #No Doub - Trt# Trt<-dat$given[dat$matchgrant==0 & dat$Collab==1] length(Trt) At<-mean(Trt) At.se<-sqrt((var(Trt)/length(Trt))) At.l95<- At - z*At.se At.u95<- At + z*At.se m<-0 j<-m k<-m-.3 points(j, Ac,pch=19) # add point estimates lines( c(j,j), c(Ac.u95, Ac.l95), lend=1) # add 95% confidence interval text(j-.02, Ac-.002, "Separate", xpd=T, cex=.9, pos=4) text(j-.02, Ac-.008, "(244)", xpd=T, cex=.85, pos=4) j<-m+.65 points(j, At,pch=19) # add point estimates lines( c(j,j), c(At.u95, At.l95),lend=1) # add 95% confidence interval text(j+.02, At-.002, "Collaborative", xpd=T, cex=.9, pos=2) text(j+.02, At-.008, "(280)", xpd=T, cex=.85, pos=2) SGCx<-j SGCy<-At text(j-.4, .22, "Standard\n giving", xpd=T, cex=.9) ## Double-amount ## #Double-amount - Ctl# Ctl<-dat$given[dat$matchgrant==1 & dat$Collab==0] length(Ctl) Ac<-mean(Ctl) Ac.se<-sqrt((var(Ctl)/length(Ctl))) Ac.l95<- Ac - z*Ac.se Ac.u95<- Ac + z*Ac.se #Double-amount - Trt# Trt<-dat$given[dat$matchgrant==1 & dat$Collab==1] length(Trt) At<-mean(Trt) At.se<-sqrt((var(Trt)/length(Trt))) At.l95<- At - z*At.se At.u95<- At + z*At.se m<-m+1 j<-m k<-m-.3 points(j, Ac,pch=19) # add point estimates lines( c(j,j), c(Ac.u95, Ac.l95), lend=1) # add 95% confidence interval text(j-.02, Ac-.002, "Separate", xpd=T, cex=.9, pos=4) text(j-.02, Ac-.008, "(272)", xpd=T, cex=.85, pos=4) j<-m+.66 points(j, At,pch=19) # add point estimates lines( c(j,j), c(At.u95, At.l95),lend=1) # add 95% confidence interval text(j+.02, At-.002, "Collaborative", xpd=T, cex=.9, pos=2) text(j+.02, At-.008, "(259)", xpd=T, cex=.85, pos=2) DGCx<-j DGCy<-At text(j-.4, .22, "Matching\n grant", xpd=T, cex=.9) lines(c(SGCx,DGCx), c(SGCy,DGCy), col="red", lty="dashed") points(SGCx,SGCy, pch=19) points(DGCx,DGCy, pch=19) text((m+SGCx)/2, .068, "Experiment 1", xpd=T, cex=1, font=2) #Round 2 dat<-data[data$Exp==2, ] ## No Doubling ## Ctl<-dat$given[dat$matchgrant==0 & dat$Collab==0] length(Ctl) Ac<-mean(Ctl) Ac.se<-sqrt((var(Ctl)/length(Ctl))) Ac.l95<- Ac - z*Ac.se Ac.u95<- Ac + z*Ac.se Trt<-dat$given[dat$matchgrant==0 & dat$Collab==1] length(Trt) At<-mean(Trt) At.se<-sqrt((var(Trt)/length(Trt))) At.l95<- At - z*At.se At.u95<- At + z*At.se m<-m+1.4 j<-m k<-m-.3 points(j, Ac,pch=19) # add point estimates lines( c(j,j), c(Ac.u95, Ac.l95), lend=1) # add 95% confidence interval text(j-.02, Ac-.002, "Separate", xpd=T, cex=.9, pos=4) text(j-.02, Ac-.008, "(274)", xpd=T, cex=.85, pos=4) j<-m+.65 points(j, At,pch=19) # add point estimates lines( c(j,j), c(At.u95, At.l95),lend=1) # add 95% confidence interval text(j+.02, At-.002, "Collaborative", xpd=T, cex=.9, pos=2) text(j+.02, At-.008, "(287)", xpd=T, cex=.85, pos=2) SGCx<-j SGCy<-At text(j-.4, .22, "Standard\n giving", xpd=T, cex=.9) ## Double-amount ## Ctl<-dat$given[dat$matchgrant==1 & dat$Collab==0] length(Ctl) Ac<-mean(Ctl) Ac.se<-sqrt((var(Ctl)/length(Ctl))) Ac.l95<- Ac - z*Ac.se Ac.u95<- Ac + z*Ac.se Trt<-dat$given[dat$matchgrant==1 & dat$Collab==1] length(Trt) At<-mean(Trt) At.se<-sqrt((var(Trt)/length(Trt))) At.l95<- At - z*At.se At.u95<- At + z*At.se m<-m+1 j<-m k<-m-.3 points(j, Ac,pch=19) # add point estimates lines( c(j,j), c(Ac.u95, Ac.l95), lend=1) # add 95% confidence interval text(j-.02, Ac-.002, "Separate", xpd=T, cex=.9, pos=4) text(j-.02, Ac-.008, "(295)", xpd=T, cex=.85, pos=4) j<-m+.66 points(j, At,pch=19) # add point estimates lines( c(j,j), c(At.u95, At.l95),lend=1) # add 95% confidence interval text(j+.02, At-.002, "Collaborative", xpd=T, cex=.9, pos=2) text(j+.02, At-.008, "(279)", xpd=T, cex=.85, pos=2) text(j-.4, .22, "Matching\n grant", xpd=T, cex=.9) DGCx<-j DGCy<-At lines(c(SGCx,DGCx), c(SGCy,DGCy), col="red", lty="dashed") points(SGCx,SGCy, pch=19) points(DGCx,DGCy, pch=19) text((m+SGCx)/2, .068, "Experiment 2", xpd=T, cex=1, font=2) # add axes and labels axis(side=2, at=seq(.05,.5, by=.05)) # add y axis mtext(side=2, "Cents Given to Partner (out of $.50)", line=2) #dev.off()