1 Results

1.1 Demographics

# demographics 
min(tdata$Age)
## [1] 18
max(tdata$Age)
## [1] 69
mean(tdata$Age)
## [1] 32.94167
sd(tdata$Age)
## [1] 12.80841

above we see: min age, max age, mean age, and sd of age.

# 1 = male, 2 = female, 3 = other
table(tdata$Sex)
## 
##  1  2 
## 46 74

1 = male, 2 = female.

# Data preparation

# reorder factor 
tdata$type_effect <- factor(tdata$type_effect, levels = c("similar", "diverse"))

# reorder factor 
tdata$target_cause <- factor(tdata$target_cause, levels = c("single", "multi"), 
                            labels = c("single-effect cause", "multiple-effects cause"))

# reorder factor 
tdata$target_effect <- factor(tdata$target_effect, levels = c("first", "second", "third"), 
                                     labels = c("first effect", "second effect", "third effect"))


# to create a chart, the data must be in long format and only contain the relevant dependent variables

# make a subset with only the relevant dvs 

tdata_sub <- subset(tdata, select = 1:6)

# recode dependent variables (to have values between 0 and 1)

tdata_sub$Value <- (tdata_sub$Value) * 0.01

2 Graphs

## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## Warning: `fun.y` is deprecated. Use `fun` instead.
## `fun.y` is deprecated. Use `fun` instead.
## `fun.y` is deprecated. Use `fun` instead.

A clear dilution effect. Effects seems to be robust against effect domains.

## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## Warning: `fun.y` is deprecated. Use `fun` instead.
## `fun.y` is deprecated. Use `fun` instead.
## `fun.y` is deprecated. Use `fun` instead.

Effect also occurs for all target effects.

3 Descriptive Stats

## : single-effect cause
## : similar
##       median         mean      SE.mean CI.mean.0.95          var      std.dev 
##   0.67500000   0.65933333   0.04692359   0.09596953   0.06605471   0.25701111 
##     coef.var 
##   0.38980452 
## ------------------------------------------------------------ 
## : multiple-effects cause
## : similar
##       median         mean      SE.mean CI.mean.0.95          var      std.dev 
##   0.38500000   0.49100000   0.04366105   0.08929688   0.05718862   0.23914142 
##     coef.var 
##   0.48704974 
## ------------------------------------------------------------ 
## : single-effect cause
## : diverse
##       median         mean      SE.mean CI.mean.0.95          var      std.dev 
##   0.78000000   0.78633333   0.03255935   0.06659134   0.03180333   0.17833489 
##     coef.var 
##   0.22679299 
## ------------------------------------------------------------ 
## : multiple-effects cause
## : diverse
##       median         mean      SE.mean CI.mean.0.95          var      std.dev 
##   0.49000000   0.56500000   0.04552062   0.09310011   0.06216379   0.24932668 
##     coef.var 
##   0.44128616

4 Statistical Test

# ANOVA 

library(afex)
## ************
## Welcome to afex. For support visit: http://afex.singmann.science/
## - Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
## - Methods for calculating p-values with mixed(): 'S', 'KR', 'LRT', and 'PB'
## - 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
## - NEWS: emmeans() for ANOVA models now uses model = 'multivariate' as default.
## - Get and set global package options with: afex_options()
## - Set orthogonal sum-to-zero contrasts globally: set_sum_contrasts()
## - For example analyses see: browseVignettes("afex")
## ************
## 
## Attache Paket: 'afex'
## Das folgende Objekt ist maskiert 'package:lme4':
## 
##     lmer
library(emmeans)

