Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language.
6 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 7 matches
- [1] § 2. Materials and methods › 2.6. Data analysis › 2.6.2. Electrophysiological measures. ↔ Matlab scripts/C_MoBSeR_ERPs.m, lines 70 to 82 · score 0.75 · Artifact rejection, pop_jointprob, SDs, EEGLAB, Matlab, rejected · block
oscr:b:25Y9DKCHKX29N-5· Report a mismatch - [2] § 2. Materials and methods › 2.6. Data analysis › 2.6.1. Self-report measures: Mood ratings. ↔ R scripts/MoBSeR_word_pairs.R, lines 52 to 122 · score 0.69 · linear mixed, principal component, lme4, justified, PCA, fit · block
oscr:b:40NH3T71KNZ2N-L· Report a mismatch - [3] § 3. Results › 3.1. Self-report data: Mood ratings ↔ R scripts/MoBSeR_mood.R, lines 292 to 350 · score 0.64 · physiological arousal, Mood induction phase, arousal ratings, valence · block
oscr:b:SA80D7527CDEF-V· Report a mismatch - [4] § 3. Results › 3.2. Electrophysiological data: N400 (300–500 ms) › 3.2.1. Polish (L1) prime–target pairs. ↔ R scripts/MoBSeR_ERP_R1.R, lines 574 to 634 · score 0.60 · Mood induction progression, positive mood induction, negative mood induction, Word pair, slopes, N400 amplitudes · block
oscr:b:CFF2191KK1AE3-O· Report a mismatch - [5] § 2. Materials and methods › 2.6. Data analysis › 2.6.2. Electrophysiological measures. ↔ R scripts/MoBSeR_ERP_R1.R, lines 378 to 425 · score 0.59 · films watched, Mood induction progression, Weakly related, block, predictor, Negative mood · block
oscr:b:B2P57ZRDHYH1G-Z· Report a mismatch - [6] § 2. Materials and methods › 2.6. Data analysis › 2.6.1. Self-report measures: Mood ratings. ↔ R scripts/MoBSeR_ERP.R, lines 198 to 251 · score 0.57 · principal component, lme4, variance, PCA, fit, intercepts · block
oscr:b:XATC5MHZ6N996-6· Report a mismatch - [7] § 2. Materials and methods › 2.6. Data analysis › 2.6.2. Electrophysiological measures. ↔ R scripts/MoBSeR_ERP.R, lines 198 to 251 · score 0.51 · smpsize_lmm, medium, ICC, power, correlation, model · block
oscr:b:XATC5MHZ6N996-6· 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 · 1,719 lines · 85 KB · no license · 2 matches
- #################################
- ########## MoBSeR: ERPs ########
- #################################
- # positive = "#EB0030",negative = "#404A80"
- # Polish = "#353269",English = "#120BDE"
- # "UN" = "#ffc000", "WR" = "#ff2f92", "CR" = "#404A80"
- #### libraries ####
- library(tidyverse)
- library(patchwork)
- library(ggplot2)
- library(lmerTest)
- library(ggpubr)
- library(lme4)
- library(emmeans)
- library(survival)
- library(car)
- library(stats)
- library(lattice)
- library(dplyr)
- library(reshape2)
- library(ez)
- library(multcomp)
- library(lsmeans)
- library(tidyr)
- library(apaTables)
- library(RColorBrewer)
- library(afex)
- library(purrr)
- library(ggridges)
- library(MuMIn)
- library(devtools)
- library(Hmisc)
- library(corrplot)
- library(PerformanceAnalytics)
- library(vcd)
- library(psych)
- library(irr)
- library(datarium)
- library(tables)
- library(ggrepel)
- library(sjPlot)
- library(sjmisc)
- library(sjlabelled)
- library(ggprism)
- library(sjstats)
- #### data preparation ####
- # import data
- dir()
- setwd(dirname(rstudioapi::getSourceEditorContext()$path))
- dir()
- df <- read.csv(file = "MoBSeR_ERP_R1.csv", fileEncoding = "UTF-8-BOM", sep = ',')
- summary(df)
- # str(df)
- # View(df)
- # set factors
- df$mood <- as.factor(df$mood)
- df$language <- as.factor(df$language)
- df$type <- as.factor(df$type)
- df$type <- factor(df$type, levels=c("UN", "WR", "CR"))
- df$mood <- factor(df$mood, levels=c("positive", "negative"))
- df$language <- factor(df$language, levels=c("Polish", "English"))
- df$chan <- factor(df$chan, levels=c("F1", "Fz", "F2", "FC1", "FCz", "FC2", "C1", "Cz", "C2", "CP1", "CPz", "CP2", "P1", "Pz", "P2"))
- df$chan1 <- with(df, ifelse(chan %in% c("FC1", "FCz", "FC2"), "FC",ifelse(chan %in% c("C1", "Cz", "C2"), "C",ifelse(chan %in% c("CP1", "CPz", "CP2"), "CP",ifelse(chan %in% c("P1", "Pz", "P2"), "P",NA)))))
- df$chan1 <- factor(df$chan1, levels=c("FC", "C", "CP","P"))
- df$amp <- as.numeric(df$amp)
- names(df)[names(df) == "trgtrig"] <- "word"
- names(df)[names(df) == "cndtrig"] <- "cnd"
- df <- na.omit(df)
- FC_C_CP_3 <- c("FC1","FCz","FC2","C1","Cz","C2","CP1","CPz","CP2")
- FC_C_CP_P_3 <- c("FC1","FCz","FC2","C1","Cz","C2","CP1","CPz","CP2","P1","Pz","P2")
- FCs <- c("FC1","FCz","FC2")
- Cs <- c("C1","Cz","C2")
- CPs <- c("CP1","CPz","CP2")
- Ps <- c("P1", "Pz", "P2")
- #### _________________ N400 mood x type x mood induction progression (film1) _________________ ####
- #### LMMs: N400 Polish [L1] ####
- # df4 --- N400 Polish
- df4 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500 & language %in% "Polish") %>% droplevels() %>%
- dplyr::group_by(mood, type, ptp, word, chan, film1) %>%
- dplyr::summarise(mean_amp = mean(amp))
- # contrasts
- df4$mood <- factor(df4$mood, levels=c("positive", "negative"))
- df4$type <- factor(df4$type, levels=c("UN", "WR", "CR"))
- contrasts(df4$mood) <- contr.sum(levels(df4$mood))
- df4$type <- relevel(df4$type, ref = "UN")
- # lmer
- N4_L1_film_model0 <- lmer(mean_amp ~ mood*type*film1 + (1|ptp) + (1|word), data=df4)
- N4_L1_film_model1 <- lmer(mean_amp ~ mood*type*film1 + (1+type+mood|ptp) + (1+type+mood|word), data=df4)
- N4_L1_film_model2 <- lmer(mean_amp ~ mood*type*film1 + (1+type|ptp) + (1+type|word), data=df4)
- summary(N4_L1_film_model2)
- anova(N4_L1_film_model2)
- anova(m0, N4_L1_film_model2)
- ' Estimate Std. Error df t value Pr(>|t|)
- (Intercept) -1.509e+00 2.898e-01 4.327e+01 -5.207 5.04e-06 ***
- mood1 -2.505e-01 9.690e-02 5.910e+03 -2.585 0.009763 **
- typeWR 2.884e-01 1.814e-01 2.801e+02 1.590 0.113052
- typeCR 4.259e-01 2.266e-01 1.353e+02 1.879 0.062370 .
- mood1:typeWR 3.212e-01 1.368e-01 1.055e+04 2.348 0.018886 *
- mood1:typeCR 3.758e-01 1.297e-01 1.411e+04 2.898 0.003760 **
- mood1:typeWR:film1 -7.683e-02 2.734e-02 8.222e+03 -2.810 0.004970 **
- mood1:typeCR:film1 -8.381e-02 2.668e-02 1.170e+04 -3.141 0.001688 ** '
- summary(rePCA(N4_L1_film_model2)) # singular fit? ==> relative Principal Component Analysis
- relgrad <- with(N4_L1_film_model1@optinfo$derivs,solve(Hessian,gradient)) # convergence problem?
- max(abs(relgrad)) # <.001? ==> the model is close to convergence
- plot_model(N4_L1_chan1_model2) # plot the model
- plot(N4_L1_chan1_model2) # reasonably equal amount of spread?
- hist(residuals(N4_L1_chan1_model2)) # more or less normally distributed?
- qqnorm(residuals(N4_L1_chan1_model2)) # reasonably aligned? '/'
- #tab_model(N4_L1_chan1_model2,transform = NULL, show.est=TRUE, show.ci=TRUE, show.se=TRUE, show.df=TRUE, show.stat=TRUE, wrap.labels=2, df.method = "satterthwaite", title = "N400 Polish (L1)", file = "N400_L1_model_specs.html")
- # POST-HOCS
- # mood
- Polish_film_fixed_mood <- emmeans(N4_L1_film_model2, pairwise ~ mood,adjust = "bonferroni")
- print(Polish_film_fixed_mood)
- plot(Polish_film_fixed_mood)
- ' mood emmean SE df asymp.LCL asymp.UCL
- positive -1.05 0.27 Inf -1.58 -0.524
- negative -1.20 0.27 Inf -1.73 -0.675'
- ' contrast estimate SE df z.ratio p.value
- positive - negative 0.15 0.0407 Inf 3.693 0.0002'
- # type
- Polish_film_fixed_type <- emmeans(N4_L1_film_model2, pairwise ~ type,adjust = "bonferroni")
- print(Polish_film_fixed_type)
- plot(Polish_film_fixed_type)
- ' type emmean SE df asymp.LCL asymp.UCL
- UN -1.679 0.274 Inf -2.22 -1.143
- WR -1.235 0.282 Inf -1.79 -0.683
- CR -0.469 0.300 Inf -1.06 0.118'
- 'contrast estimate SE df z.ratio p.value
- UN - WR -0.444 0.128 Inf -3.459 0.0016
- UN - CR -1.210 0.189 Inf -6.412 <.0001
- WR - CR -0.766 0.173 Inf -4.420 <.0001'
- # mood x type
- Polish_film_int_mood_type1 <- emmeans(N4_L1_film_model2, pairwise ~ mood|type, adjust = "bonferroni")
- print(Polish_film_int_mood_type1)
- plot(Polish_film_int_mood_type1)
- 'type = UN:
- mood emmean SE df asymp.LCL asymp.UCL
- positive -1.595 0.276 Inf -2.136 -1.0541
- negative -1.764 0.276 Inf -2.305 -1.2226
- type = WR:
- mood emmean SE df asymp.LCL asymp.UCL
- positive -1.176 0.284 Inf -1.733 -0.6198
- negative -1.295 0.284 Inf -1.851 -0.7379
- type = CR:
- mood emmean SE df asymp.LCL asymp.UCL
- positive -0.387 0.302 Inf -0.979 0.2045
- negative -0.551 0.302 Inf -1.143 0.0404'
- 'type = UN:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.169 0.0704 Inf 2.395 0.0166
- type = WR:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.118 0.0701 Inf 1.686 0.0918
- type = CR:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.164 0.0711 Inf 2.313 0.0207'
- Polish_film_int_mood_type2 <- emmeans(N4_L1_film_model2, pairwise ~ type|mood, adjust = "bonferroni")
- print(Polish_film_int_mood_type2)
- plot(Polish_film_int_mood_type2)
- 'mood = positive:
- type emmean SE df asymp.LCL asymp.UCL
- UN -1.595 0.276 Inf -2.136 -1.0541
- WR -1.176 0.284 Inf -1.733 -0.6198
- CR -0.387 0.302 Inf -0.979 0.2045
- mood = negative:
- type emmean SE df asymp.LCL asymp.UCLx
- UN -1.764 0.276 Inf -2.305 -1.2226
- WR -1.295 0.284 Inf -1.851 -0.7379
- CR -0.551 0.302 Inf -1.143 0.0404'
- 'mood = positive:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.419 0.138 Inf -3.044 0.0070
- UN - CR -1.208 0.195 Inf -6.191 <.0001
- WR - CR -0.789 0.180 Inf -4.378 <.0001
- mood = negative:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.469 0.138 Inf -3.407 0.0020
- UN - CR -1.212 0.195 Inf -6.205 <.0001
- WR - CR -0.743 0.181 Inf -4.117 0.0001'
- # mood x type x film1
- emm_trends <- emtrends(N4_L1_film_model2,specs = ~ mood * type,var = "film1")
- summary(emm_trends)
- 'mood type film1.trend SE df asymp.LCL asymp.UCL
- positive UN 0.036478 0.0279 Inf -0.0182 0.0912
- negative UN -0.112016 0.0276 Inf -0.1661 -0.0579
- positive WR -0.005858 0.0281 Inf -0.0610 0.0492
- negative WR -0.000689 0.0263 Inf -0.0522 0.0508
- positive CR 0.126571 0.0265 Inf 0.0746 0.1785
- negative CR 0.145692 0.0270 Inf 0.0928 0.1986'
- contrast(emm_trends,method = "pairwise",adjust = "holm", by ="mood")
- 'mood = positive:
- contrast estimate SE df z.ratio p.value
- UN - WR 0.0423 0.0396 Inf 1.070 0.2847
- UN - CR -0.0901 0.0385 Inf -2.339 0.0387
- WR - CR -0.1324 0.0387 Inf -3.426 0.0018
- mood = negative:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.1113 0.0381 Inf -2.924 0.0035
- UN - CR -0.2577 0.0387 Inf -6.654 <.0001
- WR - CR -0.1464 0.0376 Inf -3.888 0.0002'
- contrast(emm_trends,method = "pairwise",adjust = "holm", by ="type")
- 'type = UN:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.14849 0.0382 Inf 3.884 0.0001
- type = WR:
- contrast estimate SE df z.ratio p.value
- positive - negative -0.00517 0.0393 Inf -0.132 0.8953
- type = CR:
- contrast estimate SE df z.ratio p.value
- positive - negative -0.01912 0.0371 Inf -0.516 0.6060'
- # observed power
- vc <- as.data.frame(VarCorr(N4_L1_film_model2))
- sigma_ptp <- vc$vcov[vc$grp == "ptp" & vc$var1 == "(Intercept)"][1] # Participant intercept variance (scalar)
- sigma_resid <- vc$vcov[vc$grp == "Residual"][1] # Residual variance (scalar)
- print(icc_ptp <- sigma_ptp / (sigma_ptp + sigma_resid))
- smpsize_lmm(
- eff.size = 0.25, # medium effect size
- df.n = 2, # (3-1)*(2-1) -- 3x2 design [for a two-way interaction]
- power = .96, # observed power for 40 items per condition
- sig.level = 0.05,
- k = 32, # participants
- n = 240, # trials per participant (40*6)
- icc = 0.05837853)
- #### Polish [L1] - PLOTS ####
- #### Polish -- N400: type x mood [GAV] ####
- plotstats2c <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= -200 & time <= 800 & language %in% "Polish") %>% droplevels() %>%
- dplyr::group_by(time, type, mood) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- plotstats2c <- plotstats2c %>% group_by(type, mood) %>% mutate(baseline = mean_amp[time == 0],mean_amp = mean_amp - baseline, CIlower = CIlower - baseline,CIupper = CIupper - baseline) %>% dplyr::select(-baseline)
- plotstats2c <- plotstats2c %>% arrange(time) %>% group_by(type, mood) %>% mutate(mean_amp = zoo::rollmean(mean_amp, k = 10, fill = NA, align = "center"), CIlower = zoo::rollmean(CIlower, k = 10, fill = NA, align = "center"), CIupper = zoo::rollmean(CIupper, k = 17, fill = NA, align = "center"))
- # by type
- ggplot(plotstats2c, aes(time, mean_amp, color = type, group = type)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = type),
- alpha = 0.2, linetype = 0) +
- facet_wrap(.~mood, ncol =2, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood"))) +
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c(1,0, -1, -2, -3), limits = c(1,-3), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_color_manual(name = "", values = c("#ffc000","#ff2f92","#404A80"), labels = c("Unrelated (UR) pairs", "Weakly related (WR) pairs", "Closely related (CR) pairs"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- ggsave(filename ="L1_mood_type_R1.png", plot = last_plot(), width = 30,height = 12, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- # by mood
- ggplot(plotstats2c, aes(time, mean_amp, color = mood, group = mood)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = mood),
- alpha = 0.2, linetype = 0) +
- facet_wrap(.~type, ncol =3, labeller = as_labeller(c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"))) +
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c(0, -1, -2, -3), limits = c(0.75,-2.75), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("red","blue")) +
- scale_color_manual(name = "", values = c("red","blue"), labels = c("Positive mood", "Negative mood"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- #### Polish -- N400: type x mood [distribution] ####
- plotstats2c <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <= 500 & language %in% "Polish") %>% droplevels() %>%
- dplyr::group_by(type, mood, word) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- ggplot(plotstats2c, aes(x = type, y = mean_amp, colour = type, fill = type)) +
- facet_wrap(.~mood, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood", "Polish" = "Polish (L1)", "English" = "English (L2)"))) +
- # ggdist::stat_halfeye(aes(colour = type), width = 0.8, .width = 0, alpha = 0.75, justification = -0.3, point_colour = NA) +
- geom_point(aes(colour = type), size = 1.0, alpha = 0.2, position = position_jitter(seed = 1, width = 0.1)) +
- geom_boxplot(aes(colour = type), width = .25, alpha = 0.25, outlier.shape = NA) +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(limits = c(3,-6), breaks = c(-6,-3, 0,3), guide = "prism_offset") +
- #coord_cartesian(ylim = c(-3, 0.5), clip = "off") +
- scale_x_discrete(labels = c("UN" = "Unrelated", "WR" = "Weakly related", "CR" = "Closely related"), guide = "prism_bracket") +
- labs(y = expression(paste("Amplitude (", mu, "V)")), x = "Word pair") +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_colour_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- theme_classic2() +
- theme(legend.position="none") +
- theme(panel.background = element_rect(fill = "white"),
- strip.background = element_rect(fill = "white",color="black",size=1),
- legend.key = element_rect(fill = "white"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.title = element_text(size = 15, color= "black"),
- strip.text = element_text(size = 15, color= "black"),
- legend.text = element_text(size = 15, color= "black"),
- legend.title = element_text(size = 15, color= "black"),
- strip.text.x.top = element_text(size = 15, color= "black"),
- axis.text = element_text(size = 15, color= "black"))
- ggsave(filename ="L1_distribution.png", plot = last_plot(), width = 25,height = 8, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### Polish -- N400: type x mood x mood induction progression [slopes] ####
- block_points1 <- quantile(df4$film1, probs = c(.05, .5, .95))
- emm_plot1 <- emmeans(N4_L1_film_model2,~ mood * type | film1,at = list(film1 = block_points1))
- plot_df1 <- as.data.frame(emm_plot1)
- plot_df1$type <- factor(plot_df1$type, levels=c("CR", "WR", "UN"))
- # by mood
- ggplot(plot_df1,aes(x = film1, y = emmean, color = type)) +
- geom_line(aes(group = type), linewidth = 1) +
- geom_point(size = 3) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(~ mood,ncol = 2,labeller = as_labeller(c("positive" = "Positive mood","negative" = "Negative mood"))) +
- scale_color_manual(name = "",values = c("#ffc000", "#ff2f92", "#404A80"),labels = c("Unrelated (UR) pairs","Weakly related (WR) pairs","Closely related (CR) pairs")) +
- scale_x_continuous(name = "Block progression",breaks = c(1,2,3,4,5,6,7, 8),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1,0, -1, -2, -3),limits = c(1, -3),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- # by type
- ggplot(plot_df1,aes(x = film1, y = emmean, color = mood)) +
- geom_line(aes(group = mood), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(.~type, ncol =3, labeller = as_labeller(c("UN" = "Unrelated \npairs", "WR" = "Weakly \nrelated pairs", "CR" = "Closely \nrelated pairs"))) +
- scale_color_manual(name = "",values = c("firebrick2","darkblue"),labels = c("Positive mood","Negative mood")) +
- scale_x_continuous(name = "Number of films watched",breaks = c(1,2,3,4,5,6,7, 8),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1,0, -1, -2, -3),limits = c(1, -3),guide = "prism_offset") +
- scale_shape_prism() +
- theme_classic2() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- ggsave(filename ="L1_predicted_films.png", plot = last_plot(), width = 15,height = 14, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### LMMs: N400 English [L2] ####
- # df5 --- N400 English
- df5 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500 & language %in% "English") %>% droplevels() %>%
- dplyr::group_by(mood, type, ptp, word, chan, film1) %>%
- dplyr::summarise(mean_amp = mean(amp))
- # contrasts
- df5$mood <- factor(df5$mood, levels=c("positive", "negative"))
- df5$type <- factor(df5$type, levels=c("UN", "WR", "CR"))
- contrasts(df5$mood) <- contr.sum(levels(df5$mood))
- df5$type <- relevel(df5$type, ref = "UN")
- # lmer
- N4_L2_film_model0 <- lmer(mean_amp ~ mood*type*film1 + (1|ptp) + (1|word), data=df5)
- N4_L2_film_model1 <- lmer(mean_amp ~ mood*type*film1 + (1+type+mood|ptp) + (1+type+mood|word), data=df5)
- N4_L2_film_model2 <- lmer(mean_amp ~ mood*type*film1 + (1+mood|ptp) + (1|word), data=df5)
- summary(N4_L2_film_model2)
- anova(N4_L2_film_model2)
- anova(m0, N4_L2_film_model2)
- ' Estimate Std. Error df t value Pr(>|t|)
- (Intercept) -1.372e+00 2.717e-01 4.011e+01 -5.050 1.00e-05 ***
- mood1 9.008e-02 9.191e-02 5.040e+02 0.980 0.327
- typeWR -5.580e-03 1.140e-01 6.683e+04 -0.049 0.961
- typeCR 7.777e-01 1.164e-01 6.483e+04 6.679 2.42e-11 ***
- mood1:typeWR -4.807e-02 1.135e-01 6.941e+04 -0.424 0.672
- mood1:typeCR 1.852e-01 1.150e-01 7.218e+04 1.611 0.107
- mood1:typeWR:film1 -4.171e-03 2.298e-02 6.224e+04 -0.181 0.856
- mood1:typeCR:film1 -1.565e-02 2.278e-02 6.709e+04 -0.687 0.492 '
- summary(rePCA(N4_L2_film_model2)) # singular fit? ==> relative Principal Component Analysis
- relgrad <- with(N4_L2_film_model2@optinfo$derivs,solve(Hessian,gradient)) # convergence problem?
- max(abs(relgrad)) # <.001? ==> the model is close to convergence
- plot_model(N4_L2_film_model2) # plot the model
- plot(N4_L2_film_model2) # reasonably equal amount of spread?
- hist(residuals(N4_L2_film_model2)) # more or less normally distributed?
- qqnorm(residuals(N4_L2_film_model2)) # reasonably aligned? '/'
- #tab_model(N4_L2_film_model2,transform = NULL, show.est=TRUE, show.ci=TRUE, show.se=TRUE, show.df=TRUE, show.stat=TRUE, wrap.labels=2, df.method = "satterthwaite", title = "N400 Polish (L1)", file = "N400_L1_model_specs.html")
- # POST-HOCS
- # type
- English_film_fixed_type <- emmeans(N4_L2_film_model2, pairwise ~ type,adjust = "bonferroni")
- print(English_film_fixed_type)
- plot(English_film_fixed_type)
- ' type emmean SE df asymp.LCL asymp.UCL
- UN -1.72 0.261 Inf -2.234 -1.211
- WR -1.13 0.261 Inf -1.639 -0.616
- CR -0.43 0.261 Inf -0.941 0.082'
- ' contrast estimate SE df z.ratio p.value
- UN - WR -0.595 0.0494 Inf -12.038 <.0001
- UN - CR -1.293 0.0493 Inf -26.222 <.0001
- WR - CR -0.698 0.0493 Inf -14.158 <.0001'
- # observed power
- vc <- as.data.frame(VarCorr(N4_L2_film_model2))
- sigma_ptp <- vc$vcov[vc$grp == "ptp" & vc$var1 == "(Intercept)"][1] # Participant intercept variance (scalar)
- sigma_resid <- vc$vcov[vc$grp == "Residual"][1] # Residual variance (scalar)
- print(icc_ptp <- sigma_ptp / (sigma_ptp + sigma_resid))
- smpsize_lmm(
- eff.size = 0.25, # medium effect size
- df.n = 2, # (3-1)*(2-1) -- 3x2 design [for a two-way interaction]
- power = .97, # observed power for 40 items per condition
- sig.level = 0.05,
- k = 32, # participants
- n = 240, # trials per participant (40*6)
- icc = 0.05552603)
- #### English [L2] - PLOTS ####
- #### English -- N400: type x mood [GAV] ####
- plotstats2f <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= -200 & time <= 800 & language %in% "English") %>% droplevels() %>%
- dplyr::group_by(time, type, mood) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- plotstats2f <- plotstats2f %>% group_by(type, mood) %>% mutate(baseline = mean_amp[time == 0],mean_amp = mean_amp - baseline, CIlower = CIlower - baseline,CIupper = CIupper - baseline) %>% dplyr::select(-baseline)
- plotstats2f <- plotstats2f %>% arrange(time) %>% group_by(type, mood) %>% mutate(mean_amp = zoo::rollmean(mean_amp, k = 10, fill = NA, align = "center"), CIlower = zoo::rollmean(CIlower, k = 10, fill = NA, align = "center"), CIupper = zoo::rollmean(CIupper, k = 17, fill = NA, align = "center"))
- # by type
- ggplot(plotstats2f, aes(time, mean_amp, color = type, group = type)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = type),
- alpha = 0.2, linetype = 0) +
- facet_wrap(.~mood, ncol =2, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood"))) +
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c(1,0, -1, -2, -3), limits = c(1,-3), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_color_manual(name = "", values = c("#ffc000","#ff2f92","#404A80"), labels = c("Unrelated (UR) pairs", "Weakly related (WR) pairs", "Closely related (CR) pairs"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- ggsave(filename ="L2_mood_type_R1.png", plot = last_plot(), width = 30,height = 12, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- # by mood
- ggplot(plotstats2f, aes(time, mean_amp, color = mood, group = mood)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = mood),
- alpha = 0.2, linetype = 0) +
- facet_wrap(.~type, ncol =3, labeller = as_labeller(c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"))) +
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c(0, -1, -2, -3), limits = c(0.75,-2.75), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("red","blue")) +
- scale_color_manual(name = "", values = c("red","blue"), labels = c("Positive mood", "Negative mood"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- #### English -- N400: type x mood [distribution] ####
- plotstats2f <- df %>% subset(chan %in% FC_C_CP_3 & time >= 300 & time <= 500 & language %in% "English") %>% droplevels() %>%
- dplyr::group_by(type, mood, word) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- ggplot(plotstats2f, aes(x = type, y = mean_amp, colour = type, fill = type)) +
- facet_wrap(.~mood, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood", "Polish" = "Polish (L1)", "English" = "English (L2)"))) +
- # ggdist::stat_halfeye(aes(colour = type), width = 0.8, .width = 0, alpha = 0.75, justification = -0.3, point_colour = NA) +
- geom_point(aes(colour = type), size = 1.0, alpha = 0.2, position = position_jitter(seed = 1, width = 0.1)) +
- geom_boxplot(aes(colour = type), width = .25, alpha = 0.25, outlier.shape = NA) +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(limits = c(3,-6), breaks = c(-6,-3, 0,3), guide = "prism_offset") +
- #coord_cartesian(ylim = c(-3, 0.5), clip = "off") +
- scale_x_discrete(labels = c("UN" = "Unrelated", "WR" = "Weakly related", "CR" = "Closely related"), guide = "prism_bracket") +
- labs(y = expression(paste("Amplitude (", mu, "V)")), x = "Word pair") +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_colour_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- theme_classic2() +
- theme(legend.position="none") +
- theme(panel.background = element_rect(fill = "white"),
- strip.background = element_rect(fill = "white",color="black",size=1),
- legend.key = element_rect(fill = "white"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.title = element_text(size = 15, color= "black"),
- strip.text = element_text(size = 15, color= "black"),
- legend.text = element_text(size = 15, color= "black"),
- legend.title = element_text(size = 15, color= "black"),
- strip.text.x.top = element_text(size = 15, color= "black"),
- axis.text = element_text(size = 15, color= "black"))
- ggsave(filename ="L2_distribution.png", plot = last_plot(), width = 25,height = 8, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### English -- N400: type x mood x mood induction progression [slopes] ####
- block_points2 <- quantile(df4$film1, probs = c(.05, .5, .95))
- emm_plot2 <- emmeans(N4_L2_film_model2,~ mood * type | film1,at = list(film1 = block_points2))
- emm_plot2 <- as.data.frame(emm_plot2)
- emm_plot2$type <- factor(emm_plot2$type, levels=c("CR", "WR", "UN"))
- ggplot(emm_plot2,aes(x = film1, y = emmean, color = type)) +
- geom_line(aes(group = type), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(~ mood,ncol = 2,labeller = as_labeller(c("positive" = "Positive mood","negative" = "Negative mood"))) +
- scale_color_manual(name = "",values = c("#ffc000", "#ff2f92", "#404A80"),labels = c("Unrelated (UR) pairs","Weakly related (WR) pairs","Closely related (CR) pairs")) +
- scale_x_continuous(name = "Block progression",breaks = c(1,2,3,4,5,6,7,8),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1,0, -1, -2, -3),limits = c(1, -3),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- # by type
- ggplot(emm_plot2,aes(x = film1, y = emmean, color = mood)) +
- geom_line(aes(group = mood), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(.~type, ncol =3, labeller = as_labeller(c("UN" = "Unrelated \npairs", "WR" = "Weakly \nrelated pairs", "CR" = "Closely \nrelated pairs"))) +
- scale_color_manual(name = "",values = c("firebrick2","darkblue"),labels = c("Positive mood","Negative mood")) +
- scale_x_continuous(name = "Number of films watched",breaks = c(1,2,3,4,5,6,7, 8),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1,0, -1, -2, -3),limits = c(1, -3),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- ggsave(filename ="L2_predicted_films.png", plot = last_plot(), width = 15,height = 14, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### _________________ FCs+Cs+CPs+Ps _________________ ####
- #### LMMs: N400 Polish [L1] ####
- # df2 --- N400 Polish
- df2 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500 & language %in% "Polish") %>% droplevels() %>%
- dplyr::group_by(mood, type, ptp, word,chan1) %>%
- dplyr::summarise(mean_amp = mean(amp))
- # contrasts
- df2$mood <- factor(df2$mood, levels=c("positive", "negative"))
- df2$type <- factor(df2$type, levels=c("UN", "WR", "CR"))
- contrasts(df2$mood) <- contr.sum(levels(df2$mood))
- df2$type <- relevel(df2$type, ref = "UN")
- contrasts(df2$chan1) <- contr.sum(levels(df2$chan1))
- df2$chan1 <- relevel(df2$chan1, ref = "FC")
- summary(df2)
- # lmer
- N4_L1_chan1_model0 <- lmer(mean_amp ~ mood*type*chan1 + (1|ptp) + (1|word), data=df2)
- N4_L1_chan1_model1 <- lmer(mean_amp ~ mood*type*chan1 + (1+type+mood|ptp) + (1+type+mood|word), data=df2)
- N4_L1_chan1_model2 <- lmer(mean_amp ~ mood*type*chan1 + (1+type|ptp) + (1|word), data=df2)
- summary(N4_L1_chan1_model2)
- anova(N4_L1_chan1_model2)
- anova(N4_L1_chan1_model0, N4_L1_chan1_model2)
- ' Estimate Std. Error df t value Pr(>|t|)
- (Intercept) -2.496e+00 3.490e-01 7.934e+01 -7.151 3.77e-10 ***
- mood1 2.019e-01 9.365e-02 2.932e+04 2.156 0.03107 *
- typeWR 4.015e-01 1.490e-01 1.834e+02 2.695 0.00769 **
- typeCR 1.118e+00 1.888e-01 7.819e+01 5.920 8.12e-08 ***
- chan1C -2.048e-01 3.587e-01 1.126e+02 -0.571 0.56916
- chan1CP 8.099e-01 3.587e-01 1.126e+02 2.258 0.02587 *
- chan1P 2.582e+00 3.587e-01 1.126e+02 7.200 7.22e-11 ***
- mood1:typeWR -2.484e-01 1.322e-01 2.932e+04 -1.879 0.06027 .
- mood1:typeCR -1.087e-01 1.326e-01 2.933e+04 -0.819 0.41267
- mood1:chan1C -6.886e-02 1.324e-01 2.930e+04 -0.520 0.60303
- mood1:chan1CP -1.492e-01 1.324e-01 2.930e+04 -1.127 0.25968
- mood1:chan1P -1.581e-01 1.324e-01 2.930e+04 -1.194 0.23236
- typeWR:chan1C 8.896e-02 1.869e-01 2.930e+04 0.476 0.63414
- typeCR:chan1C 4.866e-02 1.875e-01 2.930e+04 0.259 0.79527
- typeWR:chan1CP -7.093e-02 1.869e-01 2.930e+04 -0.379 0.70436
- typeCR:chan1CP 1.340e-01 1.875e-01 2.930e+04 0.715 0.47486
- typeWR:chan1P 1.534e-01 1.869e-01 2.930e+04 0.821 0.41176
- typeCR:chan1P 9.579e-02 1.875e-01 2.930e+04 0.511 0.60950
- mood1:typeWR:chan1C 1.309e-01 1.869e-01 2.930e+04 0.700 0.48377
- mood1:typeCR:chan1C 1.319e-01 1.875e-01 2.930e+04 0.703 0.48180
- mood1:typeWR:chan1CP 3.135e-01 1.869e-01 2.930e+04 1.677 0.09351 .
- mood1:typeCR:chan1CP 1.788e-01 1.875e-01 2.930e+04 0.953 0.34045
- mood1:typeWR:chan1P 3.742e-01 1.869e-01 2.930e+04 2.002 0.04529 *
- mood1:typeCR:chan1P 1.226e-01 1.875e-01 2.930e+04 0.654 0.51322 '
- summary(rePCA(N4_L1_chan1_model2)) # singular fit? ==> relative Principal Component Analysis
- relgrad <- with(N4_L1_chan1_model2@optinfo$derivs,solve(Hessian,gradient)) # convergence problem?
- max(abs(relgrad)) # <.001? ==> the model is close to convergence
- plot_model(N4_L1_chan1_model2) # plot the model
- plot(N4_L1_chan1_model2) # reasonably equal amount of spread?
- hist(residuals(N4_L1_chan1_model2)) # more or less normally distributed?
- qqnorm(residuals(N4_L1_chan1_model2)) # reasonably aligned? '/'
- #tab_model(N4_L1_chan1_model2,transform = NULL, show.est=TRUE, show.ci=TRUE, show.se=TRUE, show.df=TRUE, show.stat=TRUE, wrap.labels=2, df.method = "satterthwaite", title = "N400 Polish (L1)", file = "N400_L1_model_specs.html")
- # POST-HOCS
- # mood
- Polish_chan1_fixed_mood <- emmeans(N4_L1_chan1_model2, pairwise ~ mood,adjust = "bonferroni")
- print(Polish_chan1_fixed_mood)
- plot(Polish_chan1_fixed_mood)
- ' mood emmean SE df asymp.LCL asymp.UCL
- positive -1.06 0.271 Inf -1.59 -0.531
- negative -1.25 0.271 Inf -1.78 -0.717'
- ' contrast estimate SE df z.ratio p.value
- positive - negative 0.186 0.0541 Inf 3.446 0.0006'
- # type
- Polish_chan1_fixed_type <- emmeans(N4_L1_chan1_model2, pairwise ~ type,adjust = "bonferroni")
- print(Polish_chan1_fixed_type)
- plot(Polish_chan1_fixed_type)
- ' type emmean SE df asymp.LCL asymp.UCL
- UN -1.699 0.271 Inf -2.23 -1.1671
- WR -1.254 0.276 Inf -1.79 -0.7142
- CR -0.511 0.291 Inf -1.08 0.0586'
- ' contrast estimate SE df z.ratio p.value
- UN - WR -0.444 0.0953 Inf -4.662 <.0001
- UN - CR -1.187 0.1500 Inf -7.923 <.0001
- WR - CR -0.743 0.1290 Inf -5.747 <.0001'
- # mood x type x chan1 [1]
- Polish_int_mood_chan1_type1 <- emmeans(N4_L1_chan1_model2, pairwise ~ mood|type,by="chan1",adjust = "bonferroni")
- print(Polish_int_mood_chan1_type1)
- plot(Polish_int_mood_chan1_type1)
- '
- # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FC
- type = UN, chan1 = FC:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.4039 0.187 Inf 2.156 0.0311
- type = WR, chan1 = FC:
- contrast estimate SE df z.ratio p.value
- positive - negative -0.0930 0.187 Inf -0.498 0.6184
- type = CR, chan1 = FC:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.1865 0.188 Inf 0.993 0.3208
- # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> C
- type = UN, chan1 = C:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.2662 0.187 Inf 1.421 0.1553
- type = WR, chan1 = C:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.0311 0.187 Inf 0.167 0.8677
- type = CR, chan1 = C:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.3126 0.188 Inf 1.664 0.0961
- # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CP
- type = UN, chan1 = CP:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.1054 0.187 Inf 0.563 0.5737
- type = WR, chan1 = CP:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.2356 0.187 Inf 1.262 0.2069
- type = CR, chan1 = CP:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.2456 0.188 Inf 1.307 0.1912
- # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> P
- type = UN, chan1 = P:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.0876 0.187 Inf 0.468 0.6400
- type = WR, chan1 = P:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.3392 0.187 Inf 1.817 0.0692
- type = CR, chan1 = P:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.1155 0.188 Inf 0.615 0.5388'
- # mood x type x chan1 [2]
- Polish_int_mood_chan1_type2 <- emmeans(N4_L1_chan1_model2, pairwise ~ type|mood,by="chan1",adjust = "bonferroni")
- print(Polish_int_mood_chan1_type2)
- plot(Polish_int_mood_chan1_type2)
- '# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FC
- mood = positive, chan1 = FC:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.153 0.199 Inf -0.770 1.0000
- UN - CR -1.009 0.231 Inf -4.373 <.0001
- WR - CR -0.856 0.218 Inf -3.930 0.0003
- mood = negative, chan1 = FC:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.650 0.200 Inf -3.256 0.0034
- UN - CR -1.226 0.231 Inf -5.315 <.0001
- WR - CR -0.577 0.218 Inf -2.650 0.0241'
- '# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> C
- mood = positive, chan1 = C:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.373 0.199 Inf -1.876 0.1819
- UN - CR -1.190 0.231 Inf -5.155 <.0001
- WR - CR -0.817 0.218 Inf -3.750 0.0005
- mood = negative, chan1 = C:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.608 0.200 Inf -3.046 0.0070
- UN - CR -1.143 0.231 Inf -4.955 <.0001
- WR - CR -0.535 0.218 Inf -2.460 0.0417'
- '# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CP
- mood = positive, chan1 = CP:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.396 0.199 Inf -1.991 0.1396
- UN - CR -1.322 0.231 Inf -5.728 <.0001
- WR - CR -0.926 0.218 Inf -4.252 0.0001
- mood = negative, chan1 = CP:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.265 0.200 Inf -1.330 0.5507
- UN - CR -1.182 0.231 Inf -5.121 <.0001
- WR - CR -0.916 0.218 Inf -4.211 0.0001'
- '# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> P
- mood = positive, chan1 = P:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.681 0.199 Inf -3.425 0.0018
- UN - CR -1.228 0.231 Inf -5.319 <.0001
- WR - CR -0.547 0.218 Inf -2.510 0.0362
- mood = negative, chan1 = P:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.429 0.200 Inf -2.150 0.0947
- UN - CR -1.200 0.231 Inf -5.199 <.0001
- WR - CR -0.771 0.218 Inf -3.542 0.0012'
- # observed power
- vc <- as.data.frame(VarCorr(N4_L1_chan1_model2))
- sigma_ptp <- vc$vcov[vc$grp == "ptp" & vc$var1 == "(Intercept)"][1] # Participant intercept variance (scalar)
- sigma_resid <- vc$vcov[vc$grp == "Residual"][1] # Residual variance (scalar)
- print(icc_ptp <- sigma_ptp / (sigma_ptp + sigma_resid))
- smpsize_lmm(
- eff.size = 0.25, # medium effect size
- df.n = 6, # (3-1)*(2-1)*(4-1) -- 3x2x4 design
- power = .19, # observed power for 40 items per condition
- sig.level = 0.05,
- k = 32, # participants
- n = 960, # trials per participant (40*6*4)
- icc = 0.05919195)
- #### LMMs: N400 English [L2] ####
- # df3 --- N400 English
- df3 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500 & language %in% "English") %>% droplevels() %>%
- dplyr::group_by(mood, type, ptp, word,chan1) %>%
- dplyr::summarise(mean_amp = mean(amp))
- # contrasts
- df3$mood <- factor(df3$mood, levels=c("positive", "negative"))
- df3$type <- factor(df3$type, levels=c("UN", "WR", "CR"))
- contrasts(df3$mood) <- contr.sum(levels(df3$mood))
- df3$type <- relevel(df3$type, ref = "UN")
- contrasts(df3$chan1) <- contr.sum(levels(df3$chan1))
- df3$chan1 <- relevel(df3$chan1, ref = "FC")
- # lmer
- N4_L2_chan1_model0 <- lmer(mean_amp ~ mood*type*chan1 + (1|ptp) + (1|word) + (1|ptp:chan1), data=df3)
- N4_L2_chan1_model1 <- lmer(mean_amp ~ mood*type*chan1 + (1+type+mood|ptp) + (1+type+mood|word) + (1|ptp:chan1), data=df3)
- N4_L2_chan1_model2 <- lmer(mean_amp ~ mood*type*chan1 + (1+mood|ptp) + (1|word) + (1|ptp:chan1), data=df3)
- summary(N4_L2_chan1_model2)
- anova(N4_L1_chan1_model2)
- anova(N4_L1_chan1_model0, N4_L1_chan1_model2)
- ' Estimate Std. Error df t value Pr(>|t|)
- (Intercept) -2.281e+00 3.554e-01 9.589e+01 -6.418 5.25e-09 ***
- mood1 9.539e-02 9.961e-02 7.059e+02 0.958 0.338613
- typeWR 4.646e-01 1.308e-01 2.900e+04 3.552 0.000383 ***
- typeCR 1.250e+00 1.309e-01 2.900e+04 9.549 < 2e-16 ***
- chan1C -4.528e-01 3.932e-01 1.084e+02 -1.152 0.252023
- chan1CP 3.809e-01 3.932e-01 1.084e+02 0.969 0.334859
- chan1P 2.264e+00 3.932e-01 1.084e+02 5.757 8.08e-08 ***
- mood1:typeWR -1.318e-01 1.308e-01 2.899e+04 -1.008 0.313399
- mood1:typeCR 6.028e-02 1.309e-01 2.900e+04 0.461 0.645063
- mood1:chan1C -2.149e-02 1.309e-01 2.898e+04 -0.164 0.869553
- mood1:chan1CP 4.181e-02 1.309e-01 2.898e+04 0.319 0.749373
- mood1:chan1P 1.071e-01 1.309e-01 2.898e+04 0.818 0.413154
- typeWR:chan1C 1.100e-01 1.849e-01 2.898e+04 0.595 0.551902
- typeCR:chan1C 1.751e-01 1.850e-01 2.898e+04 0.946 0.344058
- typeWR:chan1CP 2.923e-01 1.849e-01 2.898e+04 1.581 0.113952
- typeCR:chan1CP 2.085e-01 1.850e-01 2.898e+04 1.127 0.259682
- typeWR:chan1P 1.327e-01 1.849e-01 2.898e+04 0.718 0.473061
- typeCR:chan1P -1.564e-01 1.850e-01 2.898e+04 -0.845 0.397996
- mood1:typeWR:chan1C 1.162e-01 1.849e-01 2.898e+04 0.629 0.529545
- mood1:typeCR:chan1C 8.101e-02 1.850e-01 2.898e+04 0.438 0.661499
- mood1:typeWR:chan1CP 1.231e-01 1.849e-01 2.898e+04 0.666 0.505468
- mood1:typeCR:chan1CP 7.412e-02 1.850e-01 2.898e+04 0.401 0.688675
- mood1:typeWR:chan1P 1.108e-03 1.849e-01 2.898e+04 0.006 0.995220
- mood1:typeCR:chan1P -2.562e-02 1.850e-01 2.898e+04 -0.138 0.889862 '
- #POST-HOCS
- # mood
- English_chan1_fixed_mood <- emmeans(N4_L2_chan1_model2, pairwise ~ mood,adjust = "bonferroni")
- print(English_chan1_fixed_mood)
- plot(English_chan1_fixed_mood)
- ' mood emmean SE df asymp.LCL asymp.UCL
- positive -0.964 0.250 Inf -1.45 -0.473
- negative -1.232 0.274 Inf -1.77 -0.694'
- ' contrast estimate SE df z.ratio p.value
- positive - negative 0.268 0.0909 Inf 2.952 0.0032'
- # type
- Polish_chan1_fixed_type <- emmeans(N4_L2_chan1_model2, pairwise ~ type,adjust = "bonferroni")
- print(Polish_chan1_fixed_type)
- plot(Polish_chan1_fixed_type)
- ' type emmean SE df asymp.LCL asymp.UCL
- UN -1.733 0.261 Inf -2.245 -1.221
- WR -1.135 0.261 Inf -1.647 -0.622
- CR -0.426 0.261 Inf -0.939 0.086'
- ' contrast estimate SE df z.ratio p.value
- UN - WR -0.598 0.0655 Inf -9.135 <.0001
- UN - CR -1.307 0.0655 Inf -19.937 <.0001
- WR - CR -0.708 0.0655 Inf -10.817 <.0001'
- #### PLOTS: N400 ####
- #### Polish -- N400: type x mood by chan1 [POSITIVE MOOD] ####
- plotstats2a <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= -200 & time <= 800 & language %in% "Polish" & mood %in% "positive") %>% droplevels() %>%
- dplyr::group_by(time, type, chan1) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- plotstats2a <- plotstats2a %>% group_by(type, chan1) %>% mutate(baseline = mean_amp[time == 0],mean_amp = mean_amp - baseline, CIlower = CIlower - baseline,CIupper = CIupper - baseline) %>% dplyr::select(-baseline)
- plotstats2a <- plotstats2a %>% arrange(time) %>% group_by(type, chan1) %>% mutate(mean_amp = zoo::rollmean(mean_amp, k = 10, fill = NA, align = "center"), CIlower = zoo::rollmean(CIlower, k = 10, fill = NA, align = "center"), CIupper = zoo::rollmean(CIupper, k = 17, fill = NA, align = "center"))
- ggplot(plotstats2a, aes(time, mean_amp, color = type, group = type)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = type),
- alpha = 0.2, linetype = 0) +
- #facet_wrap(.~mood, ncol =2, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood"))) +
- facet_wrap(.~chan1, ncol=4)+
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c( 3,2,1,0, -1, -2, -3), limits = c(3,-3.7), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_color_manual(name = "", values = c("#ffc000","#ff2f92","#404A80"), labels = c("Unrelated (UR) pairs", "Weakly related (WR) pairs", "Closely related (CR) pairs"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- ggsave(filename ="L1_negative_chan1.png", plot = last_plot(), width = 30,height = 12, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### Polish -- N400: type x mood by chan1 [NEGATIVE MOOD] ####
- plotstats2b <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= -200 & time <= 800 & language %in% "Polish" & mood %in% "negative") %>% droplevels() %>%
- dplyr::group_by(time, type, chan1) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- plotstats2b <- plotstats2b %>% group_by(type, chan1) %>% mutate(baseline = mean_amp[time == 0],mean_amp = mean_amp - baseline, CIlower = CIlower - baseline,CIupper = CIupper - baseline) %>% dplyr::select(-baseline)
- plotstats2b <- plotstats2b %>% arrange(time) %>% group_by(type, chan1) %>% mutate(mean_amp = zoo::rollmean(mean_amp, k = 10, fill = NA, align = "center"), CIlower = zoo::rollmean(CIlower, k = 10, fill = NA, align = "center"), CIupper = zoo::rollmean(CIupper, k = 17, fill = NA, align = "center"))
- ggplot(plotstats2b, aes(time, mean_amp, color = type, group = type)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = type),
- alpha = 0.2, linetype = 0) +
- #facet_wrap(.~mood, ncol =2, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood"))) +
- facet_wrap(.~chan1, ncol=4)+
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c( 3,2,1,0, -1, -2, -3), limits = c(3,-3.7), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_color_manual(name = "", values = c("#ffc000","#ff2f92","#404A80"), labels = c("Unrelated (UR) pairs", "Weakly related (WR) pairs", "Closely related (CR) pairs"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- ggsave(filename ="L1_negative_chan1.png", plot = last_plot(), width = 30,height = 12, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### English -- N400: type x mood by chan1 [POSITIVE MOOD] ####
- plotstats2d <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= -200 & time <= 800 & language %in% "English" & mood %in% "positive") %>% droplevels() %>%
- dplyr::group_by(time, type, chan1) %>%
- dplyr::summarise(mean_amp = mean(amp),CIlower = Rmisc::CI(amp, ci = 0.95)["lower"],CIupper = Rmisc::CI(amp, ci = 0.95)["upper"])
- plotstats2d <- plotstats2d %>% group_by(type, chan1) %>% mutate(baseline = mean_amp[time == 0],mean_amp = mean_amp - baseline, CIlower = CIlower - baseline,CIupper = CIupper - baseline) %>% dplyr::select(-baseline)
- plotstats2d <- plotstats2d %>% arrange(time) %>% group_by(type, chan1) %>% mutate(mean_amp = zoo::rollmean(mean_amp, k = 10, fill = NA, align = "center"), CIlower = zoo::rollmean(CIlower, k = 10, fill = NA, align = "center"), CIupper = zoo::rollmean(CIupper, k = 17, fill = NA, align = "center"))
- ggplot(plotstats2d, aes(time, mean_amp, color = type, group = type)) +
- geom_ribbon(aes(ymin = CIlower, ymax = CIupper, fill = type),
- alpha = 0.2, linetype = 0) +
- #facet_wrap(.~mood, ncol =2, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood"))) +
- facet_wrap(.~chan1, ncol=4)+
- geom_line(size = 0.75) +
- guides(fill = "none") +
- labs(x = "Time (ms)", y = expression(paste("Amplitude (", mu, "V)")), colour = "") +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_reverse(breaks = c( 3,2,1,0, -1, -2, -3), limits = c(3,-3.7), guide = "prism_offset") +
- scale_x_continuous(breaks = c(-100, 0, 100, 300, 500, 700), guide = "prism_offset") +
- theme_classic2()+
- geom_vline(xintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_hline(yintercept = 0, linetype = "dotted", alpha = 0.5) +
- geom_vline(xintercept = 300, linetype = "solid", alpha = 1, color = "black") +
- geom_vline(xintercept = 500, linetype = "solid", alpha = 1, color = "black") +
- theme(text = element_text(size = 20, color = "black", family = "Helvetica"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.text = element_text(size = 18, color = "black", family = "Helvetica"),
- strip.text.x.top = element_text(size = 20, color = "black", family = "Helvetica"),
- plot.title = element_text(hjust = 0, family = "Helvetica"),
- legend.position = "bottom",
- legend.title = element_text(size = 20),
- legend.text = element_text(size = 20)) +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_color_manual(name = "", values = c("#ffc000","#ff2f92","#404A80"), labels = c("Unrelated (UR) pairs", "Weakly related (WR) pairs", "Closely related (CR) pairs"))+
- guides(colour = guide_legend(override.aes = list(linetype = 1, shape = 16, size = 5)))
- ggsave(filename ="L2_positive_chan1.png", plot = last_plot(), width = 30,height = 12, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### _________________ semantic vectors x language _________________ ####
- df8 <- df %>%
- dplyr::group_by(language, type, word) %>%
- dplyr::summarise(vector = mean(vector))
- # contrasts
- df8$type <- factor(df8$type, levels=c("UN", "WR", "CR"))
- df8$type <- relevel(df8$type, ref = "UN")
- # lmer
- vct_model0 <- lmer(vector ~ language*type + (1|word), data=df8)
- vct_model1 <- lmer(vector ~ language*type + (1|word), data=df8)
- ' Estimate Std. Error df t value Pr(>|t|)
- (Intercept) 0.143665 0.009863 702.880235 14.566 < 2e-16 ***
- languageEnglish -0.047342 0.013948 702.880235 -3.394 0.000727 ***
- typeCR 0.331080 0.013520 471.999996 24.487 < 2e-16 ***
- typeWR 0.215297 0.013520 471.999995 15.924 < 2e-16 ***
- languageEnglish:typeCR 0.086150 0.019121 471.999995 4.506 8.36e-06 ***
- languageEnglish:typeWR 0.019210 0.019121 471.999995 1.005 0.315573 '
- summary(vct_model1)
- anova(vct_model1)
- anova(vct_model0, vct_model1)
- summary(rePCA(vct_model1)) # singular fit? ==> relative Principal Component Analysis
- relgrad <- with(vct_model1@optinfo$derivs,solve(Hessian,gradient)) # convergence problem?
- max(abs(relgrad)) # <.001? ==> the model is close to convergence
- plot_model(vct_model1) # plot the model
- plot(vct_model1) # reasonably equal amount of spread?
- hist(residuals(vct_model1)) # more or less normally distributed?
- qqnorm(residuals(vct_model1)) # reasonably aligned? '/'
- #POST-HOCS
- # means
- summary_table <- df8 %>%
- dplyr::group_by(language, type) %>%
- dplyr::summarize(
- mean_vector = mean(vector, na.rm = TRUE),
- n = sum(!is.na(vector)),
- sd_vector = sd(vector, na.rm = TRUE),
- se_vector = sd_vector / sqrt(n),
- ci_lower = mean_vector - qt(0.975, df = n - 1) * se_vector,
- ci_upper = mean_vector + qt(0.975, df = n - 1) * se_vector,
- .groups = "drop"
- )
- print(summary_table)
- ' language type mean_vector n sd_vector se_vector ci_lower ci_upper
- <fct> <fct> <dbl> <int> <dbl> <dbl> <dbl> <dbl>
- 1 Polish UN 0.144 119 0.0832 0.00762 0.129 0.159
- 2 Polish WR 0.359 119 0.114 0.0104 0.338 0.380
- 3 Polish CR 0.475 119 0.115 0.0106 0.454 0.496
- 4 English UN 0.0963 119 0.0713 0.00654 0.0834 0.109
- 5 English WR 0.331 119 0.107 0.00980 0.311 0.350
- 6 English CR 0.514 119 0.141 0.0129 0.488 0.539'
- # language
- fixed_lng <- emmeans(vct_model1, pairwise ~ language, adjust = "bonferroni")
- print(fixed_lng)
- plot(fixed_lng)
- ' language emmean SE df lower.CL upper.CL
- Polish 0.326 0.00603 236 0.314 0.338
- English 0.314 0.00603 236 0.302 0.325'
- ' contrast estimate SE df t.ratio p.value
- Polish - English 0.0122 0.00852 236 1.434 0.1530'
- # type
- fixed_type <- emmeans(vct_model1, pairwise ~ type, adjust = "bonferroni")
- print(fixed_type)
- plot(fixed_type)
- ' contrast estimate SE df t.ratio p.value
- UN - WR -0.225 0.00956 472 -23.524 <.0001
- UN - CR -0.374 0.00956 472 -39.136 <.0001
- WR - CR -0.149 0.00956 472 -15.611 <.0001'
- ' type emmean SE df lower.CL upper.CL
- UN 0.120 0.00697 703 0.106 0.134
- WR 0.345 0.00697 703 0.331 0.359
- CR 0.494 0.00697 703 0.480 0.508'
- # # language x type
- # vct_lng_type1 <- emmeans(vct_model1, pairwise ~ language|type, adjust = "bonferroni")
- # print(vct_lng_type1)
- # plot(vct_lng_type1)
- #
- # 'type = UN:
- # contrast estimate SE df t.ratio p.value
- # Polish - English 0.0473 0.0139 703 3.394 0.0007
- #
- # type = WR:
- # contrast estimate SE df t.ratio p.value
- # Polish - English 0.0281 0.0139 703 2.017 0.0441
- #
- # type = CR:
- # contrast estimate SE df t.ratio p.value
- # Polish - English -0.0388 0.0139 703 -2.782 0.0055'
- #
- # 'type = UN:
- # language emmean SE df lower.CL upper.CL
- # Polish 0.1437 0.00986 703 0.124 0.163
- # English 0.0963 0.00986 703 0.077 0.116
- #
- # type = WR:
- # language emmean SE df lower.CL upper.CL
- # Polish 0.3590 0.00986 703 0.340 0.378
- # English 0.3308 0.00986 703 0.311 0.350
- #
- # type = CR:
- # language emmean SE df lower.CL upper.CL
- # Polish 0.4747 0.00986 703 0.455 0.494
- # English 0.5136 0.00986 703 0.494 0.533'
- #
- # vct_lng_type2 <- emmeans(vct_model1, pairwise ~ type|language, adjust = "bonferroni")
- # print(vct_lng_type2)
- # plot(vct_lng_type2)
- #
- # 'language = Polish:
- # contrast estimate SE df t.ratio p.value
- # UN - WR -0.215 0.0135 472 -15.924 <.0001
- # UN - CR -0.331 0.0135 472 -24.487 <.0001
- # WR - CR -0.116 0.0135 472 -8.563 <.0001
- #
- # language = English:
- # contrast estimate SE df t.ratio p.value
- # UN - WR -0.235 0.0135 472 -17.345 <.0001
- # UN - CR -0.417 0.0135 472 -30.859 <.0001
- # WR - CR -0.183 0.0135 472 -13.514 <.0001'
- #
- # 'language = Polish:
- # type emmean SE df lower.CL upper.CL
- # UN 0.1437 0.00986 703 0.124 0.163
- # WR 0.3590 0.00986 703 0.340 0.378
- # CR 0.4747 0.00986 703 0.455 0.494
- #
- # language = English:
- # type emmean SE df lower.CL upper.CL
- # UN 0.0963 0.00986 703 0.077 0.116
- # WR 0.3308 0.00986 703 0.311 0.350
- # CR 0.5136 0.00986 703 0.494 0.533'
- #### _________________ N400 x semantic vectors _________________ ####
- #### N400 Polish [L1] ####
- df6 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500 & language %in% "Polish") %>% droplevels() %>%
- dplyr::group_by(mood, type, ptp, word,vector) %>%
- dplyr::summarise(mean_amp = mean(amp))
- # contrasts
- df6$mood <- factor(df6$mood, levels=c("positive", "negative"))
- df6$type <- factor(df6$type, levels=c("UN", "WR", "CR"))
- contrasts(df6$mood) <- contr.sum(levels(df6$mood))
- df6$type <- relevel(df6$type, ref = "UN")
- # lmer
- N4_L1_vct_model0 <- lmer(mean_amp ~ mood*type*vector + (1|ptp) + (1|word), data=df6)
- N4_L1_vct_model1 <- lmer(mean_amp ~ mood*type*vector + (1+type+mood|ptp) + (1+type+mood|word), data=df6)
- N4_L1_vct_model2 <- lmer(mean_amp ~ mood*type*vector + (1+type|ptp) + (1+mood|word), data=df6)
- '(Intercept) -1.71230 0.29660 45.98929 -5.773 6.33e-07 ***
- mood1 0.23508 0.13275 1101.16563 1.771 0.0769 .
- typeWR 0.34981 0.26492 1153.40508 1.320 0.1869
- typeCR 0.53566 0.34596 693.27999 1.548 0.1220
- vector 0.09186 0.84098 2190.51093 0.109 0.9130
- mood1:typeWR -0.17480 0.25189 1688.42684 -0.694 0.4878
- mood1:typeCR -0.72402 0.30938 1450.31427 -2.340 0.0194 *
- mood1:vector -0.86860 0.80161 1264.54526 -1.084 0.2788
- typeWR:vector 0.20325 1.03078 2393.92563 0.197 0.8437
- typeCR:vector 1.31299 1.03798 2120.10267 1.265 0.2060
- mood1:typeWR:vector 0.88584 0.98317 1380.95736 0.901 0.3677
- mood1:typeCR:vector 2.12366 0.98697 1222.05738 2.152 0.0316 * '
- summary(N4_L1_vct_model2)
- anova(N4_L1_vct_model2)
- anova(N4_L1_vct_model0, N4_L1_vct_model2)
- summary(rePCA(N4_L1_vct_model2)) # singular fit? ==> relative Principal Component Analysis
- relgrad <- with(N4_L1_vct_model2@optinfo$derivs,solve(Hessian,gradient)) # convergence problem?
- max(abs(relgrad)) # <.001? ==> the model is close to convergence
- plot_model(N4_L1_vct_model2) # plot the model
- plot(N4_L1_vct_model2) # reasonably equal amount of spread?
- hist(residuals(N4_L1_vct_model2)) # more or less normally distributed?
- qqnorm(residuals(N4_L1_vct_model2)) # reasonably aligned? '/'
- #POST-HOCS
- # mood x type
- Polish_vct_int_mood_type1 <- emmeans(N4_L1_vct_model2, pairwise ~ mood|type, adjust = "bonferroni")
- print(Polish_vct_int_mood_type1)
- plot(Polish_vct_int_mood_type1)
- 'type = UN:
- contrast estimate SE df z.ratio p.value
- positive - negative -0.0952 0.320 Inf -0.298 0.7659
- type = WR:
- contrast estimate SE df z.ratio p.value
- positive - negative 0.1318 0.137 Inf 0.963 0.3356
- type = CR:
- contrast estimate SE df z.ratio p.value
- positive - negative -0.1610 0.216 Inf -0.744 0.4567'
- Polish_vct_int_mood_type2 <- emmeans(N4_L1_vct_model2, pairwise ~ type|mood, adjust = "bonferroni")
- print(Polish_vct_int_mood_type2)
- plot(Polish_vct_int_mood_type2)
- 'mood = positive:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.529 0.250 Inf -2.118 0.1024
- UN - CR -0.930 0.302 Inf -3.081 0.0062
- WR - CR -0.401 0.204 Inf -1.964 0.1485
- mood = negative:
- contrast estimate SE df z.ratio p.value
- UN - WR -0.302 0.249 Inf -1.214 0.6740
- UN - CR -0.996 0.300 Inf -3.321 0.0027
- WR - CR -0.693 0.202 Inf -3.431 0.0018'
- # mood x type x vector
- emm_trends <- emtrends(N4_L1_vct_model2,specs = ~ mood * type,var = "vector")
- summary(emm_trends)
- ' mood type vector.trend SE df asymp.LCL asymp.UCL
- positive UN -0.777 1.160 Inf -3.06 1.50
- negative UN 0.960 1.160 Inf -1.31 3.23
- positive WR 0.312 0.848 Inf -1.35 1.97
- negative WR 0.278 0.824 Inf -1.34 1.89
- positive CR 2.660 0.841 Inf 1.01 4.31 <- significant (does not include 0)
- negative CR 0.150 0.826 Inf -1.47 1.77'
- contrast(emm_trends,method = "pairwise",adjust = "holm", by ="mood")
- 'mood = positive:
- contrast estimate SE df z.ratio p.value
- UN - WR -1.089 1.43 Inf -0.760 0.4471
- UN - CR -3.437 1.44 Inf -2.388 0.0508
- WR - CR -2.348 1.19 Inf -1.969 0.0980
- mood = negative:
- contrast estimate SE df z.ratio p.value
- UN - WR 0.683 1.42 Inf 0.482 1.0000
- UN - CR 0.811 1.43 Inf 0.569 1.0000
- WR - CR 0.128 1.17 Inf 0.110 1.0000'
- block_points2 <- quantile(df6$vector, probs = c(.05, .5, .95))
- emm_plot2 <- emmeans(N4_L1_vct_model2,~ mood * type | vector,at = list(vector = block_points2))
- emm_plot2 <- as.data.frame(emm_plot2)
- emm_plot2$type <- factor(emm_plot2$type, levels=c("CR", "WR", "UN"))
- ggplot(emm_plot2,aes(x = vector, y = emmean, color = type)) +
- geom_line(aes(group = type), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(~ mood,ncol = 2,labeller = as_labeller(c("positive" = "Positive mood","negative" = "Negative mood"))) +
- scale_color_manual(name = "",values = c("#ffc000", "#ff2f92", "#404A80"),labels = c("Unrelated (UR) pairs","Weakly related (WR) pairs","Closely related (CR) pairs")) +
- #scale_x_continuous(name = "Block progression",breaks = c(1,2,3,4,5,6,7,8),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1,0, -1, -2, -3, -4),limits = c(1, -4),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- # by type
- ggplot(emm_plot2,aes(x = vector, y = emmean, color = mood)) +
- geom_line(aes(group = mood), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(.~type, ncol =3, labeller = as_labeller(c("UN" = "Unrelated \npairs", "WR" = "Weakly \nrelated pairs", "CR" = "Closely \nrelated pairs"))) +
- scale_color_manual(name = "",values = c("firebrick2","darkblue"),labels = c("Positive mood","Negative mood")) +
- scale_x_continuous(name = "Semantic similarity",breaks = c(0.0, 0.2, 0.4,0.6),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1, 0, -1, -2, -3),limits = c(1, -3),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- ggsave(filename ="L1_predicted_similarity.png", plot = last_plot(), width = 20,height = 14, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### N400 English [L2] ####
- df7 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500 & language %in% "English") %>% droplevels() %>%
- dplyr::group_by(mood, type, ptp, word,vector) %>%
- dplyr::summarise(mean_amp = mean(amp))
- # contrasts
- df7$mood <- factor(df7$mood, levels=c("positive", "negative"))
- df7$type <- factor(df7$type, levels=c("UN", "WR", "CR"))
- contrasts(df7$mood) <- contr.sum(levels(df7$mood))
- df7$type <- relevel(df7$type, ref = "UN")
- # lmer
- N4_L2_vct_model0 <- lmer(mean_amp ~ mood*type*vector + (1|ptp) + (1|word), data=df7)
- N4_L2_vct_model1 <- lmer(mean_amp ~ mood*type*vector + (1+type+mood|ptp) + (1+type+mood|word), data=df7)
- N4_L2_vct_model2 <- lmer(mean_amp ~ mood*type*vector + (1+type|ptp) + (1+mood|word), data=df7)
- summary(N4_L1_vct_model2)
- anova(N4_L1_vct_model2)
- anova(N4_L1_vct_model0, N4_L1_vct_model2)
- ' Estimate Std. Error df t value Pr(>|t|)
- (Intercept) -1.8010 0.2970 39.4702 -6.063 4.05e-07 ***
- mood1 0.1056 0.1118 1053.5220 0.945 0.3449
- typeWR 0.1565 0.2552 869.4058 0.613 0.5401
- typeCR 0.7242 0.3014 609.7491 2.402 0.0166 *
- vector 0.6812 0.9718 2277.0085 0.701 0.4834
- mood1:typeWR -0.3553 0.2382 1891.8090 -1.491 0.1361
- mood1:typeCR 0.3406 0.2729 1702.8740 1.248 0.2122
- mood1:vector 0.2537 0.9304 1396.8918 0.273 0.7852
- typeWR:vector 0.8672 1.1558 2590.3667 0.750 0.4531
- typeCR:vector 0.5884 1.0876 2330.1993 0.541 0.5885
- mood1:typeWR:vector 0.6686 1.1107 1597.5895 0.602 0.5473
- mood1:typeCR:vector -0.6980 1.0416 1451.2130 -0.670 0.5029 '
- summary(rePCA(N4_L1_vct_model2)) # singular fit? ==> relative Principal Component Analysis
- relgrad <- with(N4_L1_vct_model2@optinfo$derivs,solve(Hessian,gradient)) # convergence problem?
- max(abs(relgrad)) # <.001? ==> the model is close to convergence
- plot_model(N4_L1_vct_model2) # plot the model
- plot(N4_L1_vct_model2) # reasonably equal amount of spread?
- hist(residuals(N4_L1_vct_model2)) # more or less normally distributed?
- qqnorm(residuals(N4_L1_vct_model2)) # reasonably aligned? '/'
- #POST-HOCS
- # type
- English_vct_fixed_type <- emmeans(N4_L1_vct_model2, pairwise ~ type,adjust = "bonferroni")
- print(English_vct_fixed_type)
- plot(English_vct_fixed_type)
- 'contrast estimate SE df z.ratio p.value
- UN - WR -0.416 0.181 Inf -2.301 0.0642
- UN - CR -0.963 0.232 Inf -4.145 0.0001
- WR - CR -0.547 0.160 Inf -3.423 0.0019'
- ' type emmean SE df asymp.LCL asymp.UCL
- UN -1.682 0.311 Inf -2.29 -1.073
- WR -1.266 0.276 Inf -1.81 -0.726
- CR -0.719 0.303 Inf -1.31 -0.127'
- block_points2 <- quantile(df7$vector, probs = c(.05, .5, .95))
- emm_plot2 <- emmeans(N4_L2_vct_model2,~ mood * type | vector,at = list(vector = block_points2))
- emm_plot2 <- as.data.frame(emm_plot2)
- emm_plot2$type <- factor(emm_plot2$type, levels=c("CR", "WR", "UN"))
- ggplot(emm_plot2,aes(x = vector, y = emmean, color = type)) +
- geom_line(aes(group = type), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(~ mood,ncol = 2,labeller = as_labeller(c("positive" = "Positive mood","negative" = "Negative mood"))) +
- scale_color_manual(name = "",values = c("#ffc000", "#ff2f92", "#404A80"),labels = c("Unrelated (UR) pairs","Weakly related (WR) pairs","Closely related (CR) pairs")) +
- #scale_x_continuous(name = "Block progression",breaks = c(1,2,3,4,5,6,7,8),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1,0, -1, -2, -3, -4),limits = c(1, -4),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- # by type
- ggplot(emm_plot2,aes(x = vector, y = emmean, color = mood)) +
- geom_line(aes(group = mood), linewidth = 1) +
- geom_point(size = 2) +
- geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),width = 0.1) +
- facet_wrap(.~type, ncol =3, labeller = as_labeller(c("UN" = "Unrelated \npairs", "WR" = "Weakly \nrelated pairs", "CR" = "Closely \nrelated pairs"))) +
- scale_color_manual(name = "",values = c("firebrick2","darkblue"),labels = c("Positive mood","Negative mood")) +
- scale_x_continuous(name = "Semantic similarity",breaks = c(0.0, 0.2, 0.4,0.6),guide = "prism_offset") +
- scale_y_reverse(name = "Predicted mean N400 amplitude (µV)",breaks = c(1, 0, -1, -2, -3),limits = c(1, -3),guide = "prism_offset") +
- theme_classic2() +
- scale_shape_prism() +
- theme(text = element_text(size = 20, family = "Helvetica", color = "black"),
- axis.text = element_text(size = 18),
- axis.line = element_line(size = 0.5),
- strip.text = element_text(size = 20),
- strip.background = element_blank(),
- legend.position = "bottom",
- legend.text = element_text(size = 20))
- ggsave(filename ="L2_predicted_similarity.png", plot = last_plot(), width = 20,height = 14, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #### _________________ correlations _________________ ####
- df7 <- df %>% subset(chan %in% FC_C_CP_P_3 & time >= 300 & time <=500) %>% droplevels() %>%
- dplyr::group_by(mood, type, language, word, relatedness, vector) %>%
- dplyr::summarise(mean_amp = mean(amp))
- df7$type <- factor(df7$type, levels=c("UN", "WR", "CR"))
- df7$mood <- factor(df7$mood, levels=c("positive", "negative"))
- df7$language <- factor(df7$language, levels=c("Polish", "English"))
- df7Pl <- df7[df7$language=="Polish",]
- df7En <- df7[df7$language=="English",]
- df7PlPos <- df7Pl[df7Pl$mood=="positive",]
- df7PlNeg <- df7Pl[df7Pl$mood=="negative",]
- df7EnPos <- df7En[df7En$mood=="positive",]
- df7EnNeg <- df7En[df7En$mood=="negative",]
- cor.test(df7$mean_amp, df7$relatedness,method = "pearson")
- cor.test(df7PlPos$mean_amp, df7PlPos$relatedness,method = "pearson")
- cor.test(df7PlNeg$mean_amp, df7PlNeg$relatedness,method = "pearson")
- cor.test(df7EnPos$mean_amp, df7EnPos$relatedness,method = "pearson")
- cor.test(df7EnNeg$mean_amp, df7EnNeg$relatedness,method = "pearson")
- cor.test(df7$mean_amp, df7$vector,method = "pearson")
- cor.test(df7PlPos$mean_amp, df7PlPos$vector,method = "pearson")
- cor.test(df7PlNeg$mean_amp, df7PlNeg$vector,method = "pearson")
- cor.test(df7EnPos$mean_amp, df7EnPos$vector,method = "pearson")
- cor.test(df7EnNeg$mean_amp, df7EnNeg$vector,method = "pearson")
- cor.test(df7$vector, df7$relatedness,method = "pearson")
- # N400 x semantic relatedness ratings
- ggplot(df7, aes(x = mean_amp, y = relatedness)) +
- geom_point(aes(color = type)) + # color by type for points only
- facet_grid(language~mood, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood", "Polish" = "Polish (L1)", "English" = "English (L2)"))) +
- geom_smooth(method = "lm", se = TRUE, color = "black") + # overall regression line
- scale_color_manual(values = c("#ffc000","#ff2f92","#404A80"), labels = c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"), name = "") +
- geom_rug(aes(color = type)) + # keep rug lines color-coded too
- scale_shape_prism() +
- #theme_prism() +
- scale_y_continuous(limits = c(1,7), breaks = c(1, 2, 3, 4, 5, 6, 7), guide = "prism_offset") +
- scale_x_continuous(limits = c(-5,4), breaks = c(-7,-6,-5, -4, -3, -2, -1, 0, 1, 2,3), guide = "prism_offset") +
- #scale_y_reverse(limits = c(7,0), breaks = c(1, 2,3,4,5,6,7), guide = "prism_offset") +
- xlab(expression(paste("Mean N400 amplitude (", mu, "V)"))) +
- ylab("Mean semantic relatedness rating") +
- theme_classic2() +
- theme(legend.position="bottom") +
- theme(plot.title = element_text(hjust = 0.5))+
- theme(panel.background = element_rect(fill = "white"),
- strip.background = element_rect(fill = "white",color="black",size=1),
- legend.key = element_rect(fill = "white"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.title = element_text(size = 15, color= "black"),
- strip.text = element_text(size = 15, color= "black"),
- legend.text = element_text(size = 15, color= "black"),
- legend.title = element_text(size = 15, color= "black"),
- strip.text.x.top = element_text(size = 15, color= "black"),
- axis.text = element_text(size = 15, color= "black"))
- ggsave(filename ="Correlation_plot_relatedness.png", plot = last_plot(), width = 20,height = 15, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- # ggplot(df7, aes(x = mean_amp, y = relatedness)) +
- # geom_point(aes(color = type)) + # color by type for points only
- # #facet_grid(language~mood, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood", "Polish" = "Polish (L1)", "English" = "English (L2)"))) +
- # geom_smooth(method = "lm", se = TRUE, color = "black") + # overall regression line
- # scale_color_manual(values = c("#ffc000","#ff2f92","#404A80"), labels = c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"), name = "") +
- # geom_rug(aes(color = type)) + # keep rug lines color-coded too
- # scale_shape_prism() +
- # #theme_prism() +
- # #scale_y_continuous(limits = c(1,7), breaks = c(1, 2, 3, 4, 5, 6, 7), guide = "prism_offset") +
- # #scale_x_continuous(limits = c(-5,2), breaks = c(-5, -4, -3, -2, -1, 0, 1, 2), guide = "prism_offset") +
- # #scale_y_reverse(limits = c(2,-5), breaks = c(-5, -4, -3, -2, -1, 0, 1, 2), guide = "prism_offset") +
- # xlab(expression(paste("Mean N400 amplitudes (", mu, "V)"))) +
- # ylab("Mean semantic relatedness relatednesss") +
- # theme_classic2() +
- # theme(legend.position="bottom") +
- # theme(plot.title = element_text(hjust = 0.5))+
- # theme(panel.background = element_rect(fill = "white"),
- # strip.background = element_rect(fill = "white",color="black",size=1),
- # legend.key = element_rect(fill = "white"),
- # axis.line.x = element_line(colour = "black", size = .5),
- # axis.line.y = element_line(colour = "black", size = .5),
- # axis.title = element_text(size = 15, color= "black"),
- # strip.text = element_text(size = 15, color= "black"),
- # legend.text = element_text(size = 15, color= "black"),
- # legend.title = element_text(size = 15, color= "black"),
- # strip.text.x.top = element_text(size = 15, color= "black"),
- # axis.text = element_text(size = 15, color= "black"))
- #
- # ggsave(filename ="Correlation_plot_relatedness_all.png", plot = last_plot(), width = 20,height = 15, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- # N400 x vectors
- ggplot(df7, aes(x = mean_amp, y = vector)) +
- geom_point(aes(color = type)) + # color by type for points only
- facet_grid(language~mood, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood", "Polish" = "Polish (L1)", "English" = "English (L2)"))) +
- geom_smooth(method = "lm", se = TRUE, color = "black") + # overall regression line
- scale_color_manual(values = c("#ffc000","#ff2f92","#404A80"), labels = c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"), name = "") +
- geom_rug(aes(color = type)) + # keep rug lines color-coded too
- scale_shape_prism() +
- scale_y_continuous(limits = c(-0.1,0.8), breaks = c(0, 0.2, 0.4, 0.6, 0.8), guide = "prism_offset") +
- scale_x_continuous(limits = c(-5,4), breaks = c(-7,-6,-5, -4, -3, -2, -1, 0, 1, 2,3), guide = "prism_offset") +
- xlab(expression(paste("Mean N400 amplitude (", mu, "V)"))) +
- ylab("Mean semantic similarity") +
- theme_classic2() +
- theme(legend.position="bottom") +
- theme(plot.title = element_text(hjust = 0.5))+
- theme(panel.background = element_rect(fill = "white"),
- strip.background = element_rect(fill = "white",color="black",size=1),
- legend.key = element_rect(fill = "white"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.title = element_text(size = 15, color= "black"),
- strip.text = element_text(size = 15, color= "black"),
- legend.text = element_text(size = 15, color= "black"),
- legend.title = element_text(size = 15, color= "black"),
- strip.text.x.top = element_text(size = 15, color= "black"),
- axis.text = element_text(size = 15, color= "black"))
- ggsave(filename ="Correlation_plot_vector.png", plot = last_plot(), width = 20,height = 15, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- #
- # ggplot(df7, aes(x = mean_amp, y = vector)) +
- # geom_point(aes(color = type)) + # color by type for points only
- # #facet_grid(language~mood, labeller = as_labeller(c("positive" = "Positive mood", "negative" = "Negative mood", "Polish" = "Polish (L1)", "English" = "English (L2)"))) +
- # geom_smooth(method = "lm", se = TRUE, color = "black") + # overall regression line
- # scale_color_manual(values = c("#ffc000","#ff2f92","#404A80"), labels = c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"), name = "") +
- # geom_rug(aes(color = type)) + # keep rug lines color-coded too
- # scale_shape_prism() +
- # #theme_prism() +
- # #scale_y_continuous(limits = c(1,7), breaks = c(1, 2, 3, 4, 5, 6, 7), guide = "prism_offset") +
- # #scale_x_continuous(limits = c(-5,2), breaks = c(-5, -4, -3, -2, -1, 0, 1, 2), guide = "prism_offset") +
- # #scale_y_reverse(limits = c(2,-5), breaks = c(-5, -4, -3, -2, -1, 0, 1, 2), guide = "prism_offset") +
- # xlab(expression(paste("Mean ERP amplitudes (", mu, "V)"))) +
- # ylab("Mean semantic vector") +
- # theme_classic2() +
- # theme(legend.position="bottom") +
- # theme(plot.title = element_text(hjust = 0.5))+
- # theme(panel.background = element_rect(fill = "white"),
- # strip.background = element_rect(fill = "white",color="black",size=1),
- # legend.key = element_rect(fill = "white"),
- # axis.line.x = element_line(colour = "black", size = .5),
- # axis.line.y = element_line(colour = "black", size = .5),
- # axis.title = element_text(size = 15, color= "black"),
- # strip.text = element_text(size = 15, color= "black"),
- # legend.text = element_text(size = 15, color= "black"),
- # legend.title = element_text(size = 15, color= "black"),
- # strip.text.x.top = element_text(size = 15, color= "black"),
- # axis.text = element_text(size = 15, color= "black"))
- #
- # ggsave(filename ="Correlation_plot_vector_all.png", plot = last_plot(), width = 20,height = 15, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- # semantic relatedness ratings - distribution
- ggplot(df7, aes(x = language, y = relatedness, colour = type, fill = type)) +
- facet_wrap(~type, labeller = as_labeller(c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"))) +
- # ggdist::stat_halfeye(aes(colour = type), width = 0.8, .width = 0, alpha = 0.75, justification = -0.3, point_colour = NA) +
- geom_point(aes(colour = type), size = 1.0, alpha = 0.2, position = position_jitter(seed = 1, width = 0.1)) +
- geom_boxplot(aes(colour = type), width = .25, alpha = 0.25, outlier.shape = NA) +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_continuous(limits = c(1,7), breaks = c(1, 2, 3, 4, 5, 6, 7), guide = "prism_offset") +
- #coord_cartesian(ylim = c(1, 7), clip = "off") +
- scale_x_discrete(labels = c("Polish" = "Polish (L1)", "English" = "English (L2)"), guide = "prism_bracket") +
- labs(y = "Mean semantic relatedness rating", x = "Language of operation") +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_colour_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- #scale_y_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7))+
- theme_classic() +
- theme(legend.position="none") +
- theme(panel.background = element_rect(fill = "white"),
- strip.background = element_rect(fill = "white",color="black",size=1),
- legend.key = element_rect(fill = "white"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.title = element_text(size = 15, color= "black"),
- strip.text = element_text(size = 15, color= "black"),
- legend.text = element_text(size = 15, color= "black"),
- legend.title = element_text(size = 15, color= "black"),
- strip.text.x.top = element_text(size = 15, color= "black"),
- axis.text = element_text(size = 15, color= "black"))
- ggsave(filename ="Mean semantic relatedness rating.png", plot = last_plot(), width = 21,height = 9, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
- # vectors - distribution
- ggplot(df7, aes(x = language, y = vector, colour = type, fill = type)) +
- facet_wrap(~type, labeller = as_labeller(c("UN" = "Unrelated pairs", "WR" = "Weakly related pairs", "CR" = "Closely related pairs"))) +
- # ggdist::stat_halfeye(aes(colour = type), width = 0.8, .width = 0, alpha = 0.75, justification = -0.3, point_colour = NA) +
- geom_point(aes(colour = type), size = 1.0, alpha = 0.2, position = position_jitter(seed = 1, width = 0.1)) +
- geom_boxplot(aes(colour = type), width = .25, alpha = 0.25, outlier.shape = NA) +
- scale_shape_prism() +
- #theme_prism() +
- scale_y_continuous(limits = c(-0.1,0.8), breaks = c(0, 0.2, 0.4, 0.6, 0.8), guide = "prism_offset") +
- #coord_cartesian(ylim = c(1, 7), clip = "off") +
- scale_x_discrete(labels = c("Polish" = "Polish (L1)", "English" = "English (L2)"), guide = "prism_bracket") +
- labs(y = "Mean semantic similarity", x = "Language of operation") +
- scale_fill_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- scale_colour_manual(values = c("#ffc000","#ff2f92","#404A80")) +
- #scale_y_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7))+
- theme_classic() +
- theme(legend.position="none") +
- theme(panel.background = element_rect(fill = "white"),
- strip.background = element_rect(fill = "white",color="black",size=1),
- legend.key = element_rect(fill = "white"),
- axis.line.x = element_line(colour = "black", size = .5),
- axis.line.y = element_line(colour = "black", size = .5),
- axis.title = element_text(size = 15, color= "black"),
- strip.text = element_text(size = 15, color= "black"),
- legend.text = element_text(size = 15, color= "black"),
- legend.title = element_text(size = 15, color= "black"),
- strip.text.x.top = element_text(size = 15, color= "black"),
- axis.text = element_text(size = 15, color= "black"))
- ggsave(filename ="Mean semantic vector.png", plot = last_plot(), width = 21,height = 9, units = "cm", bg = "white", path="/Users/m/Desktop/MoBSeR/R /plots")
MoBSeR_ERP_R1.R, no license · at the source
Overview
- Laboratory for Social Neuroscience, Faculty of English, Adam Mickiewicz University, Poznań, Poland
- Cognitive Neuroscience Center, Adam Mickiewicz University, Poznań, Poland
Abstract
Prior research has shown that, compared to a negative mood, a positive mood facilitates spreading activation within semantic memory in the first language. Yet, little is still known about neurocognitive mechanisms underlying mood effects on semantic processes in the foreign language. Here, we show that a positive mood enhances accessibility of unrelated concepts within semantic memory in the first but not the foreign language. Highly proficient Polish–English bilingual women were induced into positive and negative mood states with animated films and made semantic relatedness judgements about closely related, weakly related, and unrelated prime–target pairs in their first and foreign languages. Mean N400 responses were analysed as neural markers of spreading activation within semantic memory. Our results revealed reduced N400 responses to unrelated word pairs under a positive compared to a negative mood only in the first language. Critically, no mood-driven effects emerged for the foreign language. These findings provide novel evidence that a positive mood broadens spreading activation within semantic memory only in the first language context, making distant concepts more accessible. Critically, they also highlight mood-independent responding when bilinguals operate in their foreign language.
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 7 matches between paragraphs and lines of code.
OSF nq4vz
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
9 files
- Matlab scripts/
A_MoBSeR_datainfo.m , MATLAB, 272 lines - Matlab scripts/
B_MoBSeR_pipeline.m , MATLAB, 270 lines - Matlab scripts/
C_MoBSeR_ERPs.m , MATLAB, 247 lines, 1 match - R scripts/
MoBSeR_ERP.R , R, 454 lines, 2 matches - R scripts/
MoBSeR_ERP_R1.R , R, 1,719 lines, 2 matches - R scripts/
MoBSeR_beh.R , R, 443 lines - R scripts/
MoBSeR_films.R , R, 96 lines - R scripts/
MoBSeR_mood.R , R, 384 lines, 1 match - R scripts/
MoBSeR_word_pairs.R , R, 427 lines, 1 match
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;
- 9 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
Pre-processed data, experimental stimuli, model specifications, as well as R and Matlab scripts are publicly available on the Open Science Framework at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 3, 28 September 2026
- Funding: added Uniwersytet im. Adama Mickiewicza w Poznaniu: 140/04/POB5/00, 140/04/POB5/0010
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 11 MeSH terms, 72 references.
Cite
This paper
Żukowski, P., & Naranowicz, M. (2026). Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language. PloS one, 21(8), e0353990. https://
BibTeX
@article{zukowski2026pos
author = {Żukowski, Piotr and Naranowicz, Marcin},
title = {{Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language}},
journal = {PloS one},
year = {2026},
month = aug,
volume = {21},
number = {8},
pages = {e0353990},
publisher = {PLOS},
issn = {1932-6203},
doi = {10.1371/
url = {https://
pmid = {42585154},
pmcid = {PMC13465833}
}
RIS
TY - JOUR
AU - Żukowski, Piotr
AU - Naranowicz, Marcin
TI - Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language
T2 - PloS one
J2 - PLoS One
PY - 2026
DA - 2026/
VL - 21
IS - 8
SP - e0353990
SN - 1932-6203
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"type": "article-journal",
"title": "Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language",
"container-title": "PloS one",
"author": [
{
"family": "Żukowski",
"given": "Piotr"
},
{
"family": "Naranowicz",
"given": "Marcin"
}
],
"container-title-short":
"volume": "21",
"issue": "8",
"page": "e0353990",
"DOI": "10.1371/
"PMID": "42585154",
"PMCID": "PMC13465833",
"ISSN": "1932-6203",
"publisher": "PLOS",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
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.3390/brainsci12030316 [code]
- In a Bilingual Mood: Mood Affects Lexico-Semantic Processing Differently in Native and Non-Native Languages.Journal: Brain sciencesIn common: multcomp, afex, emmeans, 7 other tools, EEG, cognitive, 21 references, author Marcin Naranowicz
- [2] doi:10.3758/s13415-025-01394-x [code]
- Mood modulations of emotional word processing: A predictive perspective view of EEG data.Journal: Cognitive, affective & behavioral neuroscienceIn common: afex, psych, emmeans, 4 other tools, EEG, cognitive, 15 references
- [3] 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: ERPLAB, multcomp, afex, 9 other tools, EEG, 4 references
- [4] 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: afex, psych, emmeans, 6 other tools, EEG, cognitive, 8 references
- [5] 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: ERPLAB, ICLabel, psych, 8 other tools, EEG, cognitive, 2 references
- [6] doi:10.1016/j.clinph.2025.2110972 [code]
- Timing of implicit processes in aphasia: An event-related potential investigation of masked priming effects.Journal: Clinical neurophysiology : official journal of the International Federation of Clinical NeurophysiologyIn common: ERPLAB, multcomp, afex, 7 other tools, EEG, cognitive, 2 references
- [7] doi:10.1038/s41598-025-34117-w [code]
- The impact of awareness on affective emoji priming in visual word recognition.Journal: Scientific reportsIn common: multcomp, afex, emmeans, 6 other tools, EEG, cognitive, 4 references
- [8] doi:10.1016/j.dcn.2025.101614 [code]
- Analysis of event-related potential difference waves can benefit from linear mixed effects modeling: Recommendations for analyses and general model fitting.Journal: Developmental cognitive neuroscienceIn common: ERPLAB, afex, emmeans, 6 other tools, EEG, 4 references
- [9] doi:10.1016/j.dcn.2022.101070 [code]
- Utility of linear mixed effects models for event-related potential research with infants and children.Journal: Developmental cognitive neuroscienceIn common: ERPLAB, afex, emmeans, 6 other tools, EEG, 4 references
- [10] doi:10.1038/s42003-023-04953-5 [code]
- Sulcal morphology of posteromedial cortex substantially differs between humans and chimpanzees.Journal: Communications biologyIn common: multcomp, afex, psych, 9 other tools, cognitive
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, 9 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:5e1a81d0eb57b685…
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.1371/journal.pone.0353990)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1371/journal.pone.0353990.svg
:target: https://openscicode.org/badge/doi/10.1371/journal.pone.0353990
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1371/journal.pone.0353990"><img src="https://openscicode.org/badge/doi/10.1371/journal.pone.0353990.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.
