knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(patchwork)
library(ggpubr)
grad_double <- read_csv("data/grad_data_double_7_12Hz_300_1000ms.csv")
grad_nostim <- read_csv("data/grad_data_nostim_7_12Hz_300_1000ms.csv")
mag_double <- read_csv("data/mag_data_double_7_12Hz_300_1000ms.csv")
mag_nostim <- read_csv("data/mag_data_nostim_7_12Hz_300_1000ms.csv")
GDS_o <- grad_double
GDS_o$"LH Left Cue" <-
((GDS_o$"Left-occipital_ROI_left_attention" - GDS_o$"Left-occipital_ROI_neutral_attention")/(GDS_o$"Left-occipital_ROI_left_attention" + GDS_o$"Left-occipital_ROI_neutral_attention"))
GDS_o$"LH Right Cue" <-
((GDS_o$"Left-occipital_ROI_right_attention" - GDS_o$"Left-occipital_ROI_neutral_attention")/(GDS_o$"Left-occipital_ROI_right_attention" + GDS_o$"Left-occipital_ROI_neutral_attention"))
GDS_o$"RH Left Cue" <-
((GDS_o$"Right-occipital_ROI_left_attention" - GDS_o$"Right-occipital_ROI_neutral_attention")/(GDS_o$"Right-occipital_ROI_left_attention" + GDS_o$"Right-occipital_ROI_neutral_attention"))
GDS_o$"RH Right Cue" <-
((GDS_o$"Right-occipital_ROI_right_attention" - GDS_o$"Right-occipital_ROI_neutral_attention")/(GDS_o$"Right-occipital_ROI_right_attention" + GDS_o$"Right-occipital_ROI_neutral_attention"))
GDS_o <- pivot_longer(GDS_o, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
GDS_o_plot <- ggplot(GDS_o, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere", #" Left Hemisphere Right Hemisphere"
y = "Alpha Modulation",
title = "Double Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Left Cue", "LH Right Cue"),
c("RH Left Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("****", "***")) + #, textsize = 8
geom_signif(comparisons = list(c("LH Left Cue", "RH Left Cue"),
c("LH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.19, 0.23),
annotations = c("****", "****"))
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
#ggsave("Gradiometer Double Stimulus Occipital Sig.png", GDS_o_plot)
print(GDS_o_plot)
GNS_o <- grad_nostim
GNS_o$"LH Left Cue" <-
((GNS_o$"Left-occipital_ROI_left_attention" - GNS_o$"Left-occipital_ROI_neutral_attention")/(GNS_o$"Left-occipital_ROI_left_attention" + GNS_o$"Left-occipital_ROI_neutral_attention"))
GNS_o$"LH Right Cue" <-
((GNS_o$"Left-occipital_ROI_right_attention" - GNS_o$"Left-occipital_ROI_neutral_attention")/(GNS_o$"Left-occipital_ROI_right_attention" + GNS_o$"Left-occipital_ROI_neutral_attention"))
GNS_o$"RH Left Cue" <-
((GNS_o$"Right-occipital_ROI_left_attention" - GNS_o$"Right-occipital_ROI_neutral_attention")/(GNS_o$"Right-occipital_ROI_left_attention" + GNS_o$"Right-occipital_ROI_neutral_attention"))
GNS_o$"RH Right Cue" <-
((GNS_o$"Right-occipital_ROI_right_attention" - GNS_o$"Right-occipital_ROI_neutral_attention")/(GNS_o$"Right-occipital_ROI_right_attention" + GNS_o$"Right-occipital_ROI_neutral_attention"))
GNS_o <- pivot_longer(GNS_o, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
GNS_o_plot <- ggplot(GNS_o, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere", #" Left Hemisphere Right Hemisphere"
y = "Alpha Modulation",
title = "No Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Left Cue", "LH Right Cue"),
c("RH Left Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("****", "****")) + #, textsize = 8
geom_signif(comparisons = list(c("LH Left Cue", "RH Left Cue"),
c("LH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.19, 0.23),
annotations = c("****", "****"))
#ggsave("Gradiometer No Stimulus Occipital Sig.png", GNS_o_plot)
print(GNS_o_plot)
MDS_o <- mag_double
MDS_o$"LH Left Cue" <-
((MDS_o$"Left-occipital_ROI_left_attention" - MDS_o$"Left-occipital_ROI_neutral_attention")/(MDS_o$"Left-occipital_ROI_left_attention" + MDS_o$"Left-occipital_ROI_neutral_attention"))
MDS_o$"LH Right Cue" <-
((MDS_o$"Left-occipital_ROI_right_attention" - MDS_o$"Left-occipital_ROI_neutral_attention")/(MDS_o$"Left-occipital_ROI_right_attention" + MDS_o$"Left-occipital_ROI_neutral_attention"))
MDS_o$"RH Left Cue" <-
((MDS_o$"Right-occipital_ROI_left_attention" - MDS_o$"Right-occipital_ROI_neutral_attention")/(MDS_o$"Right-occipital_ROI_left_attention" + MDS_o$"Right-occipital_ROI_neutral_attention"))
MDS_o$"RH Right Cue" <-
((MDS_o$"Right-occipital_ROI_right_attention" - MDS_o$"Right-occipital_ROI_neutral_attention")/(MDS_o$"Right-occipital_ROI_right_attention" + MDS_o$"Right-occipital_ROI_neutral_attention"))
MDS_o <- pivot_longer(MDS_o, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
MDS_o_plot <- ggplot(MDS_o, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Magnetometer Double Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE)
print(MDS_o_plot)
MNS_o <- mag_nostim
MNS_o$"LH Left Cue" <-
((MNS_o$"Left-occipital_ROI_left_attention" - MNS_o$"Left-occipital_ROI_neutral_attention")/(MNS_o$"Left-occipital_ROI_left_attention" + MNS_o$"Left-occipital_ROI_neutral_attention"))
MNS_o$"LH Right Cue" <-
((MNS_o$"Left-occipital_ROI_right_attention" - MNS_o$"Left-occipital_ROI_neutral_attention")/(MNS_o$"Left-occipital_ROI_right_attention" + MNS_o$"Left-occipital_ROI_neutral_attention"))
MNS_o$"RH Left Cue" <-
((MNS_o$"Right-occipital_ROI_left_attention" - MNS_o$"Right-occipital_ROI_neutral_attention")/(MNS_o$"Right-occipital_ROI_left_attention" + MNS_o$"Right-occipital_ROI_neutral_attention"))
MNS_o$"RH Right Cue" <-
((MNS_o$"Right-occipital_ROI_right_attention" - MNS_o$"Right-occipital_ROI_neutral_attention")/(MNS_o$"Right-occipital_ROI_right_attention" + MNS_o$"Right-occipital_ROI_neutral_attention"))
MNS_o <- pivot_longer(MNS_o, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
MNS_o_plot <- ggplot(MNS_o, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Magnetometer No Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE)
print(MNS_o_plot)
all_o <- GDS_o_plot + GNS_o_plot + MDS_o_plot + MNS_o_plot
#ggsave("Occipital Grad + Mag.png", all_o)
print(all_o)
GDS_p <- grad_double
GDS_p$"LH Left Cue" <-
((GDS_p$"Left-parietal_ROI_left_attention" - GDS_p$"Left-parietal_ROI_neutral_attention")/(GDS_p$"Left-parietal_ROI_left_attention" + GDS_p$"Left-parietal_ROI_neutral_attention"))
GDS_p$"LH Right Cue" <-
((GDS_p$"Left-parietal_ROI_right_attention" - GDS_p$"Left-parietal_ROI_neutral_attention")/(GDS_p$"Left-parietal_ROI_right_attention" + GDS_p$"Left-parietal_ROI_neutral_attention"))
GDS_p$"RH Left Cue" <-
((GDS_p$"Right-parietal_ROI_left_attention" - GDS_p$"Right-parietal_ROI_neutral_attention")/(GDS_p$"Right-parietal_ROI_left_attention" + GDS_p$"Right-parietal_ROI_neutral_attention"))
GDS_p$"RH Right Cue" <-
((GDS_p$"Right-parietal_ROI_right_attention" - GDS_p$"Right-parietal_ROI_neutral_attention")/(GDS_p$"Right-parietal_ROI_right_attention" + GDS_p$"Right-parietal_ROI_neutral_attention"))
GDS_p <- pivot_longer(GDS_p, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
GDS_p_plot <- ggplot(GDS_p, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere", #" Left Hemisphere Right Hemisphere"
y = "Alpha Modulation",
title = "Double Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Left Cue", "LH Right Cue"),
c("RH Left Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("**", "***")) + #, textsize = 8
geom_signif(comparisons = list(c("LH Left Cue", "RH Left Cue"),
c("LH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.19, 0.23),
annotations = c("***", "***"))
#ggsave("Gradiometer Double Stimulus Parietal Sig.png", GDS_p_plot)
print(GDS_p_plot)
GNS_p <- grad_nostim
GNS_p$"LH Left Cue" <-
((GNS_p$"Left-parietal_ROI_left_attention" - GNS_p$"Left-parietal_ROI_neutral_attention")/(GNS_p$"Left-parietal_ROI_left_attention" + GNS_p$"Left-parietal_ROI_neutral_attention"))
GNS_p$"LH Right Cue" <-
((GNS_p$"Left-parietal_ROI_right_attention" - GNS_p$"Left-parietal_ROI_neutral_attention")/(GNS_p$"Left-parietal_ROI_right_attention" + GNS_p$"Left-parietal_ROI_neutral_attention"))
GNS_p$"RH Left Cue" <-
((GNS_p$"Right-parietal_ROI_left_attention" - GNS_p$"Right-parietal_ROI_neutral_attention")/(GNS_p$"Right-parietal_ROI_left_attention" + GNS_p$"Right-parietal_ROI_neutral_attention"))
GNS_p$"RH Right Cue" <-
((GNS_p$"Right-parietal_ROI_right_attention" - GNS_p$"Right-parietal_ROI_neutral_attention")/(GNS_p$"Right-parietal_ROI_right_attention" + GNS_p$"Right-parietal_ROI_neutral_attention"))
GNS_p <- pivot_longer(GNS_p, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
GNS_p_plot <- ggplot(GNS_p, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere", #" Left Hemisphere Right Hemisphere"
y = "Alpha Modulation",
title = "No Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Left Cue", "LH Right Cue"),
c("RH Left Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("**", "***")) + #, textsize = 8
geom_signif(comparisons = list(c("LH Left Cue", "RH Left Cue"),
c("LH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.19, 0.23),
annotations = c("***", "***"))
#ggsave("Gradiometer No Stimulus Parietal Sig.png", GNS_p_plot)
print(GNS_p_plot)
MDS_p <- mag_double
MDS_p$"LH Left Cue" <-
((MDS_p$"Left-parietal_ROI_left_attention" - MDS_p$"Left-parietal_ROI_neutral_attention")/(MDS_p$"Left-parietal_ROI_left_attention" + MDS_p$"Left-parietal_ROI_neutral_attention"))
MDS_p$"LH Right Cue" <-
((MDS_p$"Left-parietal_ROI_right_attention" - MDS_p$"Left-parietal_ROI_neutral_attention")/(MDS_p$"Left-parietal_ROI_right_attention" + MDS_p$"Left-parietal_ROI_neutral_attention"))
MDS_p$"RH Left Cue" <-
((MDS_p$"Right-parietal_ROI_left_attention" - MDS_p$"Right-parietal_ROI_neutral_attention")/(MDS_p$"Right-parietal_ROI_left_attention" + MDS_p$"Right-parietal_ROI_neutral_attention"))
MDS_p$"RH Right Cue" <-
((MDS_p$"Right-parietal_ROI_right_attention" - MDS_p$"Right-parietal_ROI_neutral_attention")/(MDS_p$"Right-parietal_ROI_right_attention" + MDS_p$"Right-parietal_ROI_neutral_attention"))
MDS_p <- pivot_longer(MDS_p, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
MDS_p_plot <- ggplot(MDS_p, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Magnetometer Double Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE)
print(MDS_p_plot)
MNS_p <- mag_nostim
MNS_p$"LH Left Cue" <-
((MNS_p$"Left-parietal_ROI_left_attention" - MNS_p$"Left-parietal_ROI_neutral_attention")/(MNS_p$"Left-parietal_ROI_left_attention" + MNS_p$"Left-parietal_ROI_neutral_attention"))
MNS_p$"LH Right Cue" <-
((MNS_p$"Left-parietal_ROI_right_attention" - MNS_p$"Left-parietal_ROI_neutral_attention")/(MNS_p$"Left-parietal_ROI_right_attention" + MNS_p$"Left-parietal_ROI_neutral_attention"))
MNS_p$"RH Left Cue" <-
((MNS_p$"Right-parietal_ROI_left_attention" - MNS_p$"Right-parietal_ROI_neutral_attention")/(MNS_p$"Right-parietal_ROI_left_attention" + MNS_p$"Right-parietal_ROI_neutral_attention"))
MNS_p$"RH Right Cue" <-
((MNS_p$"Right-parietal_ROI_right_attention" - MNS_p$"Right-parietal_ROI_neutral_attention")/(MNS_p$"Right-parietal_ROI_right_attention" + MNS_p$"Right-parietal_ROI_neutral_attention"))
MNS_p <- pivot_longer(MNS_p, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
MNS_p_plot <- ggplot(MNS_p, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Magnetometer No Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw() + #base_size=15
guides(fill = FALSE)
print(MNS_p_plot)
all_p <- GDS_p_plot + GNS_p_plot + MDS_p_plot + MNS_p_plot
#ggsave("Parietal Grad + Mag.png", all_p)
print(all_p)
Grad_Parietal_Occipital <- GDS_p_plot + GNS_p_plot + GDS_o_plot + GNS_o_plot
#ggsave("Grad Parietal Occipital.png", Grad_Parietal_Occipital)
print(Grad_Parietal_Occipital)
Mag_Parietal_Occipital <- MDS_p_plot + MNS_p_plot + MDS_p_plot + MNS_p_plot
#ggsave("Mag Parietal Occipital.png", Mag_Parietal_Occipital)
print(Mag_Parietal_Occipital)
GDAP <- grad_double
GDAP$"LH Left Cue d" <-
((GDAP$"Left-parietal_ROI_left_attention" - GDAP$"Left-parietal_ROI_neutral_attention")/(GDAP$"Left-parietal_ROI_left_attention" + GDAP$"Left-parietal_ROI_neutral_attention"))
GDAP$"LH Right Cue d" <-
((GDAP$"Left-parietal_ROI_right_attention" - GDAP$"Left-parietal_ROI_neutral_attention")/(GDAP$"Left-parietal_ROI_right_attention" + GDAP$"Left-parietal_ROI_neutral_attention"))
GDAP$"RH Left Cue d" <-
((GDAP$"Right-parietal_ROI_left_attention" - GDAP$"Right-parietal_ROI_neutral_attention")/(GDAP$"Right-parietal_ROI_left_attention" + GDAP$"Right-parietal_ROI_neutral_attention"))
GDAP$"RH Right Cue d" <-
((GDAP$"Right-parietal_ROI_right_attention" - GDAP$"Right-parietal_ROI_neutral_attention")/(GDAP$"Right-parietal_ROI_right_attention" + GDAP$"Right-parietal_ROI_neutral_attention"))
GNAP <- grad_nostim
GNAP$"LH Left Cue n" <-
((GNAP$"Left-parietal_ROI_left_attention" - GNAP$"Left-parietal_ROI_neutral_attention")/(GNAP$"Left-parietal_ROI_left_attention" + GNAP$"Left-parietal_ROI_neutral_attention"))
GNAP$"LH Right Cue n" <-
((GNAP$"Left-parietal_ROI_right_attention" - GNAP$"Left-parietal_ROI_neutral_attention")/(GNAP$"Left-parietal_ROI_right_attention" + GNAP$"Left-parietal_ROI_neutral_attention"))
GNAP$"RH Left Cue n" <-
((GNAP$"Right-parietal_ROI_left_attention" - GNAP$"Right-parietal_ROI_neutral_attention")/(GNAP$"Right-parietal_ROI_left_attention" + GNAP$"Right-parietal_ROI_neutral_attention"))
GNAP$"RH Right Cue n" <-
((GNAP$"Right-parietal_ROI_right_attention" - GNAP$"Right-parietal_ROI_neutral_attention")/(GNAP$"Right-parietal_ROI_right_attention" + GNAP$"Right-parietal_ROI_neutral_attention"))
all_avg <-
full_join(GDAP, GNAP, by = "...1")
all_avg$"LH Left Cue" <-
(((all_avg$"LH Left Cue d" + all_avg$"LH Left Cue n")/2))
all_avg$"LH Right Cue" <-
(((all_avg$"LH Right Cue d" + all_avg$"LH Right Cue n")/2))
all_avg$"RH Left Cue" <-
(((all_avg$"RH Left Cue d" + all_avg$"RH Left Cue n")/2))
all_avg$"RH Right Cue" <-
(((all_avg$"RH Right Cue d" + all_avg$"RH Right Cue n")/2))
all_avg <- pivot_longer(all_avg, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
all_avg <- ggplot(all_avg, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Averaged Stimulus Parietal") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw(base_size=15) + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Right Cue", "LH Right Cue"),
c("LH Right Cue", "LH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("", ""),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("RH Right Cue", "RH Right Cue"),
c("RH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10)
#ggsave("Gradiometer Averaged Stimulus Parietal.png", all_avg)
print(all_avg)
GDAO <- grad_double
GDAO$"LH Left Cue d" <-
((GDAO$"Left-occipital_ROI_left_attention" - GDAO$"Left-occipital_ROI_neutral_attention")/(GDAO$"Left-occipital_ROI_left_attention" + GDAO$"Left-occipital_ROI_neutral_attention"))
GDAO$"LH Right Cue d" <-
((GDAO$"Left-occipital_ROI_right_attention" - GDAO$"Left-occipital_ROI_neutral_attention")/(GDAO$"Left-occipital_ROI_right_attention" + GDAO$"Left-occipital_ROI_neutral_attention"))
GDAO$"RH Left Cue d" <-
((GDAO$"Right-occipital_ROI_left_attention" - GDAO$"Right-occipital_ROI_neutral_attention")/(GDAO$"Right-occipital_ROI_left_attention" + GDAO$"Right-occipital_ROI_neutral_attention"))
GDAO$"RH Right Cue d" <-
((GDAO$"Right-occipital_ROI_right_attention" - GDAO$"Right-occipital_ROI_neutral_attention")/(GDAO$"Right-occipital_ROI_right_attention" + GDAO$"Right-occipital_ROI_neutral_attention"))
GNAO <- grad_nostim
GNAO$"LH Left Cue n" <-
((GNAO$"Left-occipital_ROI_left_attention" - GNAO$"Left-occipital_ROI_neutral_attention")/(GNAO$"Left-occipital_ROI_left_attention" + GNAO$"Left-occipital_ROI_neutral_attention"))
GNAO$"LH Right Cue n" <-
((GNAO$"Left-occipital_ROI_right_attention" - GNAO$"Left-occipital_ROI_neutral_attention")/(GNAO$"Left-occipital_ROI_right_attention" + GNAO$"Left-occipital_ROI_neutral_attention"))
GNAO$"RH Left Cue n" <-
((GNAO$"Right-occipital_ROI_left_attention" - GNAO$"Right-occipital_ROI_neutral_attention")/(GNAO$"Right-occipital_ROI_left_attention" + GNAO$"Right-occipital_ROI_neutral_attention"))
GNAO$"RH Right Cue n" <-
((GNAO$"Right-occipital_ROI_right_attention" - GNAO$"Right-occipital_ROI_neutral_attention")/(GNAO$"Right-occipital_ROI_right_attention" + GNAO$"Right-occipital_ROI_neutral_attention"))
all_avg <-
full_join(GDAO, GNAO, by = "...1")
all_avg$"LH Left Cue" <-
(((all_avg$"LH Left Cue d" + all_avg$"LH Left Cue n")/2))
all_avg$"LH Right Cue" <-
(((all_avg$"LH Right Cue d" + all_avg$"LH Right Cue n")/2))
all_avg$"RH Left Cue" <-
(((all_avg$"RH Left Cue d" + all_avg$"RH Left Cue n")/2))
all_avg$"RH Right Cue" <-
(((all_avg$"RH Right Cue d" + all_avg$"RH Right Cue n")/2))
all_avg <- pivot_longer(all_avg, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
all_avg <- ggplot(all_avg, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Occipital Averaged Stimulus") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw(base_size=15) + #base_size=15
guides(fill = FALSE)
#ggsave("Gradiometer Occipital Averaged Stimulus.png", all_avg)
print(all_avg)
GD <- grad_double
GD$"LH Left Cue" <-
((GD$"Left-occipital_ROI_left_attention" - GD$"Left-occipital_ROI_neutral_attention")/(GD$"Left-occipital_ROI_left_attention" + GD$"Left-occipital_ROI_neutral_attention"))
GD$"LH Right Cue" <-
((GD$"Left-occipital_ROI_right_attention" - GD$"Left-occipital_ROI_neutral_attention")/(GD$"Left-occipital_ROI_right_attention" + GD$"Left-occipital_ROI_neutral_attention"))
GD$"RH Left Cue" <-
((GD$"Right-occipital_ROI_left_attention" - GD$"Right-occipital_ROI_neutral_attention")/(GD$"Right-occipital_ROI_left_attention" + GD$"Right-occipital_ROI_neutral_attention"))
GD$"RH Right Cue" <-
((GD$"Right-occipital_ROI_right_attention" - GD$"Right-occipital_ROI_neutral_attention")/(GD$"Right-occipital_ROI_right_attention" + GD$"Right-occipital_ROI_neutral_attention"))
GD <- pivot_longer(GD, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
GD_plot_oD <- ggplot(GD, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "Double Stimulus Occipital") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw(base_size=15) + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Left Cue", "LH Left Cue"),
c("LH Left Cue", "LH Left Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("RH Right Cue", "RH Right Cue"),
c("RH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10)
#ggsave("Gradiometer Double Stimulus Occipital.png", GD_plot_oD)
print(GD_plot_oD)
# Gradiometer Occipital NoStim
GN <- grad_nostim
GN$"LH Left Cue" <-
((GN$"Left-occipital_ROI_left_attention" - GN$"Left-occipital_ROI_neutral_attention")/(GN$"Left-occipital_ROI_left_attention" + GN$"Left-occipital_ROI_neutral_attention"))
GN$"LH Right Cue" <-
((GN$"Left-occipital_ROI_right_attention" - GN$"Left-occipital_ROI_neutral_attention")/(GN$"Left-occipital_ROI_right_attention" + GN$"Left-occipital_ROI_neutral_attention"))
GN$"RH Left Cue" <-
((GN$"Right-occipital_ROI_left_attention" - GN$"Right-occipital_ROI_neutral_attention")/(GN$"Right-occipital_ROI_left_attention" + GN$"Right-occipital_ROI_neutral_attention"))
GN$"RH Right Cue" <-
((GN$"Right-occipital_ROI_right_attention" - GN$"Right-occipital_ROI_neutral_attention")/(GN$"Right-occipital_ROI_right_attention" + GN$"Right-occipital_ROI_neutral_attention"))
GN <- pivot_longer(GN, cols = c("LH Left Cue", "LH Right Cue", "RH Left Cue", "RH Right Cue"),
values_to = "score")
GN_plot_oN <- ggplot(GN, aes(name, score, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere",
y = "Alpha Modulation",
title = "No Stimulus Occipital") +
scale_x_discrete(labels=c("Left Cue", "Right Cue", "Left Cue", "Right Cue")) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw(base_size=15) + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("LH Left Cue", "LH Left Cue"),
c("LH Left Cue", "LH Left Cue")),
map_signif_level = TRUE,
y_position = c(0.2, 0.2),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("RH Right Cue", "RH Right Cue"),
c("RH Right Cue", "RH Right Cue")),
map_signif_level = TRUE,
y_position = c(0.2, 0.2),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10)
#ggsave("Gradiometer No Stimulus Occipital.png", GN_plot_oN)
print(GN_plot_oN)
grad_double_low <- read_csv("data/grad_data_double_5_10Hz_300_1000ms.csv")
grad_nostim_low <- read_csv("data/grad_data_nostim_5_10Hz_300_1000ms.csv")
grad_double_high <- read_csv("data/grad_data_double_10_15Hz_300_1000ms.csv")
grad_nostim_high <- read_csv("data/grad_data_nostim_10_15Hz_300_1000ms.csv")
#Double
GD_parietal_low <- grad_double_low |>
mutate(
Left_Hem_ROI_Right_Attention_stim_Double = (`Left-parietal_ROI_right_attention`-`Left-parietal_ROI_neutral_attention`)/(`Left-parietal_ROI_right_attention`+`Left-parietal_ROI_neutral_attention`),
Right_Hem_ROI_Left_Attention_stim_Double = (`Right-parietal_ROI_left_attention`-`Right-parietal_ROI_neutral_attention`)/(`Right-parietal_ROI_left_attention`+`Right-parietal_ROI_neutral_attention`)) |>
select(1,
"Left_Hem_ROI_Right_Attention_stim_Double",
"Right_Hem_ROI_Left_Attention_stim_Double",)
GD_occipital_high <- grad_double_high |>
mutate(
Left_Hem_ROI_Left_Attention_stim_Double =
(`Left-occipital_ROI_left_attention` - `Left-occipital_ROI_neutral_attention`)/(`Left-occipital_ROI_left_attention`+`Left-occipital_ROI_neutral_attention`),
Right_Hem_ROI_Right_Attention_stim_Double = (`Right-occipital_ROI_right_attention`-`Right-occipital_ROI_neutral_attention`)/(`Right-occipital_ROI_right_attention`+`Right-occipital_ROI_neutral_attention`)) |>
select(1,
"Left_Hem_ROI_Left_Attention_stim_Double",
"Right_Hem_ROI_Right_Attention_stim_Double",)
all_double <-
full_join(GD_parietal_low, GD_occipital_high, by = "...1")
#NoStim
GN_parietal_low <- grad_nostim_low |>
mutate(
Left_Hem_ROI_Right_Attention_stim_NoStim = (`Left-parietal_ROI_right_attention`-`Left-parietal_ROI_neutral_attention`)/(`Left-parietal_ROI_right_attention`+`Left-parietal_ROI_neutral_attention`),
Right_Hem_ROI_Left_Attention_stim_NoStim = (`Right-parietal_ROI_left_attention`-`Right-parietal_ROI_neutral_attention`)/(`Right-parietal_ROI_left_attention`+`Right-parietal_ROI_neutral_attention`)) |>
select(1,
"Left_Hem_ROI_Right_Attention_stim_NoStim",
"Right_Hem_ROI_Left_Attention_stim_NoStim",)
GN_occipital_high <- grad_nostim_high |>
mutate(
Left_Hem_ROI_Left_Attention_stim_NoStim =
(`Left-occipital_ROI_left_attention` - `Left-occipital_ROI_neutral_attention`)/(`Left-occipital_ROI_left_attention`+`Left-occipital_ROI_neutral_attention`),
Right_Hem_ROI_Right_Attention_stim_NoStim = (`Right-occipital_ROI_right_attention`-`Right-occipital_ROI_neutral_attention`)/(`Right-occipital_ROI_right_attention`+`Right-occipital_ROI_neutral_attention`)) |>
select(1,
"Left_Hem_ROI_Left_Attention_stim_NoStim",
"Right_Hem_ROI_Right_Attention_stim_NoStim",)
all_nostim <-
full_join(GN_parietal_low, GN_occipital_high, by = "...1")
all_stim <- full_join(all_double, all_nostim, by = "...1")
G_all <- all_stim |>
mutate(
Left_Hem_ROI_Left_Attention =
((`Left_Hem_ROI_Left_Attention_stim_Double` + `Left_Hem_ROI_Left_Attention_stim_NoStim`)/2),
Left_Hem_ROI_Right_Attention =
((`Left_Hem_ROI_Right_Attention_stim_Double` + `Left_Hem_ROI_Right_Attention_stim_NoStim`)/2),
Right_Hem_ROI_Left_Attention =
((`Right_Hem_ROI_Left_Attention_stim_Double` + `Right_Hem_ROI_Left_Attention_stim_NoStim`)/2),
Right_Hem_ROI_Right_Attention =
((`Right_Hem_ROI_Right_Attention_stim_Double` + `Right_Hem_ROI_Right_Attention_stim_NoStim`)/2)) |>
select(1,
"Left_Hem_ROI_Left_Attention",
"Left_Hem_ROI_Right_Attention",
"Right_Hem_ROI_Left_Attention",
"Right_Hem_ROI_Right_Attention")
GD_PO <- pivot_longer(G_all,
cols = c(2:5),
values_to = "alpha")
GD_PO_plot <- ggplot(GD_PO, aes(name, alpha, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere", #"Left Hemisphere Right Hemisphere"
y = "Alpha Modulation",
title = "Low & High Alpha Against Neutral Attention") +
scale_x_discrete(labels=c("L-Occipital Ipsi (Hα)", "L-Parietal Contra (Lα)", "R-Parietal Contra (Lα)", "R-Occipital Ipsi (Hα)"),
guide=guide_axis(n.dodge=2)) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw(base_size=15) + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("Left_Hem_ROI_Left_Attention", "Left_Hem_ROI_Left_Attention"),
c("Left_Hem_ROI_Left_Attention", "Left_Hem_ROI_Left_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("Left_Hem_ROI_Right_Attention", "Left_Hem_ROI_Right_Attention"),
c("Left_Hem_ROI_Right_Attention", "Left_Hem_ROI_Right_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("Right_Hem_ROI_Left_Attention", "Right_Hem_ROI_Left_Attention"),
c("Right_Hem_ROI_Left_Attention", "Right_Hem_ROI_Left_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("", ""),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("Right_Hem_ROI_Right_Attention", "Right_Hem_ROI_Right_Attention"),
c("Right_Hem_ROI_Right_Attention", "Right_Hem_ROI_Right_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10)
ggsave("Low & High Alpha Against Neutral Attention.png", GD_PO_plot)
print(GD_PO_plot)
#Double
GD_parietal_low <- grad_double_low |>
mutate(
Left_Hem_ROI_Right_Attention_stim_Double = (`Left-parietal_ROI_right_attention`-`Left-parietal_ROI_no_attention`)/(`Left-parietal_ROI_right_attention`+`Left-parietal_ROI_no_attention`),
Right_Hem_ROI_Left_Attention_stim_Double = (`Right-parietal_ROI_left_attention`-`Right-parietal_ROI_no_attention`)/(`Right-parietal_ROI_left_attention`+`Right-parietal_ROI_no_attention`)) |>
select(1,
"Left_Hem_ROI_Right_Attention_stim_Double",
"Right_Hem_ROI_Left_Attention_stim_Double",)
GD_occipital_high <- grad_double_high |>
mutate(
Left_Hem_ROI_Left_Attention_stim_Double =
(`Left-occipital_ROI_left_attention` - `Left-occipital_ROI_no_attention`)/(`Left-occipital_ROI_left_attention`+`Left-occipital_ROI_no_attention`),
Right_Hem_ROI_Right_Attention_stim_Double = (`Right-occipital_ROI_right_attention`-`Right-occipital_ROI_no_attention`)/(`Right-occipital_ROI_right_attention`+`Right-occipital_ROI_no_attention`)) |>
select(1,
"Left_Hem_ROI_Left_Attention_stim_Double",
"Right_Hem_ROI_Right_Attention_stim_Double",)
all_double <-
full_join(GD_parietal_low, GD_occipital_high, by = "...1")
#NoStim
GN_parietal_low <- grad_nostim_low |>
mutate(
Left_Hem_ROI_Right_Attention_stim_NoStim = (`Left-parietal_ROI_right_attention`-`Left-parietal_ROI_no_attention`)/(`Left-parietal_ROI_right_attention`+`Left-parietal_ROI_no_attention`),
Right_Hem_ROI_Left_Attention_stim_NoStim = (`Right-parietal_ROI_left_attention`-`Right-parietal_ROI_no_attention`)/(`Right-parietal_ROI_left_attention`+`Right-parietal_ROI_no_attention`)) |>
select(1,
"Left_Hem_ROI_Right_Attention_stim_NoStim",
"Right_Hem_ROI_Left_Attention_stim_NoStim",)
GN_occipital_high <- grad_nostim_high |>
mutate(
Left_Hem_ROI_Left_Attention_stim_NoStim =
(`Left-occipital_ROI_left_attention` - `Left-occipital_ROI_no_attention`)/(`Left-occipital_ROI_left_attention`+`Left-occipital_ROI_no_attention`),
Right_Hem_ROI_Right_Attention_stim_NoStim = (`Right-occipital_ROI_right_attention`-`Right-occipital_ROI_no_attention`)/(`Right-occipital_ROI_right_attention`+`Right-occipital_ROI_no_attention`)) |>
select(1,
"Left_Hem_ROI_Left_Attention_stim_NoStim",
"Right_Hem_ROI_Right_Attention_stim_NoStim",)
all_nostim <-
full_join(GN_parietal_low, GN_occipital_high, by = "...1")
all_stim <- full_join(all_double, all_nostim, by = "...1")
G_all <- all_stim |>
mutate(
Left_Hem_ROI_Left_Attention =
((`Left_Hem_ROI_Left_Attention_stim_Double` + `Left_Hem_ROI_Left_Attention_stim_NoStim`)/2),
Left_Hem_ROI_Right_Attention =
((`Left_Hem_ROI_Right_Attention_stim_Double` + `Left_Hem_ROI_Right_Attention_stim_NoStim`)/2),
Right_Hem_ROI_Left_Attention =
((`Right_Hem_ROI_Left_Attention_stim_Double` + `Right_Hem_ROI_Left_Attention_stim_NoStim`)/2),
Right_Hem_ROI_Right_Attention =
((`Right_Hem_ROI_Right_Attention_stim_Double` + `Right_Hem_ROI_Right_Attention_stim_NoStim`)/2)) |>
select(1,
"Left_Hem_ROI_Left_Attention",
"Left_Hem_ROI_Right_Attention",
"Right_Hem_ROI_Left_Attention",
"Right_Hem_ROI_Right_Attention")
GD_PO <- pivot_longer(G_all,
cols = c(2:5),
values_to = "alpha")
GD_PO_plot <- ggplot(GD_PO, aes(name, alpha, fill=name)) +
geom_boxplot() +
labs(x = " Left Hemisphere Right Hemisphere", #"Left Hemisphere Right Hemisphere"
y = "Alpha Modulation",
title = "Low & High Alpha Against No Attention") +
scale_x_discrete(labels=c("L-Occipital Ipsi (Hα)", "L-Parietal Contra (Lα)", "R-Parietal Contra (Lα)", "R-Occipital Ipsi (Hα)"),
guide=guide_axis(n.dodge=2)) +
geom_hline(yintercept = 0, linetype="dashed", color="dark grey") +
geom_vline(xintercept = 2.5) +
ylim(-0.25, 0.25) +
scale_fill_manual(values=c("salmon", "cadetblue2", "salmon", "cadetblue2")) +
theme_bw(base_size=15) + #base_size=15
guides(fill = FALSE) +
geom_signif(comparisons = list(c("Left_Hem_ROI_Left_Attention", "Left_Hem_ROI_Left_Attention"),
c("Left_Hem_ROI_Left_Attention", "Left_Hem_ROI_Left_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("", ""),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("Left_Hem_ROI_Right_Attention", "Left_Hem_ROI_Right_Attention"),
c("Left_Hem_ROI_Right_Attention", "Left_Hem_ROI_Right_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("Right_Hem_ROI_Left_Attention", "Right_Hem_ROI_Left_Attention"),
c("Right_Hem_ROI_Left_Attention", "Right_Hem_ROI_Left_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("*", "*"),
tip_length = 0,
textsize = 10) +
geom_signif(comparisons = list(c("Right_Hem_ROI_Right_Attention", "Right_Hem_ROI_Right_Attention"),
c("Right_Hem_ROI_Right_Attention", "Right_Hem_ROI_Right_Attention")),
map_signif_level = TRUE,
y_position = c(0.15, 0.15),
annotations = c("", ""),
tip_length = 0,
textsize = 10)
ggsave("Low & High Alpha Against No Attention.png", GD_PO_plot)
print(GD_PO_plot)