a1 <- aov_car(Value ~ target_cause*target_cause_color*type_effect*target_effect + Error(sID), tdata_sub)
## Converting to factor: target_cause_color
## Contrasts set to contr.sum for the following variables: target_cause, target_cause_color, type_effect, target_effect
a1
## Anova Table (Type 3 tests)
## 
## Response: Value
##                                                       Effect    df  MSE
## 1                                               target_cause 1, 96 0.05
## 2                                         target_cause_color 1, 96 0.05
## 3                                                type_effect 1, 96 0.05
## 4                                              target_effect 2, 96 0.05
## 5                            target_cause:target_cause_color 1, 96 0.05
## 6                                   target_cause:type_effect 1, 96 0.05
## 7                             target_cause_color:type_effect 1, 96 0.05
## 8                                 target_cause:target_effect 2, 96 0.05
## 9                           target_cause_color:target_effect 2, 96 0.05
## 10                                 type_effect:target_effect 2, 96 0.05
## 11               target_cause:target_cause_color:type_effect 1, 96 0.05
## 12             target_cause:target_cause_color:target_effect 2, 96 0.05
## 13                    target_cause:type_effect:target_effect 2, 96 0.05
## 14              target_cause_color:type_effect:target_effect 2, 96 0.05
## 15 target_cause:target_cause_color:type_effect:target_effect 2, 96 0.05
##            F  ges p.value
## 1  22.88 *** .192   <.001
## 2  14.89 *** .134   <.001
## 3     6.09 * .060    .015
## 4       0.71 .015    .494
## 5       2.33 .024    .130
## 6       0.42 .004    .517
## 7       0.26 .003    .610
## 8       0.08 .002    .924
## 9       0.66 .014    .519
## 10      0.21 .004    .815
## 11      2.30 .023    .132
## 12      0.59 .012    .556
## 13      1.03 .021    .361
## 14      1.77 .036    .176
## 15      0.34 .007    .709
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1

Main effect of target cause, as predicted by theory. Also a smaller main effect for type of effect (i.e., effect domains). Figures show that effect is a bit bitter for effects from the same domain. There also was a main effect target cause color, which was not predicted. However. The following graph checks this main effect:

g <- ggplot(tdata_sub, aes(x=target_cause, y=valueJitter, color = target_cause, fill = target_cause)) +
  guides(fill=FALSE)+
  facet_grid( ~ target_cause_color)+
  #ggtitle("Subjects' causal srength ratings") +
  scale_y_continuous(limits = c(-0.05, 1.05), breaks=seq(0, 1, 0.1), expand = c(0,0)) +
  scale_x_discrete(labels=c("single-effect \n cause", "common \n case")) +
  geom_violinhalf(position=position_dodge(1), alpha = 0.2, color = NA)+
  geom_point(position=position_jitterdodge(dodge.width=0.5), alpha = 0.2) +
  stat_summary(fun.y=mean, colour="black", geom="line", group = 1, size = 1.5, linetype = "solid", alpha = 1)+
  stat_summary(fun.data = mean_cl_boot, geom = "errorbar", width = 0, size = 1, position = position_dodge(width = 0.5), color = "black") +
  stat_summary(fun.y=mean, geom="point", color = "black", shape = 22, size = 4, group=1, alpha = 1, position = position_dodge(width = 0.5))+
  stat_summary(fun.y=median, geom="point", color = "black",  shape = 3, size = 4, group=1, alpha = 1, position = position_dodge(width = 0.5))+
  labs(x = "Target Cause", y = "Causal Strength Rating") +
  scale_color_manual(name = "Entity",values=c("#3182bd", "#fc9272"))+
  scale_fill_manual(name = "Entity",values=c("#3182bd", "#fc9272"))+
  theme(legend.position = "none")+
  myTheme
## Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
## "none")` instead.
## Warning: `fun.y` is deprecated. Use `fun` instead.
## `fun.y` is deprecated. Use `fun` instead.
## `fun.y` is deprecated. Use `fun` instead.
g

As can be seen, the effect was obtained because ratings tended to be higher in the “red” condition. What is important is that there are no significant interaction effects.

Test the dilution effects:

############### 
# a conditional analysis 

# Means for the different conditions

ls2 <- lsmeans(a1, c("target_cause"), by = "type_effect") # group means by between-condition
## NOTE: Results may be misleading due to involvement in interactions
ls2
## type_effect = similar:
##  target_cause           lsmean     SE df lower.CL upper.CL
##  single-effect cause     0.659 0.0407 96    0.578    0.740
##  multiple-effects cause  0.491 0.0407 96    0.410    0.572
## 
## type_effect = diverse:
##  target_cause           lsmean     SE df lower.CL upper.CL
##  single-effect cause     0.786 0.0407 96    0.705    0.867
##  multiple-effects cause  0.565 0.0407 96    0.484    0.646
## 
## Results are averaged over the levels of: target_cause_color, target_effect 
## Confidence level used: 0.95
# Tets

