OSCR

Attentional processing in individual anxiety: Electrocortical correlates of threat- and safety-related declarative memory formation.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § Method › Statistical analysis ↔ EEG-SME OSF.R, lines 160–199 · score 0.68 · median split, Kenward Roger, inferential, variable, memory ratings, lme4

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 · 697 lines · 30 KB · no license · 1 match

  1. library(tidyverse)
  2. library(stringr)
  3. library(afex)
  4. library(ez)
  5. library(apa)
  6. require(r2glmm)
  7. require(psych)
  8. options(warn = 1)
  9. # Describe demographics
  10. # Please note for ethical reasons we did not upload the diagnosis information to the OSF,
  11. #please reach out to "[email hidden]" for access to the full demographic data on request.
  12. sampledata <- read.csv("Sampledata_osf.csv")
  13. # Describe demographics
  14. sampledata %>% filter(include_final == 1) %>%
  15. select(ASI_sum_real,mA,Alter,Geschlecht) %>%
  16. describe()
  17. # Correlate things
  18. sampledata %>% filter(include_final == 1) %>%
  19. select(ASI_sum_labor,mA,Alter,Geschlecht,total_remembered,csp_remembered,csm_remembered) %>%
  20. cor() %>%
  21. corrplot::corrplot(method = "number",diag = F, type = "upper",col = 'black', cl.pos = 'n')
  22. # Histogram of ASI values
  23. sampledata %>% filter(include_final == 1) %>%
  24. ggplot(aes(ASI_sum_real)) +
  25. geom_histogram(bins = 10,color="black", fill = "darkgoldenrod3") +
  26. geom_vline(xintercept = mean(sampledata$ASI_sum_real), color= "black") +
  27. geom_vline(xintercept = mean(sampledata$ASI_sum_real)+sd(sampledata$ASI_sum_real), color= "black", linetype=2) +
  28. geom_vline(xintercept = mean(sampledata$ASI_sum_real)-sd(sampledata$ASI_sum_real), color= "black", linetype=2) +
  29. annotate("text", label ="µ = 23.3", x = 30, y = 12, color = "black")+
  30. annotate("text", label ="σ = 16.7", x = 46.5, y = 12, color = "black")+
  31. scale_y_continuous("Count", expand=c(0,0), breaks=c(0,2,4,6,8,10,12)) +
  32. scale_x_continuous("ASI levels", breaks=c(0,10,20,30,40,50,60)) +
  33. theme_classic()
  34. mean(sampledata$ASI_sum_real)
  35. sd(sampledata$ASI_sum_real)
  36. # Behavioral Analysis
  37. # Read Raw Rating Data
  38. ratings <- read.csv2("C:/Users/yas70ym/Documents/Experimente/Experiment JW - EEG SME/Logfiles/Rating/Rating.txt", skip = 4, header=F) %>%
  39. select(-V5) %>%
  40. rename(ID = V1, stim = V2, rating = V3, score = V4) %>% #rename columns
  41. filter(stim != "") %>% #remove empty cells
  42. mutate(ID = str_remove(ID,"_Rating")) %>% #clean up ID
  43. filter(ID != "Test") %>% #Just take the memory ratings
  44. filter(stim != "alle") %>%
  45. mutate(cue = factor(ifelse(str_sub(stim,1,3) == "CS+",2,1)), #recode CS+ -> 2, CS- -> 1
  46. score = as.numeric(score))
  47. # Now take the memory ratings and categorize (if they are correctly remembered)
  48. memory_ratings <- ratings %>% filter(rating == "Sch") %>%
  49. mutate(memorized = ifelse(cue == 2 & score > 2, 1,0), # CS+ was correctly remembered when score was > +2
  50. memorized = ifelse(cue == 1 & score < -2, 1, memorized)) # CS- was correctly remembered when score was < -2
  51. # Calculate number of correctly remembered items, total and per CS
  52. #total_rem <- memory_ratings %>% group_by(ID) %>%
  53. # summarize(total_remembered = sum(memorized))
  54. #cs_rem <- memory_ratings %>% group_by(ID,cue) %>%
  55. # mutate(cue = ifelse(cue == 1,"csm_remembered","csp_remembered")) %>%
  56. # summarize(remembered = sum(memorized)) %>%
  57. # pivot_wider(names_from = cue, values_from = remembered)
  58. # Tests
  59. memory_ratings %>%
  60. left_join(sampledata, by = "ID")%>%
  61. filter(include_final == 1) %>%
  62. group_by(ID,cue) %>%
  63. summarize(remembered = sum(memorized),
  64. mean_score = mean(score)) %>%
  65. group_by(cue) %>%
  66. summarize(remembered_m = mean(remembered)/40,
  67. remembered_sd = sd(remembered)/40,
  68. score_m = mean(mean_score),
  69. score_sd = sd(mean_score))
  70. lm <- memory_ratings %>%
  71. left_join(sampledata, by = "ID")%>%
  72. filter(include_final == 1) %>%
  73. group_by(ID,cue,ASI_sum_labor) %>%
  74. summarize(mean_score = mean(score)) %>%
  75. lmer(mean_score ~ cue * ASI_sum_labor + (1|ID), data = .) #cue, memory, as factors, asi as continuous, id as random
  76. anova(lm,ddf="Kenward-Roger")
  77. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  78. lm <- memory_ratings %>%
  79. left_join(sampledata, by = "ID")%>%
  80. filter(include_final == 1) %>%
  81. group_by(ID,cue,ASI_sum_labor) %>%
  82. summarize(remembered = sum(memorized),
  83. mean_score = mean(score)) %>%
  84. lmer(remembered ~ cue * ASI_sum_labor + (1|ID), data = .)
  85. anova(lm,ddf="Kenward-Roger")
  86. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  87. # Arousal & Valence
  88. # Plots
  89. aro_plot <- ratings %>%
  90. left_join(sampledata, by = "ID") %>%
  91. left_join(memory_ratings %>% select(ID,stim,memorized), by = c("ID","stim")) %>%
  92. filter(include_final == 1) %>%
  93. filter(rating == "Aro") %>%
  94. mutate(memorized = factor(memorized),
  95. ASI_median = factor(ASI_median)) %>%
  96. group_by(ID,cue, memorized, ASI_median) %>%
  97. summarize(mean_score = mean(score)) %>%
  98. group_by(cue,memorized,ASI_median) %>%
  99. summarize(score_m = mean(mean_score),
  100. score_se = sd(mean_score)/sqrt(n())) %>%
  101. ggplot(aes(x = cue, y = score_m, linetype = memorized, fill = ASI_median, group = interaction(ASI_median,memorized))) +
  102. geom_errorbar(aes(ymin = score_m-score_se, ymax=score_m+score_se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  103. geom_line(position = position_dodge(width=0.2)) +
  104. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  105. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  106. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +
  107. scale_x_discrete("",labels=c("CS-","CS+")) +
  108. scale_y_continuous("Arousal [0 - 100]") +
  109. theme_classic() +
  110. theme(legend.position = "none")
  111. val_plot <-ratings %>%
  112. left_join(sampledata, by = "ID") %>%
  113. left_join(memory_ratings %>% select(ID,stim,memorized), by = c("ID","stim")) %>%
  114. filter(include_final == 1) %>%
  115. filter(rating == "Val") %>%
  116. mutate(score = 100-score) %>%
  117. mutate(memorized = factor(memorized),
  118. ASI_median = factor(ASI_median)) %>%
  119. group_by(ID,cue, memorized, ASI_median) %>%
  120. summarize(mean_score = mean(score)) %>%
  121. group_by(cue,memorized,ASI_median) %>%
  122. summarize(score_m = mean(mean_score),
  123. score_se = sd(mean_score)/sqrt(n())) %>%
  124. ggplot(aes(x = cue, y = score_m, linetype = memorized, fill = ASI_median, group = interaction(ASI_median,memorized))) +
  125. geom_errorbar(aes(ymin = score_m-score_se, ymax=score_m+score_se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  126. geom_line(position = position_dodge(width=0.2)) +
  127. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  128. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  129. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +
  130. scale_x_discrete("",labels=c("CS-","CS+")) +
  131. scale_y_continuous("Unpleasantness [0 - 100]") +
  132. theme_classic() +
  133. theme(legend.title = element_blank())
  134. cowplot::plot_grid(aro_plot, val_plot, ncol=2, nrow=1, rel_widths=c(1, 1.3))
  135. # Inferential analysis
  136. # Valence
  137. lm <- ratings %>%
  138. left_join(sampledata, by = "ID")%>%
  139. left_join(memory_ratings %>% select(ID,stim,memorized), by = c("ID","stim")) %>%
  140. filter(include_final == 1) %>%
  141. filter(rating == "Val") %>%
  142. group_by(ID,cue, memorized,ASI_sum_labor) %>%
  143. summarize(mean_score = mean(score)) %>%
  144. lmer(mean_score ~ cue * memorized * ASI_sum_labor + (1|ID), data = .) #cue, memory, as factors, asi as continuous, id as random
  145. anova(lm,ddf="Kenward-Roger")
  146. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  147. # Arousal
  148. lm <- ratings %>%
  149. left_join(sampledata, by = "ID")%>%
  150. left_join(memory_ratings %>% select(ID,stim,memorized), by = c("ID","stim")) %>%
  151. filter(include_final == 1) %>%
  152. filter(rating == "Aro") %>%
  153. group_by(ID,cue, memorized,ASI_sum_labor) %>%
  154. summarize(mean_score = mean(score)) %>%
  155. lmer(mean_score ~ cue * memorized * ASI_sum_labor + (1|ID), data = .)#cue, memory, as factors, asi as continuous, id as random
  156. anova(lm,ddf="Kenward-Roger")
  157. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  158. # Pupil Analysis
  159. # Read preprocessed pupil data, there is memory and some other info already included
  160. ga_unified <- readRDS("C:/Users/yas70ym/Documents/Experimente/Experiment JW - EEG SME/ET_ga_unified.RData")
  161. pupil_df <- readRDS("C:/Users/yas70ym/Documents/Experimente/Experiment JW - EEG SME/ET_pupil_df.Rdata")
  162. # Combine with sampledata info
  163. ga_unified <- ga_unified %>% left_join(sampledata %>% select(-ASI_sum_labor, -Asi_sum_screening), by ="ID")
  164. pupil_df <- pupil_df %>% select(-ASI_sum_labor,-Gruppe) %>% left_join(sampledata %>% select(-Asi_sum_screening), by ="ID")
  165. # Insert ASI median split group in the trial variable for plotting ... this will load some minutes
  166. for (t in 1:nrow(ga_unified)) {
  167. ga_unified$diameter[[t]] = ga_unified$diameter[[t]] %>%
  168. mutate(ASI_median = ga_unified$ASI_median[[t]])}
  169. # Plot grand average
  170. pupil_wave_plot <- ga_unified %>%
  171. filter(include_final == 1) %>%
  172. .$diameter %>% bind_rows() %>%
  173. mutate(condition = as.factor(condition)) %>%
  174. mutate(condition = factor(condition,labels = c("CS-","CS+")),
  175. memorized = factor(memorized),
  176. ASI_median = factor(ASI_median)) %>%
  177. group_by(condition,memorized,samplepoint,ASI_median) %>%
  178. summarise(diameter = mean(diameter), time = mean(time)) %>%
  179. ggplot(., aes(x=time, y=diameter, color=ASI_median, group=interaction(ASI_median,memorized), linetype = memorized)) +
  180. facet_wrap(~condition)+
  181. geom_rect(xmin = 0.5, xmax = 3, ymin = -Inf, ymax = Inf, fill = "#EEEEEE", color = "transparent")+
  182. geom_path() +
  183. geom_hline(yintercept = 0) +
  184. scale_x_continuous("Time [s]")+ #,limits=c(-0.5, 6)) +
  185. scale_color_manual(labels=c("low ASI","high ASI"),
  186. values=c("darkgoldenrod3", "darkblue")) +
  187. scale_linetype_manual(values=c(2,1), labels = c("forgotten","remembered"))+
  188. scale_y_continuous("Pupil Diameter [mm]") +
  189. theme_classic() +
  190. theme(legend.position="bottom",
  191. legend.background = element_rect(fill = "transparent"),
  192. legend.title = element_blank(),
  193. strip.background.x = element_blank())
  194. pupil_plot <- pupil_df %>%
  195. filter(include_final == 1) %>% #take only included subjects
  196. select(ID,ASI_median,condition,memorized,dilation) %>% #this line is technically not necessary
  197. group_by(ID,condition,memorized,ASI_median) %>% # average over single trials
  198. summarise(dilation = mean(dilation)) %>% ungroup() %>%
  199. mutate(cue = factor(condition,labels = c("csm","csp")), #factorize factors
  200. memorized = factor(memorized),
  201. ASI_median = factor(ASI_median)) %>%
  202. group_by(cue,memorized,ASI_median) %>%
  203. summarize(dilation_m = mean(dilation),
  204. dilation_se = sd(dilation)/sqrt(n())) %>%
  205. ggplot(aes(x = cue, y = dilation_m, linetype = memorized, fill = ASI_median, group = interaction(ASI_median,memorized))) +
  206. geom_errorbar(aes(ymin = dilation_m-dilation_se, ymax=dilation_m+dilation_se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  207. geom_line(position = position_dodge(width=0.2)) +
  208. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  209. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  210. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1),guide = 'none') +
  211. scale_x_discrete("",labels=c("CS-","CS+")) +
  212. scale_y_continuous("Change in pupil dilation [mm]") +
  213. theme_classic() +
  214. theme(legend.title = element_blank(),
  215. legend.position = "bottom")
  216. cowplot::plot_grid(pupil_wave_plot,pupil_plot,ncol=2,rel_widths=c(2,1),labels=c("A","B"))
  217. # Calculate linear mixed model
  218. pupil_model <- pupil_df %>%
  219. filter(include_final == 1) %>% #take only included subjects
  220. select(ID,ASI_sum_labor,condition,memorized,dilation) %>% #this line is technically not necessary
  221. group_by(ID,condition,memorized,ASI_sum_labor) %>% # average over single trials
  222. summarise(dilation = mean(dilation)) %>% ungroup() %>%
  223. mutate(cue = factor(condition,labels = c("csm","csp")), #factorize factors
  224. memorized = factor(memorized)) %>%
  225. lmer(dilation ~ cue * memorized * ASI_sum_labor + (1|ID), data = .) #cue, memory, as factors, asi as continuous, id as random
  226. anova(pupil_model,ddf ="Kenward-Roger") # show results
  227. r2beta(pupil_model,method="kr") #Effectsize and 95-CI estimation
  228. # Follow up Tests:
  229. # Calculate linear mixed model
  230. lm <- pupil_df %>%
  231. filter(include_final == 1) %>% #take only included subjects
  232. select(ID,ASI_sum_labor,condition,memorized,dilation) %>% #this line is technically not necessary
  233. group_by(ID,condition,memorized,ASI_sum_labor) %>% # average over single trials
  234. summarise(dilation = mean(dilation)) %>% ungroup() %>%
  235. mutate(cue = factor(condition,labels = c("csm","csp")), #factorize factors
  236. memorized = factor(memorized)) %>%
  237. filter(cue == "csp") %>%
  238. lmer(dilation ~ memorized * ASI_sum_labor + (1|ID), data = .) #cue, memory, as factors, asi as continuous, id as random
  239. anova(lm,ddf ="Kenward-Roger") # show results
  240. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  241. # Calculate linear mixed model
  242. lm <- pupil_df %>%
  243. filter(include_final == 1) %>% #take only included subjects
  244. select(ID,ASI_sum_labor,condition,memorized,dilation) %>% #this line is technically not necessary
  245. group_by(ID,condition,memorized,ASI_sum_labor) %>% # average over single trials
  246. summarise(dilation = mean(dilation)) %>% ungroup() %>%
  247. mutate(cue = factor(condition,labels = c("csm","csp")), #factorize factors
  248. memorized = factor(memorized)) %>%
  249. filter(cue == "csm") %>%
  250. lmer(dilation ~ memorized * ASI_sum_labor + (1|ID), data = .)
  251. anova(lm,ddf ="Kenward-Roger") # show results
  252. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  253. # ERP Analysis
  254. p300Data = read.table("C:/Users/yas70ym/Documents/Experimente/Experiment JW - EEG SME/P300.txt",header=T) %>%
  255. mutate(ID = substr(ERPset,1,4),
  256. bini = factor(bini),
  257. condition = factor(bini,labels = c("CSp_re",
  258. "CSp_fo",
  259. "CSm_re",
  260. "CSm_fo",
  261. "US_re",
  262. "US_fo",
  263. "OM_re",
  264. "OM_fo",
  265. "CSp",
  266. "CSm",
  267. "US",
  268. "OM"))) %>%
  269. select(-ERPset,-bini) %>%
  270. separate(condition,into=c("condition","memory")) %>%
  271. mutate(memory = ifelse(is.na(memory),"all",memory)) %>%
  272. left_join(sampledata, by = "ID") %>%
  273. mutate(ID = factor(ID),
  274. condition = factor(condition),
  275. memory = factor(memory),
  276. ASI_median = factor(ASI_median, labels=c("low ASI", "high ASI")),
  277. chlabel = factor(chlabel))
  278. LPPData = read.table("C:/Users/yas70ym/Documents/Experimente/Experiment JW - EEG SME/LPP.txt",header=T) %>%
  279. mutate(ID = substr(ERPset,1,4),
  280. bini = factor(bini),
  281. condition = factor(bini,labels = c("CSp_re",
  282. "CSp_fo",
  283. "CSm_re",
  284. "CSm_fo",
  285. "US_re",
  286. "US_fo",
  287. "OM_re",
  288. "OM_fo",
  289. "CSp_all",
  290. "CSm_all",
  291. "US_all",
  292. "OM_all"))) %>%
  293. select(-ERPset,-bini) %>%
  294. separate(condition,into=c("condition","memory")) %>%
  295. mutate(memory = ifelse(is.na(memory),"all",memory)) %>%
  296. left_join(sampledata, by = "ID")%>%
  297. mutate(ID = factor(ID),
  298. condition = factor(condition),
  299. memory = factor(memory),
  300. ASI_median = factor(ASI_median, labels=c("low ASI", "high ASI")),
  301. chlabel = factor(chlabel))
  302. # Full analysis with Memory, ASI, and CS:
  303. # LPP
  304. # Pz biggest effects:
  305. # CS x Memory x ASI
  306. lm <- LPPData %>%
  307. filter(condition %in% c("CSp","CSm")) %>%
  308. filter(memory != "all") %>%
  309. filter(include_final == 1) %>%
  310. filter(chlabel == "Pz") %>%
  311. lmer(value ~ condition * memory * ASI_sum_labor + (1|ID), data = .)
  312. #cue, memory, as factors, asi as continuous, id as random
  313. anova(lm,ddf ="Kenward-Roger") # show results
  314. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  315. LPPData %>%
  316. filter(condition %in% c("CSp")) %>%
  317. filter(memory != "all") %>%
  318. filter(include_final == 1) %>%
  319. filter(chlabel == "Pz") %>%
  320. lmer(value ~ memory * ASI_sum_labor + (1|ID), data = .) %>%
  321. #cue, memory, as factors, asi as continuous, id as random
  322. anova() # show results
  323. LPPData %>%
  324. filter(condition %in% c("CSm")) %>%
  325. filter(memory != "all") %>%
  326. filter(include_final == 1) %>%
  327. filter(chlabel == "Pz") %>%
  328. lmer(value ~ memory * ASI_sum_labor + (1|ID), data = .) %>%
  329. #cue, memory, as factors, asi as continuous, id as random
  330. anova() # show results
  331. lpp_cue_plot <- LPPData %>%
  332. filter(condition %in% c("CSp","CSm")) %>%
  333. filter(memory != "all") %>%
  334. filter(chlabel == "Pz") %>%
  335. filter(include_final == 1) %>%
  336. group_by(condition,memory,ASI_median,chlabel) %>%
  337. summarise(mean = mean(value),
  338. se = sd(value)/sqrt(n())) %>%
  339. ggplot(aes(x = condition, y = mean, linetype = memory, fill = ASI_median, group = interaction(ASI_median,memory))) +
  340. geom_errorbar(aes(ymin = mean-se, ymax=mean+se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  341. geom_line(position = position_dodge(width=0.2)) +
  342. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  343. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  344. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +##,guide = 'none') +
  345. scale_x_discrete("",labels=c("CS-","CS+")) +
  346. scale_y_continuous("LPP [µV]") +
  347. theme_classic() +
  348. theme(legend.title = element_blank(),
  349. legend.position = "none")
  350. # P300
  351. # Pz biggest effects:
  352. # CS x Memory x ASI
  353. lm <- p300Data %>%
  354. filter(condition %in% c("CSp","CSm")) %>%
  355. filter(memory != "all") %>%
  356. filter(include_final == 1) %>%
  357. filter(chlabel == "Pz") %>%
  358. lmer(value ~ condition * memory * ASI_sum_labor + (1|ID), data = .)
  359. anova(lm,ddf ="Kenward-Roger") # show results
  360. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  361. p300Data %>%
  362. filter(condition %in% c("CSp")) %>%
  363. filter(memory != "all") %>%
  364. filter(include_final == 1) %>%
  365. filter(chlabel == "Pz") %>%
  366. lmer(value ~ memory * ASI_sum_labor + (1|ID), data = .) %>%
  367. #cue, memory, as factors, asi as continuous, id as random
  368. anova() # show results
  369. p300Data %>%
  370. filter(condition %in% c("CSm")) %>%
  371. filter(memory != "all") %>%
  372. filter(include_final == 1) %>%
  373. filter(chlabel == "Pz") %>%
  374. lmer(value ~ memory * ASI_sum_labor + (1|ID), data = .) %>%
  375. #cue, memory, as factors, asi as continuous, id as random
  376. anova() # show results
  377. p300_cue_plot <- p300Data %>%
  378. filter(condition %in% c("CSp","CSm")) %>%
  379. filter(memory != "all") %>%
  380. filter(chlabel == "Pz") %>%
  381. filter(include_final == 1) %>%
  382. group_by(condition,memory,ASI_median,chlabel) %>%
  383. summarise(mean = mean(value),
  384. se = sd(value)/sqrt(n())) %>%
  385. ggplot(aes(x = condition, y = mean, linetype = memory, fill = ASI_median, group = interaction(ASI_median,memory))) +
  386. geom_errorbar(aes(ymin = mean-se, ymax=mean+se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  387. geom_line(position = position_dodge(width=0.2)) +
  388. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  389. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  390. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +##,guide = 'none') +
  391. scale_x_discrete("",labels=c("CS-","CS+")) +
  392. scale_y_continuous("P300 [µV]") +
  393. theme_classic() +
  394. theme(legend.position = "none",
  395. legend.title = element_blank())
  396. plot_labels <- p300Data %>%
  397. filter(condition %in% c("CSp","CSm")) %>%
  398. filter(memory != "all") %>%
  399. filter(chlabel == "Pz") %>%
  400. filter(include_final == 1) %>%
  401. group_by(condition,memory,ASI_median,chlabel) %>%
  402. summarise(mean = mean(value),
  403. se = sd(value)/sqrt(n())) %>%
  404. ggplot(aes(x = condition, y = mean, linetype = memory, fill = ASI_median, group = interaction(ASI_median,memory))) +
  405. geom_errorbar(aes(ymin = mean-se, ymax=mean+se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  406. geom_line(position = position_dodge(width=0.2)) +
  407. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  408. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  409. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +##,guide = 'none') +
  410. scale_x_discrete("",labels=c("CS-","CS+")) +
  411. scale_y_continuous("P300 [µV]") +
  412. theme_void() +
  413. theme(legend.position = "bottom",
  414. legend.title = element_blank())
  415. legend <- ggpubr::as_ggplot(ggpubr::get_legend(plot_labels))
  416. cowplot::plot_grid(cowplot::plot_grid(p300_cue_plot,lpp_cue_plot,ncol=2,labels=c("A","B"),rel_widths = c(1,1)),legend, nrow=2, rel_heights = c(1,0.1))
  417. # OM: Memory x Channel x Gruppe
  418. lm <- LPPData %>%
  419. filter(condition %in% c("OM")) %>%
  420. filter(memory != "all") %>%
  421. filter(include_final == 1) %>%
  422. filter(chlabel == "Cz") %>%
  423. lmer(value ~ memory * ASI_sum_labor + (1|ID), data = .)
  424. anova(lm,ddf ="Kenward-Roger") # show results
  425. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  426. lpp_om_plot <- LPPData %>%
  427. filter(condition %in% c("OM")) %>%
  428. filter(memory != "all") %>%
  429. filter(chlabel == "Cz") %>%
  430. filter(include_final == 1) %>%
  431. group_by(memory,ASI_median) %>%
  432. summarise(mean = mean(value),
  433. se = sd(value)/sqrt(n())) %>%
  434. ggplot(aes(x = memory, y = mean, fill = ASI_median, group = ASI_median)) +
  435. geom_errorbar(aes(ymin = mean-se, ymax=mean+se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  436. geom_line(position = position_dodge(width=0.2)) +
  437. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  438. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  439. scale_x_discrete("",labels=c("forgotten","remembered")) +
  440. scale_y_continuous("LPP [µV]") +
  441. theme_classic() +
  442. theme(legend.position = "none",
  443. legend.title = element_blank())
  444. lm <- p300Data %>%
  445. filter(condition %in% c("OM")) %>%
  446. filter(memory != "all") %>%
  447. filter(include_final == 1) %>%
  448. filter(chlabel == "Cz") %>%
  449. #group_by(memory,ID,ASI_sum_labor) %>%
  450. #summarise(value = mean(value)) %>%
  451. lmer(value ~ memory * ASI_sum_labor + (1|ID), data = .)
  452. anova(lm,ddf ="Kenward-Roger") # show results
  453. r2beta(lm,method="kr") #Effectsize and 95-CI estimation
  454. p300_om_plot <- p300Data %>%
  455. filter(condition %in% c("OM")) %>%
  456. filter(memory != "all") %>%
  457. filter(chlabel == "Cz") %>%
  458. filter(include_final == 1) %>%
  459. group_by(memory,ASI_median) %>%
  460. summarise(mean = mean(value),
  461. se = sd(value)/sqrt(n())) %>%
  462. ggplot(aes(x = memory, y = mean, fill = ASI_median, group = ASI_median)) +
  463. geom_errorbar(aes(ymin = mean-se, ymax=mean+se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  464. geom_line(position = position_dodge(width=0.2)) +
  465. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  466. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  467. scale_x_discrete("",labels=c("forgotten","remembered")) +
  468. scale_y_continuous("P300 [µV]") +
  469. theme_classic() +
  470. theme(legend.position = "none",
  471. legend.title = element_blank())
  472. legend_om_plot <- p300Data %>%
  473. filter(condition %in% c("OM")) %>%
  474. filter(memory != "all") %>%
  475. filter(chlabel == "Cz") %>%
  476. filter(include_final == 1) %>%
  477. group_by(memory,ASI_median) %>%
  478. summarise(mean = mean(value),
  479. se = sd(value)/sqrt(n())) %>%
  480. ggplot(aes(x = memory, y = mean, fill = ASI_median, group = ASI_median)) +
  481. geom_errorbar(aes(ymin = mean-se, ymax=mean+se), linetype = 1, width = 0.1,,position = position_dodge(width=0.2)) +
  482. geom_line(position = position_dodge(width=0.2)) +
  483. geom_point(size = 3, shape = 21,position = position_dodge(width=0.2)) +
  484. scale_fill_manual(labels = c("low ASI", "high ASI"), values=c("darkgoldenrod3","darkblue"))+
  485. scale_x_discrete("",labels=c("forgotten","remembered")) +
  486. scale_y_continuous("P300 [µV]") +
  487. theme_classic() +
  488. theme(legend.position = "bottom",
  489. legend.title = element_blank())
  490. legend_om <- ggpubr::as_ggplot(ggpubr::get_legend(legend_om_plot))
  491. cowplot::plot_grid(cowplot::plot_grid(p300_om_plot,lpp_om_plot,ncol=2,labels=c("A","B")),
  492. legend_om,
  493. nrow=2, rel_heights = c(1,0.1))
  494. # Plot Waveforms
  495. high_csmfo <- read.table("Plots/Topographies/High__csmfo .txt", header = T) %>%
  496. select(time,Pz) %>% mutate(ASI_group = "high",
  497. condition = "csm",
  498. memory = "fo")
  499. high_cspfo <- read.table("Plots/Topographies/High__cspfo .txt", header = T) %>%
  500. select(time,Pz) %>% mutate(ASI_group = "high",
  501. condition = "csp",
  502. memory = "fo")
  503. high_csmre <- read.table("Plots/Topographies/High__csmre .txt", header = T) %>%
  504. select(time,Pz) %>% mutate(ASI_group = "high",
  505. condition = "csm",
  506. memory = "re")
  507. high_cspre <- read.table("Plots/Topographies/High__cspre .txt", header = T) %>%
  508. select(time,Pz) %>% mutate(ASI_group = "high",
  509. condition = "csp",
  510. memory = "re")
  511. high_omfo<- read.table("Plots/Topographies/High__omfo.txt", header = T) %>%
  512. select(time,Cz) %>% mutate(ASI_group = "high",
  513. condition = "om",
  514. memory = "fo")
  515. high_omre <- read.table("Plots/Topographies/High__omre.txt", header = T) %>%
  516. select(time,Cz) %>% mutate(ASI_group = "high",
  517. condition = "om",
  518. memory = "re")
  519. low_csmfo <- read.table("Plots/Topographies/Low__csmfo .txt", header = T) %>%
  520. select(time,Pz) %>% mutate(ASI_group = "low",
  521. condition = "csm",
  522. memory = "fo")
  523. low_cspfo <- read.table("Plots/Topographies/Low__cspfo .txt", header = T) %>%
  524. select(time,Pz) %>% mutate(ASI_group = "low",
  525. condition = "csp",
  526. memory = "fo")
  527. low_csmre <- read.table("Plots/Topographies/Low__csmre .txt", header = T) %>%
  528. select(time,Pz) %>% mutate(ASI_group = "low",
  529. condition = "csm",
  530. memory = "re")
  531. low_cspre <- read.table("Plots/Topographies/Low__cspre .txt", header = T) %>%
  532. select(time,Pz) %>% mutate(ASI_group = "low",
  533. condition = "csp",
  534. memory = "re")
  535. low_omfo<- read.table("Plots/Topographies/Low__omfo.txt", header = T) %>%
  536. select(time,Cz) %>% mutate(ASI_group = "low",
  537. condition = "om",
  538. memory = "fo")
  539. low_omre <- read.table("Plots/Topographies/Low__omre.txt", header = T) %>%
  540. select(time,Cz) %>% mutate(ASI_group = "low",
  541. condition = "om",
  542. memory = "re")
  543. cs_erps <- high_csmfo %>%
  544. rbind(high_cspfo) %>%
  545. rbind(high_csmre) %>%
  546. rbind(high_cspre) %>%
  547. rbind(low_csmfo) %>%
  548. rbind(low_cspfo) %>%
  549. rbind(low_csmre) %>%
  550. rbind(low_cspre) %>%
  551. mutate(ASI_group = factor(ASI_group),
  552. condition = factor(condition),
  553. memory = factor(memory))
  554. om_erps <- high_omfo %>%
  555. rbind(high_omre) %>%
  556. rbind(low_omfo) %>%
  557. rbind(low_omre)
  558. # Plot Cue-related Waveforms
  559. csp_erp_plot <- cs_erps %>%
  560. filter(condition %in% c("csp")) %>%
  561. ggplot(aes(x = time, y = Pz, color = ASI_group, linetype = memory)) +
  562. geom_vline(xintercept = 0,linetype = 2) +
  563. geom_line() +
  564. scale_color_manual(labels = c("high ASI", "low ASI"), values=c("darkblue","darkgoldenrod3"))+
  565. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +##,guide = 'none') +
  566. scale_x_continuous("Time [ms]", expand = c(0.05,0.05), breaks=c(-200,0,200,400,600,800,1000)) +
  567. scale_y_continuous("CS+ ERP [µV]") +
  568. theme_classic() +
  569. theme(legend.title = element_blank(),
  570. legend.position = "none")
  571. csm_erp_plot <- cs_erps %>%
  572. filter(condition %in% c("csm")) %>%
  573. ggplot(aes(x = time, y = Pz, color = ASI_group, linetype = memory)) +
  574. geom_vline(xintercept = 0,linetype = 2) +
  575. geom_line() +
  576. scale_color_manual(labels = c("high ASI", "low ASI"), values=c("darkblue","darkgoldenrod3"))+
  577. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +##,guide = 'none') +
  578. scale_x_continuous("Time [ms]", expand = c(0.05,0.05), breaks=c(-200,0,200,400,600,800,1000)) +
  579. scale_y_continuous("CS- ERP [µV]") +
  580. theme_classic() +
  581. theme(legend.title = element_blank(),
  582. legend.position = "none")
  583. cowplot::plot_grid(csm_erp_plot,csp_erp_plot,ncol=2,labels=c("D","E"),rel_widths = c(1,1))
  584. # Plot Omission-related Waveforms
  585. om_erps %>%
  586. filter(condition %in% c("om")) %>%
  587. ggplot(aes(x = time, y = Cz, color = ASI_group, linetype = memory)) +
  588. geom_vline(xintercept = 0,linetype = 2) +
  589. geom_line() +
  590. scale_color_manual(labels = c("high ASI", "low ASI"), values=c("darkblue","darkgoldenrod3"))+
  591. scale_linetype_manual(labels = c("forgotten", "remembered"), values=c(2,1)) +##,guide = 'none') +
  592. scale_x_continuous("Time [ms]", expand = c(0.05,0.05), breaks=c(-200,0,200,400,600,800,1000)) +
  593. scale_y_continuous("CS- offset ERP [µV]") +
  594. theme_classic() +
  595. theme(legend.title = element_blank(),
  596. legend.position = "none")

EEG-SME OSF.R, no license · at the source

Overview

  1. Department of Psychology, University of Würzburg,Marcusstraße 9-11, 97070 Würzburg, Germany
  2. Department of General Psychiatry and Psychotherapy, University Hospital Tübingen,Tübingen, Germany
  3. Tübingen Center for Mental Health, University Hospital Tübingen,Tübingen, Germany
Institutions: University of Würzburg (Germany); Universitätsklinikum Tübingen (Germany)
Journal: Cognitive, affective & behavioral neuroscience, volume 26, issue 5, pages 2297-2310
Dates: received 1 December 2025; accepted 6 April 2026; published online 12 May 2026; in print 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.3758/s13415-026-01450-0 · PMID 42120709 · PMCID PMC13615150 · OpenAlex W7160910323
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), other condition (population), cognitive (subfield)
Methods: Spectral & time-frequency, Smoothing, state filtering, decompositions, Preprocessing, Evoked potentials, Statistics, Physiology & signal measures
Keywords: Memory, Conditioning, Event-related potentials, Anxiety, Anxiety sensitivity index
MeSH: Anxiety*, Attention*, Evoked Potentials*, Fear*, Memory*, Adolescent, Adult, Conditioning, Classical, Electroencephalography, Event-Related Potentials, P300, Female, Humans, Individuality, Male, Young Adult (* major topic)
Topic: Anxiety, Depression, Psychometrics, Treatment, Cognitive Processes (Experimental and Cognitive Psychology, Psychology), according to OpenAlex
Funding: Deutsche Forschungsgemeinschaft (DFG) (378414384); Julius-Maximilians-Universität Würzburg (3088)
Citations: not cited yet (Europe PMC); 74 references in the paper

Abstract

The ability to accurately detect and remember threatening stimuli is essential for adaptive behavior in potentially dangerous environments. While threat-related defensive processes are increasingly well understood, recent research has begun to emphasize complementary safety-related attention and learning mechanisms, processes especially relevant to the development and maintenance of pathological anxiety. Prior fear conditioning studies have identified a key role for late positive event-related potentials, particularly the P300 and late positive potential (LPP) in the formation of declarative memories related to threat and safety. However, the influence of individual differences in anxiety on these mechanisms remains insufficiently explored. In the present study, we examined how anxiety sensitivity, a transdiagnostic risk factor for anxiety-related pathologies, modulates attention and memory processes during declarative threat and safety learning. Using a subsequent memory paradigm, we recorded event-related potentials as participants learned associations between neutral faces and either an aversive outcome or safety. Stronger P300 and LPP amplitudes were found for remembered compared with forgotten items. Crucially, elevated anxiety sensitivity was associated with increased P300 and LPP amplitudes at the onset of both threat and safety cues, indicating heightened attentional allocation to both types of stimuli. Despite these amplified neural responses during memory encoding, higher anxiety sensitivity did not correspond to enhanced memory performance. These results suggest that, while individuals at heightened risk for anxiety-related psychopathology exhibit generalized hypervigilance, this increased attentional engagement does not necessarily translate into enhanced memory formation during intentional learning.

Supplementary Information: The online version contains supplementary material available at https://doi.org/10.3758/s13415-026-01450-0.

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 1 match between paragraphs and lines of code.

OSF 83zbx

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Languages: R (1)
Size: 19 files, 1 script
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: afex (1 file), cowplot (1 file), ggpubr (1 file), psych (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
1 file
At the source: osf.io/83zbx/

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;
  • 1 script, each with its path and the digest of its content;
  • 1 match 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

All data and code behind the analyses have been made publicly available at the Open Science Framework and can be accessed at https://osf.io/83zbx/.

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

  • Publisher: n/a → Springer Science+Business Media

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 5 keywords, 15 MeSH terms, 2 funders, 71 references.

Cite

This paper

Stegmann, Y., Glück, V., Andreatta, M., & Wiemer, J. (2026). Attentional processing in individual anxiety: Electrocortical correlates of threat- and safety-related declarative memory formation. Cognitive, affective & behavioral neuroscience, 26(5), 2297-2310. https://doi.org/10.3758/s13415-026-01450-0

BibTeX

@article{stegmann2026attentional,
author = {Stegmann, Yannik and Glück, Valentina and Andreatta, Marta and Wiemer, Julian},
title = {{Attentional processing in individual anxiety: Electrocortical correlates of threat- and safety-related declarative memory formation}},
journal = {Cognitive, affective \& behavioral neuroscience},
year = {2026},
month = may,
volume = {26},
number = {5},
pages = {2297--2310},
publisher = {Springer Science+Business Media},
issn = {1530-7026},
doi = {10.3758/s13415-026-01450-0},
url = {https://doi.org/10.3758/s13415-026-01450-0},
pmid = {42120709},
pmcid = {PMC13615150}
}

RIS

TY - JOUR
AU - Stegmann, Yannik
AU - Glück, Valentina
AU - Andreatta, Marta
AU - Wiemer, Julian
TI - Attentional processing in individual anxiety: Electrocortical correlates of threat- and safety-related declarative memory formation
T2 - Cognitive, affective & behavioral neuroscience
J2 - Cogn Affect Behav Neurosci
PY - 2026
DA - 2026/05/12
VL - 26
IS - 5
SP - 2297
EP - 2310
SN - 1530-7026
PB - Springer Science+Business Media
DO - 10.3758/s13415-026-01450-0
UR - https://doi.org/10.3758/s13415-026-01450-0
LA - en
ER -

CSL-JSON

{
"id": "10.3758/s13415-026-01450-0",
"type": "article-journal",
"title": "Attentional processing in individual anxiety: Electrocortical correlates of threat- and safety-related declarative memory formation",
"container-title": "Cognitive, affective & behavioral neuroscience",
"author": [
{
"family": "Stegmann",
"given": "Yannik"
},
{
"family": "Glück",
"given": "Valentina"
},
{
"family": "Andreatta",
"given": "Marta"
},
{
"family": "Wiemer",
"given": "Julian"
}
],
"container-title-short": "Cogn Affect Behav Neurosci",
"volume": "26",
"issue": "5",
"page": "2297-2310",
"DOI": "10.3758/s13415-026-01450-0",
"PMID": "42120709",
"PMCID": "PMC13615150",
"ISSN": "1530-7026",
"publisher": "Springer Science+Business Media",
"URL": "https://doi.org/10.3758/s13415-026-01450-0",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
12
]
]
}
}

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.1371/journal.pone.0353990 [code]
Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language.
Journal: PloS one
In common: afex, psych, ggpubr, 1 other tool, EEG, cognitive, 3 references
[2] doi:10.1038/s41467-026-74565-0 [code]
The functional neurobiology of dispositions towards negative emotions.
Journal: Nature communications
In common: afex, psych, cowplot, 1 other tool, cognitive, 1 reference
[3] doi:10.1038/s41537-026-00761-y [code]
The role of fear learning in the development of psychosis: an EEG study utilizing a differential fear conditioning paradigm in people with psychotic vulnerability.
Journal: Schizophrenia (Heidelberg, Germany)
In common: psych, tidyverse, EEG, 4 references
[4] doi:10.1038/s41598-026-42906-0
Social learning of emotion and its implication for memory: an ERP study.
Journal: Scientific reports
In common: EEG, cognitive, 5 references
[5] doi:10.1016/j.neuroimage.2026.122115 [code]
Midfrontal theta power relates to response speeding following frustrative nonreward.
Journal: NeuroImage
In common: psych, ggpubr, tidyverse, EEG, cognitive, 3 references
[6] 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 biology
In common: afex, psych, tidyverse, EEG, other condition, 2 references
[7] doi:10.1038/s44271-026-00431-w [code]
Alpha power increases spontaneously during a neurofeedback session.
Journal: Communications psychology
In common: afex, cowplot, ggpubr, 1 other tool, EEG, cognitive, 1 reference
[8] doi:10.1111/psyp.70265 [code]
Neurocognitive Dynamics of Translating Information From a Spatial Map Into Action.
Journal: Psychophysiology
In common: cowplot, ggpubr, tidyverse, EEG, cognitive, 3 references
[9] doi:10.1111/psyp.70285 [code]
Spontaneous Modulation of Alpha Power During a Neurofeedback Session Without Instructions.
Journal: Psychophysiology
In common: afex, cowplot, ggpubr, 1 other tool, EEG, 1 reference
[10] doi:10.7554/elife.103566 [code]
Effort produces after-effects costly for others but valued for self.
Journal: eLife
In common: psych, ggpubr, tidyverse, EEG, 3 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.

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: 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.