#Figure for Exp. 3 & 4 in "Collaboration induces debt-motivated altruism" setwd("[paste here the filepath where you saved EqOutcome.csv and take.csv]") z<-qnorm(1-(.05/2)) #pdf(file="Exp3-4_pts.pdf", width=7, height=7) # create an empty plot plot(NULL, xlim = c(0,2.5), ylim = c(-.12,.09), axes = F, xlab = NA, ylab = NA ) box() axis(side=2, at=seq(-.12,.12, by=.02)) mtext(side=2, "Cents Interchanged, Participant : Partner", line=3)#, cex=.85) lines(c(-.1,1.25),c(0,0), col="red") text(0.25,.0015, "equalizing amount\nExp. 3", xpd=T, cex=.85, pos=1, col="red") lines(c(1.25,2.6),c(-.1,-.1), col="red") text(2.25,-.098, "equalizing amount\nExp. 4", xpd=T, cex=.85, pos=1, col="red") text(.5, -.14, "Experiment 3", xpd=T, cex=1, font=2) text(.5, -.15, "Baseline Equality", xpd=T, cex=.8, font=2) text(2, -.14, "Experiment 4", xpd=T, cex=1, font=2) text(2, -.15, "Disadvantageous Inequality", xpd=T, cex=.8, font=2) ## Experiment 3 - from equality ## #Exp. 3 data dat<-read.csv("EqOutcome.csv") t.test(given ~ Collab, data=dat) #Ctl# Ctl<-dat$given[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# Trt<-dat$given[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.2 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, paste0("(n=",length(Ctl),")"), xpd=T, cex=.85, pos=4) j<-m+.5 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=4) text(j-.02, At-.008, paste0("(n=",length(Trt),")"), xpd=T, cex=.85, pos=4) ## Experiment 4 - disadvantageous inequality ## #Exp. 4 data dat<-read.csv("take.csv") t.test(given ~ Collab, data=dat) dat$taken<-dat$given*(-1) #amount recorded is actually amount TAKEN from partner #Ctl# Ctl<-dat$taken[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# Trt<-dat$taken[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<-1.7 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+.04, Ac-.005, "Separate", xpd=T, cex=.9, pos=2) text(j+.04, Ac-.011, paste0("(n=",length(Ctl),")"), xpd=T, cex=.85, pos=2) j<-m+.6 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-.009, paste0("(n=",length(Trt),")"), xpd=T, cex=.85, pos=2) #dev.off()