# simple main effects 

t1 <- pairs(ls2) # compares rep-measure differences separately for each between-factor level
t1
## type_effect = similar:
##  contrast                                         estimate     SE df t.ratio
##  (single-effect cause) - (multiple-effects cause)    0.168 0.0576 96   2.922
##  p.value
##   0.0043
## 
## type_effect = diverse:
##  contrast                                         estimate     SE df t.ratio
##  (single-effect cause) - (multiple-effects cause)    0.221 0.0576 96   3.842
##  p.value
##   0.0002
## 
## Results are averaged over the levels of: target_cause_color, target_effect
# interaction contrast 
pairs(pairs(ls2), by = NULL)
##  contrast                                                                                                               
##  ((single-effect cause) - (multiple-effects cause) similar) - ((single-effect cause) - (multiple-effects cause) diverse)
##  estimate     SE df t.ratio p.value
##    -0.053 0.0815 96  -0.651  0.5169
## 
## Results are averaged over the levels of: target_cause_color, target_effect
#test(pairs(pairs(ls2), by = NULL), joint = TRUE) # This reproduces the F-Value of the ANOVA interaction


#lsmip(a1, High_Strength_Component ~ variable) # lsemans can also produce graphs
# Get CIs for the effects

confint(t1)
## type_effect = similar:
##  contrast                                         estimate     SE df lower.CL
##  (single-effect cause) - (multiple-effects cause)    0.168 0.0576 96    0.054
##  upper.CL
##     0.283
## 
## type_effect = diverse:
##  contrast                                         estimate     SE df lower.CL
##  (single-effect cause) - (multiple-effects cause)    0.221 0.0576 96    0.107
##  upper.CL
##     0.336
## 
## Results are averaged over the levels of: target_cause_color, target_effect 
## Confidence level used: 0.95

Make difference plots:

# Plot the effect

# compute the confidence interval for the singular causation differences in each between-subject condition

# similar effects

t <- qt(0.975, 116, lower.tail = TRUE, log.p = FALSE)
#t

effect <- "Mdiff"
Mdiff <- 0.168
SE <- 0.0602
CI <- SE*t
CI_low <- Mdiff - CI
CI_up <- Mdiff + CI

Mdiff
## [1] 0.168
CI_low
## [1] 0.04876631
CI_up
## [1] 0.2872337
# Plot 

myTheme <- theme(plot.title = element_text(face="bold", size = 22),
        axis.title.x = element_text(face = "bold", size = 20),
        axis.title.y = element_text(face = "bold", size = 20),
        axis.text.x = element_text(size = 18, angle = 0), 
        axis.text.y = element_text(size = 25, angle = 0),
        legend.text = element_text(size = 18),
        legend.title = element_text(face = "bold", size = 18),
        strip.text.x = element_text(size = 18),
        #panel.grid.major = element_blank(), 
        #panel.grid.minor = element_blank(), 
        #panel.background = element_blank(), 
        axis.line.x = element_line(colour = "black"), 
        axis.line.y = element_line(colour = "black"),
        axis.text = element_text(colour ="black"), 
        axis.ticks = element_line(colour ="black"))

theme_set(theme_light(base_size = 30, base_family = "Poppins"))



