Broadening the Agent Preference Hypothesis Through Experiencers: Eye-Tracking and EEG Evidence of Proto-Agents and Proto-Patients.
The 7 matches
- [1] § EXPERIMENT 2 › Data Processing and Analyses ↔ Scripts/Preprocessing_eeg_data.m, lines 361–416 · score 0.64 · 200–900 ms, TBT, artifact, epoched, 200 ms, ERP
- [2] § EXPERIMENT 2 › Data Processing and Analyses ↔ Scripts/Preprocessing_eeg_data.m, lines 6–29 · score 0.59 · rejected channels, Artifact correction, EEG
- [3] § EXPERIMENT 2 › Data Processing and Analyses ↔ Scripts/Preprocessing_eeg_data.m, lines 190–245 · score 0.59 · high pass filtered, EEGLAB, preprocessed, channels
- [4] § EXPERIMENT 2 › Data Processing and Analyses ↔ Scripts/TFA.qmd, lines 308–384 · score 0.55 · 300–500 ms, 600–800 ms, TFA, windows, 300 ms, 600 ms
- [5] § EXPERIMENT 2 › Results ↔ Scripts/TFA.qmd, lines 227–306 · score 0.55 · 600–800 ms, 600 ms, theta, N400, patients, agents
- [6] § EXPERIMENT 2 › Discussion ↔ Scripts/TFA.qmd, lines 176–225 · score 0.53 · 300–500 ms, 600–800 ms, window, N400, electrodes, 300 ms
- [7] § EXPERIMENT 2 › Data Processing and Analyses ↔ Scripts/TFA.qmd, lines 308–384 · score 0.51 · 300–500 ms, 600–800 ms, window, electrode, 300 ms, 600 ms
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
Quarto · 1,556 lines · 45 KB · no license · 4 matches
- ---
- title: "TFA"
- format: pdf
- editor: visual
- ---
- This script is based on the original analysis script published on OSF for: Isasi-Isasmendi, A. et al., (2023). Incremental sentence processing is guided by a preference for agents: EEG evidence from Basque. Language, Cognition and Neuroscience. Original OSF repository: https://osf.io/6gjkz/?viewonly=825cdcbd9b1347c9868cf43426e7761c The present version includes modifications and extensions for the current project.
- # Library
- ```{r}
- library(tidyverse)
- library(pbapply)
- library(reshape2)
- library(car)
- library(DescTools)
- library(readxl)
- library(mgcv)
- library(itsadug)
- library(mgcViz)
- library(gplots)
- library(brms)
- library(R.matlab)
- library(viridisLite)
- library(dplyr)
- ```
- # Create function
- ```{r}
- surprisal_df <- readxl::read_excel('/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/Matlab_code/EYEEEG2025/export_epochs/EYEEEG_2025_ERP/output_surprisal_eeg_2.xlsx')
- names(surprisal_df) <- tolower(names(surprisal_df))
- surprisal_df <- surprisal_df %>%
- filter(!region %in% c("subject", "preverb")) %>%
- group_by(number_item, condition, region) %>%
- summarise(
- surprisal = if (region[1] == "verb") sum(surprisal, na.rm = TRUE) else first(surprisal),
- .groups = "drop"
- )
- ```
- ```{r}
- read_tfa_agent_v <- function(i) {
- data <- readMat(agent_v_files[i])
- data<-data$freq.agent.v.baselined
- datachan<-data[[1]]
- datafreq<-data[[3]]
- datatime<-data[[4]]
- data<-data[[8]]
- dimnames(data) <- list(c(),c(datachan),c(datafreq),c(datatime))
- data<-reshape2::melt(data)
- return(data)
- }
- read_tfa_experiencer_v <- function(i) {
- data <- readMat(experiencer_v_files[i])
- data<-data$freq.experiencer.v.baselined
- datachan<-data[[1]]
- datafreq<-data[[3]]
- datatime<-data[[4]]
- data<-data[[8]]
- dimnames(data) <- list(c(),c(datachan),c(datafreq),c(datatime))
- data<-reshape2::melt(data)
- return(data)
- }
- read_tfa_patient_v <- function(i) {
- data <- readMat(patient_v_files[i])
- data<-data$freq.patient.v.baselined
- datachan<-data[[1]]
- datafreq<-data[[3]]
- datatime<-data[[4]]
- data<-data[[8]]
- dimnames(data) <- list(c(),c(datachan),c(datafreq),c(datatime))
- data<-melt(data)
- return(data)
- }
- ```
- # Set directory
- ```{r}
- setwd(
- '/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/Matlab_code/EYEEEG2025/4_output_TFA'
- )
- agent_v_files <- list.files(path = '/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/Matlab_code/EYEEEG2025/4_output_TFA', pattern = "_agent_v_TFA_rev.mat")
- experiencer_v_files <- list.files(path = '/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/Matlab_code/EYEEEG2025/4_output_TFA', pattern = "_experiencer_v_TFA_rev.mat")
- patient_v_files <- list.files(path = '/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/Matlab_code/EYEEEG2025/4_output_TFA', pattern = "_patient_v_TFA_rev.mat")
- ```
- # Run function
- ```{r}
- process_files_segmented <- function(files, read_function, output_dir_n400, output_dir_p600, time_window_n400, time_window_p600, condition) {
- if (!dir.exists(output_dir_n400)) dir.create(output_dir_n400)
- if (!dir.exists(output_dir_p600)) dir.create(output_dir_p600)
- message("Processing files for condition: ", condition)
- lapply(seq_along(files), function(i) {
- message(paste("Processing file:", i, "de", length(files)))
- df <- read_function(i)
- df$Condition <- condition
- df$Participant <- gsub("\\D", "", files[i])
- colnames(df) <- c("Channel", "Electrode", "Frequency", "Time", "Power", "condition", "Participant")
- # E-Prime files
- subj_id <- sprintf("%02d", as.numeric(df$Participant[1]))
- eprime_dir <- '/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/Matlab_code/EYEEEG2025/export_epochs/EEG_Marta'
- eprime_file <- list.files(path = eprime_dir, pattern = paste0("-", as.numeric(subj_id), "-1\\.txt$"), full.names = TRUE)
- for (window_name in c("n400", "p600")) {
- time_window <- if (window_name == "n400") time_window_n400 else time_window_p600
- df_segment <- df %>% filter(Time >= time_window[1] & Time <= time_window[2])
- if (nrow(df_segment) == 0) next
- if (length(eprime_file) == 1) {
- eprime_lines <- readLines(file(eprime_file[1], encoding = "UTF-16LE"), warn = FALSE)
- number_items <- c()
- potential_number <- NULL
- is_experimental <- FALSE
- for (line in eprime_lines) {
- if (grepl("NUMBER_ITEM", line)) {
- potential_number <- as.numeric(stringr::str_extract(line, "\\d+$"))
- }
- if (grepl("CONDITION:\\s*EXPERIMENTAL", line, ignore.case = TRUE)) {
- is_experimental <- TRUE
- }
- if (!is.null(potential_number) && is_experimental) {
- number_items <- c(number_items, potential_number)
- potential_number <- NULL
- is_experimental <- FALSE
- }
- if (grepl("^Trial", line, ignore.case = TRUE)) {
- potential_number <- NULL
- is_experimental <- FALSE
- }
- }
- n_timepoints <- length(unique(df_segment$Time))
- n_trials <- length(number_items)
- df_segment$trial_number <- rep(1:n_trials, each = n_timepoints, length.out = nrow(df_segment))
- trial_info <- tibble(
- trial_number = 1:n_trials,
- number_item = number_items,
- region = "verb"
- )
- df_segment <- left_join(df_segment, trial_info, by = "trial_number")
- } else {
- warning(paste("No E-Prime file found for Subject", subj_id))
- df_segment$trial_number <- NA
- df_segment$number_item <- NA
- df_segment$region <- NA
- }
- # Guardar archivo
- output_file <- file.path(
- if (window_name == "n400") output_dir_n400 else output_dir_p600,
- paste0("processed_", condition, "_", window_name, "_", i, ".csv")
- )
- write.csv(df_segment, file = output_file, row.names = FALSE)
- }
- })
- message("Procesamiento para ", condition, " completado.")
- }
- time_window_n400 <- c(0.3, 0.5)
- time_window_p600 <- c(0.6, 0.8)
- output_dir_agent_n400 <- "processed_agent_n400_files"
- output_dir_agent_p600 <- "processed_agent_p600_files"
- output_dir_experiencer_n400 <- "processed_experiencer_n400_files"
- output_dir_experiencer_p600 <- "processed_experiencer_p600_files"
- output_dir_patient_n400 <- "processed_patient_n400_files"
- output_dir_patient_p600 <- "processed_patient_p600_files"
- process_files_segmented(agent_v_files, read_tfa_agent_v, output_dir_agent_n400, output_dir_agent_p600, time_window_n400, time_window_p600, "agent")
- process_files_segmented(experiencer_v_files, read_tfa_experiencer_v, output_dir_experiencer_n400, output_dir_experiencer_p600, time_window_n400, time_window_p600, "experiencer")
- process_files_segmented(patient_v_files, read_tfa_patient_v, output_dir_patient_n400, output_dir_patient_p600, time_window_n400, time_window_p600, "patient")
- iaf_table <- read.csv("IAF_table.csv")
- combine_files_to_disk_filtered <- function(files, output_file_theta, output_file_alpha, output_file_low_beta) {
- for (file in files) {
- df <- data.table::fread(file)
- df$Electrode <- substr(df$Electrode, 7, nchar(df$Electrode) - 2)
- df$Participant <- as.numeric(as.character(df$Participant))
- print(names(df))
- print(names(surprisal_df))
- df <- left_join(df, surprisal_df, by = c("condition", "region", "number_item"))
- print(head(df$surprisal))
- print(head(df$region))
- print(head(df$number_item))
- # Join with IAF
- df <- left_join(df, iaf_table, by = "Participant")
- print(summary(df$Frequency))
- print(sort(unique(df$Frequency)))
- df_theta <- df %>%
- group_by(Participant) %>%
- filter(Frequency >= (IAF - 6) & Frequency <= (IAF - 4)) %>%
- ungroup()
- print(nrow(df_theta))
- df_alpha <- df %>%
- group_by(Participant) %>%
- filter(Frequency >= (IAF - 4) & Frequency <= (IAF + 2)) %>%
- ungroup()
- print(nrow(df_alpha))
- df_low_beta <- df %>%
- group_by(Participant) %>%
- filter(Frequency >= (IAF + 2) & Frequency <= (IAF + 10)) %>%
- ungroup()
- print(nrow(df_low_beta))
- df_theta_600_800 <- df_theta %>%
- filter(Time >= 0.6 & Time <= 0.8)
- df_alpha_600_800 <- df_alpha %>%
- filter(Time >= 0.6 & Time <= 0.8)
- df_low_beta_600_800 <- df_low_beta %>%
- filter(Time >= 0.6 & Time <= 0.8)
- cat("Data in 600–800 ms:\n")
- cat("Theta:", nrow(df_theta_600_800), "\n")
- cat("Alpha:", nrow(df_alpha_600_800), "\n")
- cat("Low Beta:", nrow(df_low_beta_600_800), "\n")
- data.table::fwrite(df_theta, file = output_file_theta, append = TRUE, sep = ",", col.names = FALSE)
- data.table::fwrite(df_alpha, file = output_file_alpha, append = TRUE, sep = ",", col.names = FALSE)
- data.table::fwrite(df_low_beta, file = output_file_low_beta, append = TRUE, sep = ",", col.names = FALSE)
- rm(df, df_theta, df_alpha, df_low_beta)
- gc()
- }
- }
- output_file_theta <- "theta_with_locations.csv"
- output_file_alpha <- "alpha_with_locations.csv"
- output_file_low_beta <- "low_beta_with_locations.csv"
- write.table(NULL, file = output_file_theta, col.names = TRUE, sep = ",", row.names = FALSE)
- write.table(NULL, file = output_file_alpha, col.names = TRUE, sep = ",", row.names = FALSE)
- write.table(NULL, file = output_file_low_beta, col.names = TRUE, sep = ",", row.names = FALSE)
- # Procesar archivos segmentados para ambas condiciones
- agent_n400_files <- list.files(output_dir_agent_n400, full.names = TRUE)
- agent_p600_files <- list.files(output_dir_agent_p600, full.names = TRUE)
- experiencer_n400_files <- list.files(output_dir_experiencer_n400, full.names = TRUE)
- experiencer_p600_files <- list.files(output_dir_experiencer_p600, full.names = TRUE)
- patient_n400_files <- list.files(output_dir_patient_n400, full.names = TRUE)
- patient_p600_files <- list.files(output_dir_patient_p600, full.names = TRUE)
- combine_files_to_disk_filtered(c(agent_n400_files, experiencer_n400_files, patient_n400_files), output_file_theta, output_file_alpha, output_file_low_beta)
- combine_files_to_disk_filtered(c(agent_p600_files, experiencer_p600_files, patient_p600_files), output_file_theta, output_file_alpha, output_file_low_beta)
- message("Completed")
- message("Theta: ", output_file_theta)
- message("Alpha: ", output_file_alpha)
- message("Beta: ", output_file_low_beta)
- ```
- ```{r}
- channel_loc_file <- '/Users/martasanchez/Documents/Documentos - MacBook Pro de Marta/R/EEG/location_erp'
- channel_loc <- read.table(file = channel_loc_file, sep = '\t', header = FALSE) %>%
- mutate(
- electrode = trimws(as.character(V2)),
- x = -as.numeric(V6),
- y = as.numeric(V5)
- ) %>%
- select(electrode, x, y) %>%
- mutate(electrode = gsub(" ", "", electrode, fixed = TRUE))
- theta_data <- read.csv("theta_with_locations.csv", header = FALSE, fill = TRUE, strip.white = TRUE)
- alpha_data <- read.csv("alpha_with_locations.csv", header = FALSE, fill = TRUE, strip.white = TRUE)
- low_beta_data <- read.csv("low_beta_with_locations.csv", header = FALSE, fill = TRUE, strip.white = TRUE)
- column_names <- c("Channel", "Electrode", "Frequency", "Time", "Power", "Condition", "Participant", "Trial", "number_item", "region", "surprisal", "IAF")
- colnames(theta_data) <- column_names
- colnames(alpha_data) <- column_names
- colnames(low_beta_data) <- column_names
- theta_data <- theta_data[, colSums(is.na(theta_data)) < nrow(theta_data)]
- alpha_data <- alpha_data[, colSums(is.na(alpha_data)) < nrow(alpha_data)]
- low_beta_data <- low_beta_data[, colSums(is.na(low_beta_data)) < nrow(low_beta_data)]
- theta_data$Electrode <- gsub('\\"', '', theta_data$Electrode)
- alpha_data$Electrode <- gsub('\\"', '', alpha_data$Electrode)
- low_beta_data$Electrode <- gsub('\\"', '', low_beta_data$Electrode)
- time_window_n400 <- c(0.3, 0.5)
- time_window_p600 <- c(0.6, 0.8)
- theta_N400 <- theta_data %>% filter(Time >= time_window_n400[1] & Time <= time_window_n400[2])
- theta_P600 <- theta_data %>% filter(Time >= time_window_p600[1] & Time <= time_window_p600[2])
- print(nrow(theta_P600))
- alpha_N400 <- alpha_data %>% filter(Time >= time_window_n400[1] & Time <= time_window_n400[2])
- alpha_P600 <- alpha_data %>% filter(Time >= time_window_p600[1] & Time <= time_window_p600[2])
- low_beta_N400 <- low_beta_data %>% filter(Time >= time_window_n400[1] & Time <= time_window_n400[2])
- low_beta_P600 <- low_beta_data %>% filter(Time >= time_window_p600[1] & Time <= time_window_p600[2])
- theta_N400 <- left_join(theta_N400, channel_loc, by = c("Electrode" = "electrode"))
- theta_P600 <- left_join(theta_P600, channel_loc, by = c("Electrode" = "electrode"))
- alpha_N400 <- left_join(alpha_N400, channel_loc, by = c("Electrode" = "electrode"))
- alpha_P600 <- left_join(alpha_P600, channel_loc, by = c("Electrode" = "electrode"))
- low_beta_N400 <- left_join(low_beta_N400, channel_loc, by = c("Electrode" = "electrode"))
- low_beta_P600 <- left_join(low_beta_P600, channel_loc, by = c("Electrode" = "electrode"))
- write.csv(theta_N400, "N400_theta.csv", row.names = FALSE)
- write.csv(theta_P600, "P600_theta.csv", row.names = FALSE)
- write.csv(alpha_N400, "N400_alpha.csv", row.names = FALSE)
- write.csv(alpha_P600, "P600_alpha.csv", row.names = FALSE)
- write.csv(low_beta_N400, "N400_low_beta.csv", row.names = FALSE)
- write.csv(low_beta_P600, "P600_low_beta.csv", row.names = FALSE)
- message("Files created:")
- message("N400 Theta: N400_alpha.csv")
- message("P600 Theta: P600_alpha.csv")
- message("N400 Alpha: N400_alpha.csv")
- message("P600 Alpha: P600_alpha.csv")
- message("N400 Beta: N400_low_beta.csv")
- message("P600 Beta: P600_low_beta.csv")
- ```
- # Fit the model
- ## Alpha 400
- ```{r}
- alpha_400_data <- read.csv("N400_alpha.csv", header = TRUE)
- summary(alpha_400_data)
- alpha_400_data <- alpha_400_data %>%
- dplyr::group_by_at(setdiff(names(alpha_400_data), c("Time", "Power"))) %>%
- dplyr::summarise(Power = mean(Power))
- alpha_400_data$Condition <- as.factor(alpha_400_data$Condition)
- alpha_400_data$trial_number.C <- c(scale(x = alpha_400_data$Trial, center = T, scale = F))
- alpha_400_data$surprisal.C <- c(scale(x = alpha_400_data$surprisal, center = T, scale = F))
- alpha_400_data <- alpha_400_data%>%drop_na(Power, x, y)
- alpha_400_data$Participant <- factor(alpha_400_data$Participant)
- alpha_400_data$number_item <- factor(alpha_400_data$number_item)
- ###################
- gam_space_alpha_400_null <-
- bam(formula = Power
- ~ 1
- + trial_number.C
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_alpha_400_all <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_alpha_400_es <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_alpha_400_s <-
- bam(formula = Power
- ~ 1
- + surprisal.C
- + trial_number.C
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_400_data,
- method = "ML",
- gc.level = 0)
- AIC(gam_space_alpha_400_all,gam_space_alpha_400_es, gam_space_alpha_400_s, gam_space_alpha_400_null)
- saveRDS(gam_space_alpha_400_null, file = "gam_space_alpha_400_null.rds")
- saveRDS(gam_space_alpha_400_all, file = "gam_space_alpha_400_all.rds")
- saveRDS(gam_space_alpha_400_es, file = "gam_space_alpha_400_es.rds")
- saveRDS(gam_space_alpha_400_s, file = "gam_space_alpha_400_s.rds")
- ```
- The model with the lower AIC is the model with all predictors.
- ```{r}
- alpha_400_data_pat <- within(alpha_400_data, Condition <- relevel(Condition, ref = "patient"))
- gam_space_alpha_400_pat <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_400_data_pat,
- method = "ML",
- gc.level = 0)
- summary(gam_space_alpha_400_pat)
- summary(gam_space_alpha_400_all)
- saveRDS(gam_space_alpha_400_pat, file = "gam_space_alpha_400_all_pat.rds")
- ```
- ###Plots
- ```{r}
- gam_space_alpha_400_null <- readRDS("gam_space_alpha_400_null.rds")
- gam_space_alpha_400_all <- readRDS("gam_space_alpha_400_all.rds")
- gam_space_alpha_400_es <- readRDS("gam_space_alpha_400_es.rds")
- gam_space_alpha_400_s <- readRDS("gam_space_alpha_400_s.rds")
- gam_space_alpha_400_pat <- readRDS("gam_space_alpha_400_all_pat.rds")
- png("agent_experiencer_alpha_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_alpha_400_all,
- view = c("x", "y"),
- comp = list(Condition = c("agent", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Agent - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_agent_alpha_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_alpha_400_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "agent")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Agent",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_experiencer_alpha_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_alpha_400_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- ```
- ```{r}
- newdata_base <- alpha_400_data %>%
- select(x, y, Electrode) %>%
- distinct()
- newdata_base <- newdata_base %>%
- mutate(
- surprisal.C = 0,
- trial_number.C=0,
- number_item=0,
- Participant = "P001"
- )
- newdata_patient <- newdata_base %>% mutate(Condition = "patient")
- newdata_experiencer <- newdata_base %>% mutate(Condition = "experiencer")
- pred_patient <- predict(gam_space_alpha_400_all, newdata = newdata_patient, type = "response")
- pred_experiencer <- predict(gam_space_alpha_400_all, newdata = newdata_experiencer, type = "response")
- ```
- ## Alpha 600
- ```{r}
- alpha_600_data <- read.csv("P600_alpha.csv", header = TRUE)
- summary(alpha_600_data)
- alpha_600_data <- alpha_600_data %>%
- dplyr::group_by_at(setdiff(names(alpha_600_data), c("Time", "Power"))) %>%
- dplyr::summarise(Power = mean(Power))
- alpha_600_data$Condition <- as.factor(alpha_600_data$Condition)
- alpha_600_data$trial_number.C <- c(scale(x = alpha_600_data$Trial, center = T, scale = F))
- alpha_600_data$surprisal.C <- c(scale(x = alpha_600_data$surprisal, center = T, scale = F))
- alpha_600_data <- alpha_600_data%>%drop_na(Power, x, y)
- alpha_600_data$Participant <- factor(alpha_600_data$Participant)
- alpha_600_data$number_item <- factor(alpha_600_data$number_item)
- ###################
- gam_space_alpha_600_null <-
- bam(formula = Power
- ~ 1
- + trial_number.C
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_alpha_600_all <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_alpha_600_es <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_alpha_600_s <-
- bam(formula = Power
- ~ 1
- + surprisal.C
- + trial_number.C
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_600_data,
- method = "ML",
- gc.level = 0)
- AIC(gam_space_alpha_600_all,gam_space_alpha_600_es, gam_space_alpha_600_s, gam_space_alpha_600_null)
- saveRDS(gam_space_alpha_600_null, file = "gam_space_alpha_600_null.rds")
- saveRDS(gam_space_alpha_600_all, file = "gam_space_alpha_600_all.rds")
- saveRDS(gam_space_alpha_600_es, file = "gam_space_alpha_600_es.rds")
- saveRDS(gam_space_alpha_600_s, file = "gam_space_alpha_600_s.rds")
- ```
- The model with the lower AIC is the one with all predictors.
- ```{r}
- alpha_600_data_pat <- within(alpha_600_data, Condition <- relevel(Condition, ref = "patient"))
- gam_space_alpha_600_pat <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = alpha_600_data_pat,
- method = "ML",
- gc.level = 0)
- summary(gam_space_alpha_600_pat)
- summary(gam_space_alpha_600_all)
- saveRDS(gam_space_alpha_600_pat, file = "gam_space_alpha_600_all_pat.rds")
- ```
- #### Plots
- ```{r}
- gam_space_alpha_600_null <- readRDS("gam_space_alpha_600_null.rds")
- gam_space_alpha_600_all <- readRDS("gam_space_alpha_600_all.rds")
- gam_space_alpha_600_es <- readRDS("gam_space_alpha_600_es.rds")
- gam_space_alpha_600_s <- readRDS("gam_space_alpha_600_s.rds")
- gam_space_alpha_600_pat <- readRDS("gam_space_alpha_600_all_pat.rds")
- png("agent_experiencer_alpha_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_alpha_600_all,
- view = c("x", "y"),
- comp = list(Condition = c("agent", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Agent - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_agent_alpha_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_alpha_600_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "agent")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Agent",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_experiencer_alpha_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_alpha_600_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- ```
- ## Theta 400
- ```{r}
- theta_400_data <- read.csv("N400_theta.csv", header = TRUE)
- summary(theta_400_data)
- theta_400_data <- theta_400_data %>%
- dplyr::group_by_at(setdiff(names(theta_400_data), c("Time", "Power"))) %>%
- dplyr::summarise(Power = mean(Power))
- theta_400_data$Condition <- as.factor(theta_400_data$Condition)
- theta_400_data$trial_number.C <- c(scale(x = theta_400_data$Trial, center = T, scale = F))
- theta_400_data$surprisal.C <- c(scale(x = theta_400_data$surprisal, center = T, scale = F))
- theta_400_data <- theta_400_data%>%drop_na(Power, x, y)
- theta_400_data$Participant <- factor(theta_400_data$Participant)
- theta_400_data$number_item <- factor(theta_400_data$number_item)
- ###################
- gam_space_theta_400_null <-
- bam(formula = Power
- ~ 1
- + trial_number.C
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_theta_400_all <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_theta_400_es <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_theta_400_s <-
- bam(formula = Power
- ~ 1
- + surprisal.C
- + trial_number.C
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_400_data,
- method = "ML",
- gc.level = 0)
- AIC(gam_space_theta_400_all,gam_space_theta_400_es, gam_space_theta_400_s, gam_space_theta_400_null)
- saveRDS(gam_space_theta_400_null, file = "gam_space_theta_400_null.rds")
- saveRDS(gam_space_theta_400_all, file = "gam_space_theta_400_all.rds")
- saveRDS(gam_space_theta_400_es, file = "gam_space_theta_400_es.rds")
- saveRDS(gam_space_theta_400_s, file = "gam_space_theta_400_s.rds")
- ```
- The model with the lowest AIC is the verb type predictor.
- ```{r}
- theta_400_data_pat <- within(theta_400_data, Condition <- relevel(Condition, ref = "patient"))
- gam_space_theta_400_pat <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_400_data_pat,
- method = "ML",
- gc.level = 0)
- summary(gam_space_theta_400_pat)
- summary(gam_space_theta_400_es)
- saveRDS(gam_space_theta_400_pat, file = "gam_space_theta_400_es_pat.rds")
- ```
- #### Plots
- ```{r}
- gam_space_theta_400_null <- readRDS("gam_space_theta_400_null.rds")
- gam_space_theta_400_all <- readRDS("gam_space_theta_400_all.rds")
- gam_space_theta_400_es <- readRDS("gam_space_theta_400_es.rds")
- gam_space_theta_400_s <- readRDS("gam_space_theta_400_s.rds")
- gam_space_theta_400_pat <- readRDS("gam_space_theta_400_es_pat.rds")
- png("agent_experiencer_theta_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_theta_400_all,
- view = c("x", "y"),
- comp = list(Condition = c("agent", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Agent - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_agent_theta_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_theta_400_all,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "agent")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Agent",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_experiencer_theta_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_theta_400_all,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- ```
- ## Theta 600
- ```{r}
- theta_600_data <- read.csv("P600_theta.csv", header = TRUE)
- summary(theta_600_data)
- theta_600_data <- theta_600_data %>%
- dplyr::group_by_at(setdiff(names(theta_600_data), c("Time", "Power"))) %>%
- dplyr::summarise(Power = mean(Power))
- theta_600_data$Condition <- as.factor(theta_600_data$Condition)
- theta_600_data$trial_number.C <- c(scale(x = theta_600_data$Trial, center = T, scale = F))
- theta_600_data$surprisal.C <- c(scale(x = theta_600_data$surprisal, center = T, scale = F))
- theta_600_data <- theta_600_data%>%drop_na(Power, x, y)
- theta_600_data$Participant <- factor(theta_600_data$Participant)
- theta_600_data$number_item <- factor(theta_600_data$number_item)
- ###################
- gam_space_theta_600_null <-
- bam(formula = Power
- ~ 1
- + trial_number.C
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_theta_600_all <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_theta_600_es <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_theta_600_s <-
- bam(formula = Power
- ~ 1
- + surprisal.C
- + trial_number.C
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_600_data,
- method = "ML",
- gc.level = 0)
- AIC(gam_space_theta_600_all,gam_space_theta_600_es, gam_space_theta_600_s, gam_space_theta_600_null)
- saveRDS(gam_space_theta_600_null, file = "gam_space_theta_600_null.rds")
- saveRDS(gam_space_theta_600_all, file = "gam_space_theta_600_all.rds")
- saveRDS(gam_space_theta_600_es, file = "gam_space_theta_600_es.rds")
- saveRDS(gam_space_theta_600_s, file = "gam_space_theta_600_s.rds")
- ```
- The model with the lowest AIC is the one with all predictors.
- ```{r}
- theta_600_data_pat <- within(theta_600_data, Condition <- relevel(Condition, ref = "patient"))
- gam_space_theta_600_pat <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = theta_600_data_pat,
- method = "ML",
- gc.level = 0)
- summary(gam_space_theta_600_pat)
- summary(gam_space_theta_600_all)
- saveRDS(gam_space_theta_600_pat, file = "gam_space_theta_600_all_pat.rds")
- ```
- #### Plots
- ```{r}
- gam_space_theta_600_null <- readRDS("gam_space_theta_600_null.rds")
- gam_space_theta_600_all <- readRDS("gam_space_theta_600_all.rds")
- gam_space_theta_600_es <- readRDS("gam_space_theta_600_es.rds")
- gam_space_theta_600_s <- readRDS("gam_space_theta_600_s.rds")
- gam_space_theta_600_pat <- readRDS("gam_space_theta_600_all_pat.rds")
- png("agent_experiencer_theta_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_theta_600_all,
- view = c("x", "y"),
- comp = list(Condition = c("agent", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Agent - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_agent_theta_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_theta_600_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "agent")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Agent",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_experiencer_theta_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_theta_600_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- ```
- ## Low beta 400
- ```{r}
- low_beta_400_data <- read.csv("N400_low_beta.csv", header = TRUE)
- summary(low_beta_400_data)
- low_beta_400_data <- low_beta_400_data %>%
- dplyr::group_by_at(setdiff(names(low_beta_400_data), c("Time", "Power"))) %>%
- dplyr::summarise(Power = mean(Power))
- low_beta_400_data$Condition <- as.factor(low_beta_400_data$Condition)
- low_beta_400_data$trial_number.C <- c(scale(x = low_beta_400_data$Trial, center = T, scale = F))
- low_beta_400_data$surprisal.C <- c(scale(x = low_beta_400_data$surprisal, center = T, scale = F))
- low_beta_400_data <- low_beta_400_data%>%drop_na(Power, x, y)
- low_beta_400_data$Participant <- factor(low_beta_400_data$Participant)
- low_beta_400_data$number_item <- factor(low_beta_400_data$number_item)
- ###################
- gam_space_low_beta_400_null <-
- bam(formula = Power
- ~ 1
- + trial_number.C
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_low_beta_400_all <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_low_beta_400_es <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_400_data,
- method = "ML",
- gc.level = 0)
- gam_space_low_beta_400_s <-
- bam(formula = Power
- ~ 1
- + surprisal.C
- + trial_number.C
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_400_data,
- method = "ML",
- gc.level = 0)
- AIC(gam_space_low_beta_400_all,gam_space_low_beta_400_es, gam_space_low_beta_400_s, gam_space_low_beta_400_null)
- saveRDS(gam_space_low_beta_400_null, file = "gam_space_low_beta_400_null.rds")
- saveRDS(gam_space_low_beta_400_all, file = "gam_space_low_beta_400_all.rds")
- saveRDS(gam_space_low_beta_400_es, file = "gam_space_low_beta_400_es.rds")
- saveRDS(gam_space_low_beta_400_s, file = "gam_space_low_beta_400_s.rds")
- ```
- The model with the lower AIC is the model with all predictors.
- ```{r}
- low_beta_400_data_pat <- within(low_beta_400_data, Condition <- relevel(Condition, ref = "patient"))
- gam_space_low_beta_400_pat <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_400_data_pat,
- method = "ML",
- gc.level = 0)
- summary(gam_space_low_beta_400_pat)
- summary(gam_space_low_beta_400_all)
- saveRDS(gam_space_low_beta_400_pat, file = "gam_space_low_beta_400_all_pat.rds")
- ```
- ### Plots
- ```{r}
- gam_space_low_beta_400_null <- readRDS("gam_space_low_beta_400_null.rds")
- gam_space_low_beta_400_all <- readRDS("gam_space_low_beta_400_all.rds")
- gam_space_low_beta_400_es <- readRDS("gam_space_low_beta_400_es.rds")
- gam_space_low_beta_400_s <- readRDS("gam_space_low_beta_400_s.rds")
- gam_space_low_beta_400_pat <- readRDS("gam_space_low_beta_400_all_pat.rds")
- png("agent_experiencer_lowbeta_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_low_beta_400_all,
- view = c("x", "y"),
- comp = list(Condition = c("agent", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Agent - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_agent_lowbeta_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_low_beta_400_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "agent")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Agent",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_experiencer_lowbeta_400.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_low_beta_400_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- ```
- ## Low beta 600
- ```{r}
- low_beta_600_data <- read.csv("P600_low_beta.csv", header = TRUE)
- summary(low_beta_600_data)
- low_beta_600_data <- low_beta_600_data %>%
- dplyr::group_by_at(setdiff(names(low_beta_600_data), c("Time", "Power"))) %>%
- dplyr::summarise(Power = mean(Power))
- low_beta_600_data$Condition <- as.factor(low_beta_600_data$Condition)
- low_beta_600_data$trial_number.C <- c(scale(x = low_beta_600_data$Trial, center = T, scale = F))
- low_beta_600_data$surprisal.C <- c(scale(x = low_beta_600_data$surprisal, center = T, scale = F))
- low_beta_600_data <- low_beta_600_data%>%drop_na(Power, x, y)
- low_beta_600_data$Participant <- factor(low_beta_600_data$Participant)
- low_beta_600_data$number_item <- factor(low_beta_600_data$number_item)
- ###################
- gam_space_low_beta_600_null <-
- bam(formula = Power
- ~ 1
- + trial_number.C
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_low_beta_600_all <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_low_beta_600_es <-
- bam(formula = Power
- ~ 1
- + Condition
- + trial_number.C
- + te(x, y, by = Condition)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_600_data,
- method = "ML",
- gc.level = 0)
- gam_space_low_beta_600_s <-
- bam(formula = Power
- ~ 1
- + surprisal.C
- + trial_number.C
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_600_data,
- method = "ML",
- gc.level = 0)
- AIC(gam_space_low_beta_600_all,gam_space_low_beta_600_es, gam_space_low_beta_600_s, gam_space_low_beta_600_null)
- saveRDS(gam_space_low_beta_600_null, file = "gam_space_low_beta_600_null.rds")
- saveRDS(gam_space_low_beta_600_all, file = "gam_space_low_beta_600_all.rds")
- saveRDS(gam_space_low_beta_600_es, file = "gam_space_low_beta_600_es.rds")
- saveRDS(gam_space_low_beta_600_s, file = "gam_space_low_beta_600_s.rds")
- ```
- The model with the lower AIC is the model with all predictors.
- ```{r}
- low_beta_600_data_pat <- within(low_beta_600_data, Condition <- relevel(Condition, ref = "patient"))
- gam_space_low_beta_600_pat <-
- bam(formula = Power
- ~ 1
- + Condition
- + surprisal.C
- + trial_number.C
- + te(x, y, by = Condition)
- + te(x, y, by = surprisal.C)
- + s(Participant,x, y, bs = "re")
- + s(number_item,x, y, bs = "re")
- ,
- data = low_beta_600_data_pat,
- method = "ML",
- gc.level = 0)
- summary(gam_space_low_beta_600_pat)
- summary(gam_space_low_beta_600_all)
- saveRDS(gam_space_low_beta_600_pat, file = "gam_space_low_beta_600_all_pat.rds")
- ```
- ### Plots
- ```{r}
- gam_space_low_beta_600_null <- readRDS("gam_space_low_beta_600_null.rds")
- gam_space_low_beta_600_all <- readRDS("gam_space_low_beta_600_all.rds")
- gam_space_low_beta_600_es <- readRDS("gam_space_low_beta_600_es.rds")
- gam_space_low_beta_600_s <- readRDS("gam_space_low_beta_600_s.rds")
- gam_space_low_beta_600_pat <- readRDS("gam_space_low_beta_600_all_pat.rds")
- png("agent_experiencer_lowbeta_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_low_beta_600_all,
- view = c("x", "y"),
- comp = list(Condition = c("agent", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Agent - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- png("patient_agent_lowbeta_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_low_beta_600_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "agent")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Agent",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- png("patient_experiencer_lowbeta_600.png", width = 1800, height = 1500, res = 300)
- par(mar = c(5, 4, 4, 8))
- plot_diff2(
- model = gam_space_low_beta_600_pat,
- view = c("x", "y"),
- comp = list(Condition = c("patient", "experiencer")),
- show.diff = T,
- sim.ci = T,
- rm.ranef = T,
- color = gplots::rich.colors(n = 256, palette = "temperature"),
- ci.col = c("gray", "gray"),
- main = "Patient - Experiencer",
- add.color.legend = F,
- zlim = c(-1, 1)
- )
- fields::image.plot(
- legend.only = TRUE,
- zlim = c(-1, 1),
- col = gplots::rich.colors(256, "temperature"),
- legend.args = list(text = "", side = 4, line = 2)
- )
- dev.off()
- ```
TFA.qmd, no license · at the source
Overview
- Department of Linguistics and Basque Studies, University of the Basque Country (UPV/EHU), Vitoria-Gasteiz, Spain
- Université de Pau et des Pays de l’Adour, Bayonne, France
- CNRS-IKER UMR 5478, Bayonne, France
- Institute for the Interdisciplinary Study of Language Evolution (ISLE), University of Zurich, Zurich, Switzerland
Abstract
Despite the large number of proposed event roles, psycholinguistic evidence supports only two core knowledge categories with distinct processing correlates: agent and patient roles. This evidence aligns with the proto-role approach, which proposes only two proto-roles, proto-agent and proto-patient. Here, we investigate the processing correlates of arguments labeled as “experiencers” to determine whether they exhibit specific processing correlates, as agents and patients do, or whether they are subsumed under the proto-agent role category, sharing similar processing correlates with agents and differing from patients. We conducted both eye-tracking and EEG reading tasks, where Spanish speakers were instructed to read intransitive sentences with either agent, experiencer, or patient subjects. In eye-tracking, agents and experiencers elicited longer fixation times and regression counts than patients, in both the verb and post-verb regions. In EEG, we replicated the known N400 component associated with processing patients compared to both agents and experiencers. Crucially, no N400 effect was observed when comparing agents to experiencers. Additionally, patients revealed a power increase in the theta band compared to agents and experiencers, and a power decrease in the low-beta band. These findings replicate previous results supporting a transient preference for agents in language comprehension and suggest that experiencers align with agents in this regard, providing further evidence for the proto-role approach.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 7 matches between paragraphs and lines of code.
OSF t9zer
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
11 files
- Scripts/
Building_models_eyetrack , Quarto, 1,284 linesing.qmd - Scripts/
ERPs.qmd , Quarto, 1,338 lines - Scripts/
Model_comparison_eyetrac , Quarto, 735 linesking.qmd - Scripts/
Models_definitive_eyetra , Quarto, 420 linescking.qmd - Scripts/
Norming.qmd , Quarto, 169 lines - Scripts/
Null_models_eyetracking. , Quarto, 398 linesqmd - Scripts/
Preparation_data_eyetrac , Quarto, 220 linesking.qmd - Scripts/
Preprocessing_eeg_data.m , MATLAB, 904 lines, 3 matches - Scripts/
Suprisal_eyetracking.qmd , Quarto, 479 lines - Scripts/
Surprisal_materials.qmd , Quarto, 145 lines - Scripts/
TFA.qmd , Quarto, 1,556 lines, 4 matches
OSF wnar8
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
10 files
- Chapter 2/
Scripts/ , Quarto, 197 lines01_Length_frequency_verb s_exp_1.qmd - Chapter 2/
Scripts/ , Quarto, 149 lines02_Norming_exp_1.qmd - Chapter 2/
Scripts/ , Quarto, 278 lines03_Preparation_data_expe riment_1.qmd - Chapter 2/
Scripts/ , Quarto, 2,730 lines04_Building_models_witho ut_surprisal_exp_1_part_ 1.qmd - Chapter 2/
Scripts/ , Quarto, 2,669 lines05_Building_models_witho ut_surprisal_exp_1_part_ 2.qmd - Chapter 2/
Scripts/ , Quarto, 132 lines06_Add_surprisal_values_ dataframe_exp_1.qmd - Chapter 2/
Scripts/ , Quarto, 949 lines07_Building_models_witho ut_predictor_and_with_on ly_surprisal_values_exp_ 1.qmd - Chapter 2/
Scripts/ , Quarto, 1,034 lines08_Building_models_with_ all_predictors_exp_1.qmd - Chapter 2/
Scripts/ , Quarto, 1,387 lines09_Model_comparison_all_ exp_1.qmd - Chapter 2/
Scripts/ , Quarto, 2,974 lines10_Models_exp_1_def.qmd
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:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 21 scripts, each with its path and the digest of its content;
- 7 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 statement
The data, analysis scripts, materials, and appendices can be accessed at the following OSF repository: 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, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 4 authors, 5 keywords, 89 references.
Cite
This paper
Sánchez-López, M., Isasi-Isasmendi, A., Bickel, B., & Santesteban, M. (2026). Broadening the Agent Preference Hypothesis Through Experiencers: Eye-Tracking and EEG Evidence of Proto-Agents and Proto-Patients. Open mind : discoveries in cognitive science, 10, 1092-1117. https://
BibTeX
@article{sanchezlopez202
author = {Sánchez-López, Marta and Isasi-Isasmendi, Arrate and Bickel, Balthasar and Santesteban, Mikel},
title = {{Broadening the Agent Preference Hypothesis Through Experiencers: Eye-Tracking and EEG Evidence of Proto-Agents and Proto-Patients}},
journal = {Open mind : discoveries in cognitive science},
year = {2026},
month = jul,
volume = {10},
pages = {1092--1117},
publisher = {MIT Press},
issn = {2470-2986},
doi = {10.1162/
url = {https://
pmid = {42657401},
pmcid = {PMC13518077}
}
RIS
TY - JOUR
AU - Sánchez-López, Marta
AU - Isasi-Isasmendi, Arrate
AU - Bickel, Balthasar
AU - Santesteban, Mikel
TI - Broadening the Agent Preference Hypothesis Through Experiencers: Eye-Tracking and EEG Evidence of Proto-Agents and Proto-Patients
T2 - Open mind : discoveries in cognitive science
J2 - Open Mind (Camb)
PY - 2026
DA - 2026/
VL - 10
SP - 1092
EP - 1117
SN - 2470-2986
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"type": "article-journal",
"title": "Broadening the Agent Preference Hypothesis Through Experiencers: Eye-Tracking and EEG Evidence of Proto-Agents and Proto-Patients",
"container-title": "Open mind : discoveries in cognitive science",
"author": [
{
"family": "Sánchez-López",
"given": "Marta"
},
{
"family": "Isasi-Isasmendi",
"given": "Arrate"
},
{
"family": "Bickel",
"given": "Balthasar"
},
{
"family": "Santesteban",
"given": "Mikel"
}
],
"container-title-short":
"volume": "10",
"page": "1092-1117",
"DOI": "10.1162/
"PMID": "42657401",
"PMCID": "PMC13518077",
"ISSN": "2470-2986",
"publisher": "MIT Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
17
]
]
}
}
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.1162/imag.a.1258 [code]
- Non-specific increase in alpha power during a neurofeedback session targeting its downregulation.Journal: Imaging neuroscience (Cambridge, Mass.)In common: Stan, brms, EEGLAB, 4 other tools, EEG, 3 references
- [2] doi:10.1523/eneuro.0316-25.2026 [code]
- Neural Mechanisms of Self-Generated Action Sequences.Journal: eNeuroIn common: ERPLAB, brms, EEGLAB, 4 other tools, EEG, 2 references
- [3] 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: Stan, brms, mgcv, 5 other tools
- [4] doi:10.1371/journal.pbio.3003979 [code]
- Impaired midfrontal‑motor theta phase synchronization characterizes maladaptive motivational behavior in people with obsessive‑compulsive disorder.Journal: PLoS biologyIn common: Stan, car, EEGLAB, 4 other tools, EEG, 2 references
- [5] 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: ERPLAB, car, EEGLAB, 4 other tools, EEG, 1 reference
- [6] doi:10.7554/elife.111114 [code]
- Theta beta ratio in attention deficit hyperactivity disorder using a multiverse analysis.Journal: eLifeIn common: EEGLAB, FieldTrip, patchwork, 2 other tools, EEG, 4 references
- [7] doi:10.1523/eneuro.0076-26.2026 [code]
- Exogenously Driven Neural Reactivation of Spatially Matching Visual Working-Memory Contents.Journal: eNeuroIn common: brms, car, FieldTrip, 4 other tools, EEG, 1 reference
- [8] doi:10.1371/journal.pone.0355165 [code]
- Pupillary dynamics during hands-off L2 driving and transitions of control under high cognitive load.Journal: PloS oneIn common: Stan, brms, mgcv, 4 other tools
- [9] doi:10.1162/imag.a.1201 [code]
- All spectral frequencies of neural activity reveal semantic representation in the human anterior ventral temporal cortex.Journal: Imaging neuroscience (Cambridge, Mass.)In common: EEGLAB, FieldTrip, reshape2, 2 other tools, 4 references
- [10] doi:10.1371/journal.pbio.3003899 [code]
- Social interactions between people of same and different generations shape longitudinal changes in interpersonal neural synchrony, loneliness, and social connection.Journal: PLoS biologyIn common: brms, FieldTrip, data.table, 3 other tools, 2 references
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: 2 repositories of the authors' code, each at its verified commit and with its license, 21 scripts, and 7 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:9d2c8b4ed62d59b4…
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.
