Load data
setwd("~/Projects/Prosociality DG_Sai/EX3 cost benefit")
pilotResult <- read.csv("pilotResult_core.csv")
library(ggplot2)
Describe MU shared and number of prosocial actors
normalMan <- subset(pilotResult, pilotResult$Dictator_FinalValue >0)
aov_value = aov(Dictator_FinalValue~ConditionName,data=normalMan)
print(model.tables(aov_value,"means"),digits=3)
## Tables of means
## Grand mean
##
## 39.31
##
## ConditionName
## boost control penalty
## 31.2 45 42.8
## rep 152.0 151 109.0
Number of rational actors
rationalMan <- subset(pilotResult, pilotResult$Dictator_FinalValue == 0)
aov_value = aov(Dictator_FinalValue~ConditionName,data=rationalMan)
print(model.tables(aov_value,"means"),digits=3)
## Tables of means
## Grand mean
##
## 0
##
## ConditionName
## boost control penalty
## 0 0 0
## rep 41 45 75
logic regression: comparison of number of rational man among three conditions
logic_df = data.frame(Condition= c("boost3","1control1", "penalty3"), rational=c(41,45,75), normal=c(152,151,109))
glm.out = glm(cbind(rational, normal) ~ Condition, family=binomial(logit), data=logic_df)
summary(glm.out)
##
## Call:
## glm(formula = cbind(rational, normal) ~ Condition, family = binomial(logit),
## data = logic_df)
##
## Deviance Residuals:
## [1] 0 0 0
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.2106 0.1698 -7.13 1e-12 ***
## Conditionboost3 -0.0997 0.2446 -0.41 0.68355
## Conditionpenalty3 0.8368 0.2266 3.69 0.00022 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2.0992e+01 on 2 degrees of freedom
## Residual deviance: -7.3275e-15 on 0 degrees of freedom
## AIC: 22.34
##
## Number of Fisher Scoring iterations: 3
Figure 1: Number of rational actor and prosocial actor in baseline study
number <- read.csv("graphs table.csv")
bar <- ggplot(number, aes(Condition, Number.of.participants, fill = Choices))
bar + stat_summary(fun.y = mean, geom = "bar") + stat_summary(fun.data = mean_cl_normal, geom = "errorbar", width = 0.2) + facet_wrap(~Choices)+ labs(x = "Cost benefit conditions", y = "Number of participants", fill = "Choices")+ggtitle("Experiment 2")
Analysis on prosocial men
MU shared in cost benefit groups
model <- lm(Dictator_FinalValue ~ boost3 + penalty3, data = pilotResult[pilotResult$Dictator_FinalValue>0,], na.action = na.omit)
summary(model)
##
## Call:
## lm(formula = Dictator_FinalValue ~ boost3 + penalty3, data = pilotResult[pilotResult$Dictator_FinalValue >
## 0, ], na.action = na.omit)
##
## Residuals:
## Min 1Q Median 3Q Max
## -44.01 -6.15 1.85 4.99 68.85
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 45.01 1.62 27.76 < 2e-16 ***
## boost3 -13.86 2.29 -6.05 3.2e-09 ***
## penalty3 -2.23 2.50 -0.89 0.37
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.9 on 409 degrees of freedom
## Multiple R-squared: 0.0914, Adjusted R-squared: 0.087
## F-statistic: 20.6 on 2 and 409 DF, p-value: 3.05e-09
Figure 3: MU shared for prosocial actor
bar <- ggplot(normalMan, aes(ConditionName, Dictator_FinalValue))
bar + stat_summary(fun.y = mean, geom = "bar", fill= "White", colour = "Black")+ stat_summary(fun.data = mean_cl_normal, geom = "errorbar") + labs(x ="ConditionName", y = "MU shared")+ggtitle("Experiment 2")
MU shared distribution in three conditions
boost <- subset(pilotResult, pilotResult$ConditionName == "boost"& pilotResult$Dictator_FinalValue>0,)
penalty <- subset(pilotResult, pilotResult$ConditionName == "penalty"& pilotResult$Dictator_FinalValue>0,)
control <- subset(pilotResult, pilotResult$ConditionName == "control"& pilotResult$Dictator_FinalValue>0,)
hist(boost$Dictator_FinalValue, main="MU shared in boosted donation condition", xlab="MU shared", ylab="Participants number")
hist(penalty$Dictator_FinalValue,main="MU shared in penalized donation condition", xlab="MU shared", ylab="Participants number")
hist(control$Dictator_FinalValue, main="MU shared in unmodified donation condition", xlab="MU shared", ylab="Participants number")