barchart <- ggplot()+
  myTheme+
  #guides(fill=FALSE)+
  #facet_wrap(~Latency + SampleSize, ncol=2)+
  #ggtitle("Mean difference (95% CI)") +
  #coord_cartesian(ylim=c(-0.1,2)) + 
  scale_y_continuous(limits = c(-0.1, 0.5), breaks=seq(-0.1, 0.5, 0.1), expand = c(0,0)) +
  scale_x_discrete(labels=c("r")) +
  #annotate("rect", xmin=1.7, xmax=2.3, ymin=0.95, ymax=1.05, color="#31a354", fill = "white", size = 1) +
  #stat_summary(fun.y=mean, colour="grey20", geom="point", shape = 21, size = 3)+
  #stat_summary(fun.y = mean, geom = "bar", position = "dodge", colour = "black")+
  #stat_summary(fun.data = mean_cl_boot, geom = "errorbar", position = position_dodge(width = 0.90), width = 0.2) +
  #geom_jitter(width = 0.3, height = 0.02, alpha = 0.6, colour = "red") +
  #ggtitle("Means (95% bootstr. CIs)") +
  #theme(axis.text.x = element_text(size = 10, angle = 0, hjust = 0.5))+
  labs(x= "", y = "Mean difference") +
  #scale_color_manual(values=c("#005083",  "#f0b64d"))# +
  #scale_fill_manual(values=c("#969696",  "#969696"))
  #annotate("point", x = 1, y = 100, colour = "firebrick", size = 2)+
  #annotate(xmin = -Inf, xmax = Inf, ymin = 4.77-1.96*0.297, ymax = 4.77+1.96*0.297, geom = "rect", alpha = 0.2, fill = "firebrick")+
  #annotate(xmin = -Inf, xmax = Inf, ymin = 5.02-1.96*0.372, ymax = 5.02+1.96*0.372, geom = "rect", alpha = 0.2, fill = "blue")+
  #annotate(geom = "hline",yintercept = 100, y = 100, color = "red")+
  annotate("pointrange", x = 1, y = Mdiff, ymin = CI_low, ymax = CI_up, colour = "black", size = 1.5, shape = 24, fill = "darkgrey")+
  #annotate("pointrange", x = 2, y = 5.02, ymin = 5.02-1.96*0.372, ymax = 5.02+1.96*0.372, colour = "blue", size = 0.8, shape = 15)+
  #annotate("text", x = 0.5, y = 2.6, family = "Poppins", size = 6, color = "gray20", label = "Impfeffekt")+
  #geom_curve(aes(x = 0.5, y = 3, xend = 0.9, yend = 4),arrow = arrow(length = unit(0.03, "npc")),color = "gray20", curvature = +0.2)+
  #annotate("text", x = 1.8, y = 2.6, family = "Poppins", size = 6, color = "gray20", label = "Dosierungseffekt")+
  #geom_curve(aes(x = 1.8, y = 3, xend = 2, yend = 4),arrow = arrow(length = unit(0.03, "npc")),color = "gray20", curvature = +0.2)+
  annotate(geom = "hline",yintercept = 0, y = 0, color = "red", size = 1.2)+
  theme(plot.background = element_rect(
    fill = "white",
    colour = "black",
    size = 1
  ))
## Warning: Ignoring unknown aesthetics: y
barchart

#ggsave("delta_similar.svg",width=2.5,height=4)
#ggsave("delta_similar.pdf",width=2.5,height=4)
# compute the confidence interval for the singular causation differences in each between-subject condition

# different effects

t <- qt(0.975, 116, lower.tail = TRUE, log.p = FALSE)
#t

effect <- "Mdiff"
Mdiff <- 0.221
SE <- 0.0602
CI <- SE*t
CI_low <- Mdiff - CI
CI_up <- Mdiff + CI

Mdiff
## [1] 0.221
CI_low
## [1] 0.1017663
CI_up
## [1] 0.3402337
# Plot 

myTheme <- theme(plot.title = element_text(face="bold", size = 22),
        axis.title.x = element_text(face = "bold", size = 20),
        axis.title.y = element_text(face = "bold", size = 20),
        axis.text.x = element_text(size = 18, angle = 0), 
        axis.text.y = element_text(size = 25, angle = 0),
        legend.text = element_text(size = 18),
        legend.title = element_text(face = "bold", size = 18),
        strip.text.x = element_text(size = 18),
        #panel.grid.major = element_blank(), 
        #panel.grid.minor = element_blank(), 
        #panel.background = element_blank(), 
        axis.line.x = element_line(colour = "black"), 
        axis.line.y = element_line(colour = "black"),
        axis.text = element_text(colour ="black"), 
        axis.ticks = element_line(colour ="black"))

theme_set(theme_light(base_size = 30, base_family = "Poppins"))



