Bilingualism modulates functional connectivity induced by a domain-general artificial grammar learning task.
The 3 matches
- [1] § Method › Statistical analysis ↔ Analysis/EEG/BIFUNC Supplementary Model Comparisons.Rmd, lines 166–181 · score 0.96 · approximate Likelihood Ratio, Akaike Information Criterion, Chi Square, anova.gam, adding handedness, better fit
- [2] § Results › Post-task ↔ Analysis/EEG/BIFUNC Pre- & Post-task Statistical Analysis.Rmd, lines 478–496 · score 0.57 · medial frontal, medial occipital, right parietal, post task, pre task, smooths
- [3] § Results › Post-task ↔ Analysis/EEG/BIFUNC Pre- & Post-task Statistical Analysis.Rmd, lines 794–836 · score 0.53 · right parietal, LSBQ composite score, post task, pre task, smooth, connection
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R Markdown · 840 lines · 23 KB · no license · 2 matches
- ---
- title: "BIFUNC Pre- & Post-task Statistical Analysis"
- author: "Alex Sheehan"
- date: "2025-09-16"
- output:
- html_document:
- theme: flatly
- highlight: tango
- toc: TRUE
- toc_float:
- collapsed: false
- smooth_scroll: true
- toc_depth: 3
- ---
- # Set-up
- ```{r setup, include=FALSE}
- knitr::opts_chunk$set(echo = TRUE,
- message = FALSE,
- warning = FALSE,
- dev = 'png')
- options(scipen=999)
- ```
- ## Load packages
- ```{r message=FALSE, warning=FALSE}
- library(readxl)
- library(mgcv)
- library(ggplot2)
- library(reshape2)
- library(tidyverse)
- library(tidygam)
- library(gratia)
- library(dplyr)
- ```
- ## Load data
- After the first time you run this markdown, this chunk should then find 'Data/projectdata_long.RData' and pre-load it
- ```{r}
- if (file.exists("Data/projectdata_long.RData")) {
- load("Data/projectdata_long.RData")
- print("Loaded 'projectdata_long'. Skip straight to 'Functions' section.")
- } else {
- print("Could not find 'projectdata_long' RData file. Importing original data sheet for wrangling...")
- data <- read_excel("Data/BIFUNC_data_GC_matrices.xlsx")
- maindata <- data.frame(data)
- }
- ```
- ## Set up data
- ```{r message=FALSE}
- # "postfib" = Domain-general
- # "postflan" = Attentional domain
- # "postmulti" = Language domain
- if (exists("projectdata_long")) {
- print("'projectdata_long' already loaded. Skip straight to 'Functions' section")
- } else {
- # Check column names
- names(maindata)
- }
- ```
- ### Set variable types
- ```{r collapse=TRUE}
- if (exists("projectdata_long")) {
- print("'projectdata_long' already loaded. Skip straight to 'Functions' section")
- } else {
- # Gender - nominal factor - 2 levels
- maindata$gender_quant <- factor(maindata$gender_quant,
- levels = c("1", "2"),
- labels = c("Female", "Male"))
- contrasts(maindata$gender_quant) <- "contr.treatment"
- # Subject Education level - ordinal factor - 5 levels
- maindata$education_subj_quant <- factor(maindata$education_subj_quant,
- levels = c("3", "4", "5"),
- labels = c("A-Level",
- "Degree/Diploma",
- "Postgraduate"),
- ordered = TRUE)
- contrasts(maindata$education_subj_quant) <- "contr.sum"
- # Subjid - factor - random effect
- maindata$subjid <- as.factor(maindata$subjid)
- }
- ```
- ### Convert to long format
- ```{r}
- if (exists("projectdata_long")) {
- print("'projectdata_long' has already been made & saved. Skip straight to 'Functions' section")
- } else {
- projectdata_long <- maindata
- projectdata_long <- maindata %>%
- pivot_longer(
- cols = matches("^(pretask|postfib|postflan|postmulti)_"),
- names_to = c("condition", "region"),
- names_pattern = "([^_]+)_(.*)",
- values_to = "connectivity"
- )
- # Set region to factor
- projectdata_long$region <- as.factor(projectdata_long$region)
- # Remove LSBQ_comp outlier
- projectdata_long <- subset(projectdata_long, subjid != "30")
- # Save for quick loading in future
- save(projectdata_long, file = "Data/projectdata_long.RData")
- }
- ```
- ## Functions
- Make sure to run all 3 of these to avoid errors later in the markdown
- ### MC correction function
- ```{r}
- extract_pre_post_pvals <- function(model, model_id = "model1") {
- smry <- summary(model)
- if (!is.null(smry$s.table) && "p-value" %in% colnames(smry$s.table)) {
- df <- data.frame(
- model_id = model_id,
- term = rownames(smry$s.table),
- p_value = smry$s.table[, "p-value"]
- )
- rownames(df) <- NULL
- df <- df %>%
- filter(grepl("^s\\(lsbq_comp):region", term)) %>%
- mutate(
- region = sub("^s\\(lsbq_comp):region", "", term),
- p_adj_fdr = p.adjust(p_value, method = "fdr"),
- sig_raw = ifelse(p_value < 0.05, "SIG", "-"),
- sig_fdr = ifelse(p_adj_fdr < 0.05, "SIG", "-")
- )
- return(df)
- } else {
- return(data.frame(
- model_id = character(0),
- term = character(0),
- p_value = numeric(0),
- region = character(0),
- p_adj_fdr = numeric(0),
- sig_raw = character(0),
- sig_fdr = character(0)
- ))
- }
- }
- ```
- ### Pre-task plots function
- ```{r}
- generate_pretask_plots <- function(model, term_list, color = "green4") {
- plot_list <- list()
- for (term in term_list) {
- region_label <- gsub("s\\(lsbq_comp):region", "", term)
- title_text <- gsub("_", " ", region_label)
- title_text <- tools::toTitleCase(title_text)
- plot_obj <- draw(model, select = term) +
- labs(
- title = paste("Pre-task", title_text, "Connectivity"),
- y = "Connectivity",
- x = "LSBQ Composite Score"
- ) +
- geom_line(color = color)
- plot_obj$layers[[1]]$aes_params$fill <- color
- plot_list[[region_label]] <- plot_obj
- print(plot_obj)
- }
- return(plot_list)
- }
- ```
- ### Post-task plots function
- ```{r}
- generate_posttask_plots <- function(model, term_list, color = "orange2") {
- plot_list <- list()
- for (term in term_list) {
- region_label <- gsub("s\\(lsbq_comp):region", "", term)
- title_text <- gsub("_", " ", region_label)
- title_text <- tools::toTitleCase(title_text)
- plot_obj <- draw(model, select = term) +
- labs(
- title = paste("Post-task", title_text, "Connectivity"),
- y = "Connectivity",
- x = "LSBQ Composite Score"
- ) +
- geom_line(color = color)
- plot_obj$layers[[1]]$aes_params$fill <- color
- plot_list[[region_label]] <- plot_obj
- print(plot_obj)
- }
- return(plot_list)
- }
- ```
- ### Save GAM checks function
- ```{r}
- save_gam_check <- function(model, name) {
- subfolder <- if (grepl("pretask", name, ignore.case = TRUE)) {
- "Checks/gam.check/Pretask"
- } else {
- "Checks/gam.check/Posttask"
- }
- dir.create(subfolder, recursive = TRUE, showWarnings = FALSE)
- txt <- capture.output(gam.check(model, k.rep = 1000))
- writeLines(txt, file.path(subfolder, paste0(name, "_gam.check.txt")))
- pdf(file.path(subfolder, paste0(name, "_gam.check.pdf")),
- width = 8.27, height = 11.69)
- lines_per_page <- 70
- total_lines <- length(txt)
- pages <- ceiling(total_lines / lines_per_page)
- for (i in seq_len(pages)) {
- start_line <- (i - 1) * lines_per_page + 1
- end_line <- min(i * lines_per_page, total_lines)
- plot.new()
- text(0, 1, paste(txt[start_line:end_line], collapse = "\n"),
- adj = c(0, 1), family = "mono", cex = 0.6)
- }
- gam.check(model, k.rep = 1000)
- dev.off()
- }
- ```
- # Models
- ## Load Pre-fitted
- After running this markdown for the first time, the chunk below should then find the listed models & summaries
- This avoids having to re-fit everything each time the markdown is loaded
- ```{r}
- gam_files <- c(
- "Models/lsbq_pretask.RData",
- "Models/lsbq_posttask.RData",
- "Summaries/lsbq_pretask_summ.RData",
- "Summaries/lsbq_posttask_summ.RData"
- )
- for (f in gam_files) {
- if (file.exists(f)) {
- load(f)
- print(paste("Loaded:", f))
- } else {
- print(paste("No previously-fitted GAM or summary found at", f))
- }
- }
- # Clean up env
- rm(f)
- rm(gam_files)
- ```
- ## Fitting
- ### Pre-task
- #### Construct & FDR correct
- ```{r}
- if (!exists("lsbq_pretask")) {
- lsbq_pretask <- bam(connectivity ~
- s(lsbq_comp, by = region, k = 15, sp = 0.02) + # k = 15 means k-value (no. of basis functions) = 14
- region +
- s(taskorder, bs = "re") +
- s(subjid, bs = "re") +
- age + lang2_aoa + education_subj_quant + gender_quant,
- data = projectdata_long %>%
- filter(condition == "pretask"),
- method = "fREML", discrete = TRUE, nthreads = 21)
- save(lsbq_pretask, file = "Models/lsbq_pretask.RData")
- lsbq_pretask_summ <- summary(lsbq_pretask)
- save(lsbq_pretask_summ, file = "Summaries/lsbq_pretask_summ.RData")
- print(lsbq_pretask_summ)
- pretask_pvals <- extract_pre_post_pvals(lsbq_pretask, model_id = "lsbq_pretask")
- write.csv(
- pretask_pvals,
- file = "MC_corrections/lsbq_pretask_pvals_fdr.csv",
- row.names = FALSE
- )
- } else {
- print("lsbq_pretask model already exists in environment; skipping re-fit & printing summary...")
- if (exists("lsbq_pretask_summ")) {
- print(lsbq_pretask_summ)
- pretask_pvals <- extract_pre_post_pvals(lsbq_pretask, model_id = "lsbq_pretask")
- } else {
- print("lsbq_pretask_summ object not found, saving for later retrieval & printing summary...")
- lsbq_pretask_summ <- summary(lsbq_pretask)
- save(lsbq_pretask_summ, file = "Summaries/lsbq_pretask_summ.RData")
- print(lsbq_pretask_summ)
- pretask_pvals <- extract_pre_post_pvals(lsbq_pretask, model_id = "lsbq_pretask")
- if (file.exists("MC_corrections/lsbq_pretask_pvals_fdr.csv")) {
- print("Pre-task FDR-corrected CSV file already exists; skipping saving...")
- } else {
- write.csv(
- pretask_pvals,
- file = "MC_corrections/lsbq_pretask_pvals_fdr.csv",
- row.names = FALSE
- )
- }
- }
- }
- ```
- ##### Corrected p-values
- ```{r}
- print(pretask_pvals[, c("region", "p_adj_fdr", "sig_fdr")])
- ```
- #### Plot
- ```{r}
- # List significant terms post-FDR correction
- pretask_sig_mods <- list(
- "s(lsbq_comp):regionleft_central_right_central",
- "s(lsbq_comp):regionleft_central_right_parietal",
- "s(lsbq_comp):regionmedial_occipital_medial_frontal",
- "s(lsbq_comp):regionright_central_medial_occipital",
- "s(lsbq_comp):regionright_temporal_right_parietal"
- )
- # Plot preliminary visualisations
- pretask_plots <- generate_pretask_plots(lsbq_pretask, pretask_sig_mods)
- ```
- ### Post-task
- #### Construct & FDR correct
- ```{r}
- if (!exists("lsbq_posttask")) {
- lsbq_posttask <- bam(connectivity ~
- s(lsbq_comp, by = region, k = 15, sp = 0.02) + # k = 15 means k-value (no. of basis functions) = 14
- region +
- s(taskorder, bs = "re") +
- s(subjid, bs = "re") +
- age + lang2_aoa + education_subj_quant + gender_quant,
- data = projectdata_long %>%
- filter(condition == "postfib"),
- method = "fREML", discrete = TRUE, nthreads = 21)
- save(lsbq_posttask, file = "Models/lsbq_posttask.RData")
- lsbq_posttask_summ <- summary(lsbq_posttask)
- save(lsbq_posttask_summ, file = "Summaries/lsbq_posttask_summ.RData")
- print(lsbq_posttask_summ)
- posttask_pvals <- extract_pre_post_pvals(lsbq_posttask, model_id = "lsbq_posttask")
- write.csv(
- posttask_pvals,
- file = "MC_corrections/lsbq_posttask_pvals_fdr.csv",
- row.names = FALSE
- )
- } else {
- print("lsbq_posttask model already exists in environment; skipping re-fit & printing summary...")
- if (exists("lsbq_posttask_summ")) {
- print(lsbq_posttask_summ)
- posttask_pvals <- extract_pre_post_pvals(lsbq_posttask, model_id = "lsbq_posttask")
- } else {
- print("lsbq_posttask_summ object not found, saving for later retrieval & printing summary...")
- lsbq_posttask_summ <- summary(lsbq_posttask)
- save(lsbq_posttask_summ, file = "Summaries/lsbq_posttask_summ.RData")
- print(lsbq_posttask_summ)
- posttask_pvals <- extract_pre_post_pvals(lsbq_posttask, model_id = "lsbq_posttask")
- if (file.exists("MC_corrections/lsbq_posttask_pvals_fdr.csv")) {
- print("Post-task FDR-corrected CSV file already exists; skipping saving...")
- } else {
- write.csv(
- posttask_pvals,
- file = "MC_corrections/lsbq_posttask_pvals_fdr.csv",
- row.names = FALSE
- )
- }
- }
- }
- ```
- ##### Corrected p-values
- ```{r}
- print(posttask_pvals[, c("region", "p_adj_fdr", "sig_fdr")])
- ```
- #### Plot
- ```{r}
- # List significant terms post-FDR correction
- posttask_sig_mods <- list(
- "s(lsbq_comp):regionleft_central_left_temporal",
- "s(lsbq_comp):regionleft_central_medial_occipital",
- "s(lsbq_comp):regionleft_central_right_parietal",
- "s(lsbq_comp):regionleft_temporal_left_parietal",
- "s(lsbq_comp):regionmedial_frontal_left_central",
- "s(lsbq_comp):regionmedial_frontal_left_temporal",
- "s(lsbq_comp):regionmedial_frontal_medial_occipital"
- )
- # Plot preliminary visualisations
- posttask_plots <- generate_posttask_plots(lsbq_posttask, posttask_sig_mods)
- ```
- # Model Checks
- ## Pre-task
- ```{r}
- save_gam_check(lsbq_pretask, "lsbq_pretask")
- ```
- ## Post-task
- ```{r}
- save_gam_check(lsbq_posttask, "lsbq_posttask")
- ```
- # Individual plots
- Running the chunks below will overwrite any plots already generated & saved
- ## Pre-task
- ```{r}
- # Show index numbers of terms in model
- invisible(lapply(seq_along(lsbq_pretask$smooth), function(i) {
- cat(paste0("[", i, "] ", lsbq_pretask$smooth[[i]]$label, "\n"))
- }))
- # # Sig. terms & index numbers
- # s(lsbq_comp):regionleft_central_right_central - [5]
- # s(lsbq_comp):regionleft_central_right_parietal - [6]
- # s(lsbq_comp):regionmedial_occipital_medial_frontal - [32]
- # s(lsbq_comp):regionright_central_medial_occipital - [40]
- # s(lsbq_comp):regionright_temporal_right_parietal - [56]
- ```
- ### Left Central to Right Central
- ```{r}
- plt_lsbq_pretask_lefcen_rigcen <- draw(lsbq_pretask, select = 5) +
- labs(title = "Left Central to Right Central",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "green4")
- plt_lsbq_pretask_lefcen_rigcen$layers[[1]]$aes_params$fill <- "green4"
- print(plt_lsbq_pretask_lefcen_rigcen)
- ggsave(
- "Pre-task - Left Central to Right Central.svg",
- device = "svg",
- path = "Plots/SVG/Pretask")
- ggsave(
- "Pre-task - Left Central to Right Central.png",
- device = "png",
- path = "Plots/PNG/Pretask")
- ```
- ### Left Central to Right Parietal
- ```{r}
- plt_lsbq_pretask_lefcen_rigpar <- draw(lsbq_pretask, select = 6) +
- labs(title = "Left Central to Right Parietal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "green4")
- plt_lsbq_pretask_lefcen_rigpar$layers[[1]]$aes_params$fill <- "green4"
- print(plt_lsbq_pretask_lefcen_rigpar)
- ggsave(
- "Pre-task - Left Central to Right Parietal.svg",
- device = "svg",
- path = "Plots/SVG/Pretask")
- ggsave(
- "Pre-task - Left Central to Right Parietal.png",
- device = "png",
- path = "Plots/PNG/Pretask")
- ```
- ### Medial Occipital to Medial Frontal
- ```{r}
- plt_lsbq_pretask_medocc_medfro <- draw(lsbq_pretask, select = 32) +
- labs(title = "Medial Occipital to Medial Frontal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "green4")
- plt_lsbq_pretask_medocc_medfro$layers[[1]]$aes_params$fill <- "green4"
- print(plt_lsbq_pretask_medocc_medfro)
- ggsave(
- "Pre-task - Medial Occipital to Medial Frontal.svg",
- device = "svg",
- path = "Plots/SVG/Pretask")
- ggsave(
- "Pre-task - Medial Occipital to Medial Frontal.png",
- device = "png",
- path = "Plots/PNG/Pretask")
- ```
- ### Right Central to Medial Occipital
- ```{r}
- plt_lsbq_pretask_rigcen_medocc <- draw(lsbq_pretask, select = 40) +
- labs(title = "Right Central to Medial Occipital",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "green4")
- plt_lsbq_pretask_rigcen_medocc$layers[[1]]$aes_params$fill <- "green4"
- print(plt_lsbq_pretask_rigcen_medocc)
- ggsave(
- "Pre-task - Right Central to Medial Occipital.svg",
- device = "svg",
- path = "Plots/SVG/Pretask")
- ggsave(
- "Pre-task - Right Central to Medial Occipital.png",
- device = "png",
- path = "Plots/PNG/Pretask")
- ```
- ### Right Temporal to Right Parietal
- ```{r}
- plt_lsbq_pretask_rigtem_rigpar <- draw(lsbq_pretask, select = 56) +
- labs(title = "Right Temporal to Right Parietal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "green4")
- plt_lsbq_pretask_rigtem_rigpar$layers[[1]]$aes_params$fill <- "green4"
- print(plt_lsbq_pretask_rigtem_rigpar)
- ggsave(
- "Pre-task - Right Temporal to Right Parietal.svg",
- device = "svg",
- path = "Plots/SVG/Pretask")
- ggsave(
- "Pre-task - Right Temporal to Right Parietal.png",
- device = "png",
- path = "Plots/PNG/Pretask")
- ```
- ## Post-task
- ```{r}
- # Show index numbers of terms in model
- invisible(lapply(seq_along(lsbq_posttask$smooth), function(i) {
- cat(paste0("[", i, "] ", lsbq_posttask$smooth[[i]]$label, "\n"))
- }))
- # s(lsbq_comp):regionleft_central_left_temporal - [2]
- # s(lsbq_comp):regionleft_central_medial_occipital - [4]
- # s(lsbq_comp):regionleft_central_right_parietal - [6]
- # s(lsbq_comp):regionleft_temporal_left_parietal - [16]
- # s(lsbq_comp):regionmedial_frontal_left_central - [22]
- # s(lsbq_comp):regionmedial_frontal_left_temporal - [24]
- # s(lsbq_comp):regionmedial_frontal_medial_occipital - [25]
- ```
- ### Left Central to Left Temporal
- ```{r}
- plt_lsbq_posttask_lefcen_leftem <- draw(lsbq_posttask, select = 2) +
- labs(title = "Left Central to Left Temporal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_lefcen_leftem$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_lefcen_leftem)
- ggsave(
- "Post-task - Left Central to Left Temporal.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Left Central to Left Temporal.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- ### Left Central to Medial Occipital
- ```{r}
- plt_lsbq_posttask_lefcen_medocc <- draw(lsbq_posttask, select = 4) +
- labs(title = "Left Central to Medial Occipital",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_lefcen_medocc$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_lefcen_medocc)
- ggsave(
- "Post-task - Left Central to Medial Occipital.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Left Central to Medial Occipital.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- ### Left Central to Right Parietal
- ```{r}
- plt_lsbq_posttask_lefcen_rigpar <- draw(lsbq_posttask, select = 6) +
- labs(title = "Left Central to Right Parietal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_lefcen_rigpar$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_lefcen_rigpar)
- ggsave(
- "Post-task - Left Central to Right Parietal.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Left Central to Right Parietal.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- ### Left Temporal to Left Parietal
- ```{r}
- plt_lsbq_posttask_leftem_lefpar <- draw(lsbq_posttask, select = 16) +
- labs(title = "Left Temporal to Left Parietal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_leftem_lefpar$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_leftem_lefpar)
- ggsave(
- "Post-task - Left Temporal to Left Parietal.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Left Temporal to Left Parietal.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- ### Medial Frontal to Left Central
- ```{r}
- plt_lsbq_posttask_medfro_lefcen <- draw(lsbq_posttask, select = 22) +
- labs(title = "Medial Frontal to Left Central",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_medfro_lefcen$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_medfro_lefcen)
- ggsave(
- "Post-task - Medial Frontal to Left Central.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Medial Frontal to Left Central.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- ### Medial Frontal to Left Temporal
- ```{r}
- plt_lsbq_posttask_medfro_leftem <- draw(lsbq_posttask, select = 24) +
- labs(title = "Medial Frontal to Left Temporal",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_medfro_leftem$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_medfro_leftem)
- ggsave(
- "Post-task - Medial Frontal to Left Temporal.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Medial Frontal to Left Temporal.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- ### Medial Frontal to Medial Occipital
- ```{r}
- plt_lsbq_posttask_medfro_medocc <- draw(lsbq_posttask, select = 25) +
- labs(title = "Medial Frontal to Medial Occipital",
- subtitle = NULL) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- geom_line(color = "orange2")
- plt_lsbq_posttask_medfro_medocc$layers[[1]]$aes_params$fill <- "orange2"
- print(plt_lsbq_posttask_medfro_medocc)
- ggsave(
- "Post-task - Medial Frontal to Medial Occipital.svg",
- device = "svg",
- path = "Plots/SVG/Posttask")
- ggsave(
- "Post-task - Medial Frontal to Medial Occipital.png",
- device = "png",
- path = "Plots/PNG/Posttask")
- ```
- # Common connections between conditions
- ## Left Central to Right Parietal
- ```{r}
- lsbq_prepost <- compare_smooths(
- lsbq_pretask, lsbq_posttask,
- select = "s(lsbq_comp):regionleft_central_right_parietal"
- )
- lsbq_prepost$.model <- factor(lsbq_prepost$.model,
- levels = c("lsbq_pretask", "lsbq_posttask"),
- labels = c("Pre-task", "Post-task"))
- plt_lsbq_prepost_lefcen_rigpar <- draw(lsbq_prepost) +
- labs(title = "Left Central to Right Parietal",
- subtitle = "Pre-task and Post-task Comparison",
- color = "Condition") +
- scale_color_manual(labels = c("Pre-task", "Post-task"),
- values = c("green4", "orange2")) +
- scale_fill_manual(values = c("green4", "orange2")) +
- ylab("Granger Causality") +
- xlab("LSBQ Composite Score") +
- guides(fill = "none") +
- geom_rug(data = subset(projectdata_long, condition == "pretask"),
- mapping = aes(x = lsbq_comp),
- color = scales::alpha("grey40", 0.5),
- linewidth = 0.25,
- inherit.aes = FALSE,
- show.legend = FALSE,
- sides = "b")
- print(plt_lsbq_prepost_lefcen_rigpar)
- ggsave(
- "Pre-post Comparison - Left Central to Right Parietal.svg",
- device = "svg",
- path = "Plots/SVG/Both")
- ggsave(
- "Pre-post Comparison - Left Central to Right Parietal.png",
- device = "png",
- path = "Plots/PNG/Both")
- ```
BIFUNC Pre- & Post-task Statistical Analysis.Rmd, no license · at the source
Overview
- School of Psychology and Clinical Language Sciences, University of Reading, Reading, UK
- School of Languages, Linguistics, Literatures and, Cultures, Faculty of Arts, University of Calgary, Calgary, AB Canada
- King’s College Hospital NHS Foundation Trust, London, UK
- Facultad de Lenguas y Educación, Centro de Ciencia Cognitiva, Universidad Antonio de Nebrija, Madrid, Spain
Abstract
Bilingualism is associated with distinct patterns of resting-state functional brain connectivity – a consequence of ongoing language control demands that do not apply to monolinguals. However, it is not well understood how these patterns affect, and are affected by, brain activation for domain-general cognitively demanding tasks. Here, we employ a novel task-driven resting-state electroencephalography design including an implicit Lindenmayer grammar learning task, which tracks aperiodic and hierarchical dependencies, to determine task-related functional connectivity changes in bilinguals. Quantified bilingual experience was used as a predictor of directional effects, using Generalised Additive Models to account for non-linear patterns. Our results revealed post-task alterations to connectivity involving increased involvement of occipital regions, reduced involvement of frontal and central regions, and faster reaction times to stimuli at higher levels of bilingual experience. Crucially, the regions implicated post-task appear to reflect task-relevant regions which are involved in the language and executive control networks, reflecting greater short-term task-driven flexibility. These findings have important implications for our understanding of how domain-general processing and connectivity are shaped by linguistic experience.
Supplementary Information: The online version contains supplementary material available at 10.1038/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
OSF 4qkfd
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
- 30 September 2026: the link answers (HTTP 200)
3 files
- Analysis/
Behavioural/ , R, 2,510 linesBIFUNC behavioural analysis.Rmd - Analysis/
EEG/ , R, 840 lines, 2 matchesBIFUNC Pre- & Post-task Statistical Analysis.Rmd - Analysis/
EEG/ , R, 210 lines, 1 matchBIFUNC Supplementary Model Comparisons.Rmd
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 3 scripts, each with its path and the digest of its content;
- 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability
The data sheets, code, and task used for this manuscript are available in an Open Science Framework repository at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 2 keywords, 11 MeSH terms, 1 funder, 66 references.
Cite
This paper
Sheehan, A., Saddy, D., Krivochen, D., Gupta, S., Sibsey, M., & Pliatsikas, C. (2026). Bilingualism modulates functional connectivity induced by a domain-general artificial grammar learning task. Scientific reports, 16(1), 12756. https://
BibTeX
@article{sheehan2026bili
author = {Sheehan, Alex and Saddy, Doug and Krivochen, Diego and Gupta, Shruti and Sibsey, Mickey and Pliatsikas, Christos},
title = {{Bilingualism modulates functional connectivity induced by a domain-general artificial grammar learning task}},
journal = {Scientific reports},
year = {2026},
month = mar,
volume = {16},
number = {1},
pages = {12756},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/
url = {https://
pmid = {41803385},
pmcid = {PMC13096162}
}
RIS
TY - JOUR
AU - Sheehan, Alex
AU - Saddy, Doug
AU - Krivochen, Diego
AU - Gupta, Shruti
AU - Sibsey, Mickey
AU - Pliatsikas, Christos
TI - Bilingualism modulates functional connectivity induced by a domain-general artificial grammar learning task
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/
VL - 16
IS - 1
SP - 12756
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Bilingualism modulates functional connectivity induced by a domain-general artificial grammar learning task",
"container-title": "Scientific reports",
"author": [
{
"family": "Sheehan",
"given": "Alex"
},
{
"family": "Saddy",
"given": "Doug"
},
{
"family": "Krivochen",
"given": "Diego"
},
{
"family": "Gupta",
"given": "Shruti"
},
{
"family": "Sibsey",
"given": "Mickey"
},
{
"family": "Pliatsikas",
"given": "Christos"
}
],
"container-title-short":
"volume": "16",
"issue": "1",
"page": "12756",
"DOI": "10.1038/
"PMID": "41803385",
"PMCID": "PMC13096162",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
9
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41467-026-71415-x [code]
- Regional BOLD variability reflects microstructural maturation and neuronal ensheathment in the preterm infant cortex.Journal: Nature communicationsIn common: mgcv, broom, lmerTest, 4 other tools
- [2] doi:10.1016/j.celrep.2026.117505 [code]
- Impaired spatial coding and neuronal hyperactivity in the medial entorhinal cortex of aged APP knock-in mice.Journal: Cell reportsIn common: mgcv, broom, lmerTest, 4 other tools
- [3] doi:10.1111/psyp.70265 [code]
- Neurocognitive Dynamics of Translating Information From a Spatial Map Into Action.Journal: PsychophysiologyIn common: mgcv, lmerTest, lme4, 2 other tools, EEG, cognitive, 1 reference
- [4] doi:10.1038/s41593-026-02363-4 [code]
- Cortical thickness changes precede high levels of amyloid by at least 7 years.Journal: Nature neuroscienceIn common: mgcv, broom, lmerTest, 3 other tools
- [5] doi:10.1093/bioinformatics/btag592 [code]
- Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.Journal: Bioinformatics (Oxford, England)In common: mgcv, broom, lme4, 3 other tools
- [6] doi:10.1038/s41467-026-73072-6 [code]
- Mapping the spatiotemporal continuum of structural connectivity development across the human connectome in youth.Journal: Nature communicationsIn common: mgcv, lmerTest, lme4, 3 other tools
- [7] doi:10.1162/opmi.a.372 [code]
- Broadening the Agent Preference Hypothesis Through Experiencers: Eye-Tracking and EEG Evidence of Proto-Agents and Proto-Patients.Journal: Open mind : discoveries in cognitive scienceIn common: mgcv, reshape2, ggplot2, 1 other tool, EEG, 2 references
- [8] doi:10.1371/journal.pone.0353990 [code]
- Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language.Journal: PloS oneIn common: lmerTest, lme4, reshape2, 2 other tools, EEG, cognitive, 1 reference
- [9] doi:10.1016/j.neuroimage.2026.122115 [code]
- Midfrontal theta power relates to response speeding following frustrative nonreward.Journal: NeuroImageIn common: lmerTest, lme4, reshape2, 2 other tools, EEG, cognitive, 1 reference
- [10] doi:10.1523/eneuro.0316-25.2026 [code]
- Neural Mechanisms of Self-Generated Action Sequences.Journal: eNeuroIn common: lmerTest, lme4, reshape2, 2 other tools, EEG, cognitive, 1 reference
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 3 scripts, and 3 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:69d1921ca100b027…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
