################################################################################### # Replication file for "Experimental evidence for a pure collaboration effect" # # author: Mary McGrath (mary.mcgrath@northwestern.edu) ORCID: 0000-0002-8437-4039 # # created: 10/25/2018 R version 3.3.2 # ################################################################################### library(foreign) library(sandwich) library(pwr) setwd("[insert directory where you've saved the datasets]") dat<-read.dta("Collab_3-5.dta") ## Proportion who give ## #Experiment 1 Exp <-dat[dat$rd==3,] #percent who give, separately-working pctgS<-mean(Exp$gave[Exp$Collab==0], na.rm=T)*100 round(pctgS,1) #percent who give, collaboratively-working pctgC<-mean(Exp$gave[Exp$Collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$gave,Exp$Collab), correct=F)) #z round(sqrt(result$statistic["X-squared"]),2) #Cohen's h h<-2*(asin(sqrt(mean(Exp$gave[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(Exp$gave[Exp$Collab==0], na.rm=T)))) round(h,3) #Experiment 2 Exp <-dat[dat$rd==4,] #percent who give, separately-working pctgS<-mean(Exp$gave[Exp$Collab==0], na.rm=T)*100 round(pctgS,1) #percent who give, collaboratively-working pctgC<-mean(Exp$gave[Exp$Collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$gave,Exp$Collab), correct=F)) #z round(sqrt(result$statistic["X-squared"]),2) #Cohen's h h<-2*(asin(sqrt(mean(Exp$gave[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(Exp$gave[Exp$Collab==0], na.rm=T)))) round(h,3) #Experiment 3 Exp <-dat[dat$rd==5,] #percent who give, separately-working pctgS<-mean(Exp$gave[Exp$Collab==0], na.rm=T)*100 round(pctgS,1) #percent who give, collaboratively-working pctgC<-mean(Exp$gave[Exp$Collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$gave,Exp$Collab), correct=F)) #z round(sqrt(result$statistic["X-squared"]),2) #Cohen's h h<-2*(asin(sqrt(mean(Exp$gave[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(Exp$gave[Exp$Collab==0], na.rm=T)))) round(h,3) ## Proportion who split vs. $0 ## #Experiment 1 Exp <-dat[dat$rd==3,] #percent who split, separately-working pctgS<-mean(Exp$half[Exp$Collab==0], na.rm=T)*100 round(pctgS,1) #percent who split, collaboratively-working pctgC<-mean(Exp$half[Exp$Collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$half,Exp$Collab), correct=F)) #z round(sqrt(result$statistic["X-squared"]),2) #Cohen's h h<-2*(asin(sqrt(mean(Exp$half[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(Exp$half[Exp$Collab==0], na.rm=T)))) round(h,3) #Experiment 2 Exp <-dat[dat$rd==4,] #percent who split, separately-working pctgS<-mean(Exp$half[Exp$Collab==0], na.rm=T)*100 round(pctgS,1) #percent who split, collaboratively-working pctgC<-mean(Exp$half[Exp$Collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$half,Exp$Collab), correct=F)) #z round(sqrt(result$statistic["X-squared"]),2) #Cohen's h h<-2*(asin(sqrt(mean(Exp$half[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(Exp$half[Exp$Collab==0], na.rm=T)))) round(h,3) #Experiment 3 Exp <-dat[dat$rd==5,] #percent who split, separately-working pctgS<-mean(Exp$half[Exp$Collab==0], na.rm=T)*100 round(pctgS,1) #percent who split, collaboratively-working pctgC<-mean(Exp$half[Exp$Collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$half,Exp$Collab), correct=F)) #z round(sqrt(result$statistic["X-squared"]),2) #Cohen's h h<-2*(asin(sqrt(mean(Exp$half[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(Exp$half[Exp$Collab==0], na.rm=T)))) round(h,3) ## Effort ## given<-dat$given Collab<-dat$Collab effdiff<-dat$effdiff*10 effdiff2<-(dat$effdiff*10)^2 effdiff3<-(dat$effdiff*10)^3 effdiff4<-(dat$effdiff*10)^4 rd<-dat$rd leveldiff<-dat$effdiff leveldiff[dat$eff_level=="(+) large"]<-(-25.03) leveldiff[dat$eff_level=="(+) small"]<-(-.03) leveldiff[dat$eff_level=="(-) small"]<-.03 leveldiff[dat$eff_level=="(-) large"]<-25.03 leveldiff[dat$rd!=3]<-NA data<-cbind(given,Collab,effdiff, effdiff2,effdiff3,effdiff4,rd, leveldiff) reg<-lm(given ~ Collab + effdiff + effdiff2 + as.factor(rd), data=dat) summary(reg) #Cohen's d, collaboration round(coef(reg)["Collab"]/sqrt(var(dat$given)),3) #Cohen's d, effort round(coef(reg)["effdiff"]/sqrt(var(dat$given)),3) reg<-lm(given ~ Collab + effdiff + Collab*effdiff + effdiff2 + as.factor(rd), data=dat) summary(reg) ## Affinity ## #within-subject change, before to after treatment round(mean(dat$affincrease, na.rm=T),2) round(sqrt(var(dat$affincrease, na.rm=T)),2) t.test(affincrease ~ Collab, data=dat) #Cohen's d round((mean(dat$affincrease[dat$Collab==1], na.rm=T) - mean(dat$affincrease[dat$Collab==0], na.rm=T))/sqrt(var(dat$affincrease, na.rm=T)),3) #replication, asking only after treatment dat2<-read.dta("Collab_affin_St12.dta") t.test(affinity ~ Collab, data=dat2) #Cohen's d round((mean(dat2$affinity[dat2$Collab==1], na.rm=T) - mean(dat2$affinity[dat2$Collab==0], na.rm=T))/sqrt(var(dat2$affinity, na.rm=T)),3) ## Primary Reason ## #relative to reciprocity debt<-rep(NA, length(dat$primary)) debt[dat$primary=="recipr"]<-0 debt[dat$primary=="debt"]<-1 z<-qnorm(1-(.05/2)) summary(reg<-lm(debt~dat$Collab)) rse<-sqrt(diag(vcovHC(reg, type="HC0"))) #lower CI round(reg$coeff[2] - z*rse[2],3) #upper CI round(reg$coeff[2] + z*rse[2],3) #Cohen's h round(2*(asin(sqrt(mean(debt[Exp$Collab==1], na.rm=T))) - asin(sqrt(mean(debt[Exp$Collab==0], na.rm=T)))),3) ## Experiment 4 ## Exp <- read.dta("Collab_Exp4.dta") #percent who give, separately-working pctgS<-mean(Exp$gave[Exp$collab==0], na.rm=T)*100 round(pctgS,1) #percent who give, collaboratively-working pctgC<-mean(Exp$gave[Exp$collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$gave,Exp$collab), correct=T)) #Cohen's h h<-2*(asin(sqrt(mean(Exp$gave[Exp$collab==1], na.rm=T))) - asin(sqrt(mean(Exp$gave[Exp$collab==0], na.rm=T)))) round(h,3) #percent who split, separately-working pctgS<-mean(Exp$half[Exp$collab==0], na.rm=T)*100 round(pctgS,1) #percent who split, collaboratively-working pctgC<-mean(Exp$half[Exp$collab==1], na.rm=T)*100 round(pctgC,1) #collaboration effect round(pctgC-pctgS,1) (result<-prop.test(table(Exp$half,Exp$collab), correct=T)) #Cohen's h h<-2*(asin(sqrt(mean(Exp$half[Exp$collab==1], na.rm=T))) - asin(sqrt(mean(Exp$half[Exp$collab==0], na.rm=T)))) round(h,3) ## Supplementary Information ## #Table S1 summary(lm(given ~ Collab + norm + Collab*norm + as.factor(rd), data=dat))