barchart <- ggplot()+
  myTheme+
  #guides(fill=FALSE)+
  #facet_wrap(~Latency + SampleSize, ncol=2)+
  #ggtitle("Mean difference (95% CI)") +
  #coord_cartesian(ylim=c(-0.1,2)) + 
  scale_y_continuous(limits = c(-0.1, 0.5), breaks=seq(-0.1, 0.5, 0.1), expand = c(0,0)) +
  scale_x_discrete(labels=c("r")) +
  #annotate("rect", xmin=1.7, xmax=2.3, ymin=0.95, ymax=1.05, color="#31a354", fill = "white", size = 1) +
  #stat_summary(fun.y=mean, colour="grey20", geom="point", shape = 21, size = 3)+
  #stat_summary(fun.y = mean, geom = "bar", position = "dodge", colour = "black")+
  #stat_summary(fun.data = mean_cl_boot, geom = "errorbar", position = position_dodge(width = 0.90), width = 0.2) +
  #geom_jitter(width = 0.3, height = 0.02, alpha = 0.6, colour = "red") +
  #ggtitle("Means (95% bootstr. CIs)") +
  #theme(axis.text.x = element_text(size = 10, angle = 0, hjust = 0.5))+
  labs(x= "", y = "Mean difference") +
  #scale_color_manual(values=c("#005083",  "#f0b64d"))# +
  #scale_fill_manual(values=c("#969696",  "#969696"))
  #annotate("point", x = 1, y = 100, colour = "firebrick", size = 2)+
  #annotate(xmin = -Inf, xmax = Inf, ymin = 4.77-1.96*0.297, ymax = 4.77+1.96*0.297, geom = "rect", alpha = 0.2, fill = "firebrick")+
  #annotate(xmin = -Inf, xmax = Inf, ymin = 5.02-1.96*0.372, ymax = 5.02+1.96*0.372, geom = "rect", alpha = 0.2, fill = "blue")+
  #annotate(geom = "hline",yintercept = 100, y = 100, color = "red")+
  annotate("pointrange", x = 1, y = Mdiff, ymin = CI_low, ymax = CI_up, colour = "black", size = 1.5, shape = 24, fill = "darkgrey")+
  #annotate("pointrange", x = 2, y = 5.02, ymin = 5.02-1.96*0.372, ymax = 5.02+1.96*0.372, colour = "blue", size = 0.8, shape = 15)+
  #annotate("text", x = 0.5, y = 2.6, family = "Poppins", size = 6, color = "gray20", label = "Impfeffekt")+
  #geom_curve(aes(x = 0.5, y = 3, xend = 0.9, yend = 4),arrow = arrow(length = unit(0.03, "npc")),color = "gray20", curvature = +0.2)+
  #annotate("text", x = 1.8, y = 2.6, family = "Poppins", size = 6, color = "gray20", label = "Dosierungseffekt")+
  #geom_curve(aes(x = 1.8, y = 3, xend = 2, yend = 4),arrow = arrow(length = unit(0.03, "npc")),color = "gray20", curvature = +0.2)+
  annotate(geom = "hline",yintercept = 0, y = 0, color = "red", size = 1.2)+
  theme(plot.background = element_rect(
    fill = "white",
    colour = "black",
    size = 1
  ))
## Warning: Ignoring unknown aesthetics: y
barchart

#ggsave("delta_different.svg",width=2.5,height=4)
#ggsave("delta_different.pdf",width=2.5,height=4)
# Interaction 

t <- qt(0.975, 116, lower.tail = TRUE, log.p = FALSE)
#t

effect <- "Mdiff"
Mdiff <- 0.053 
SE <- 0.0851
CI <- SE*t
CI_low <- Mdiff - CI
CI_up <- Mdiff + CI

Mdiff
## [1] 0.053
CI_low
## [1] -0.1155513
CI_up
## [1] 0.2215513
# Plot 

