The neural dynamics of political socio-pragmatic violations: an ERP study.
The 2 matches
- [1] § Materials and methods › Statistical analysis › ERP analysis ↔ polpejEEG_repo.R, lines 143 to 181 · score 0.69 · Bonferroni Holm, NoQM, lme4, bobyqa, optimizer, IC · Report a mismatch
- [2] § Materials and methods › Statistical analysis › Lexeme characteristics and SDO ↔ polpejEEG_repo.R, lines 143 to 181 · score 0.65 · Bonferroni Holm, NoQM, Word frequencies, syllables, position, channel · Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 627 lines · 22 KB · no license · 2 matches
- library(lme4)
- library(glmmTMB)
- library(emmeans)
- library(ggplot2)
- library(sjPlot)
- library(lmerTest)
- library(lattice)
- library(rlist)
- library(DHARMa)
- library(ggsignif)
- library(stringr)
- library(dplyr)
- library(tidyr)
- library(ggeffects)
- library(sjstats)
- library(ggpubr)
- library(effectsize)
- # set working directory
- setwd("C:/Users/maure/Desktop/PolPejEEG/Export")
- # read ERP data
- N400_df <- read.csv("./csvs/N400_df.csv")
- P300_df <- read.csv("./csvs/P300_df.csv")
- LPP_df <- read.csv("./csvs/LPP_df.csv")
- # set lmem and notational options
- emm_options(pbkrtest.limit = 3000)
- options(scipen=999)
- # bring dfs into long format and drop rows containing nans
- N400_df_long <- pivot_longer(N400_df, c("Cz", "Pz"), names_to = "Channel", values_to = "Amplitude")
- N400_df_long <- drop_na(N400_df_long, "Pej.Value")
- N400_df_long <- rename(N400_df_long, Amplitude_N400=Amplitude)
- n_df <- N400_df_long %>%
- filter(Channel=="Cz") %>%
- group_by(Participant, Coherence, Quotation) %>%
- count()
- n_df[n_df$n < 15, ]
- length(unique(N400_df$Participant))
- length(unique(N400_df_long$Participant))
- P300_df_long <- pivot_longer(P300_df, c("Cz", "Pz"), names_to = "Channel", values_to = "Amplitude")
- P300_df_long <- drop_na(P300_df_long, "Pej.Value")
- P300_df_long <- rename(P300_df_long, Amplitude_P300=Amplitude)
- LPP_df_long <- pivot_longer(LPP_df, c("P3", "Pz", "P4"), names_to = "Channel", values_to = "Amplitude")
- LPP_df_long <- drop_na(LPP_df_long)
- LPP_df_long <- rename(LPP_df_long, Amplitude_LPP=Amplitude)
- Amplitude_P300 <- P300_df_long$Amplitude_P300
- Amplitude_LPP <- LPP_df_long$Amplitude_LPP
- # bind dfs
- df_long <- cbind(N400_df_long, Amplitude_P300)
- # scale and center numerical variables
- df_long$Pej.Value <- scale(df_long$Pej.Value, center=T)
- df_long$Amplitude_N400_unscaled <- df_long$Amplitude_N400
- df_long$Amplitude_N400 <- scale(df_long$Amplitude_N400, center=T)
- df_long$Amplitude_P300_unscaled <- df_long$Amplitude_P300
- df_long$Amplitude_P300 <- scale(df_long$Amplitude_P300, center=T)
- df_long$SDO_mean <- scale(df_long$SDO_mean, center=T)
- LPP_df_long$Amplitude_LPP_unscaled <- LPP_df_long$Amplitude_LPP
- LPP_df_long$Amplitude_LPP <- scale(LPP_df_long$Amplitude_LPP, center=T)
- LPP_df_long$Pej.Value <- scale(LPP_df_long$Pej.Value, center=T)
- # factorize categorical variables
- df_long$Coherence <- as.factor(df_long$Coherence)
- df_long$Quotation <- as.factor(df_long$Quotation)
- LPP_df_long$Coherence <- as.factor(LPP_df_long$Coherence)
- LPP_df_long$Quotation <- as.factor(LPP_df_long$Quotation)
- # perform effect coding
- contrasts(df_long$Coherence) <- "contr.sum"
- contrasts(df_long$Quotation) <- "contr.sum"
- contrasts(LPP_df_long$Coherence) <- "contr.sum"
- contrasts(LPP_df_long$Quotation) <- "contr.sum"
- ## extract and save raw amplitude parameters
- m_sd_N400 <- df_long %>% drop_na() %>% group_by(Coherence, Quotation, Channel) %>%
- summarize(mean_amplitude = mean
- (Amplitude_N400_unscaled), sd_amplitude = sd(Amplitude_N400_unscaled))
- m_sd_P300 <- df_long %>% drop_na() %>% group_by(Coherence, Quotation, Channel) %>%
- summarize(mean_amplitude = mean
- (Amplitude_P300_unscaled), sd_amplitude = sd(Amplitude_P300_unscaled))
- m_sd_LPP <- LPP_df_long %>% drop_na() %>% group_by(Coherence, Quotation, Channel) %>%
- summarize(mean_amplitude = mean
- (Amplitude_LPP_unscaled), sd_amplitude = sd(Amplitude_LPP_unscaled))
- m_sd_df <- as.data.frame(rbind(m_sd_N400, m_sd_P300, m_sd_LPP))
- write.csv(m_sd_df, file="./csvs/m_sd_df.csv")
- df_long_1ch <- df_long %>% filter(Channel == "Cz")
- word_df <- read.csv("./word_data/word_frequencies_dwds_gegenwartskorpus.csv")
- word_df_clean <- word_df[word_df$AmbigUsage!="Y",]
- df_word_freq <- merge(df_long_1ch, word_df[, -3], by="Word")
- contrasts(df_word_freq$Coherence) <- "contr.treatment"
- df_word_freq_clean <- df_word_freq %>% filter(AmbigUsage!="Y")
- df_word_freq_clean$logWordsFrequencyPerMillion <- log(df_word_freq_clean$WordsFrequencyPerMillion+1)
- df_word_freq_clean %>% group_by(Coherence) %>%
- summarize(M = mean(WordsFrequencyPerMillion),
- SD = sd(WordsFrequencyPerMillion),
- Median = median(WordsFrequencyPerMillion),
- logM = mean(logWordsFrequencyPerMillion),
- logSD = sd(logWordsFrequencyPerMillion),
- logMedian = median(logWordsFrequencyPerMillion))
- pej_df_word <- df_long_1ch %>% group_by(Word) %>%
- summarize(mean_pej = mean(Pej.Value))
- word_df <- left_join(word_df, pej_df_word, by="Word")
- word_df
- write.csv(word_df, file="./word_data/word_characteristics_supplementary.csv")
- C_clean <- word_df_clean[word_df_clean$Coherence=="C",]
- IC_clean <- word_df_clean[word_df_clean$Coherence=="IC",]
- C <- word_df[word_df$Coherence=="C",]
- IC <- word_df[word_df$Coherence=="IC",]
- # t-tests of potential covariates
- t1 <- t.test(C_clean$WordsFrequencyPerMillion, IC_clean$WordsFrequencyPerMillion)
- t1
- sd(C_clean$WordsFrequencyPerMillion)
- sd(IC_clean$WordsFrequencyPerMillion)
- t2 <- t.test(C$n_Letters, IC$n_Letters)
- t2
- sd(C$n_Letters)
- sd(IC$n_Letters)
- t3 <- t.test(C$n_Syllables, IC$n_Syllables)
- t3
- sd(C$n_Syllables)
- sd(IC$n_Syllables)
- t4 <- t.test(C$TargetPosition, IC$TargetPosition)
- t4
- sd(C$TargetPosition)
- sd(IC$TargetPosition)
- t5 <- t.test(C$mean_pej, IC$mean_pej)
- t5
- sd(C$mean_pej)
- sd(IC$mean_pej)
- p_list <- sort(c(t1$p.value, t2$p.value, t3$p.value, t4$p.value, t5$p.value))
- p_list*c(5, 4, 3, 2, 1) #bonferroni-holm correction
- word_df_syl <- word_df %>% select(c(Word, n_Syllables))
- df_long <- merge(df_long, word_df_syl, by="Word")
- df_long_NoQM <- df_long %>% filter(Quotation=="NoQM")
- # build model based on n_syllables to show assess the isolated potential effect of the number of syllables
- syl_model <- lmer(Amplitude_N400 ~ n_Syllables + (1+n_Syllables|Participant) + (1|Word) + (1|Channel),
- data=df_long_NoQM, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- summary(syl_model)
- # building the models usually takes a lot of time and resources
- # models objects are therefore provided as .rda files and can be loaded
- # N400 amplitude analysis
- #model_full <- lmer(Amplitude_N400 ~ Coherence*Quotation*Pej.Value + (1 + Coherence*Quotation*Pej.Value|Participant) + (1 + Quotation*Pej.Value|Word) + (1 + Coherence*Quotation*Pej.Value|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_full, file="N400_model_full.rda")
- #load("N400_model_full.rda")
- #summary(model_full)
- #model_nochslopes <- lmer(Amplitude_N400 ~ Coherence*Quotation*Pej.Value + (1 + Coherence*Quotation*Pej.Value||Participant) + (1 + Quotation*Pej.Value||Word) + (1|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_nochslopes, file="N400_model_nochslopes.rda")
- #load("N400_model_nochslopes.rda")
- #summary(model_nochslopes)
- #model_inter_nochslopes <- lmer(Amplitude_N400 ~ Coherence*Quotation*Pej.Value + (1 + Coherence:Quotation:Pej.Value|Participant) + (1 + Quotation:Pej.Value|Word) + (1|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_inter_nochslopes, file="N400_model_inter_nochslopes.rda")
- #load("N400_model_inter_nochslopes.rda")
- #summary(model_inter_nochslopes)
- #model_inter_nochslopes_nocorr <- lmer(Amplitude_N400 ~ Coherence*Quotation*Pej.Value + (1 + Coherence:Quotation:Pej.Value||Participant) + (1 + Quotation:Pej.Value||Word) + (1|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_inter_nochslopes_nocorr, file="N400_model_inter_nochslopes_nocorr.rda")
- #load("N400_model_inter_nochslopes_nocorr.rda")
- #summary(model_inter_nochslopes_nocorr)
- #model <- model_inter_nochslopes_nocorr
- #save(model, file="N400_model.rda")
- model_SDO_re <- lmer(Amplitude_N400 ~ Coherence*Quotation*Pej.Value + (1 + Coherence:Quotation:Pej.Value||SDO_mean) + (1 + Quotation:Pej.Value||Word) + (1|Channel),
- data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- save(model_SDO_re, file="N400_model_SDO_re.rda")
- load("N400_model_SDO_re.rda")
- model_SDO_sum <- summary(model_SDO_re)
- print(model_SDO_sum)
- write.csv(model_SDO_sum$coefficients, "./csvs/combined_model_SDO_summary_N400.csv") # write summary to file
- model_SDO <- lmer(Amplitude_N400 ~ Coherence*Quotation*Pej.Value*SDO_mean + (1 + Coherence:Quotation:Pej.Value:SDO_mean||Participant) + (1 + Quotation:Pej.Value:SDO_mean||Word) + (1|Channel),
- data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- save(model_SDO, file="N400_model_SDO.rda")
- summary(model_SDO)
- ## load model
- load("N400_model.rda")
- anova(model_SDO_re, model)
- ## lmem summary
- model_sum <- summary(model)
- print(model_sum)
- write.csv(model_sum$coefficients, "./csvs/combined_model_summary_N400.csv") # write summary to file
- ## estimated marginal means
- emm_means <- emmeans(model, ~ Coherence*Quotation) # define estimated marginal means formula
- emm_means
- emm_contrasts <- contrast(emm_means, list(c(1, -1, 0, 0), c(0, 0, 1, -1), c(0, 1, 0, -1), c(1, 0, -1, 0)), adjust="holm") # define contrasts for emms
- emm_contrasts
- emm_means_df <- as.data.frame(emm_means)
- emm_contrasts_df <- as.data.frame(emm_contrasts) %>% mutate(contrast = str_replace_all(contrast, "C ", "C-"))
- #eta_squared(model, partial=TRUE)
- ## define plot variables
- means <- emm_means_df$emmean
- SEs <- emm_means_df$SE
- max_NoQM <- max((means+SEs)[1:2])
- max_QM <- max((means+SEs)[3:4])
- ## plot group differences
- QC_plot <- ggplot(emm_means_df, aes(x = Quotation, y = emmean, color = Coherence)) +
- ylim(-0.6, 0.6) +
- geom_point(position = position_dodge(width = 0.3), size=3) +
- geom_errorbar(aes(ymin = means-SEs, ymax = means+SEs),
- position = position_dodge(width = 0.3), # Shift error bars
- linewidth = 0.8, # Make error bars thicker
- width = 0.2) +
- labs(title = "",
- x = "Quotation",
- y = "N400 Amplitude (z-standardized)",
- color = "Coherence") +
- theme(text = element_text(size=14)) +
- geom_signif(y_position = c(max_QM+0.05, max_NoQM+0.05, max_NoQM+0.15, max_QM+0.15),
- xmin = c(1.925, 0.925, 0.925, 1.075),
- xmax = c(2.075, 1.075, 1.925, 2.075),
- annotation = c("*", "*", "n.s.", "***"),
- tip_length = 0, color="black") +
- scale_color_brewer(palette="Dark2") +
- theme(legend.position = "bottom")
- plot(QC_plot)
- ggsave("./plots/QC_plot_N400.png", dpi=300, width=1000, height=1200, units="px")
- ## plot three-way interaction
- all_plot <- plot_model(model, type="pred", terms=c("Pej.Value", "Coherence", "Quotation"), title="", axis.title=c("Pejorative Weight (z-standardized)", "N400 Amplitude (z-standardized)"), colors = "Dark2") +
- theme(legend.position = "bottom") + ylim(-0.6, 0.6)
- plot(all_plot)
- ggsave("./plots/all_plot_N400.png", dpi=300, width=2000, height=1200, units="px")
- ## plot model estimates
- est_plot <- plot_model(model, type="est", colors="Set1", title="", axis.lim = c(-0.25, 0.25),
- axis.labels = c("Coh * Quot * Pej.Weight", "Quotation * Pejorative Weight",
- "Coherence * Pejorative Weight", "Coherence * Quotation",
- "Pejorative Weight", "Quotation", "Coherence"
- )) + theme(axis.text.y = element_text(angle = 30)) +
- ylim(-0.25, 0.25)
- plot(est_plot)
- ggsave("./plots/est_plot_N400.png", dpi=300, width=1500, height=1800, units="px")
- ## combine plots
- combi_plot <- ggarrange(all_plot,
- ggarrange(QC_plot, est_plot, ncol=2, labels=c("B", "C")),
- nrow=2,
- labels="A")
- plot(combi_plot)
- ggsave("./plots/combi_plot_N400.png", dpi=300, width=2400, height=2400, units="px")
- ## Diagnostics plots
- sim_res <- simulateResiduals(fittedModel = model, plot = F)
- ### Normality of residuals
- plotQQunif(sim_res, testUniformity = F, testOutliers = F, testDispersion = F)
- ### Normality of random effects
- load("N400_model_inter_nochslopes.rda")
- diag <- plot_model(model_inter_nochslopes, type="diag")
- # model_inter_nochslopes is used because plot_model cannot produce
- # diagnostic plots for model equations contain the '||' operator
- plot(diag[[2]]$Participant)
- plot(diag[[2]]$Word)
- plot(diag[[2]]$Channel)
- ### Homoskedasticity
- plot(diag[[4]])
- ## P300
- ## build and save model
- #model_full <- lmer(Amplitude_P300 ~ Coherence*Quotation*Pej.Value + (1 + Coherence*Quotation*Pej.Value|Participant) + (1 + Quotation*Pej.Value|Word) + (1 + Coherence*Quotation*Pej.Value|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_full, file="P300_model_full.rda")
- #load("P300_model_full.rda")
- #summary(model_full)
- #model_nochslopes <- lmer(Amplitude_P300 ~ Coherence*Quotation*Pej.Value + (1 + Coherence*Quotation*Pej.Value||Participant) + (1 + Quotation*Pej.Value||Word) + (1|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_nochslopes, file="P300_model_nochslopes.rda")
- #load("P300_model_nochslopes.rda")
- #summary(model_nochslopes)
- #model_inter_nochslopes <- lmer(Amplitude_P300 ~ Coherence*Quotation*Pej.Value + (1 + Coherence:Quotation:Pej.Value|Participant) + (1 + Quotation:Pej.Value|Word) + (1|Channel),
- # data=df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_inter_nochslopes, file="P300_model_inter_nochslopes.rda")
- #load("P300_model_inter_nochslopes.rda")
- #summary(model_inter_nochslopes)
- #model <- model_inter_nochslopes
- #save(model, file="P300_model.rda")
- ## load model
- load("P300_model.rda")
- ## model summary
- model_sum <- summary(model)
- print(model_sum)
- write.csv(model_sum$coefficients, "./csvs/combined_model_summary_P300.csv")
- ## estimated marginal means
- emmeans(model, pairwise ~ Quotation)
- emm_means <- emmeans(model, ~ Coherence*Quotation)
- emm_means
- emm_contrasts <- contrast(emm_means, list(c(1, -1, 0, 0), c(0, 0, 1, -1), c(0, 1, 0, -1), c(1, 0, -1, 0)), adjust="holm")
- emm_contrasts
- emm_means_df <- as.data.frame(emm_means)
- emm_contrasts_df <- as.data.frame(emm_contrasts) %>% mutate(contrast = str_replace_all(contrast, "C ", "C-"))
- #eta_squared(model, partial=TRUE)
- ## define plot variables
- means <- emm_means_df$emmean
- SEs <- emm_means_df$SE
- max_NoQM <- max((means+SEs)[1:2])
- max_QM <- max((means+SEs)[3:4])
- ## plot group differences
- QC_plot <- ggplot(emm_means_df, aes(x = Quotation, y = emmean, color = Coherence)) +
- ylim(-0.6, 0.6) +
- geom_point(position = position_dodge(width = 0.3), size=3) +
- geom_errorbar(aes(ymin = means-SEs, ymax = means+SEs),
- position = position_dodge(width = 0.3), # Shift error bars
- linewidth = 0.8, # Make error bars thicker
- width = 0.2) +
- labs(title = "",
- x = "Quotation",
- y = "P300 Amplitude (z-standardized)",
- color = "Coherence") +
- theme(text = element_text(size=14)) +
- geom_signif(y_position = c(max_QM+0.15),
- xmin = c(1),
- xmax = c(2),
- annotation = c("***"),
- tip_length = 0.1, color="black") +
- scale_color_brewer(palette="Dark2") +
- theme(legend.position = "bottom")
- plot(QC_plot)
- ggsave("./plots/QC_plot_P300.png", dpi=300, width=1000, height=1200, units="px")
- ## plot three-way interaction
- all_plot <- plot_model(model, type="pred", terms=c("Pej.Value", "Coherence", "Quotation"), title="", axis.title=c("Pejorative Weight (z-standardized)", "P300 Amplitude (z-standardized)"), colors = "Dark2") +
- theme(legend.position = "bottom") + ylim(-0.6, 0.6)
- plot(all_plot)
- ggsave("./plots/all_plot_P300.png", dpi=300, width=2000, height=1200, units="px")
- ## plot model estimates
- est_plot <- plot_model(model, type="est", colors="Set1", title="", axis.lim = c(-2.5, 2.5),
- axis.labels = c("Coh * Quot * Pej.Weight", "Quotation * Pejorative Weight",
- "Coherence * Pejorative Weight", "Coherence * Quotation",
- "Pejorative Weight", "Quotation", "Coherence"
- )) + theme(axis.text.y = element_text(angle = 30)) +
- ylim(-0.25, 0.25)
- plot(est_plot)
- ggsave("./plots/est_plot_P300.png", dpi=300, width=1500, height=1800, units="px")
- ## combine plots
- combi_plot <- ggarrange(all_plot,
- ggarrange(QC_plot, est_plot, ncol=2, labels=c("B", "C")),
- nrow=2,
- labels="A")
- plot(combi_plot)
- ggsave("./plots/combi_plot_P300.png", dpi=300, width=2400, height=2400, units="px")
- ## Diagnostics plots
- sim_res <- simulateResiduals(fittedModel = model, plot = F)
- ### Normality of residuals
- plotQQunif(sim_res, testUniformity = F, testOutliers = F, testDispersion = F)
- ### Normality of random effects
- diag <- plot_model(model, type="diag")
- plot(diag[[2]]$Participant)
- plot(diag[[2]]$Word)
- plot(diag[[2]]$Channel)
- ### Homoskedasticity
- plot(diag[[4]])
- # LPP
- ## build and save model
- #model_full <- lmer(Amplitude_LPP ~ Coherence*Quotation*Pej.Value + (1 + Coherence*Quotation*Pej.Value|Participant) + (1 + Quotation*Pej.Value|Word) + (1 + Coherence*Quotation*Pej.Value|Channel),
- # data=LPP_df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_full, file="LPP_model_full.rda")
- #load("LPP_model_full.rda")
- #summary(model_full)
- #model_nochslopes <- lmer(Amplitude_LPP ~ Coherence*Quotation*Pej.Value + (1 + Coherence*Quotation*Pej.Value||Participant) + (1 + Quotation*Pej.Value||Word) + (1|Channel),
- # data=LPP_df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_nochslopes, file="LPP_model_nochslopes")
- #load("LPP_model_nochslopes.rda")
- #summary(model_nochslopes)
- #model_inter_nochslopes <- lmer(Amplitude_LPP ~ Coherence*Quotation*Pej.Value + (1 + Coherence:Quotation:Pej.Value|Participant) + (1 + Quotation:Pej.Value|Word) + (1|Channel),
- # data=LPP_df_long, verbose=1, control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
- #save(model_inter_nochslopes, file="LPP_model_inter_nochslopes.rda")
- #load("LPP_model_inter_nochslopes.rda")
- #summary(model_inter_nochslopes)
- #model <- model_inter_nochslopes
- #save(model, file="LPP_model.rda")
- ##load model
- load("LPP_model.rda")
- ## model summary
- model_sum <- summary(model)
- print(model_sum)
- write.csv(model_sum$coefficients, "./csvs/combined_model_summary_LPP.csv")
- ## estimated marginal means
- emmeans(model, pairwise ~ Quotation, adjust="holm")
- emmeans(model, pairwise ~ Coherence, adjust="holm")
- emtrends(model, pairwise ~ Coherence, var = "Pej.Value", adjust="holm")
- emm_means <- emmeans(model, ~ Coherence*Quotation)
- emm_means
- emm_contrasts <- contrast(emm_means, list(c(1, -1, 0, 0), c(0, 0, 1, -1), c(0, 1, 0, -1), c(1, 0, -1, 0)), adjust="holm")
- emm_contrasts
- emm_means_df <- as.data.frame(emm_means)
- emm_contrasts_df <- as.data.frame(emm_contrasts) %>% mutate(contrast = str_replace_all(contrast, "C ", "C-"))
- eta_squared(model, partial=TRUE)
- ## define plots variables
- means <- emm_means_df$emmean
- SEs <- emm_means_df$SE
- max_NoQM <- max((means+SEs)[1:2])
- max_QM <- max((means+SEs)[3:4])
- ## plot group differences
- QC_plot <- ggplot(emm_means_df, aes(x = Quotation, y = emmean, color = Coherence)) +
- ylim(-0.6, 0.6) +
- geom_point(position = position_dodge(width = 0.3), size=3) +
- geom_errorbar(aes(ymin = means-SEs, ymax = means+SEs),
- position = position_dodge(width = 0.3), # Shift error bars
- linewidth = 0.8, # Make error bars thicker
- width = 0.2) +
- labs(title = "",
- x = "Quotation",
- y = "LPP Amplitude (z-standardized)",
- color = "Coherence") +
- theme(text = element_text(size=14)) +
- geom_signif(y_position = c(max_QM+0.08, max_QM+0.08, max_QM+0.115, max_QM+0.25),
- xmin = c(0.925, 1.925, 1, 1),
- xmax = c(1.075, 2.075, 2, 2),
- annotation = c("", "", "*", "***"),
- tip_length = 0.1, color="black") +
- scale_color_brewer(palette="Dark2") +
- theme(legend.position = "bottom")
- plot(QC_plot)
- ggsave("./plots/QC_plot_LPP.png", dpi=300, width=1000, height=1200, units="px")
- ## plot three-way interactions
- all_plot <- plot_model(model, type="pred", terms=c("Pej.Value", "Coherence", "Quotation"), title="", axis.title=c("Pejorative Weight (z-standardized)", "LPP Amplitude (z-standardized)"), colors = "Dark2") +
- theme(legend.position = "bottom") + ylim(-0.6, 0.6)
- plot(all_plot)
- ggsave("./plots/all_plot_LPP.png", dpi=300, width=2000, height=1200, units="px")
- ## plot model estimates
- est_plot <- plot_model(model, type="est", colors="Set1", title="", axis.lim = c(-2.5, 2.5),
- axis.labels = c("Coh * Quot * Pej.Weight", "Quotation * Pejorative Weight",
- "Coherence * Pejorative Weight", "Coherence * Quotation",
- "Pejorative Weight", "Quotation", "Coherence"
- )) + theme(axis.text.y = element_text(angle = 30)) +
- ylim(-0.25, 0.25)
- plot(est_plot)
- ggsave("./plots/est_plot_LPP.png", dpi=300, width=1500, height=1800, units="px")
- ## combine plots
- combi_plot <- ggarrange(all_plot,
- ggarrange(QC_plot, est_plot, ncol=2, labels=c("B", "C")),
- nrow=2,
- labels="A")
- plot(combi_plot)
- ggsave("./plots/combi_plot_LPP.png", dpi=300, width=2400, height=2400, units="px")
- ## Diagnostics plots
- sim_res <- simulateResiduals(fittedModel = model, plot = F)
- ### Normality of residuals
- plotQQunif(sim_res, testUniformity = F, testOutliers = F, testDispersion = F)
- ### Normality of random effects
- diag <- plot_model(model, type="diag")
- plot(diag[[2]]$Participant)
- plot(diag[[2]]$Word)
- plot(diag[[2]]$Channel)
- ### Homoskedasticity
- plot(diag[[4]])
polpejEEG_repo.R, no license · at the source
Overview
- Department of Psychology, University of Graz, Graz, Austria
- Department of German Studies, University of Graz, Graz, Austria
Abstract
Introduction: Pragmatic violations are known to elicit reliable N400 modulations in event related potentials of electroencephalographic recordings. While this effect has been extensively documented in linguistic contexts, evidence from political discourse remains limited. To address this gap, the present study investigated neural responses to socio-pragmatic coherence in politically framed statements.
Methods: Participants read political utterances containing critical target words that were either coherent or incoherent with a preceding description of the producer. To examine whether pragmatic processing could be altered by typographic cues, target words were presented either unmarked or enclosed in quotation marks.
Results: Consistent with prior findings, pragmatically incoherent target words elicited a larger negative deflection peaking around 400 ms post-onset than coherent words. Notably, this pattern was reversed when target words were presented in quotation marks.
Discussion: We interpret this reversal as evidence that quotation marks signal a rejection or distancing from a word’s conventional meaning, thereby altering contextual integration demands. While rejecting the meaning of incoherent terms (e.g., “climate terrorists”) may facilitate integration when aligned with the speaker’s stance, rejecting the meaning of coherent terms (e.g., “climate activists”) appears to increase processing difficulty. These findings demonstrate that typographic cues can modulate socio-pragmatic interpretation in political language, with measurable neural consequences.
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 2 matches between paragraphs and lines of code.
OSF sgbqf
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
1 file
- polpejEEG_repo.R, R, 627 lines, 2 matches
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;
- 1 script, each with its path and the digest of its content;
- 2 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 datasets presented in this study can be found in online repositories. The names of the repository/
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 2, 28 September 2026
- Funding: added Karl-Franzens-Universität Graz
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 4 authors, 5 keywords, 61 references.
Cite
This paper
Hons, M., Onea, E., Schiller, I., & Kober, S. E. (2026). The neural dynamics of political socio-pragmatic violations: an ERP study. Frontiers in human neuroscience, 20, 1820376. https://
BibTeX
@article{hons2026neural,
author = {Hons, Manuel and Onea, Edgar and Schiller, Ilse and Kober, Silvia Erika},
title = {{The neural dynamics of political socio-pragmatic violations: an ERP study}},
journal = {Frontiers in human neuroscience},
year = {2026},
month = jun,
volume = {20},
pages = {1820376},
publisher = {Frontiers Media SA},
issn = {1662-5161},
doi = {10.3389/
url = {https://
pmid = {42444843},
pmcid = {PMC13357823}
}
RIS
TY - JOUR
AU - Hons, Manuel
AU - Onea, Edgar
AU - Schiller, Ilse
AU - Kober, Silvia Erika
TI - The neural dynamics of political socio-pragmatic violations: an ERP study
T2 - Frontiers in human neuroscience
J2 - Front Hum Neurosci
PY - 2026
DA - 2026/
VL - 20
SP - 1820376
SN - 1662-5161
PB - Frontiers Media SA
DO - 10.3389/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3389/
"type": "article-journal",
"title": "The neural dynamics of political socio-pragmatic violations: an ERP study",
"container-title": "Frontiers in human neuroscience",
"author": [
{
"family": "Hons",
"given": "Manuel"
},
{
"family": "Onea",
"given": "Edgar"
},
{
"family": "Schiller",
"given": "Ilse"
},
{
"family": "Kober",
"given": "Silvia Erika"
}
],
"container-title-short":
"volume": "20",
"page": "1820376",
"DOI": "10.3389/
"PMID": "42444843",
"PMCID": "PMC13357823",
"ISSN": "1662-5161",
"publisher": "Frontiers Media SA",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
29
]
]
}
}
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.1111/nyas.15407 [code]
- Foreign cultural norms are better accepted in the second language.Journal: Annals of the New York Academy of SciencesIn common: easystats, emmeans, lmerTest, 3 other tools, EEG, 5 references
- [2] doi:10.1016/j.dcn.2023.101251 [code]
- Age and vocabulary knowledge differentially influence the N400 and theta responses during semantic retrieval.Journal: Developmental cognitive neuroscienceIn common: easystats, emmeans, lmerTest, 4 other tools, EEG, 3 references
- [3] doi:10.1162/nol_a_00078 [code]
- Can You Hear What's Coming? Failure to Replicate ERP Evidence for Phonological Prediction.Journal: Neurobiology of language (Cambridge, Mass.)In common: easystats, emmeans, lmerTest, 4 other tools, EEG, 3 references
- [4] doi:10.1162/imag_a_00297 [code]
- Tone language experience enhances dimension-selective attention and subcortical encoding but not cortical entrainment to pitch.Journal: Imaging neuroscience (Cambridge, Mass.)In common: glmmTMB, easystats, emmeans, 5 other tools, 2 references
- [5] doi:10.1038/s41598-025-34117-w [code]
- The impact of awareness on affective emoji priming in visual word recognition.Journal: Scientific reportsIn common: easystats, emmeans, lmerTest, 3 other tools, EEG, 4 references
- [6] doi:10.1523/jneurosci.0657-25.2025 [code]
- Attentional Engagement with Target and Distractor Streams Predicts Speech Comprehension in Multitalker Environments.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: glmmTMB, emmeans, lmerTest, 3 other tools, EEG, 3 references
- [7] doi:10.3758/s13415-026-01401-9 [code]
- Dissociable impacts of perceived race and ascribed status in event-related brain potentials and multivariate network activity.Journal: Cognitive, affective & behavioral neuroscienceIn common: easystats, emmeans, lmerTest, 3 other tools, EEG, 3 references
- [8] doi:10.3390/brainsci16040375 [code]
- Comparing Brain Responses to Moral and Semantic Violations.Journal: Brain sciencesIn common: lmerTest, lme4, ggplot2, 1 other tool, EEG, 5 references
- [9] doi:10.1007/s42113-024-00210-y [code]
- Mnemonic vs. Executive Contributions to the N400: A Connectionist Approach to False Memories.Journal: Computational brain & behaviorIn common: easystats, emmeans, lmerTest, 3 other tools, EEG, 3 references
- [10] doi:10.1038/s41398-026-04479-4 [code]
- Altered semantic prediction error processing with increasing schizotypal and autistic traits.Journal: Translational psychiatryIn common: easystats, emmeans, lmerTest, 4 other tools, EEG, 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: 1 repository of the authors' code, each at its verified commit and with its license, 1 script, and 2 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:8933e515b547d72d…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.3389/fnhum.2026.1820376)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.3389/fnhum.2026.1820376.svg
:target: https://openscicode.org/badge/doi/10.3389/fnhum.2026.1820376
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.3389/fnhum.2026.1820376"><img src="https://openscicode.org/badge/doi/10.3389/fnhum.2026.1820376.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
