Descriptive Stats
## : single
## : generative
## : positive
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.91500000 0.82816667 0.01978703 0.03918029 0.04698317 0.21675600
## coef.var
## 0.26172993
## ------------------------------------------------------------
## : multiple
## : generative
## : positive
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.45500000 0.51300000 0.02077578 0.04113812 0.05179597 0.22758727
## coef.var
## 0.44363991
## ------------------------------------------------------------
## : single
## : preventive
## : positive
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.91000000 0.82900000 0.01924354 0.03810413 0.04443765 0.21080239
## coef.var
## 0.25428515
## ------------------------------------------------------------
## : multiple
## : preventive
## : positive
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.70500000 0.67325000 0.02490687 0.04931810 0.07444229 0.27284114
## coef.var
## 0.40525978
## ------------------------------------------------------------
## : single
## : generative
## : negative
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.88000000 0.79250000 0.02124693 0.04207105 0.05417185 0.23274847
## coef.var
## 0.29368892
## ------------------------------------------------------------
## : multiple
## : generative
## : negative
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.35000000 0.43866667 0.01893929 0.03750168 0.04304359 0.20746948
## coef.var
## 0.47295474
## ------------------------------------------------------------
## : single
## : preventive
## : negative
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.76500000 0.73891667 0.02200134 0.04356484 0.05808705 0.24101256
## coef.var
## 0.32617014
## ------------------------------------------------------------
## : multiple
## : preventive
## : negative
## median mean SE.mean CI.mean.0.95 var std.dev
## 0.49000000 0.55691667 0.02384145 0.04720844 0.06820974 0.26116995
## coef.var
## 0.46895696
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(): 'KR', 'S', 'LRT', and 'PB'
## - 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
## - NEWS: library('emmeans') now needs to be called explicitly!
## - 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")
## ************
##
## Attaching package: 'afex'
## The following object is masked from 'package:lme4':
##
## lmer
library(emmeans)
a1 <- aov_car(value ~ Order*Process*Valence*Multiple_Effects*Target*variable + Error(sID/(variable)), tdata_sub)
## Contrasts set to contr.sum for the following variables: Order, Process, Valence, Multiple_Effects, Target
a1
## Anova Table (Type 3 tests)
##
## Response: value
## Effect df MSE
## 1 Order 1, 432 0.06
## 2 Process 1, 432 0.06
## 3 Valence 1, 432 0.06
## 4 Multiple_Effects 1, 432 0.06
## 5 Target 2, 432 0.06
## 6 Order:Process 1, 432 0.06
## 7 Order:Valence 1, 432 0.06
## 8 Process:Valence 1, 432 0.06
## 9 Order:Multiple_Effects 1, 432 0.06
## 10 Process:Multiple_Effects 1, 432 0.06
## 11 Valence:Multiple_Effects 1, 432 0.06
## 12 Order:Target 2, 432 0.06
## 13 Process:Target 2, 432 0.06
## 14 Valence:Target 2, 432 0.06
## 15 Multiple_Effects:Target 2, 432 0.06
## 16 Order:Process:Valence 1, 432 0.06
## 17 Order:Process:Multiple_Effects 1, 432 0.06
## 18 Order:Valence:Multiple_Effects 1, 432 0.06
## 19 Process:Valence:Multiple_Effects 1, 432 0.06
## 20 Order:Process:Target 2, 432 0.06
## 21 Order:Valence:Target 2, 432 0.06
## 22 Process:Valence:Target 2, 432 0.06
## 23 Order:Multiple_Effects:Target 2, 432 0.06
## 24 Process:Multiple_Effects:Target 2, 432 0.06
## 25 Valence:Multiple_Effects:Target 2, 432 0.06
## 26 Order:Process:Valence:Multiple_Effects 1, 432 0.06
## 27 Order:Process:Valence:Target 2, 432 0.06
## 28 Order:Process:Multiple_Effects:Target 2, 432 0.06
## 29 Order:Valence:Multiple_Effects:Target 2, 432 0.06
## 30 Process:Valence:Multiple_Effects:Target 2, 432 0.06
## 31 Order:Process:Valence:Multiple_Effects:Target 2, 432 0.06
## 32 variable 1, 432 0.05
## 33 Order:variable 1, 432 0.05
## 34 Process:variable 1, 432 0.05
## 35 Valence:variable 1, 432 0.05
## 36 Multiple_Effects:variable 1, 432 0.05
## 37 Target:variable 2, 432 0.05
## 38 Order:Process:variable 1, 432 0.05
## 39 Order:Valence:variable 1, 432 0.05
## 40 Process:Valence:variable 1, 432 0.05
## 41 Order:Multiple_Effects:variable 1, 432 0.05
## 42 Process:Multiple_Effects:variable 1, 432 0.05
## 43 Valence:Multiple_Effects:variable 1, 432 0.05
## 44 Order:Target:variable 2, 432 0.05
## 45 Process:Target:variable 2, 432 0.05
## 46 Valence:Target:variable 2, 432 0.05
## 47 Multiple_Effects:Target:variable 2, 432 0.05
## 48 Order:Process:Valence:variable 1, 432 0.05
## 49 Order:Process:Multiple_Effects:variable 1, 432 0.05
## 50 Order:Valence:Multiple_Effects:variable 1, 432 0.05
## 51 Process:Valence:Multiple_Effects:variable 1, 432 0.05
## 52 Order:Process:Target:variable 2, 432 0.05
## 53 Order:Valence:Target:variable 2, 432 0.05
## 54 Process:Valence:Target:variable 2, 432 0.05
## 55 Order:Multiple_Effects:Target:variable 2, 432 0.05
## 56 Process:Multiple_Effects:Target:variable 2, 432 0.05
## 57 Valence:Multiple_Effects:Target:variable 2, 432 0.05
## 58 Order:Process:Valence:Multiple_Effects:variable 1, 432 0.05
## 59 Order:Process:Valence:Target:variable 2, 432 0.05
## 60 Order:Process:Multiple_Effects:Target:variable 2, 432 0.05
## 61 Order:Valence:Multiple_Effects:Target:variable 2, 432 0.05
## 62 Process:Valence:Multiple_Effects:Target:variable 2, 432 0.05
## 63 Order:Process:Valence:Multiple_Effects:Target:variable 2, 432 0.05
## F ges p.value
## 1 3.31 + .004 .070
## 2 12.90 *** .016 <.001
## 3 25.35 *** .030 <.001
## 4 0.34 <.001 .559
## 5 0.56 .001 .574
## 6 0.02 <.001 .896
## 7 3.30 + .004 .070
## 8 2.35 .003 .126
## 9 0.67 <.001 .415
## 10 0.08 <.001 .776
## 11 4.42 * .005 .036
## 12 0.49 .001 .613
## 13 0.07 <.001 .933
## 14 0.36 <.001 .699
## 15 3.86 * .009 .022
## 16 0.00 <.001 .990
## 17 0.16 <.001 .686
## 18 0.00 <.001 .969
## 19 2.44 .003 .119
## 20 0.72 .002 .487
## 21 0.73 .002 .481
## 22 0.60 .001 .551
## 23 0.34 <.001 .710
## 24 1.43 .003 .241
## 25 0.51 .001 .602
## 26 0.05 <.001 .829
## 27 2.69 + .007 .069
## 28 0.57 .001 .564
## 29 0.97 .002 .380
## 30 0.12 <.001 .889
## 31 0.03 <.001 .967
## 32 290.57 *** .240 <.001
## 33 1.67 .002 .197
## 34 31.46 *** .033 <.001
## 35 1.21 .001 .272
## 36 4.44 * .005 .036
## 37 0.17 <.001 .842
## 38 0.04 <.001 .834
## 39 2.03 .002 .154
## 40 0.04 <.001 .834
## 41 0.00 <.001 .972
## 42 0.67 <.001 .413
## 43 0.16 <.001 .686
## 44 0.02 <.001 .976
## 45 0.83 .002 .439
## 46 1.17 .003 .310
## 47 0.63 .001 .531
## 48 0.03 <.001 .860
## 49 0.06 <.001 .803
## 50 0.06 <.001 .803
## 51 0.02 <.001 .885
## 52 0.15 <.001 .859
## 53 0.23 <.001 .791
## 54 0.49 .001 .611
## 55 0.09 <.001 .913
## 56 0.91 .002 .405
## 57 0.15 <.001 .863
## 58 1.23 .001 .269
## 59 1.03 .002 .359
## 60 1.24 .003 .290
## 61 0.98 .002 .377
## 62 2.44 + .005 .089
## 63 1.13 .002 .325
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
# same ANOVA as before
lmeModel <- lmer(value ~ Process*variable + (1|sID), data=tdata_sub)
# follow-up analysis
ls1 <- lsmeans(a1, c("variable", "Process", "Valence")) # joint evaluation (basically gives the same table)
## NOTE: Results may be misleading due to involvement in interactions
ls1
## variable Process Valence lsmean SE df lower.CL upper.CL
## single generative positive 0.828 0.0216 861 0.786 0.870
## multiple generative positive 0.513 0.0216 861 0.471 0.555
## single preventive positive 0.829 0.0216 861 0.787 0.871
## multiple preventive positive 0.673 0.0216 861 0.631 0.716
## single generative negative 0.792 0.0216 861 0.750 0.835
## multiple generative negative 0.439 0.0216 861 0.396 0.481
## single preventive negative 0.739 0.0216 861 0.697 0.781
## multiple preventive negative 0.557 0.0216 861 0.515 0.599
##
## Results are averaged over the levels of: Order, Multiple_Effects, Target
## Warning: EMMs are biased unless design is perfectly balanced
## Confidence level used: 0.95
###############
# a conditional analysis
ls2 <- lsmeans(a1, c("Valence")) # group means by between-condition
## NOTE: Results may be misleading due to involvement in interactions
ls2
## Valence lsmean SE df lower.CL upper.CL
## positive 0.711 0.0111 432 0.689 0.733
## negative 0.632 0.0111 432 0.610 0.654
##
## Results are averaged over the levels of: Order, Process, Multiple_Effects, Target, variable
## Warning: EMMs are biased unless design is perfectly balanced
## Confidence level used: 0.95
# simple main effects
pairs(ls2) # compares rep-measure differences separately for each between-factor level
## contrast estimate SE df t.ratio p.value
## positive - negative 0.0791 0.0157 432 5.035 <.0001
##
## Results are averaged over the levels of: Order, Process, Multiple_Effects, Target, variable
ls3 <- lsmeans(a1, c("Process")) # group means by between-condition
## NOTE: Results may be misleading due to involvement in interactions
ls3
## Process lsmean SE df lower.CL upper.CL
## generative 0.643 0.0111 432 0.621 0.665
## preventive 0.700 0.0111 432 0.678 0.721
##
## Results are averaged over the levels of: Order, Valence, Multiple_Effects, Target, variable
## Warning: EMMs are biased unless design is perfectly balanced
## Confidence level used: 0.95
# simple main effects
pairs(ls3) # compares rep-measure differences separately for each between-factor level
## contrast estimate SE df t.ratio p.value
## generative - preventive -0.0564 0.0157 432 -3.592 0.0004
##
## Results are averaged over the levels of: Order, Valence, Multiple_Effects, Target, variable
###############
# a conditional analysis
ls4 <- lsmeans(a1, c("variable"), by = c("Process", "Valence")) # group means by between-condition
## NOTE: Results may be misleading due to involvement in interactions
ls4
## Process = generative, Valence = positive:
## variable lsmean SE df lower.CL upper.CL
## single 0.828 0.0216 861 0.786 0.870
## multiple 0.513 0.0216 861 0.471 0.555
##
## Process = preventive, Valence = positive:
## variable lsmean SE df lower.CL upper.CL
## single 0.829 0.0216 861 0.787 0.871
## multiple 0.673 0.0216 861 0.631 0.716
##
## Process = generative, Valence = negative:
## variable lsmean SE df lower.CL upper.CL
## single 0.792 0.0216 861 0.750 0.835
## multiple 0.439 0.0216 861 0.396 0.481
##
## Process = preventive, Valence = negative:
## variable lsmean SE df lower.CL upper.CL
## single 0.739 0.0216 861 0.697 0.781
## multiple 0.557 0.0216 861 0.515 0.599
##
## Results are averaged over the levels of: Order, Multiple_Effects, Target
## Warning: EMMs are biased unless design is perfectly balanced
## Confidence level used: 0.95
# simple main effects
pairs(ls4) # compares rep-measure differences separately for each between-factor level
## Process = generative, Valence = positive:
## contrast estimate SE df t.ratio p.value
## single - multiple 0.315 0.0295 432 10.673 <.0001
##
## Process = preventive, Valence = positive:
## contrast estimate SE df t.ratio p.value
## single - multiple 0.156 0.0295 432 5.274 <.0001
##
## Process = generative, Valence = negative:
## contrast estimate SE df t.ratio p.value
## single - multiple 0.354 0.0295 432 11.982 <.0001
##
## Process = preventive, Valence = negative:
## contrast estimate SE df t.ratio p.value
## single - multiple 0.182 0.0295 432 6.163 <.0001
##
## Results are averaged over the levels of: Order, Multiple_Effects, Target
# interaction contrast
pairs(pairs(ls4), by = NULL)
## contrast
## (single - multiple generative positive) - (single - multiple preventive positive)
## (single - multiple generative positive) - (single - multiple generative negative)
## (single - multiple generative positive) - (single - multiple preventive negative)
## (single - multiple preventive positive) - (single - multiple generative negative)
## (single - multiple preventive positive) - (single - multiple preventive negative)
## (single - multiple generative negative) - (single - multiple preventive negative)
## estimate SE df t.ratio p.value
## 0.1594 0.0418 432 3.817 0.0009
## -0.0387 0.0418 432 -0.926 0.7910
## 0.1332 0.0418 432 3.189 0.0083
## -0.1981 0.0418 432 -4.743 <.0001
## -0.0262 0.0418 432 -0.629 0.9228
## 0.1718 0.0418 432 4.115 0.0003
##
## Results are averaged over the levels of: Order, Multiple_Effects, Target
## P value adjustment: tukey method for comparing a family of 4 estimates
test(pairs(pairs(ls4), by = NULL), joint = TRUE) # This reproduces the F-Value of the ANOVA interaction
## df1 df2 F.ratio p.value note
## 3 432 10.903 <.0001 d
##
## d: df1 reduced due to linear dependence
#lsmip(a1, High_Strength_Component ~ variable) # lsemans can also produce graphs
# compute Cohen's d
library(rstatix)
##
## Attaching package: 'rstatix'
## The following objects are masked from 'package:plyr':
##
## desc, mutate
## The following object is masked from 'package:stats':
##
## filter
# subset for the four panels shown in the figure
gen_pos <- subset(tdata_sub, Process == "generative" & Valence == "positive")
gen_neg <- subset(tdata_sub, Process == "generative" & Valence == "negative")
prev_pos <- subset(tdata_sub, Process == "preventive" & Valence == "positive")
prev_neg <- subset(tdata_sub, Process == "preventive" & Valence == "negative")
gen_pos %>% cohens_d(value ~ variable, paired = TRUE)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 value single multiple 0.916 120 120 large
gen_neg %>% cohens_d(value ~ variable, paired = TRUE)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 value single multiple 1.14 120 120 large
prev_pos %>% cohens_d(value ~ variable, paired = TRUE)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 value single multiple 0.593 120 120 moderate
prev_neg %>% cohens_d(value ~ variable, paired = TRUE)
## # A tibble: 1 x 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 value single multiple 0.513 120 120 moderate
d_gen_pos <- 0.9161883
d_gen_neg <- 1.138706
d_prev_pos <- 0.5932288
d_prev_neg <- 0.5132523
# get confidence intervals for d
# 1) compute correlations for the ratings
gen_pos_mult <- subset(gen_pos, variable == "multiple")
gen_pos_sing <- subset(gen_pos, variable == "single")
cor.test(gen_pos_sing$value, gen_pos_mult$value)
##
## Pearson's product-moment correlation
##
## data: gen_pos_sing$value and gen_pos_mult$value
## t = -2.1966, df = 118, p-value = 0.03
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.3644973 -0.0196625
## sample estimates:
## cor
## -0.1982053
cor_pos_gen <- -0.1982053
prev_pos_mult <- subset(prev_pos, variable == "multiple")
prev_pos_sing <- subset(prev_pos, variable == "single")
cor.test(prev_pos_sing$value, prev_pos_mult$value)
##
## Pearson's product-moment correlation
##
## data: prev_pos_sing$value and prev_pos_mult$value
## t = 5.2363, df = 118, p-value = 7.234e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.2765045 0.5691676
## sample estimates:
## cor
## 0.4342252
cor_pos_prev <- 0.4342252
gen_neg_mult <- subset(gen_neg, variable == "multiple")
gen_neg_sing <- subset(gen_neg, variable == "single")
cor.test(gen_neg_sing$value, gen_neg_mult$value)
##
## Pearson's product-moment correlation
##
## data: gen_neg_sing$value and gen_neg_mult$value
## t = 0.074294, df = 118, p-value = 0.9409
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1726138 0.1858527
## sample estimates:
## cor
## 0.006839188
cor_neg_gen <- 0.006839188
prev_neg_mult <- subset(prev_neg, variable == "multiple")
prev_neg_sing <- subset(prev_neg, variable == "single")
cor.test(prev_neg_sing$value, prev_neg_mult$value)
##
## Pearson's product-moment correlation
##
## data: prev_neg_sing$value and prev_neg_mult$value
## t = 0.047856, df = 118, p-value = 0.9619
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1749740 0.1835019
## sample estimates:
## cor
## 0.004405479
cor_neg_prev <-0.004405479
# 2) Now compute SE for d
n <- 120
# formula: Sqrt((1/n + d^2/n)*2*(1-r))
SEd_pos_gen <- sqrt((1/n + d_gen_pos^2/n)*2*(1-cor_pos_gen))
SEd_pos_gen
## [1] 0.1916586
SEd_neg_gen <- sqrt((1/n + d_gen_neg^2/n)*2*(1-cor_neg_gen))
SEd_neg_gen
## [1] 0.1949762
SEd_pos_prev <- sqrt((1/n + d_prev_pos^2/n)*2*(1-cor_pos_prev))
SEd_pos_prev
## [1] 0.1129072
SEd_neg_prev <- sqrt((1/n + d_prev_neg^2/n)*2*(1-cor_neg_prev))
SEd_neg_prev
## [1] 0.1447908
# Confidence intervalls for d
("d gen pos")
## [1] "d gen pos"
round(d_gen_pos,2)
## [1] 0.92
round((d_gen_pos - 1.96*SEd_pos_gen),2)
## [1] 0.54
round((d_gen_pos + 1.96*SEd_pos_gen),2)
## [1] 1.29
("d prev pos")
## [1] "d prev pos"
round(d_prev_pos,2)
## [1] 0.59
round((d_prev_pos - 1.96*SEd_pos_prev),2)
## [1] 0.37
round((d_prev_pos + 1.96*SEd_pos_prev),2)
## [1] 0.81
("d gen neg")
## [1] "d gen neg"
round(d_gen_neg,2)
## [1] 1.14
round((d_gen_neg - 1.96*SEd_neg_gen),2)
## [1] 0.76
round((d_gen_neg + 1.96*SEd_neg_gen),2)
## [1] 1.52
("d prev neg")
## [1] "d prev neg"
round(d_prev_neg,2)
## [1] 0.51
round((d_prev_neg - 1.96*SEd_neg_prev),2)
## [1] 0.23
round((d_prev_neg + 1.96*SEd_neg_prev),2)
## [1] 0.8
# compute the confidence interval for the singular causation differences in each between-subject condition
#Process = generative, Valence = positive:
# contrast estimate SE df t.ratio p.value
# single - multiple 0.315 0.0295 432 10.673 <.0001
t <- qt(0.975, 432, lower.tail = TRUE, log.p = FALSE)
#t
effect <- "Mdiff"
Mdiff <- 0.315
SE <- 0.0295
CI <- SE*t
CI_low <- Mdiff - CI
CI_up <- Mdiff + CI
Mdiff
## [1] 0.315
CI_low
## [1] 0.2570186
CI_up
## [1] 0.3729814
# Plot
myTheme <- theme(plot.title = element_text(face="bold", size = 22),
axis.title.x = element_text(face = "bold", size = 20),
axis.title.y = element_blank(),
axis.text.x = element_text(size = 18, angle = 0),
axis.text.y = element_text(size = 40, angle = 0),
legend.text = element_text(size = 18),
legend.title = element_text(size = 22),
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 change") +
#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 = 2, 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 = "white",
size = 1
))
## Warning: Ignoring unknown aesthetics: y
barchart