myTheme <- theme(plot.title = element_text(face="bold", size = 22),
        axis.title.x = element_text(face = "bold", size = 20),
        axis.title.y = element_text(face = "bold", size = 20),
        axis.text.x = element_text(size = 18, angle = 0), 
        axis.text.y = element_text(size = 25, angle = 0),
        legend.text = element_text(size = 18),
        legend.title = element_text(face = "bold", size = 18),
        strip.text.x = element_text(size = 18),
        #panel.grid.major = element_blank(), 
        #panel.grid.minor = element_blank(), 
        #panel.background = element_blank(), 
        axis.line.x = element_line(colour = "black"), 
        axis.line.y = element_line(colour = "black"),
        axis.text = element_text(colour ="black"), 
        axis.ticks = element_line(colour ="black"))

theme_set(theme_light(base_size = 30, base_family = "Poppins"))



barchart <- ggplot()+
  myTheme+
  #guides(fill=FALSE)+
  #facet_wrap(~Latency + SampleSize, ncol=2)+
  #ggtitle("Mean difference (95% CI)") +
  #coord_cartesian(ylim=c(-0.1,2)) + 
  scale_y_continuous(limits = c(-0.2, 0.25), breaks=seq(-0.2, 0.25, 0.1), expand = c(0,0)) +
  scale_x_discrete(labels=c("r")) +
  #annotate("rect", xmin=1.7, xmax=2.3, ymin=0.95, ymax=1.05, color="#31a354", fill = "white", size = 1) +
  #stat_summary(fun.y=mean, colour="grey20", geom="point", shape = 21, size = 3)+
  #stat_summary(fun.y = mean, geom = "bar", position = "dodge", colour = "black")+
  #stat_summary(fun.data = mean_cl_boot, geom = "errorbar", position = position_dodge(width = 0.90), width = 0.2) +
  #geom_jitter(width = 0.3, height = 0.02, alpha = 0.6, colour = "red") +
  #ggtitle("Means (95% bootstr. CIs)") +
  #theme(axis.text.x = element_text(size = 10, angle = 0, hjust = 0.5))+
  labs(x= "", y = "Delta Mean difference") +
  #scale_color_manual(values=c("#005083",  "#f0b64d"))# +
  #scale_fill_manual(values=c("#969696",  "#969696"))
  #annotate("point", x = 1, y = 100, colour = "firebrick", size = 2)+
  #annotate(xmin = -Inf, xmax = Inf, ymin = 4.77-1.96*0.297, ymax = 4.77+1.96*0.297, geom = "rect", alpha = 0.2, fill = "firebrick")+
  #annotate(xmin = -Inf, xmax = Inf, ymin = 5.02-1.96*0.372, ymax = 5.02+1.96*0.372, geom = "rect", alpha = 0.2, fill = "blue")+
  #annotate(geom = "hline",yintercept = 100, y = 100, color = "red")+
  annotate("pointrange", x = 1, y = Mdiff, ymin = CI_low, ymax = CI_up, colour = "black", size = 1.5, shape = 23, fill = "darkgrey")+
  #annotate("pointrange", x = 2, y = 5.02, ymin = 5.02-1.96*0.372, ymax = 5.02+1.96*0.372, colour = "blue", size = 0.8, shape = 15)+
  #annotate("text", x = 0.5, y = 2.6, family = "Poppins", size = 6, color = "gray20", label = "Impfeffekt")+
  #geom_curve(aes(x = 0.5, y = 3, xend = 0.9, yend = 4),arrow = arrow(length = unit(0.03, "npc")),color = "gray20", curvature = +0.2)+
  #annotate("text", x = 1.8, y = 2.6, family = "Poppins", size = 6, color = "gray20", label = "Dosierungseffekt")+
  #geom_curve(aes(x = 1.8, y = 3, xend = 2, yend = 4),arrow = arrow(length = unit(0.03, "npc")),color = "gray20", curvature = +0.2)+
  annotate(geom = "hline",yintercept = 0, y = 0, color = "red", size = 1.2)+
  theme(plot.background = element_rect(
    fill = "white",
    colour = "black",
    size = 1
  ))
## Warning: Ignoring unknown aesthetics: y
barchart

#ggsave("interaction.svg",width=2.5,height=4)
#ggsave("interaction.pdf",width=2.5,height=4)

Compute Cohen’s ds.

