##Make some plots
RTbyCond_3_Plot <- RTData_E1 %>%
filter(AgeGroup==1) %>%
group_by (Congruency, Subject) %>%
summarize(meanRT = mean(RT)) %>%
group_by (Congruency) %>%
multi_boot_standard(col = "meanRT")
RTbyCond_4_Plot <- RTData_E1 %>%
filter(AgeGroup==2) %>%
group_by (Congruency, Subject) %>%
summarize(meanRT = mean(RT)) %>%
group_by (Congruency) %>%
multi_boot_standard(col = "meanRT")
RTbyCond_E2_Plot <- fastKids_RT %>%
group_by (Congruency, Subject) %>%
summarize(meanRT = mean(RT)) %>%
group_by (Congruency) %>%
multi_boot_standard(col = "meanRT")
#######
ErrbyCond_3_Plot <- ErrorData_E1 %>%
filter(AgeGroup==1) %>%
group_by (Congruency, Subject) %>%
summarize(meanError = mean(error)) %>%
mutate(meanError = meanError*100) %>%
group_by (Congruency) %>%
multi_boot_standard(col = "meanError")
ErrbyCond_4_Plot <- ErrorData_E1 %>%
filter(AgeGroup==2) %>%
group_by (Congruency, Subject) %>%
summarize(meanError = mean(error)) %>%
mutate(meanError = meanError*100) %>%
group_by (Congruency) %>%
multi_boot_standard(col = "meanError")
ErrbyCond_E2_Plot <- allData_E2_errors_raw %>%
group_by (Congruency, Subject) %>%
summarize(meanError = mean(error)) %>%
mutate(meanError = meanError*100) %>%
group_by (Congruency) %>%
multi_boot_standard(col = "meanError")
###
g1=ggplot(RTbyCond_3_Plot, aes(x = Congruency, y = mean, fill=Congruency)) +
theme_few() +
geom_bar(stat = "identity", position= "dodge", alpha=.7) +
scale_fill_manual(values=c("#3C86A0", "#821919")) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper), color=c("#3C86A0", "#821919")) +
labs(y = "Average RT (ms)", x ="") +
theme(legend.position="none") +
scale_x_discrete(labels=c("Congruent","Incongruent")) +
scale_y_continuous(limits=c(1350,2100), oob = rescale_none)
g2=ggplot(RTbyCond_4_Plot, aes(x = Congruency, y = mean, fill=Congruency)) +
theme_few() +
geom_bar(stat = "identity", position= "dodge", alpha=.7) +
scale_fill_manual(values=c("#3C86A0", "#821919")) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper), color=c("#3C86A0", "#821919")) +
labs(y = "Average RT (ms)", x ="") +
theme(legend.position="none") +
scale_x_discrete(labels=c("Congruent","Incongruent")) +
scale_y_continuous(limits=c(1350,2100), oob = rescale_none)
g3=ggplot(RTbyCond_E2_Plot, aes(x = Congruency, y = mean, fill=Congruency)) +
theme_few() +
geom_bar(stat = "identity", position= "dodge", alpha=.7) +
scale_fill_manual(values=c("#3C86A0", "#821919")) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper), color=c("#3C86A0", "#821919")) +
labs(y = "Average RT (ms)", x ="") +
theme(legend.position="none") +
scale_x_discrete(labels=c("Congruent","Incongruent")) +
scale_y_continuous(limits=c(1350,2100), oob = rescale_none)
###
g4=ggplot(ErrbyCond_3_Plot, aes(x = Congruency, y = mean, fill=Congruency)) +
theme_few() +
geom_bar(stat = "identity", position= "dodge", alpha=.7) +
scale_fill_manual(values=c("#3C86A0", "#821919")) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper), color=c("#3C86A0", "#821919")) +
labs(y = "Mean error (%)", x ="") +
theme(legend.position="none") +
scale_x_discrete(labels=c("Congruent","Incongruent")) +
ylim(c(0, 25)) +
ggtitle("E1: 3-Year-Olds")
g5=ggplot(ErrbyCond_4_Plot, aes(x = Congruency, y = mean, fill=Congruency)) +
theme_few() +
geom_bar(stat = "identity", position= "dodge", alpha=.7) +
scale_fill_manual(values=c("#3C86A0", "#821919")) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper), color=c("#3C86A0", "#821919")) +
labs(y = "Mean error (%)", x ="") +
theme(legend.position="none") +
scale_x_discrete(labels=c("Congruent","Incongruent")) +
ylim(c(0, 25)) +
ggtitle("E1: 4-Year-Olds")
g6=ggplot(ErrbyCond_E2_Plot, aes(x = Congruency, y = mean, fill=Congruency)) +
theme_few() +
geom_bar(stat = "identity", position= "dodge", alpha=.7) +
scale_fill_manual(values=c("#3C86A0", "#821919")) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper), color=c("#3C86A0", "#821919")) +
labs(y = "Mean error (%)", x ="") +
theme(legend.position="none") +
scale_x_discrete(labels=c("Congruent","Incongruent")) +
ylim(c(0, 25)) +
ggtitle("E2: Replication")
compiledPlot=ggarrange(g4,g5,g6,g1,g2,g3, nrow=2) # errors first, then RT
#compiledPlot=ggarrange(g1,g2,g3,g4,g5,g6, nrow=2)
ggsave("Figure3-E1andE2.pdf", width = 10, height = 6,unit = "in", plot = compiledPlot, path="./figures/", device = "tiff",dpi = 300)