#ggsave("delta_posGen.svg",width=2.5,height=4)
#ggsave("delta_posGen.pdf",width=2.5,height=4)
# Process = preventive, Valence = positive:
# contrast estimate SE df t.ratio p.value
# single - multiple 0.156 0.0295 432 5.274 <.0001
t <- qt(0.975, 432, lower.tail = TRUE, log.p = FALSE)
#t
effect <- "Mdiff"
Mdiff <- 0.156
SE <- 0.0295
CI <- SE*t
CI_low <- Mdiff - CI
CI_up <- Mdiff + CI
Mdiff
## [1] 0.156
CI_low
## [1] 0.09801862
CI_up
## [1] 0.2139814
# Plot
myTheme <- theme(plot.title = element_text(face="bold", size = 22),
axis.title.x = element_text(face = "bold", size = 20),
axis.title.y = element_blank(),
axis.text.x = element_text(size = 18, angle = 0),
axis.text.y = element_text(size = 40, angle = 0),
legend.text = element_text(size = 18),
legend.title = element_text(size = 22),
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 change") +
#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 = 2, 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 = "white",
size = 1
))
## Warning: Ignoring unknown aesthetics: y
barchart

#ggsave("delta_PosPrev.svg",width=2.5,height=4)
#ggsave("delta_PosPrev.pdf",width=2.5,height=4)
#Process = generative, Valence = negative:
# contrast estimate SE df t.ratio p.value
# single - multiple 0.354 0.0295 432 11.982 <.0001
t <- qt(0.975, 432, lower.tail = TRUE, log.p = FALSE)
#t
effect <- "Mdiff"
Mdiff <- 0.354
SE <- 0.0295
CI <- SE*t
CI_low <- Mdiff - CI
CI_up <- Mdiff + CI
Mdiff
## [1] 0.354
CI_low
## [1] 0.2960186
CI_up