library(dplyr) # for pipe operator
## 
## Attache Paket: 'dplyr'
## Das folgende Objekt ist maskiert 'package:nlme':
## 
##     collapse
## Die folgenden Objekte sind maskiert von 'package:data.table':
## 
##     between, first, last
## Die folgenden Objekte sind maskiert von 'package:pastecs':
## 
##     first, last
## Die folgenden Objekte sind maskiert von 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## Das folgende Objekt ist maskiert 'package:reshape':
## 
##     rename
## Die folgenden Objekte sind maskiert von 'package:stats':
## 
##     filter, lag
## Die folgenden Objekte sind maskiert von 'package:base':
## 
##     intersect, setdiff, setequal, union
# using the esc package because it gives SE of the ES directly
library(esc)



# condition: same domains

# subset for the four panels shown in the figure
same_domain <- subset(tdata_sub, type_effect == "similar")



m1 <- same_domain %>%
          filter(target_cause == "single-effect cause")%>%
          summarize(Mean1 = mean(Value))

sd1 <- same_domain %>%
          filter(target_cause == "single-effect cause")%>%
          summarize(SD1 = sd(Value))


m2 <- same_domain %>%
          filter(target_cause == "multiple-effects cause")%>%
          summarize(Mean2 = mean(Value))

sd2 <- same_domain %>%
          filter(target_cause == "multiple-effects cause")%>%
          summarize(SD2 = sd(Value))



esc_mean_sd(
  grp1m = m1[,1], grp1sd = sd1[,1], grp1n = 30,
  grp2m = m2[,1], grp2sd = sd2[,1], grp2n = 30,
  es.type = "d"
)
## 
## Effect Size Calculation for Meta Analysis
## 
##      Conversion: mean and sd to effect size d
##     Effect Size:   0.6781
##  Standard Error:   0.2655
##        Variance:   0.0705
##        Lower CI:   0.1577
##        Upper CI:   1.1985
##          Weight:  14.1847
# using the esc package because it gives SE of the ES directly
library(esc)


# condition: diff domains

diff_domain <- subset(tdata_sub, type_effect == "diverse")

m1 <- diff_domain %>%
          filter(target_cause == "single-effect cause")%>%
          summarize(Mean1 = mean(Value))

sd1 <- diff_domain %>%
          filter(target_cause == "single-effect cause")%>%
          summarize(SD1 = sd(Value))


m2 <- diff_domain %>%
          filter(target_cause == "multiple-effects cause")%>%
          summarize(Mean2 = mean(Value))

sd2 <- diff_domain %>%
          filter(target_cause == "multiple-effects cause")%>%
          summarize(SD2 = sd(Value))



esc_mean_sd(
  grp1m = m1[,1], grp1sd = sd1[,1], grp1n = 30,
  grp2m = m2[,1], grp2sd = sd2[,1], grp2n = 30,
  es.type = "d"
)
## 
## Effect Size Calculation for Meta Analysis
## 
##      Conversion: mean and sd to effect size d
##     Effect Size:   1.0211
##  Standard Error:   0.2745
##        Variance:   0.0754
##        Lower CI:   0.4831
##        Upper CI:   1.5591
##          Weight:  13.2704
# using the esc package because it gives SE of the ES directly
library(esc)


# condition: overall

m1 <- tdata_sub %>%
          filter(target_cause == "single-effect cause")%>%
          summarize(Mean1 = mean(Value))

sd1 <- tdata_sub %>%
          filter(target_cause == "single-effect cause")%>%
          summarize(SD1 = sd(Value))


m2 <- tdata_sub %>%
          filter(target_cause == "multiple-effects cause")%>%
          summarize(Mean2 = mean(Value))

sd2 <- tdata_sub %>%
          filter(target_cause == "multiple-effects cause")%>%
          summarize(SD2 = sd(Value))



esc_mean_sd(
  grp1m = m1[,1], grp1sd = sd1[,1], grp1n = 60,
  grp2m = m2[,1], grp2sd = sd2[,1], grp2n = 60,
  es.type = "d"
)
## 
## Effect Size Calculation for Meta Analysis
## 
##      Conversion: mean and sd to effect size d
##     Effect Size:   0.8224
##  Standard Error:   0.1901
##        Variance:   0.0362
##        Lower CI:   0.4497
##        Upper CI:   1.1950
##          Weight:  27.6615