This document Manuscript
Experiment 1 Experiment 1a
Experiment 2 Experiment 1b
Experiment 3 Experiment 2

1 Preparations

Load libraries and general settings:

## load libraries
library(tidyverse)
library(lme4)
library(lmerTest)
library(optimx)
library(emmeans)
library(ggpubr)
library(here)
library(psychr) # remotes::install_github("haiyangjin/psychr")
library(afex)
library(brms)
library(bayestestR)
library(tidybayes)
emm_options(lmer.df = "Satterthwaite") # as pre-registered

# two_colors <- c("#D55E00", "#56B4E9") # facilitation and interference
two_colors <- c("#D55E00", "#229CE2") # facilitation and interference
sig_color <- "red"

dir_lmm <- "lmm"
dir_fig <- "figure"
ylimit_cf_d <- c(-.5, 3.6)
ylimit_cf_fi_d <- c(-1.1, 1.1)
ylimit_cf_rt <- c(650, 1150)
ylimit_cf_fi_rt <- c(-100, 100)
ylimit_cf_fi_ie <- c(-150, 300)

# parallel cores
options(mc.cores = min(parallel::detectCores(), 10))

# APA theme for figures
theme_set(papaja::theme_apa(base_size = 13.5, base_family = "Helvetica", box = FALSE))
theme_update(strip.placement = "outside")

1.1 Experiment 1

# Order of completing tasks/blocks
readRDS(file = here("data", "df_E1_raw.rds")) %>% 
  select(SubjCode, Order, Orientation) %>% 
  distinct() %>% 
  pivot_wider(names_from = Order,
              values_from = Orientation) %>% 
  arrange(SubjCode)
# Order of completing tasks/blocks
readRDS(file = here("data", "df_E1_raw.rds")) %>% 
  select(SubjCode, Order, Orientation) %>% 
  distinct() %>% 
  filter(Order == 1) %>% 
  group_by(Orientation) %>% 
  summarize(N = n(),
            .groups = "drop")

Number of trials whose RTs were below 200 ms (if not 0):

# check number of trials RT<200 
readRDS(file = here("data", "df_E1_raw.rds")) %>% 
  group_by(SubjCode) %>% # , Orientation, Cue, Congruency, Alignment, CA
  summarize(N = n(),
            N_below200 = sum(!isabove200),
            .groups = "drop") %>% 
  filter(N_below200 != 0)

Number of trials whose responses were NAs (if not 0):

# check number of NA in `isSame`
readRDS(file = here("data", "df_E1_raw.rds")) %>% 
  mutate(isSameNA = is.na(isSame)) %>% 
  group_by(SubjCode) %>% # , Orientation, Cue, Congruency, Alignment, CA
  summarize(N = n(),
            N_NA = sum(isSameNA),
            .groups = "drop") %>% 
  filter(N_NA != 0)
df_E1_raw <- readRDS(file = here("data", "df_E1_raw.rds")) %>% 
  filter(isabove200, # remove trials whose RT was below 200ms
         !is.na(isSame)) # remove trials where no responses were recorded

str(df_E1_raw)
## 'data.frame':    25557 obs. of  12 variables:
##  $ SubjCode   : Factor w/ 40 levels "41","45","46",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ StimGroup  : Factor w/ 10 levels "F1","F2","F3",..: 8 6 1 9 7 5 4 10 5 1 ...
##  $ Order      : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation: Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Cue        : Factor w/ 2 levels "top","bot": 2 1 2 1 1 2 1 1 1 2 ...
##  $ Congruency : Factor w/ 2 levels "con","inc": 1 2 2 1 1 2 1 2 1 2 ...
##  $ Alignment  : Factor w/ 2 levels "ali","mis": 2 2 1 2 2 1 1 1 1 1 ...
##  $ CA         : Factor w/ 2 levels "sam","dif": 1 2 1 1 2 1 2 2 2 2 ...
##  $ isCorrect  : num  0 0 1 1 0 0 0 1 1 0 ...
##  $ isSame     : int  0 1 1 1 1 0 1 0 0 1 ...
##  $ RT         : num  913 955 1382 1248 1296 ...
##  $ isabove200 : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
# apply successive difference coding and add columns for LMM analysis (psychr)
df_E1_lmm <- df_E1_raw %>% 
  psychr::set_contr(c(Orientation, Cue, Congruency, Alignment, CA)) %>% 
  psychr::add_lmmcols(isSame ~ Orientation * Congruency * Alignment * CA + Cue) 
##                                                       old_name
## Ori_C                                           Orientation2-1
## Con_C                                            Congruency2-1
## Ali_C                                             Alignment2-1
## CA_C                                                     CA2-1
## Cue_C                                                   Cue2-1
## Ori_Con                           Orientation2-1:Congruency2-1
## Ori_Ali                            Orientation2-1:Alignment2-1
## Con_Ali                             Congruency2-1:Alignment2-1
## Ori_CA                                    Orientation2-1:CA2-1
## Con_CA                                     Congruency2-1:CA2-1
## Ali_CA                                      Alignment2-1:CA2-1
## Ori_Con_Ali          Orientation2-1:Congruency2-1:Alignment2-1
## Ori_Con_CA                  Orientation2-1:Congruency2-1:CA2-1
## Ori_Ali_CA                   Orientation2-1:Alignment2-1:CA2-1
## Con_Ali_CA                    Congruency2-1:Alignment2-1:CA2-1
## Ori_Con_Ali_CA Orientation2-1:Congruency2-1:Alignment2-1:CA2-1
## [1] "Ori_C + Con_C + Ali_C + CA_C + Cue_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + Ori_Con_Ali_CA"
saveRDS(df_E1_lmm, file = here(dir_lmm, "df_E1_lmm.rds"))
str(df_E1_lmm)
## 'data.frame':    25557 obs. of  28 variables:
##  $ SubjCode      : Factor w/ 40 levels "41","45","46",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ StimGroup     : Factor w/ 10 levels "F1","F2","F3",..: 8 6 1 9 7 5 4 10 5 1 ...
##  $ Order         : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation   : Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "upr" "inv"
##   .. .. ..$ : chr "2-1"
##  $ Cue           : Factor w/ 2 levels "top","bot": 2 1 2 1 1 2 1 1 1 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "top" "bot"
##   .. .. ..$ : chr "2-1"
##  $ Congruency    : Factor w/ 2 levels "con","inc": 1 2 2 1 1 2 1 2 1 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "con" "inc"
##   .. .. ..$ : chr "2-1"
##  $ Alignment     : Factor w/ 2 levels "ali","mis": 2 2 1 2 2 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "ali" "mis"
##   .. .. ..$ : chr "2-1"
##  $ CA            : Factor w/ 2 levels "sam","dif": 1 2 1 1 2 1 2 2 2 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "sam" "dif"
##   .. .. ..$ : chr "2-1"
##  $ isCorrect     : num  0 0 1 1 0 0 0 1 1 0 ...
##  $ isSame        : int  0 1 1 1 1 0 1 0 0 1 ...
##  $ RT            : num  913 955 1382 1248 1296 ...
##  $ isabove200    : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
##  $ Ori_C         : num  -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ Con_C         : num  -0.5 0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 -0.5 0.5 ...
##  $ Ali_C         : num  0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ CA_C          : num  -0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 ...
##  $ Cue_C         : num  0.5 -0.5 0.5 -0.5 -0.5 0.5 -0.5 -0.5 -0.5 0.5 ...
##  $ Ori_Con       : num  0.25 -0.25 -0.25 0.25 0.25 -0.25 0.25 -0.25 0.25 -0.25 ...
##  $ Ori_Ali       : num  -0.25 -0.25 0.25 -0.25 -0.25 0.25 0.25 0.25 0.25 0.25 ...
##  $ Con_Ali       : num  -0.25 0.25 -0.25 -0.25 -0.25 -0.25 0.25 -0.25 0.25 -0.25 ...
##  $ Ori_CA        : num  0.25 -0.25 0.25 0.25 -0.25 0.25 -0.25 -0.25 -0.25 -0.25 ...
##  $ Con_CA        : num  0.25 0.25 -0.25 0.25 -0.25 -0.25 -0.25 0.25 -0.25 0.25 ...
##  $ Ali_CA        : num  -0.25 0.25 0.25 -0.25 0.25 0.25 -0.25 -0.25 -0.25 -0.25 ...
##  $ Ori_Con_Ali   : num  0.125 -0.125 0.125 0.125 0.125 0.125 -0.125 0.125 -0.125 0.125 ...
##  $ Ori_Con_CA    : num  -0.125 -0.125 0.125 -0.125 0.125 0.125 0.125 -0.125 0.125 -0.125 ...
##  $ Ori_Ali_CA    : num  0.125 -0.125 -0.125 0.125 -0.125 -0.125 0.125 0.125 0.125 0.125 ...
##  $ Con_Ali_CA    : num  0.125 0.125 0.125 0.125 -0.125 0.125 0.125 -0.125 0.125 -0.125 ...
##  $ Ori_Con_Ali_CA: num  -0.0625 -0.0625 -0.0625 -0.0625 0.0625 -0.0625 -0.0625 0.0625 -0.0625 0.0625 ...

1.2 Experiment 2

# Order of completing tasks/blocks
readRDS(file = here("data", "df_E2_raw.rds")) %>% 
  select(SubjCode, Order, Orientation) %>% 
  distinct() %>% 
  pivot_wider(names_from = Order,
              values_from = Orientation) %>% 
  arrange(SubjCode)
# Order of completing tasks/blocks
readRDS(file = here("data", "df_E2_raw.rds")) %>% 
  select(SubjCode, Order, Orientation) %>% 
  distinct() %>% 
  filter(Order == 1) %>% 
  group_by(Orientation) %>% 
  summarize(N = n(),
            .groups = "drop")

Number of trials whose RTs were below 200 ms (if not 0):

# check number of trials RT<200 
readRDS(file = here("data", "df_E2_raw.rds")) %>% 
  group_by(SubjCode) %>% # , Orientation, Cue, Congruency, Alignment, CA
  summarize(N = n(),
            N_below200 = sum(!isabove200),
            .groups = "drop") %>% 
  filter(N_below200 != 0)

Number of trials whose responses were NAs (if not 0):

# check number of NA in `isSame`
readRDS(file = here("data", "df_E2_raw.rds")) %>% 
  mutate(isSameNA = is.na(isSame)) %>% 
  group_by(SubjCode) %>% # , Orientation, Cue, Congruency, Alignment, CA
  summarize(N = n(),
            N_NA = sum(isSameNA),
            .groups = "drop") %>% 
  filter(N_NA != 0)
df_E2_raw <- readRDS(file = here("data", "df_E2_raw.rds")) %>% 
  filter(isabove200,
         !is.na(isSame)) # remove trials where no responses were recorded

str(df_E2_raw)
## 'data.frame':    25593 obs. of  12 variables:
##  $ SubjCode   : Factor w/ 40 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ StimGroup  : Factor w/ 10 levels "F1","F2","F3",..: 8 4 7 9 7 9 9 2 7 3 ...
##  $ Order      : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation: Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Cue        : Factor w/ 2 levels "top","bot": 1 1 2 2 2 2 1 2 2 1 ...
##  $ Congruency : Factor w/ 2 levels "con","inc": 2 2 1 2 2 1 2 2 1 1 ...
##  $ Alignment  : Factor w/ 2 levels "ali","mis": 1 2 1 2 2 2 1 2 2 2 ...
##  $ CA         : Factor w/ 2 levels "sam","dif": 1 2 2 1 1 2 1 1 1 1 ...
##  $ isCorrect  : num  1 0 1 1 1 1 1 1 1 1 ...
##  $ isSame     : int  1 1 0 1 1 0 1 1 1 1 ...
##  $ RT         : num  994 842 810 811 1277 ...
##  $ isabove200 : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
# apply successive difference coding and add columns for LMM analysis (psychr)
df_E2_lmm <- df_E2_raw %>% 
  psychr::set_contr(c(Orientation, Cue, Congruency, Alignment, CA)) %>% 
  psychr::add_lmmcols(isSame ~ Orientation * Congruency * Alignment * CA + Cue) 
##                                                       old_name
## Ori_C                                           Orientation2-1
## Con_C                                            Congruency2-1
## Ali_C                                             Alignment2-1
## CA_C                                                     CA2-1
## Cue_C                                                   Cue2-1
## Ori_Con                           Orientation2-1:Congruency2-1
## Ori_Ali                            Orientation2-1:Alignment2-1
## Con_Ali                             Congruency2-1:Alignment2-1
## Ori_CA                                    Orientation2-1:CA2-1
## Con_CA                                     Congruency2-1:CA2-1
## Ali_CA                                      Alignment2-1:CA2-1
## Ori_Con_Ali          Orientation2-1:Congruency2-1:Alignment2-1
## Ori_Con_CA                  Orientation2-1:Congruency2-1:CA2-1
## Ori_Ali_CA                   Orientation2-1:Alignment2-1:CA2-1
## Con_Ali_CA                    Congruency2-1:Alignment2-1:CA2-1
## Ori_Con_Ali_CA Orientation2-1:Congruency2-1:Alignment2-1:CA2-1
## [1] "Ori_C + Con_C + Ali_C + CA_C + Cue_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + Ori_Con_Ali_CA"
saveRDS(df_E2_lmm, file = here(dir_lmm, "df_E2_lmm.rds"))
str(df_E2_lmm)
## 'data.frame':    25593 obs. of  28 variables:
##  $ SubjCode      : Factor w/ 40 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ StimGroup     : Factor w/ 10 levels "F1","F2","F3",..: 8 4 7 9 7 9 9 2 7 3 ...
##  $ Order         : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation   : Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "upr" "inv"
##   .. .. ..$ : chr "2-1"
##  $ Cue           : Factor w/ 2 levels "top","bot": 1 1 2 2 2 2 1 2 2 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "top" "bot"
##   .. .. ..$ : chr "2-1"
##  $ Congruency    : Factor w/ 2 levels "con","inc": 2 2 1 2 2 1 2 2 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "con" "inc"
##   .. .. ..$ : chr "2-1"
##  $ Alignment     : Factor w/ 2 levels "ali","mis": 1 2 1 2 2 2 1 2 2 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "ali" "mis"
##   .. .. ..$ : chr "2-1"
##  $ CA            : Factor w/ 2 levels "sam","dif": 1 2 2 1 1 2 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "sam" "dif"
##   .. .. ..$ : chr "2-1"
##  $ isCorrect     : num  1 0 1 1 1 1 1 1 1 1 ...
##  $ isSame        : int  1 1 0 1 1 0 1 1 1 1 ...
##  $ RT            : num  994 842 810 811 1277 ...
##  $ isabove200    : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
##  $ Ori_C         : num  -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ Con_C         : num  0.5 0.5 -0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 ...
##  $ Ali_C         : num  -0.5 0.5 -0.5 0.5 0.5 0.5 -0.5 0.5 0.5 0.5 ...
##  $ CA_C          : num  -0.5 0.5 0.5 -0.5 -0.5 0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ Cue_C         : num  -0.5 -0.5 0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 ...
##  $ Ori_Con       : num  -0.25 -0.25 0.25 -0.25 -0.25 0.25 -0.25 -0.25 0.25 0.25 ...
##  $ Ori_Ali       : num  0.25 -0.25 0.25 -0.25 -0.25 -0.25 0.25 -0.25 -0.25 -0.25 ...
##  $ Con_Ali       : num  -0.25 0.25 0.25 0.25 0.25 -0.25 -0.25 0.25 -0.25 -0.25 ...
##  $ Ori_CA        : num  0.25 -0.25 -0.25 0.25 0.25 -0.25 0.25 0.25 0.25 0.25 ...
##  $ Con_CA        : num  -0.25 0.25 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 0.25 0.25 ...
##  $ Ali_CA        : num  0.25 0.25 -0.25 -0.25 -0.25 0.25 0.25 -0.25 -0.25 -0.25 ...
##  $ Ori_Con_Ali   : num  0.125 -0.125 -0.125 -0.125 -0.125 0.125 0.125 -0.125 0.125 0.125 ...
##  $ Ori_Con_CA    : num  0.125 -0.125 0.125 0.125 0.125 0.125 0.125 0.125 -0.125 -0.125 ...
##  $ Ori_Ali_CA    : num  -0.125 -0.125 0.125 0.125 0.125 -0.125 -0.125 0.125 0.125 0.125 ...
##  $ Con_Ali_CA    : num  0.125 0.125 0.125 -0.125 -0.125 -0.125 0.125 -0.125 0.125 0.125 ...
##  $ Ori_Con_Ali_CA: num  -0.0625 -0.0625 -0.0625 0.0625 0.0625 0.0625 -0.0625 0.0625 -0.0625 -0.0625 ...

1.3 Experiment 1 and 2

df_E12_lmm <- rbind(mutate(df_E1_lmm, VA="10"),
                    mutate(df_E2_lmm, VA="5")) %>% 
  mutate(VA = factor(VA, levels = c("5", "10"))) %>% 
  set_contr(c(Orientation, Cue, Congruency, Alignment, CA, VA))

saveRDS(df_E12_lmm, file = here(dir_lmm, "df_E12_lmm.rds"))

str(df_E12_lmm)
## 'data.frame':    51150 obs. of  29 variables:
##  $ SubjCode      : Factor w/ 80 levels "41","45","46",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ StimGroup     : Factor w/ 10 levels "F1","F2","F3",..: 8 6 1 9 7 5 4 10 5 1 ...
##  $ Order         : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation   : Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "upr" "inv"
##   .. .. ..$ : chr "2-1"
##  $ Cue           : Factor w/ 2 levels "top","bot": 2 1 2 1 1 2 1 1 1 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "top" "bot"
##   .. .. ..$ : chr "2-1"
##  $ Congruency    : Factor w/ 2 levels "con","inc": 1 2 2 1 1 2 1 2 1 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "con" "inc"
##   .. .. ..$ : chr "2-1"
##  $ Alignment     : Factor w/ 2 levels "ali","mis": 2 2 1 2 2 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "ali" "mis"
##   .. .. ..$ : chr "2-1"
##  $ CA            : Factor w/ 2 levels "sam","dif": 1 2 1 1 2 1 2 2 2 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "sam" "dif"
##   .. .. ..$ : chr "2-1"
##  $ isCorrect     : num  0 0 1 1 0 0 0 1 1 0 ...
##  $ isSame        : int  0 1 1 1 1 0 1 0 0 1 ...
##  $ RT            : num  913 955 1382 1248 1296 ...
##  $ isabove200    : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
##  $ Ori_C         : num  -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ Con_C         : num  -0.5 0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 -0.5 0.5 ...
##  $ Ali_C         : num  0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ CA_C          : num  -0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 ...
##  $ Cue_C         : num  0.5 -0.5 0.5 -0.5 -0.5 0.5 -0.5 -0.5 -0.5 0.5 ...
##  $ Ori_Con       : num  0.25 -0.25 -0.25 0.25 0.25 -0.25 0.25 -0.25 0.25 -0.25 ...
##  $ Ori_Ali       : num  -0.25 -0.25 0.25 -0.25 -0.25 0.25 0.25 0.25 0.25 0.25 ...
##  $ Con_Ali       : num  -0.25 0.25 -0.25 -0.25 -0.25 -0.25 0.25 -0.25 0.25 -0.25 ...
##  $ Ori_CA        : num  0.25 -0.25 0.25 0.25 -0.25 0.25 -0.25 -0.25 -0.25 -0.25 ...
##  $ Con_CA        : num  0.25 0.25 -0.25 0.25 -0.25 -0.25 -0.25 0.25 -0.25 0.25 ...
##  $ Ali_CA        : num  -0.25 0.25 0.25 -0.25 0.25 0.25 -0.25 -0.25 -0.25 -0.25 ...
##  $ Ori_Con_Ali   : num  0.125 -0.125 0.125 0.125 0.125 0.125 -0.125 0.125 -0.125 0.125 ...
##  $ Ori_Con_CA    : num  -0.125 -0.125 0.125 -0.125 0.125 0.125 0.125 -0.125 0.125 -0.125 ...
##  $ Ori_Ali_CA    : num  0.125 -0.125 -0.125 0.125 -0.125 -0.125 0.125 0.125 0.125 0.125 ...
##  $ Con_Ali_CA    : num  0.125 0.125 0.125 0.125 -0.125 0.125 0.125 -0.125 0.125 -0.125 ...
##  $ Ori_Con_Ali_CA: num  -0.0625 -0.0625 -0.0625 -0.0625 0.0625 -0.0625 -0.0625 0.0625 -0.0625 0.0625 ...
##  $ VA            : Factor w/ 2 levels "5","10": 2 2 2 2 2 2 2 2 2 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "5" "10"
##   .. .. ..$ : chr "2-1"

1.4 Experiment 3 (pre-registered experiment)

# Order of completing tasks/blocks
readRDS(file = here("data", "df_E3_raw.rds")) %>% 
  select(SubjCode, Order, Orientation) %>% 
  distinct() %>% 
  pivot_wider(names_from = Order,
              values_from = Orientation) %>% 
  arrange(SubjCode) 
# Order of completing tasks/blocks
readRDS(file = here("data", "df_E3_raw.rds")) %>% 
  select(SubjCode, Order, Orientation) %>% 
  distinct() %>% 
  filter(Order == 1) %>% 
  group_by(Orientation) %>% 
  summarize(N = n(),
            .groups = "drop")

Number of trials whose RTs were below 200 ms (if not 0):

# check number of trials RT<200 
readRDS(file = here("data", "df_E3_raw.rds")) %>% 
  group_by(SubjCode) %>% # , Orientation, Cue, Congruency, Alignment, CA
  summarize(N = n(),
            N_below200 = sum(!isabove200),
            .groups = "drop") %>% 
  filter(N_below200 != 0)

Number of trials whose responses were NAs (if not 0):

# check number of NA in `isSame`
readRDS(file = here("data", "df_E3_raw.rds")) %>% 
  mutate(isSameNA = is.na(isSame)) %>% 
  group_by(SubjCode) %>% # , Orientation, Cue, Congruency, Alignment, CA
  summarize(N = n(),
            N_NA = sum(isSameNA),
            .groups = "drop") %>% 
  filter(N_NA != 0)
df_E3_raw <- readRDS(file = here("data", "df_E3_raw.rds")) %>% 
  filter(isabove200, # remove trials whose RT was below 200ms
         !is.na(isSame)) # remove trials where no responses were recorded

str(df_E3_raw)
## 'data.frame':    76678 obs. of  12 variables:
##  $ SubjCode   : Factor w/ 120 levels "91","92","93",..: 10 10 10 10 10 10 10 10 10 10 ...
##  $ StimGroup  : Factor w/ 10 levels "F1","F2","F3",..: 9 9 10 3 6 2 9 7 5 2 ...
##  $ Order      : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation: Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Cue        : Factor w/ 2 levels "top","bot": 2 2 2 2 1 2 2 1 1 1 ...
##  $ Congruency : Factor w/ 2 levels "con","inc": 1 1 2 1 2 2 2 1 1 2 ...
##  $ Alignment  : Factor w/ 2 levels "ali","mis": 2 2 1 2 2 1 2 1 1 2 ...
##  $ CA         : Factor w/ 2 levels "sam","dif": 2 1 2 2 2 1 1 1 1 1 ...
##  $ isCorrect  : num  0 1 1 1 1 1 1 0 1 1 ...
##  $ isSame     : int  1 1 0 0 0 1 1 0 1 1 ...
##  $ RT         : num  3404 1680 2222 1189 1655 ...
##  $ isabove200 : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
# apply successive difference coding and add columns for LMM analysis (psychr)
df_E3_lmm <- df_E3_raw %>% 
  psychr::set_contr(c(Orientation, Cue, Congruency, Alignment, CA)) %>% 
  psychr::add_lmmcols(isSame ~ Orientation * Congruency * Alignment * CA + Cue) 
##                                                       old_name
## Ori_C                                           Orientation2-1
## Con_C                                            Congruency2-1
## Ali_C                                             Alignment2-1
## CA_C                                                     CA2-1
## Cue_C                                                   Cue2-1
## Ori_Con                           Orientation2-1:Congruency2-1
## Ori_Ali                            Orientation2-1:Alignment2-1
## Con_Ali                             Congruency2-1:Alignment2-1
## Ori_CA                                    Orientation2-1:CA2-1
## Con_CA                                     Congruency2-1:CA2-1
## Ali_CA                                      Alignment2-1:CA2-1
## Ori_Con_Ali          Orientation2-1:Congruency2-1:Alignment2-1
## Ori_Con_CA                  Orientation2-1:Congruency2-1:CA2-1
## Ori_Ali_CA                   Orientation2-1:Alignment2-1:CA2-1
## Con_Ali_CA                    Congruency2-1:Alignment2-1:CA2-1
## Ori_Con_Ali_CA Orientation2-1:Congruency2-1:Alignment2-1:CA2-1
## [1] "Ori_C + Con_C + Ali_C + CA_C + Cue_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + Ori_Con_Ali_CA"
saveRDS(df_E3_lmm, file = here(dir_lmm, "df_E3_lmm.rds"))
str(df_E3_lmm)
## 'data.frame':    76678 obs. of  28 variables:
##  $ SubjCode      : Factor w/ 120 levels "91","92","93",..: 10 10 10 10 10 10 10 10 10 10 ...
##  $ StimGroup     : Factor w/ 10 levels "F1","F2","F3",..: 9 9 10 3 6 2 9 7 5 2 ...
##  $ Order         : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Orientation   : Factor w/ 2 levels "upr","inv": 1 1 1 1 1 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "upr" "inv"
##   .. .. ..$ : chr "2-1"
##  $ Cue           : Factor w/ 2 levels "top","bot": 2 2 2 2 1 2 2 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "top" "bot"
##   .. .. ..$ : chr "2-1"
##  $ Congruency    : Factor w/ 2 levels "con","inc": 1 1 2 1 2 2 2 1 1 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "con" "inc"
##   .. .. ..$ : chr "2-1"
##  $ Alignment     : Factor w/ 2 levels "ali","mis": 2 2 1 2 2 1 2 1 1 2 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "ali" "mis"
##   .. .. ..$ : chr "2-1"
##  $ CA            : Factor w/ 2 levels "sam","dif": 2 1 2 2 2 1 1 1 1 1 ...
##   ..- attr(*, "contrasts")= num [1:2, 1] -0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "sam" "dif"
##   .. .. ..$ : chr "2-1"
##  $ isCorrect     : num  0 1 1 1 1 1 1 0 1 1 ...
##  $ isSame        : int  1 1 0 0 0 1 1 0 1 1 ...
##  $ RT            : num  3404 1680 2222 1189 1655 ...
##  $ isabove200    : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
##  $ Ori_C         : num  -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ Con_C         : num  -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 -0.5 -0.5 0.5 ...
##  $ Ali_C         : num  0.5 0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 -0.5 0.5 ...
##  $ CA_C          : num  0.5 -0.5 0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
##  $ Cue_C         : num  0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 ...
##  $ Ori_Con       : num  0.25 0.25 -0.25 0.25 -0.25 -0.25 -0.25 0.25 0.25 -0.25 ...
##  $ Ori_Ali       : num  -0.25 -0.25 0.25 -0.25 -0.25 0.25 -0.25 0.25 0.25 -0.25 ...
##  $ Con_Ali       : num  -0.25 -0.25 -0.25 -0.25 0.25 -0.25 0.25 0.25 0.25 0.25 ...
##  $ Ori_CA        : num  -0.25 0.25 -0.25 -0.25 -0.25 0.25 0.25 0.25 0.25 0.25 ...
##  $ Con_CA        : num  -0.25 0.25 0.25 -0.25 0.25 -0.25 -0.25 0.25 0.25 -0.25 ...
##  $ Ali_CA        : num  0.25 -0.25 -0.25 0.25 0.25 0.25 -0.25 0.25 0.25 -0.25 ...
##  $ Ori_Con_Ali   : num  0.125 0.125 0.125 0.125 -0.125 0.125 -0.125 -0.125 -0.125 -0.125 ...
##  $ Ori_Con_CA    : num  0.125 -0.125 -0.125 0.125 -0.125 0.125 0.125 -0.125 -0.125 0.125 ...
##  $ Ori_Ali_CA    : num  -0.125 0.125 0.125 -0.125 -0.125 -0.125 0.125 -0.125 -0.125 0.125 ...
##  $ Con_Ali_CA    : num  -0.125 0.125 -0.125 -0.125 0.125 0.125 -0.125 -0.125 -0.125 -0.125 ...
##  $ Ori_Con_Ali_CA: num  0.0625 -0.0625 0.0625 0.0625 -0.0625 -0.0625 0.0625 0.0625 0.0625 0.0625 ...

2 Demographics

df_subjinfo <- read.csv(file.path("data", "2faces_inversion-demographics.csv")) %>% 
  group_by(Exp) %>% 
  summarize(N_total = n(),
            N_female = sum(Sex=="female"),
            N_male = sum(Sex=="male"),
            Age_mean = mean(Age),
            Age_SD = sd(Age),
            Age_min = min(Age),
            Age_max = max(Age))

df_subjinfo

3 Open data

readRDS(file = here("data", "df_E1_raw.rds")) %>%
  write_csv(file = "data_E1.csv")
readRDS(file = here("data", "df_E2_raw.rds")) %>%
  write_csv(file = "data_E2.csv")
readRDS(file = here("data", "df_E3_raw.rds")) %>%
  write_csv(file = "data_E3.csv")

4 Experiment 1

Visual angle: 11.14°×14.24°

4.1 Behavioral choices (d’)

4.1.1 Fitting the generalized linear mixed-effects models

4.1.1.1 The maximal model

# file_E1_resp_max <- file.path(dir_lmm, "lmm_E1_resp_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E1_resp_max)) {
#   glmm_E1_resp_max <- glmer(
#     isSame ~ Orientation * Congruency * Alignment * CA + Cue +
#       (Orientation * Congruency * Alignment * CA | SubjCode) +
#       (Orientation * Congruency * Alignment * CA | StimGroup), 
#     data = df_E1_lmm,
#     family = binomial(link = "probit"),
#     control = glmerControl(optCtrl = list(maxfun = 1e7))
#   )
# 
#   saveRDS(glmm_E1_resp_max, file = file_E1_resp_max)
# } else {
#   glmm_E1_resp_max <- readRDS(file_E1_resp_max)
# }
# 
# print(summary(glmm_E1_resp_max), corr = FALSE)

4.1.1.2 The zero-correlation-parameter model

file_E1_resp_zcp <- file.path(dir_lmm, "lmm_E1_resp_zcp.rds")

# fit the max model
if (!file.exists(file_E1_resp_zcp)) {
  glmm_E1_resp_zcp <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + 
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + 
         Ori_Con_Ali_CA || SubjCode) +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + 
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + 
         Ori_Con_Ali_CA || StimGroup), 
    data = df_E1_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E1_resp_zcp, file = file_E1_resp_zcp)
} else {
  glmm_E1_resp_zcp <- readRDS(file_E1_resp_zcp)
}

print(summary(glmm_E1_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA +      Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA +      Con_Ali_CA + Ori_Con_Ali_CA || SubjCode) + (Ori_C + Con_C +      Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA +      Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA +      Ori_Con_Ali_CA || StimGroup)
##    Data: df_E1_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24999.6  25398.8 -12450.8  24901.6    25508 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -8.8801 -0.5983  0.2225  0.5394  5.1358 
## 
## Random effects:
##  Groups       Name           Variance  Std.Dev. 
##  SubjCode     (Intercept)    8.502e-02 2.916e-01
##  SubjCode.1   Ori_C          4.480e-02 2.116e-01
##  SubjCode.2   Con_C          5.272e-08 2.296e-04
##  SubjCode.3   Ali_C          2.654e-02 1.629e-01
##  SubjCode.4   CA_C           2.701e-01 5.197e-01
##  SubjCode.5   Ori_Con        4.239e-03 6.511e-02
##  SubjCode.6   Ori_Ali        2.409e-02 1.552e-01
##  SubjCode.7   Con_Ali        3.492e-09 5.909e-05
##  SubjCode.8   Ori_CA         7.518e-02 2.742e-01
##  SubjCode.9   Con_CA         1.839e-01 4.288e-01
##  SubjCode.10  Ali_CA         5.837e-08 2.416e-04
##  SubjCode.11  Ori_Con_Ali    3.276e-08 1.810e-04
##  SubjCode.12  Ori_Con_CA     6.609e-03 8.130e-02
##  SubjCode.13  Ori_Ali_CA     2.386e-09 4.885e-05
##  SubjCode.14  Con_Ali_CA     3.111e-08 1.764e-04
##  SubjCode.15  Ori_Con_Ali_CA 3.912e-07 6.254e-04
##  StimGroup    (Intercept)    6.463e-03 8.039e-02
##  StimGroup.1  Ori_C          1.870e-02 1.368e-01
##  StimGroup.2  Con_C          3.020e-02 1.738e-01
##  StimGroup.3  Ali_C          2.199e-08 1.483e-04
##  StimGroup.4  CA_C           1.725e-02 1.313e-01
##  StimGroup.5  Ori_Con        1.669e-02 1.292e-01
##  StimGroup.6  Ori_Ali        5.099e-03 7.141e-02
##  StimGroup.7  Con_Ali        0.000e+00 0.000e+00
##  StimGroup.8  Ori_CA         1.948e-02 1.396e-01
##  StimGroup.9  Con_CA         9.260e-02 3.043e-01
##  StimGroup.10 Ali_CA         0.000e+00 0.000e+00
##  StimGroup.11 Ori_Con_Ali    3.286e-10 1.813e-05
##  StimGroup.12 Ori_Con_CA     8.581e-10 2.929e-05
##  StimGroup.13 Ori_Ali_CA     3.605e-02 1.899e-01
##  StimGroup.14 Con_Ali_CA     2.634e-08 1.623e-04
##  StimGroup.15 Ori_Con_Ali_CA 3.625e-09 6.021e-05
## Number of obs: 25557, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.262082   0.053578   4.892 1.00e-06 ***
## Orientation2-1                                   0.028174   0.058100   0.485 0.627728    
## Congruency2-1                                    0.018124   0.058268   0.311 0.755767    
## Alignment2-1                                     0.150435   0.032176   4.675 2.93e-06 ***
## CA2-1                                           -1.653298   0.094256 -17.541  < 2e-16 ***
## Cue2-1                                           0.007656   0.018442   0.415 0.678064    
## Orientation2-1:Congruency2-1                     0.099843   0.057067   1.750 0.080193 .  
## Orientation2-1:Alignment2-1                      0.004285   0.050826   0.084 0.932811    
## Congruency2-1:Alignment2-1                       0.080800   0.038116   2.120 0.034019 *  
## Orientation2-1:CA2-1                             0.708224   0.073314   9.660  < 2e-16 ***
## Congruency2-1:CA2-1                              0.804835   0.123905   6.496 8.27e-11 ***
## Alignment2-1:CA2-1                              -0.102802   0.038569  -2.665 0.007689 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.237890   0.076142  -3.124 0.001782 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.797355   0.077845 -10.243  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.226379   0.097490   2.322 0.020229 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.399947   0.076088  -5.256 1.47e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.528141   0.152266   3.469 0.000523 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

4.1.1.3 The reduced model

summary(rePCA(glmm_E1_resp_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]    [,8]    [,9]     [,10]     [,11]     [,12]    [,13]     [,14]     [,15]     [,16]
## Standard deviation     0.5197 0.4288 0.2916 0.2742 0.21165 0.16290 0.15521 0.08130 0.06511 0.0006254 0.0002416 0.0002296 0.000181 0.0001764 5.909e-05 4.885e-05
## Proportion of Variance 0.3749 0.2552 0.1180 0.1043 0.06218 0.03683 0.03344 0.00917 0.00588 0.0000000 0.0000000 0.0000000 0.000000 0.0000000 0.000e+00 0.000e+00
## Cumulative Proportion  0.3749 0.6301 0.7481 0.8525 0.91467 0.95151 0.98494 0.99412 1.00000 1.0000000 1.0000000 1.0000000 1.000000 1.0000000 1.000e+00 1.000e+00
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]     [,10]     [,11]     [,12]     [,13]     [,14] [,15] [,16]
## Standard deviation     0.3043 0.1899 0.1738 0.13956 0.13676 0.13133 0.12918 0.08039 0.07141 0.0001623 0.0001483 6.021e-05 2.929e-05 1.813e-05     0     0
## Proportion of Variance 0.3818 0.1487 0.1245 0.08031 0.07712 0.07112 0.06881 0.02665 0.02103 0.0000000 0.0000000 0.000e+00 0.000e+00 0.000e+00     0     0
## Cumulative Proportion  0.3818 0.5305 0.6550 0.73528 0.81240 0.88352 0.95232 0.97897 1.00000 1.0000000 1.0000000 1.000e+00 1.000e+00 1.000e+00     1     1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_Ali, Ori_Ali_CA, Con_C, Ali_CA, Ori_Con_Ali, Con_Ali_CA, and Ori_Con_Ali_CA;
  • by-StimGroup: Con_Ali, Ali_CA, Ori_Con_Ali, Ori_Con_CA, Ori_Con_Ali_CA, Ali_C, and Con_Ali_CA.
file_E1_resp_rdc <- file.path(dir_lmm, "lmm_E1_resp_rdc.rds")

# fit the reduced model
if (!file.exists(file_E1_resp_rdc)) {
  glmm_E1_resp_rdc <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_Con + Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + 
         Ori_Con_CA || SubjCode # Ori_Ali_CA + Ori_Con_Ali + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (Ori_C + Con_C + CA_C + # Ali_C + 
         Ori_Con + Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + 
         Ori_Ali_CA || StimGroup # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA
      ), # Ori_Con_Ali_CA
    data = df_E1_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E1_resp_rdc, file = file_E1_resp_rdc)
} else {
  glmm_E1_resp_rdc <- readRDS(file_E1_resp_rdc)
}

print(summary(glmm_E1_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_Con + Ori_Ali + Ori_CA + Con_CA + Ori_Con_CA ||      SubjCode) + (Ori_C + Con_C + CA_C + Ori_Con + Ori_Ali + Ori_CA +      Con_CA + Ori_Ali_CA || StimGroup)
##    Data: df_E1_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24971.6  25256.8 -12450.8  24901.6    25522 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -8.8803 -0.5983  0.2225  0.5394  5.1359 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  SubjCode    (Intercept) 0.085014 0.29157 
##  SubjCode.1  Ori_C       0.044808 0.21168 
##  SubjCode.2  Ali_C       0.026531 0.16288 
##  SubjCode.3  CA_C        0.270066 0.51968 
##  SubjCode.4  Ori_Con     0.004239 0.06511 
##  SubjCode.5  Ori_Ali     0.024096 0.15523 
##  SubjCode.6  Ori_CA      0.075207 0.27424 
##  SubjCode.7  Con_CA      0.183851 0.42878 
##  SubjCode.8  Ori_Con_CA  0.006620 0.08136 
##  StimGroup   (Intercept) 0.006460 0.08037 
##  StimGroup.1 Ori_C       0.018703 0.13676 
##  StimGroup.2 Con_C       0.030193 0.17376 
##  StimGroup.3 CA_C        0.017240 0.13130 
##  StimGroup.4 Ori_Con     0.016688 0.12918 
##  StimGroup.5 Ori_Ali     0.005096 0.07139 
##  StimGroup.6 Ori_CA      0.019501 0.13964 
##  StimGroup.7 Con_CA      0.092575 0.30426 
##  StimGroup.8 Ori_Ali_CA  0.036095 0.18999 
## Number of obs: 25557, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.262103   0.053579   4.892 9.99e-07 ***
## Orientation2-1                                   0.028192   0.058107   0.485 0.627550    
## Congruency2-1                                    0.018104   0.058267   0.311 0.756023    
## Alignment2-1                                     0.150436   0.032175   4.676 2.93e-06 ***
## CA2-1                                           -1.653348   0.094258 -17.541  < 2e-16 ***
## Cue2-1                                           0.007670   0.018443   0.416 0.677490    
## Orientation2-1:Congruency2-1                     0.099790   0.057071   1.749 0.080372 .  
## Orientation2-1:Alignment2-1                      0.004318   0.050828   0.085 0.932293    
## Congruency2-1:Alignment2-1                       0.080803   0.038117   2.120 0.034020 *  
## Orientation2-1:CA2-1                             0.708126   0.073343   9.655  < 2e-16 ***
## Congruency2-1:CA2-1                              0.804914   0.123932   6.495 8.31e-11 ***
## Alignment2-1:CA2-1                              -0.102737   0.038570  -2.664 0.007730 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.237928   0.076154  -3.124 0.001782 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.797361   0.077861 -10.241  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.226315   0.097528   2.321 0.020313 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.399963   0.076095  -5.256 1.47e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.528120   0.152337   3.467 0.000527 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.1.1.4 The extended model

file_E1_resp_etd <- file.path(dir_lmm, "lmm_E1_resp_etd.rds")

# fit the reduced model
if (!file.exists(file_E1_resp_etd)) {
  glmm_E1_resp_etd <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_Con + Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + 
         Ori_Con_CA | SubjCode # Ori_Ali_CA + Ori_Con_Ali + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (Ori_C + Con_C + CA_C + # Ali_C + 
         Ori_Con + Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + 
         Ori_Ali_CA | StimGroup # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA
      ), # Ori_Con_Ali_CA
    data = df_E1_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E1_resp_etd, file = file_E1_resp_etd)
} else {
  glmm_E1_resp_etd <- readRDS(file_E1_resp_etd)
}

print(summary(glmm_E1_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_Con + Ori_Ali + Ori_CA + Con_CA + Ori_Con_CA |      SubjCode) + (Ori_C + Con_C + CA_C + Ori_Con + Ori_Ali + Ori_CA +      Con_CA + Ori_Ali_CA | StimGroup)
##    Data: df_E1_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  25000.8  25872.7 -12393.4  24786.8    25450 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -11.9807  -0.5969   0.2212   0.5431   7.3743 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                                           
##  SubjCode  (Intercept) 0.086188 0.29358                                                 
##            Ori_C       0.048232 0.21962  -0.09                                          
##            Ali_C       0.028856 0.16987   0.23  0.16                                    
##            CA_C        0.281309 0.53039  -0.25  0.31 -0.49                              
##            Ori_Con     0.021538 0.14676   0.24 -0.34  0.86 -0.47                        
##            Ori_Ali     0.026876 0.16394  -0.44  0.09 -0.27  0.45 -0.23                  
##            Ori_CA      0.087553 0.29589   0.05 -0.12  0.46 -0.16  0.52 -0.03            
##            Con_CA      0.223566 0.47283  -0.26  0.32  0.35 -0.09  0.17  0.08  0.35      
##            Ori_Con_CA  0.118309 0.34396   0.35 -0.38 -0.11 -0.16  0.06 -0.08 -0.34 -0.94
##  StimGroup (Intercept) 0.006371 0.07982                                                 
##            Ori_C       0.017382 0.13184   0.04                                          
##            Con_C       0.030813 0.17554  -0.21 -0.89                                    
##            CA_C        0.016088 0.12684   0.50  0.52 -0.62                              
##            Ori_Con     0.020778 0.14415  -0.12  0.87 -0.76  0.62                        
##            Ori_Ali     0.009075 0.09526  -0.63 -0.33  0.47 -0.19 -0.19                  
##            Ori_CA      0.019575 0.13991   0.44  0.15  0.09  0.03 -0.16  0.01            
##            Con_CA      0.094485 0.30738  -0.11 -0.77  0.96 -0.55 -0.64  0.35  0.23      
##            Ori_Ali_CA  0.058064 0.24097  -0.04  0.59 -0.73  0.78  0.79 -0.06 -0.48 -0.75
## Number of obs: 25557, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.263700   0.053819   4.900 9.60e-07 ***
## Orientation2-1                                   0.019987   0.057996   0.345 0.730380    
## Congruency2-1                                    0.021907   0.058938   0.372 0.710117    
## Alignment2-1                                     0.159716   0.033263   4.802 1.57e-06 ***
## CA2-1                                           -1.665096   0.095233 -17.484  < 2e-16 ***
## Cue2-1                                           0.007496   0.018466   0.406 0.684808    
## Orientation2-1:Congruency2-1                     0.097563   0.065242   1.495 0.134810    
## Orientation2-1:Alignment2-1                     -0.017095   0.055843  -0.306 0.759504    
## Congruency2-1:Alignment2-1                       0.072661   0.038421   1.891 0.058596 .  
## Orientation2-1:CA2-1                             0.740777   0.076489   9.685  < 2e-16 ***
## Congruency2-1:CA2-1                              0.817784   0.128911   6.344 2.24e-10 ***
## Alignment2-1:CA2-1                              -0.113906   0.039203  -2.906 0.003666 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.226532   0.076969  -2.943 0.003249 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.824606   0.097747  -8.436  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.258646   0.109353   2.365 0.018019 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.396665   0.076459  -5.188 2.13e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.508862   0.153307   3.319 0.000903 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(glmm_E1_resp_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]    [,7]      [,8]      [,9]
## Standard deviation     0.6030 0.5688 0.29609 0.26666 0.18759 0.15312 0.13382 2.531e-05 1.192e-06
## Proportion of Variance 0.3942 0.3507 0.09504 0.07709 0.03815 0.02542 0.01941 0.000e+00 0.000e+00
## Cumulative Proportion  0.3942 0.7449 0.83993 0.91702 0.95517 0.98059 1.00000 1.000e+00 1.000e+00
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]     [,6]     [,7]      [,8]      [,9]
## Standard deviation     0.4432 0.1810 0.14504 0.11604 0.09447 0.000622 0.000162 2.581e-05 4.961e-06
## Proportion of Variance 0.7205 0.1202 0.07716 0.04939 0.03274 0.000000 0.000000 0.000e+00 0.000e+00
## Cumulative Proportion  0.7205 0.8407 0.91788 0.96726 1.00000 1.000000 1.000000 1.000e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con and Ori_Ali;
  • by-StimGroup: (Intercept), Ori_Ali, CA_C and Ori_C.
file_E1_resp_etd2 <- file.path(dir_lmm, "lmm_E1_resp_etd2.rds")

# fit the reduced model
if (!file.exists(file_E1_resp_etd2)) {
  glmm_E1_resp_etd2 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
         Ori_Con_CA | SubjCode # Ori_Ali_CA + Ori_Con_Ali + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (0 + Con_C + # Ali_C + CA_C + Ori_C + 
         Ori_Con + Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Ali + 
         Ori_Ali_CA | StimGroup # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA
      ), # Ori_Con_Ali_CA
    data = df_E1_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E1_resp_etd2, file = file_E1_resp_etd2)
} else {
  glmm_E1_resp_etd2 <- readRDS(file_E1_resp_etd2)
}

print(summary(glmm_E1_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_CA + Con_CA + Ori_Con_CA | SubjCode) +      (0 + Con_C + Ori_Con + Ori_CA + Con_CA + Ori_Ali_CA | StimGroup)
##    Data: df_E1_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  25069.6  25558.5 -12474.8  24949.6    25497 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -8.5188 -0.6113  0.2245  0.5400  7.7086 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                               
##  SubjCode  (Intercept) 0.08390  0.2897                                      
##            Ori_C       0.04465  0.2113   -0.07                              
##            Ali_C       0.02749  0.1658    0.21  0.24                        
##            CA_C        0.26860  0.5183   -0.25  0.26 -0.46                  
##            Ori_CA      0.08194  0.2862    0.02 -0.08  0.40 -0.11            
##            Con_CA      0.21882  0.4678   -0.26  0.37  0.31 -0.07  0.35      
##            Ori_Con_CA  0.11888  0.3448    0.35 -0.41 -0.04 -0.24 -0.30 -0.94
##  StimGroup Con_C       0.03577  0.1891                                      
##            Ori_Con     0.02831  0.1683   -0.84                              
##            Ori_CA      0.02350  0.1533   -0.17  0.20                        
##            Con_CA      0.08697  0.2949    0.97 -0.70 -0.04                  
##            Ori_Ali_CA  0.05914  0.2432   -0.87  0.94 -0.12 -0.78            
## Number of obs: 25557, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.261235   0.046888   5.571 2.53e-08 ***
## Orientation2-1                                   0.029719   0.038974   0.763 0.445729    
## Congruency2-1                                    0.021434   0.062910   0.341 0.733322    
## Alignment2-1                                     0.157951   0.032588   4.847 1.25e-06 ***
## CA2-1                                           -1.649155   0.084414 -19.537  < 2e-16 ***
## Cue2-1                                           0.007871   0.018385   0.428 0.668572    
## Orientation2-1:Congruency2-1                     0.082133   0.066017   1.244 0.213456    
## Orientation2-1:Alignment2-1                     -0.003267   0.038160  -0.086 0.931772    
## Congruency2-1:Alignment2-1                       0.072457   0.038165   1.898 0.057631 .  
## Orientation2-1:CA2-1                             0.723854   0.077659   9.321  < 2e-16 ***
## Congruency2-1:CA2-1                              0.802796   0.125277   6.408 1.47e-10 ***
## Alignment2-1:CA2-1                              -0.110011   0.038718  -2.841 0.004492 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.223784   0.076184  -2.937 0.003310 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.808224   0.095377  -8.474  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.216229   0.108312   1.996 0.045894 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.401548   0.075948  -5.287 1.24e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.557372   0.151898   3.669 0.000243 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0313052 (tol = 0.002, component 1)
summary(rePCA(glmm_E1_resp_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]   [,5]    [,6]      [,7]
## Standard deviation     0.6008 0.5392 0.28075 0.25849 0.1870 0.10915 0.0001569
## Proportion of Variance 0.4276 0.3444 0.09336 0.07914 0.0414 0.01411 0.0000000
## Cumulative Proportion  0.4276 0.7720 0.86535 0.94449 0.9859 1.00000 1.0000000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]      [,4]     [,5]
## Standard deviation     0.4319 0.1632 0.14310 0.0006368 0.000107
## Proportion of Variance 0.7983 0.1140 0.08763 0.0000000 0.000000
## Cumulative Proportion  0.7983 0.9124 1.00000 1.0000000 1.000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con_CA;
  • by-StimGroup: Ori_Ali_CA, and Con_C.
file_E1_resp_etd3 <- file.path(dir_lmm, "lmm_E1_resp_etd3.rds")

# fit the reduced model
if (!file.exists(file_E1_resp_etd3)) {
  glmm_E1_resp_etd3 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + CA_C + # Con_C + Ali_C + 
         Ori_CA + Con_CA | SubjCode # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
       # Ori_Ali_CA + Ori_Con_Ali + Con_Ali_CA + Ori_Con_CA 
      ) + # Ori_Con_Ali_CA 
      (0 + # Ali_C + CA_C + Ori_C + Con_C + 
         Con_CA + Ori_Con + Ori_CA | StimGroup  # Con_Ali + Ali_CA + Ori_Ali + 
       # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA + Ori_Ali_CA
      ), # Ori_Con_Ali_CA
    data = df_E1_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E1_resp_etd3, file = file_E1_resp_etd3)
} else {
  glmm_E1_resp_etd3 <- readRDS(file_E1_resp_etd3)
}

print(summary(glmm_E1_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      CA_C + Ori_CA + Con_CA | SubjCode) + (0 + Con_CA + Ori_Con +      Ori_CA | StimGroup)
##    Data: df_E1_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  25198.2  25507.9 -12561.1  25122.2    25519 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.6825 -0.6220  0.2277  0.5397  5.1265 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                   
##  SubjCode  (Intercept) 0.08274  0.2876                          
##            Ori_C       0.04391  0.2095   -0.06                  
##            CA_C        0.26123  0.5111   -0.26  0.27            
##            Ori_CA      0.07305  0.2703    0.05 -0.16 -0.10      
##            Con_CA      0.18079  0.4252   -0.24  0.35 -0.05  0.20
##  StimGroup Con_CA      0.11582  0.3403                          
##            Ori_Con     0.01657  0.1287   -0.62                  
##            Ori_CA      0.02255  0.1502    0.10  0.15            
## Number of obs: 25557, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.264044   0.046558   5.671 1.42e-08 ***
## Orientation2-1                                   0.026707   0.038652   0.691 0.489588    
## Congruency2-1                                    0.014799   0.019319   0.766 0.443638    
## Alignment2-1                                     0.140870   0.018879   7.462 8.54e-14 ***
## CA2-1                                           -1.632259   0.083253 -19.606  < 2e-16 ***
## Cue2-1                                           0.008586   0.018306   0.469 0.639024    
## Orientation2-1:Congruency2-1                     0.098567   0.055722   1.769 0.076913 .  
## Orientation2-1:Alignment2-1                      0.011218   0.037754   0.297 0.766362    
## Congruency2-1:Alignment2-1                       0.089108   0.037761   2.360 0.018286 *  
## Orientation2-1:CA2-1                             0.697327   0.075247   9.267  < 2e-16 ***
## Congruency2-1:CA2-1                              0.793334   0.132646   5.981 2.22e-09 ***
## Alignment2-1:CA2-1                              -0.091445   0.037758  -2.422 0.015440 *  
## Orientation2-1:Congruency2-1:Alignment2-1       -0.246470   0.075508  -3.264 0.001098 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.806779   0.076180 -10.590  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.214806   0.075510   2.845 0.004445 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.401671   0.075514  -5.319 1.04e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.542030   0.151006   3.589 0.000331 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.1.1.5 The optimal model

anova(glmm_E1_resp_rdc, glmm_E1_resp_etd3, refit=FALSE)

According to BIC, the reduced model is used as the optimal model.

glmm_E1_resp_opt <- glmm_E1_resp_rdc

print(summary(glmm_E1_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_Con + Ori_Ali + Ori_CA + Con_CA + Ori_Con_CA ||      SubjCode) + (Ori_C + Con_C + CA_C + Ori_Con + Ori_Ali + Ori_CA +      Con_CA + Ori_Ali_CA || StimGroup)
##    Data: df_E1_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24971.6  25256.8 -12450.8  24901.6    25522 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -8.8803 -0.5983  0.2225  0.5394  5.1359 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  SubjCode    (Intercept) 0.085014 0.29157 
##  SubjCode.1  Ori_C       0.044808 0.21168 
##  SubjCode.2  Ali_C       0.026531 0.16288 
##  SubjCode.3  CA_C        0.270066 0.51968 
##  SubjCode.4  Ori_Con     0.004239 0.06511 
##  SubjCode.5  Ori_Ali     0.024096 0.15523 
##  SubjCode.6  Ori_CA      0.075207 0.27424 
##  SubjCode.7  Con_CA      0.183851 0.42878 
##  SubjCode.8  Ori_Con_CA  0.006620 0.08136 
##  StimGroup   (Intercept) 0.006460 0.08037 
##  StimGroup.1 Ori_C       0.018703 0.13676 
##  StimGroup.2 Con_C       0.030193 0.17376 
##  StimGroup.3 CA_C        0.017240 0.13130 
##  StimGroup.4 Ori_Con     0.016688 0.12918 
##  StimGroup.5 Ori_Ali     0.005096 0.07139 
##  StimGroup.6 Ori_CA      0.019501 0.13964 
##  StimGroup.7 Con_CA      0.092575 0.30426 
##  StimGroup.8 Ori_Ali_CA  0.036095 0.18999 
## Number of obs: 25557, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.262103   0.053579   4.892 9.99e-07 ***
## Orientation2-1                                   0.028192   0.058107   0.485 0.627550    
## Congruency2-1                                    0.018104   0.058267   0.311 0.756023    
## Alignment2-1                                     0.150436   0.032175   4.676 2.93e-06 ***
## CA2-1                                           -1.653348   0.094258 -17.541  < 2e-16 ***
## Cue2-1                                           0.007670   0.018443   0.416 0.677490    
## Orientation2-1:Congruency2-1                     0.099790   0.057071   1.749 0.080372 .  
## Orientation2-1:Alignment2-1                      0.004318   0.050828   0.085 0.932293    
## Congruency2-1:Alignment2-1                       0.080803   0.038117   2.120 0.034020 *  
## Orientation2-1:CA2-1                             0.708126   0.073343   9.655  < 2e-16 ***
## Congruency2-1:CA2-1                              0.804914   0.123932   6.495 8.31e-11 ***
## Alignment2-1:CA2-1                              -0.102737   0.038570  -2.664 0.007730 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.237928   0.076154  -3.124 0.001782 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.797361   0.077861 -10.241  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.226315   0.097528   2.321 0.020313 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.399963   0.076095  -5.256 1.47e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.528120   0.152337   3.467 0.000527 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.1.2 Estimated marginal means

# hit and false alarm
emm_E1_probit <- emmeans(glmm_E1_resp_opt, 
                         ~ Orientation + Congruency + Alignment + CA,
                         type = "response")
emm_E1_probit
##  Orientation Congruency Alignment CA   prob     SE  df asymp.LCL asymp.UCL
##  upr         con        ali       sam 0.942 0.0118 Inf    0.9151     0.962
##  inv         con        ali       sam 0.823 0.0251 Inf    0.7697     0.868
##  upr         inc        ali       sam 0.750 0.0305 Inf    0.6865     0.806
##  inv         inc        ali       sam 0.781 0.0283 Inf    0.7220     0.833
##  upr         con        mis       sam 0.941 0.0120 Inf    0.9136     0.961
##  inv         con        mis       sam 0.855 0.0222 Inf    0.8075     0.894
##  upr         inc        mis       sam 0.884 0.0193 Inf    0.8419     0.918
##  inv         inc        mis       sam 0.826 0.0248 Inf    0.7733     0.871
##  upr         con        ali       dif 0.137 0.0214 Inf    0.0993     0.183
##  inv         con        ali       dif 0.269 0.0316 Inf    0.2113     0.335
##  upr         inc        ali       dif 0.324 0.0342 Inf    0.2598     0.393
##  inv         inc        ali       dif 0.386 0.0363 Inf    0.3170     0.458
##  upr         con        mis       dif 0.162 0.0238 Inf    0.1195     0.213
##  inv         con        mis       dif 0.343 0.0350 Inf    0.2776     0.414
##  upr         inc        mis       dif 0.314 0.0337 Inf    0.2514     0.383
##  inv         inc        mis       dif 0.426 0.0371 Inf    0.3553     0.500
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Intervals are back-transformed from the probit scale

Sensitivity d’ in each condition:

# sensitivity d'
emm_E1_d <- contrast(emm_E1_probit, "pairwise", simple="CA")
# emmip(emm_E1_d, Congruency ~ Alignment | Orientation, CIs = TRUE)

summary(emm_E1_d[1:8], infer=c(TRUE,FALSE), adjust="none")
##  contrast  Orientation Congruency Alignment estimate    SE  df asymp.LCL asymp.UCL
##  sam - dif upr         con        ali           2.67 0.132 Inf     2.409      2.93
##  sam - dif inv         con        ali           1.54 0.126 Inf     1.295      1.79
##  sam - dif upr         inc        ali           1.13 0.125 Inf     0.887      1.38
##  sam - dif inv         inc        ali           1.07 0.125 Inf     0.823      1.31
##  sam - dif upr         con        mis           2.55 0.131 Inf     2.294      2.81
##  sam - dif inv         con        mis           1.46 0.126 Inf     1.216      1.71
##  sam - dif upr         inc        mis           1.68 0.127 Inf     1.431      1.93
##  sam - dif inv         inc        mis           1.12 0.125 Inf     0.880      1.37
## 
## Results are averaged over the levels of: Cue 
## Note: contrasts are still on the probit scale. Consider using
##       regrid() if you want contrasts of back-transformed estimates. 
## Confidence level used: 0.95

4.1.2.1 Composite effect

Composite effect of d’:

emm_E1_cf_d <- contrast(emm_E1_d, 
                        interaction = "pairwise", 
                        simple = c("Congruency", "Alignment"),
                        infer = TRUE)

summary(emm_E1_cf_d[1:2], side=">")
##  Congruency_pairwise Alignment_pairwise contrast  Orientation estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis          sam - dif upr            0.664 0.114 Inf    0.4760       Inf   5.810  <.0001
##  con - inc           ali - mis          sam - dif inv            0.136 0.101 Inf   -0.0296       Inf   1.351  0.0884
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed

Congruency effect of d’ in aligned condition:

emm_E1_con_d <- contrast(emm_E1_d, 
                         interaction = "pairwise", 
                         simple = "Congruency",
                         infer = TRUE)

summary(emm_E1_con_d[1:2], side=">")
##  Congruency_pairwise contrast  Orientation Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           sam - dif upr         ali          1.536 0.143 Inf     1.301       Inf  10.751  <.0001
##  con - inc           sam - dif inv         ali          0.474 0.138 Inf     0.248       Inf   3.448  0.0003
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E1_cf_d <- emm_E1_d %>%
  summary(infer=TRUE) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(Alignment, estimate, color=Congruency, group=Congruency)) +
  geom_point(size = 2) + # position = position_dodge(width = 0.1),
  geom_line(aes(linetype = Congruency), linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Orientation, switch = "both") +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), linewidth=1.5, width=0, 
                alpha = .6, # position = position_dodge(width = 0.1),
                show.legend = F) + 
  coord_cartesian(ylim = c(0,3.5)) +  # set the limit for y axis c(0, 1100)
  labs(y = expression("Sensitivity"~italic("d'")), fill = "Congruency",
       x = NULL) +  # set the names for main, x and y axises
  geom_text(label = c("***", "", "", "", "", "", "", ""),
            color = "red",
            size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
  NULL
# ggsave(filename = "ccf_d.pdf", plot_ccf_d, width = 8, height = 6)
plot_E1_cf_d

4.1.2.2 Compare composite effects between upright and inverted faces

contrast(emm_E1_d, 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.528 0.152 Inf      0.23     0.827   3.467  0.0005
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

4.1.2.3 Facilitation and interference

# facilitation and interference of d'
emm_E1_d_fi <- contrast(emm_E1_d, 
                        "pairwise", 
                        simple = "Alignment",
                        infer = TRUE, 
                        adjust = "none")
# emmip(emm_E1_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 

emm_E1_d_fi[1:4]
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.1161 0.0941 Inf   -0.0682    0.3005   1.235  0.2170
##  ali - mis sam - dif inv         con          0.0784 0.0789 Inf   -0.0763    0.2330   0.993  0.3205
##  ali - mis sam - dif upr         inc         -0.5479 0.0788 Inf   -0.7023   -0.3935  -6.956  <.0001
##  ali - mis sam - dif inv         inc         -0.0575 0.0760 Inf   -0.2065    0.0915  -0.757  0.4492
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95
summary(emm_E1_d_fi[1:2], side=">")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.1161 0.0941 Inf   -0.0386       Inf   1.235  0.1085
##  ali - mis sam - dif inv         con          0.0784 0.0789 Inf   -0.0514       Inf   0.993  0.1603
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed
summary(emm_E1_d_fi[3:4], side="<")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         inc         -0.5479 0.0788 Inf      -Inf   -0.4183  -6.956  <.0001
##  ali - mis sam - dif inv         inc         -0.0575 0.0760 Inf      -Inf    0.0675  -0.757  0.2246
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E1_cffi_d <- summary(emm_E1_d_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=1.1, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin=asymp.LCL, ymax=asymp.UCL), 
                linewidth=1.5, width=0, alpha=.6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  
  labs(x = NULL, 
       y = expression("Sensitivity"~italic(d)*"' (aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E1_fi_d.pdf", plot_E1_cffi_d, width = 7, height = 4.55)
plot_E1_cffi_d

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of d'
emm_E1_d_fi_ui <- contrast(emm_E1_d, 
                           interaction = "pairwise", 
                           simple = c("Orientation", "Alignment"),
                           infer = TRUE, 
                           adjust = "none")

emm_E1_d_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise contrast  Congruency estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif con          0.0377 0.130 Inf    -0.217     0.292   0.291  0.7713
##  upr - inv            ali - mis          sam - dif inc         -0.4904 0.117 Inf    -0.720    -0.260  -4.179  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

4.1.2.4 Comparisons between facilitation and interference

contrast(emm_E1_d_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2] 
##  contrast  Orientation estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte upr          -0.4318 0.131 Inf    -0.688    -0.176  -3.308  0.0009
##  faci-inte inv           0.0208 0.118 Inf    -0.210     0.252   0.177  0.8596
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

4.1.3 Plot

plot_E1_cf_d_ <- plot_E1_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E1_d <- ggarrange(plot_E1_cf_d_, plot_E1_cffi_d, 
                       labels = c("a", "b"),
                       font.label = (list(size = 18)),
                       widths = c(1.5, 1),
                       nrow = 1)

plot_E1_d

4.2 Correct response times

4.2.1 Fitting the linear mixed-effects models

4.2.1.1 The maximal model

# file_E1_rt_max <- file.path(dir_lmm, "lmm_E1_rt_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E1_rt_max)) {
#   lmm_E1_rt_max <- lmer(
#     log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
#       (Orientation * Congruency * Alignment | SubjCode) +
#       (Orientation * Congruency * Alignment | StimGroup),
#     data = df_E1_lmm |> dplyr::filter(isCorrect==1),
#     control = lmerControl(optCtrl = list(maxfun = 1e7))
#   )
#   
#   saveRDS(lmm_E1_rt_max, file = file_E1_rt_max)
# } else {
#   lmm_E1_rt_max <- readRDS(file_E1_rt_max)
# }
# 
# print(summary(lmm_E1_rt_max), corr = FALSE)

4.2.1.2 The zero-correlation-parameter model

file_E1_rt_zcp <- file.path(dir_lmm, "lmm_E1_rt_zcp.rds")

# fit the zcp model
if (!file.exists(file_E1_rt_zcp)) {
  lmm_E1_rt_zcp <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || SubjCode) +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || StimGroup), 
    data = df_E1_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E1_rt_zcp, file = file_E1_rt_zcp)
} else {
  lmm_E1_rt_zcp <- readRDS(file_E1_rt_zcp)
}

print(summary(lmm_E1_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali ||      SubjCode) + (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali +      Con_Ali + Ori_Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E1_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17951.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2752 -0.6199 -0.1620  0.4507  7.6784 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. 
##  SubjCode    (Intercept) 4.077e-02 2.019e-01
##  SubjCode.1  Ori_C       8.976e-02 2.996e-01
##  SubjCode.2  Con_C       2.225e-04 1.492e-02
##  SubjCode.3  Ali_C       1.157e-03 3.401e-02
##  SubjCode.4  Ori_Con     8.418e-04 2.901e-02
##  SubjCode.5  Ori_Ali     2.533e-04 1.592e-02
##  SubjCode.6  Con_Ali     1.288e-09 3.589e-05
##  SubjCode.7  Ori_Con_Ali 0.000e+00 0.000e+00
##  StimGroup   (Intercept) 2.136e-05 4.622e-03
##  StimGroup.1 Ori_C       2.393e-04 1.547e-02
##  StimGroup.2 Con_C       0.000e+00 0.000e+00
##  StimGroup.3 Ali_C       2.544e-04 1.595e-02
##  StimGroup.4 Ori_Con     4.452e-04 2.110e-02
##  StimGroup.5 Ori_Ali     1.011e-03 3.179e-02
##  StimGroup.6 Con_Ali     2.780e-04 1.667e-02
##  StimGroup.7 Ori_Con_Ali 4.331e-03 6.581e-02
##  Residual                1.442e-01 3.798e-01
## Number of obs: 19357, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.750e+00  3.208e-02  3.916e+01 210.402  < 2e-16 ***
## Orientation2-1                             2.472e-02  4.794e-02  3.971e+01   0.516   0.6090    
## Congruency2-1                              3.338e-02  5.984e-03  3.596e+01   5.579 2.55e-06 ***
## Alignment2-1                              -7.990e-03  9.200e-03  1.667e+01  -0.869   0.3974    
## Cue2-1                                     1.800e-02  5.472e-03  1.910e+04   3.290   0.0010 ** 
## CA2-1                                      6.617e-02  5.532e-03  1.916e+04  11.962  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.377e-02  1.366e-02  9.885e+00  -2.472   0.0332 *  
## Orientation2-1:Alignment2-1               -6.845e-03  1.510e-02  9.071e+00  -0.453   0.6610    
## Congruency2-1:Alignment2-1                -5.279e-02  1.218e-02  8.624e+00  -4.333   0.0021 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  3.257e-02  3.026e-02  9.151e+00   1.077   0.3092    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

4.2.1.3 The reduced model

summary(rePCA(lmm_E1_rt_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]      [,7] [,8]
## Standard deviation     0.7889 0.5317 0.08956 0.07640 0.04191 0.03928 9.451e-05    0
## Proportion of Variance 0.6748 0.3065 0.00870 0.00633 0.00190 0.00167 0.000e+00    0
## Cumulative Proportion  0.6748 0.9814 0.99009 0.99642 0.99833 1.00000 1.000e+00    1
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]    [,3]    [,4]    [,5]    [,6]    [,7] [,8]
## Standard deviation     0.1733 0.08371 0.05556 0.04390 0.04200 0.04073 0.01217    0
## Proportion of Variance 0.6582 0.15359 0.06766 0.04224 0.03866 0.03636 0.00325    0
## Cumulative Proportion  0.6582 0.81183 0.87949 0.92173 0.96039 0.99675 1.00000    1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_Ali, and Ori_Con_Ali.
  • by-StimGroup: Con_C.
file_E1_rt_rdc <- file.path(dir_lmm, "lmm_E1_rt_rdc.rds")

# fit the max model
if (!file.exists(file_E1_rt_rdc)) {
  lmm_E1_rt_rdc <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali || SubjCode # Con_Ali +
      ) + # Ori_Con_Ali
      (Ori_C + Ali_C +  # Con_C + 
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || StimGroup), 
    data = df_E1_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e8))
  )
  
  saveRDS(lmm_E1_rt_rdc, file = file_E1_rt_rdc)
} else {
  lmm_E1_rt_rdc <- readRDS(file_E1_rt_rdc)
}

print(summary(lmm_E1_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali || SubjCode) + (Ori_C +      Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E1_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+08))
## 
## REML criterion at convergence: 17951.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2753 -0.6198 -0.1619  0.4507  7.6784 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 4.077e-02 0.20192 
##  SubjCode.1  Ori_C       8.974e-02 0.29957 
##  SubjCode.2  Con_C       2.224e-04 0.01491 
##  SubjCode.3  Ali_C       1.157e-03 0.03401 
##  SubjCode.4  Ori_Con     8.459e-04 0.02908 
##  SubjCode.5  Ori_Ali     2.540e-04 0.01594 
##  StimGroup   (Intercept) 2.135e-05 0.00462 
##  StimGroup.1 Ori_C       2.391e-04 0.01546 
##  StimGroup.2 Ali_C       2.543e-04 0.01595 
##  StimGroup.3 Ori_Con     4.462e-04 0.02112 
##  StimGroup.4 Ori_Ali     1.011e-03 0.03179 
##  StimGroup.5 Con_Ali     2.777e-04 0.01666 
##  StimGroup.6 Ori_Con_Ali 4.323e-03 0.06575 
##  Residual                1.442e-01 0.37977 
## Number of obs: 19357, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.750e+00  3.208e-02  3.916e+01 210.399  < 2e-16 ***
## Orientation2-1                             2.472e-02  4.794e-02  3.972e+01   0.516   0.6090    
## Congruency2-1                              3.338e-02  5.983e-03  3.596e+01   5.579 2.55e-06 ***
## Alignment2-1                              -7.990e-03  9.199e-03  1.667e+01  -0.869   0.3974    
## Cue2-1                                     1.800e-02  5.472e-03  1.910e+04   3.290   0.0010 ** 
## CA2-1                                      6.617e-02  5.532e-03  1.916e+04  11.962  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.377e-02  1.367e-02  9.894e+00  -2.471   0.0333 *  
## Orientation2-1:Alignment2-1               -6.845e-03  1.510e-02  9.072e+00  -0.453   0.6610    
## Congruency2-1:Alignment2-1                -5.279e-02  1.218e-02  8.623e+00  -4.333   0.0021 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  3.258e-02  3.024e-02  9.159e+00   1.077   0.3090    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00255145 (tol = 0.002, component 1)
summary(rePCA(lmm_E1_rt_rdc))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]
## Standard deviation     0.7888 0.5317 0.08956 0.07658 0.04197 0.03927
## Proportion of Variance 0.6748 0.3066 0.00870 0.00636 0.00191 0.00167
## Cumulative Proportion  0.6748 0.9814 0.99006 0.99642 0.99833 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]    [,3]    [,4]    [,5]    [,6]    [,7]
## Standard deviation     0.1731 0.08372 0.05562 0.04388 0.04199 0.04071 0.01217
## Proportion of Variance 0.6577 0.15380 0.06789 0.04225 0.03870 0.03637 0.00325
## Cumulative Proportion  0.6577 0.81154 0.87943 0.92168 0.96038 0.99675 1.00000

4.2.1.4 The extended model

file_E1_rt_etd <- file.path(dir_lmm, "lmm_E1_rt_etd.rds")

# fit the max model
if (!file.exists(file_E1_rt_etd)) {
  lmm_E1_rt_etd <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali | SubjCode # Con_Ali + 
      ) + # Ori_Con_Ali
      (Ori_C + Ali_C +  # Con_C + 
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali | StimGroup), 
    data = df_E1_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e8))
  )
  
  saveRDS(lmm_E1_rt_etd, file = file_E1_rt_etd)
} else {
  lmm_E1_rt_etd <- readRDS(file_E1_rt_etd)
}

print(summary(lmm_E1_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali | SubjCode) + (Ori_C +      Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E1_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+08))
## 
## REML criterion at convergence: 17928.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3038 -0.6209 -0.1614  0.4462  7.6147 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr                               
##  SubjCode  (Intercept) 4.080e-02 0.201993                                    
##            Ori_C       8.973e-02 0.299555 -0.08                              
##            Con_C       2.024e-04 0.014228  0.10 -1.00                        
##            Ali_C       1.211e-03 0.034793 -0.07  0.13 -0.13                  
##            Ori_Con     9.771e-04 0.031258  0.04 -0.34  0.34 -0.02            
##            Ori_Ali     8.671e-04 0.029447  0.21 -0.46  0.46  0.69  0.55      
##  StimGroup (Intercept) 4.451e-05 0.006672                                    
##            Ori_C       2.786e-04 0.016690 -0.31                              
##            Ali_C       3.236e-04 0.017990  0.05 -0.36                        
##            Ori_Con     6.689e-04 0.025863 -0.99  0.18  0.09                  
##            Ori_Ali     1.321e-03 0.036346  0.59  0.13  0.29 -0.58            
##            Con_Ali     8.666e-04 0.029437 -0.62  0.18  0.43  0.66 -0.55      
##            Ori_Con_Ali 5.010e-03 0.070780  0.43  0.25 -0.01 -0.46 -0.07  0.29
##  Residual              1.441e-01 0.379572                                    
## Number of obs: 19357, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.749e+00  3.213e-02  3.935e+01 210.087  < 2e-16 ***
## Orientation2-1                             2.488e-02  4.797e-02  3.984e+01   0.519  0.60694    
## Congruency2-1                              3.330e-02  5.935e-03  1.415e+02   5.611 1.02e-07 ***
## Alignment2-1                              -7.968e-03  9.637e-03  1.741e+01  -0.827  0.41956    
## Cue2-1                                     1.799e-02  5.471e-03  1.917e+04   3.289  0.00101 ** 
## CA2-1                                      6.618e-02  5.529e-03  1.920e+04  11.970  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.386e-02  1.456e-02  1.177e+01  -2.325  0.03879 *  
## Orientation2-1:Alignment2-1               -5.946e-03  1.656e-02  1.139e+01  -0.359  0.72619    
## Congruency2-1:Alignment2-1                -5.327e-02  1.439e-02  1.128e+01  -3.701  0.00335 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  3.180e-02  3.135e-02  9.699e+00   1.015  0.33497    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E1_rt_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]      [,5] [,6]
## Standard deviation     0.7935 0.5294 0.11203 0.07903 5.102e-05    0
## Proportion of Variance 0.6780 0.3018 0.01352 0.00673 0.000e+00    0
## Cumulative Proportion  0.6780 0.9798 0.99327 1.00000 1.000e+00    1
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]      [,5]     [,6]      [,7]
## Standard deviation     0.1910 0.1216 0.07104 0.05280 0.0001159 4.38e-05 4.225e-20
## Proportion of Variance 0.6172 0.2502 0.08541 0.04718 0.0000000 0.00e+00 0.000e+00
## Cumulative Proportion  0.6172 0.8674 0.95282 1.00000 1.0000000 1.00e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C, Ori_Ali, and Ori_Con;
  • by-StimGroup: (Intercept), Ori_C and Ali_C.
file_E1_rt_etd2 <- file.path(dir_lmm, "lmm_E1_rt_etd2.rds")

# fit the max model
if (!file.exists(file_E1_rt_etd2)) {
  lmm_E1_rt_etd2 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Ali_C | SubjCode  # Con_C + 
       # Con_Ali + Ori_Con  + Ori_Ali
      ) + # Ori_Con_Ali
      (0 + # Con_C + Ori_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali | StimGroup), 
    data = df_E1_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E1_rt_etd2, file = file_E1_rt_etd2)
} else {
  lmm_E1_rt_etd2 <- readRDS(file_E1_rt_etd2)
}

print(summary(lmm_E1_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ali_C | SubjCode) + (0 + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali |      StimGroup)
##    Data: dplyr::filter(df_E1_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17951
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2798 -0.6204 -0.1616  0.4498  7.7318 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr             
##  SubjCode  (Intercept) 0.0407815 0.20194                   
##            Ori_C       0.0897102 0.29952  -0.07            
##            Ali_C       0.0011508 0.03392  -0.08  0.13      
##  StimGroup Ori_Con     0.0006487 0.02547                   
##            Ori_Ali     0.0010711 0.03273  -0.45            
##            Con_Ali     0.0005217 0.02284   0.14 -0.95      
##            Ori_Con_Ali 0.0050242 0.07088  -0.82 -0.15  0.46
##  Residual              0.1444376 0.38005                   
## Number of obs: 19357, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.750e+00  3.205e-02  3.902e+01 210.592  < 2e-16 ***
## Orientation2-1                             2.486e-02  4.768e-02  3.899e+01   0.521  0.60498    
## Congruency2-1                              3.334e-02  5.497e-03  1.923e+04   6.064 1.35e-09 ***
## Alignment2-1                              -7.982e-03  7.686e-03  3.935e+01  -1.039  0.30534    
## Cue2-1                                     1.816e-02  5.474e-03  1.923e+04   3.318  0.00091 ***
## CA2-1                                      6.620e-02  5.533e-03  1.924e+04  11.965  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.395e-02  1.363e-02  1.218e+01  -2.491  0.02810 *  
## Orientation2-1:Alignment2-1               -6.894e-03  1.509e-02  9.908e+00  -0.457  0.65772    
## Congruency2-1:Alignment2-1                -5.326e-02  1.315e-02  1.280e+01  -4.050  0.00142 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  3.140e-02  3.139e-02  9.751e+00   1.000  0.34136    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E1_rt_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]
## Standard deviation     0.7900 0.5287 0.08825
## Proportion of Variance 0.6848 0.3067 0.00854
## Cumulative Proportion  0.6848 0.9915 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]     [,3]      [,4]
## Standard deviation     0.1967 0.1077 0.000343 4.992e-20
## Proportion of Variance 0.7692 0.2308 0.000000 0.000e+00
## Cumulative Proportion  0.7692 1.0000 1.000000 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ali_C;
  • by-StimGroup: Ori_Con and Con_Ali.
file_E1_rt_etd3 <- file.path(dir_lmm, "lmm_E1_rt_etd3.rds")

# fit the max model
if (!file.exists(file_E1_rt_etd3)) {
  lmm_E1_rt_etd3 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C | SubjCode  # Con_C + + Ali_C
       # Con_Ali + Ori_Con  + Ori_Ali
      ) + # Ori_Con_Ali
      (0 + # Con_C + Ori_C + Ali_C +  
         Ori_Ali + # Ori_Con + Con_Ali + 
         Ori_Con_Ali | StimGroup), 
    data = df_E1_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E1_rt_etd3, file = file_E1_rt_etd3)
} else {
  lmm_E1_rt_etd3 <- readRDS(file_E1_rt_etd3)
}

print(summary(lmm_E1_rt_etd3), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C |      SubjCode) + (0 + Ori_Ali + Ori_Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E1_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17968.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2739 -0.6201 -0.1636  0.4479  7.7175 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr 
##  SubjCode  (Intercept) 0.0407523 0.20187       
##            Ori_C       0.0896344 0.29939  -0.07
##  StimGroup Ori_Ali     0.0009359 0.03059       
##            Ori_Con_Ali 0.0044377 0.06662  -0.15
##  Residual              0.1447965 0.38052       
## Number of obs: 19357, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.750e+00  3.204e-02  3.902e+01 210.667  < 2e-16 ***
## Orientation2-1                             2.468e-02  4.766e-02  3.899e+01   0.518 0.607430    
## Congruency2-1                              3.350e-02  5.504e-03  1.926e+04   6.088 1.17e-09 ***
## Alignment2-1                              -9.034e-03  5.499e-03  1.926e+04  -1.643 0.100397    
## Cue2-1                                     1.809e-02  5.479e-03  1.926e+04   3.302 0.000963 ***
## CA2-1                                      6.651e-02  5.538e-03  1.926e+04  12.010  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.407e-02  1.100e-02  1.926e+04  -3.096 0.001966 ** 
## Orientation2-1:Alignment2-1               -6.885e-03  1.465e-02  9.221e+00  -0.470 0.649242    
## Congruency2-1:Alignment2-1                -5.365e-02  1.099e-02  1.926e+04  -4.880 1.07e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1  3.309e-02  3.046e-02  9.148e+00   1.086 0.305116    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.2.1.5 The optimal model

anova(lmm_E1_rt_rdc, lmm_E1_rt_etd3, refit=FALSE)

According to BIC, the extended model is used as the optimal model.

lmm_E1_rt_opt <- lmm_E1_rt_etd3

print(summary(lmm_E1_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C |      SubjCode) + (0 + Ori_Ali + Ori_Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E1_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17968.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2739 -0.6201 -0.1636  0.4479  7.7175 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr 
##  SubjCode  (Intercept) 0.0407523 0.20187       
##            Ori_C       0.0896344 0.29939  -0.07
##  StimGroup Ori_Ali     0.0009359 0.03059       
##            Ori_Con_Ali 0.0044377 0.06662  -0.15
##  Residual              0.1447965 0.38052       
## Number of obs: 19357, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.750e+00  3.204e-02  3.902e+01 210.667  < 2e-16 ***
## Orientation2-1                             2.468e-02  4.766e-02  3.899e+01   0.518 0.607430    
## Congruency2-1                              3.350e-02  5.504e-03  1.926e+04   6.088 1.17e-09 ***
## Alignment2-1                              -9.034e-03  5.499e-03  1.926e+04  -1.643 0.100397    
## Cue2-1                                     1.809e-02  5.479e-03  1.926e+04   3.302 0.000963 ***
## CA2-1                                      6.651e-02  5.538e-03  1.926e+04  12.010  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.407e-02  1.100e-02  1.926e+04  -3.096 0.001966 ** 
## Orientation2-1:Alignment2-1               -6.885e-03  1.465e-02  9.221e+00  -0.470 0.649242    
## Congruency2-1:Alignment2-1                -5.365e-02  1.099e-02  1.926e+04  -4.880 1.07e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1  3.309e-02  3.046e-02  9.148e+00   1.086 0.305116    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.2.2 Estimated marginal means

emm_E1_rt <- emmeans(lmm_E1_rt_opt, ~ Orientation + Congruency + Alignment,
                     pbkrtest.limit = 2e5,
                     lmerTest.limit = 2e5)
# emmip(regrid(emm_E1_rt), Congruency ~ Alignment | Orientation, CIs = TRUE)

summary(emm_E1_rt, type = "response") # equivalent to regrid(emm_E1_rt)
##  Orientation Congruency Alignment response   SE   df lower.CL upper.CL
##  upr         con        ali            810 34.0 41.4      744      882
##  inv         con        ali            855 33.5 42.1      790      925
##  upr         inc        ali            883 37.1 41.9      811      961
##  inv         inc        ali            885 34.8 42.2      818      958
##  upr         con        mis            834 35.0 41.4      767      908
##  inv         con        mis            860 33.8 42.2      794      931
##  upr         inc        mis            847 35.6 41.6      779      922
##  inv         inc        mis            858 33.7 42.2      793      929
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale

4.2.2.1 Composite effect

Composite effect of d’:

emm_E1_rt_cf <- contrast(regrid(emm_E1_rt), 
                         interaction = "pairwise", 
                         by = "Orientation", 
                         infer = TRUE)

summary(emm_E1_rt_cf[1:2], side="<")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr            -59.5 15.8 41.4     -Inf   -32.93  -3.772  0.0003
##  con - inc           ali - mis          inv            -32.3 16.6 42.1     -Inf    -4.37  -1.945  0.0292
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed

Congruency effect of rt in aligned condition:

emm_E1_rt_con <- contrast(regrid(emm_E1_rt), 
                          interaction = "pairwise", 
                          by = c("Orientation", "Alignment"),
                          infer = TRUE)

summary(emm_E1_rt_con[1:2], side="<")
##  Congruency_pairwise Orientation Alignment estimate   SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           upr         ali          -72.4 10.6 41.4     -Inf    -54.5  -6.803  <.0001
##  con - inc           inv         ali          -30.5 10.9 42.1     -Inf    -12.2  -2.800  0.0038
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E1_cf_rt <- summary(emm_E1_rt, type = "response") %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Orientation, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "*", "", "", "", ""), color = sig_color, size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  NULL

# ggsave(filename = "E1_cf_rt.pdf", plot_E1_cf_rt, width = 8, height = 4.8)

plot_E1_cf_rt

4.2.2.2 Compare composite effects between upright and inverted faces

contrast(regrid(emm_E1_rt), 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE   df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -27.2 26.1 41.4      -80     25.6  -1.041  0.3039
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

4.2.2.3 Facilitation and interference

emm_E1_rt_fi <- contrast(regrid(emm_E1_rt), 
                         "pairwise", 
                         by = c("Orientation", "Congruency"), 
                         infer = TRUE, 
                         adjust = "none")
# emmip(emm_E1_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 

emm_E1_rt_fi[1:4]
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con          -24.26 10.5 41.4   -45.52     -3.0  -2.304  0.0263
##  ali - mis inv         con           -5.21 11.5 42.1   -28.46     18.0  -0.452  0.6535
##  ali - mis upr         inc           35.19 11.3 41.6    12.31     58.1   3.105  0.0034
##  ali - mis inv         inc           27.04 11.6 42.2     3.58     50.5   2.325  0.0249
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95
summary(emm_E1_rt_fi[1:2], side="<")
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con          -24.26 10.5 41.4     -Inf    -6.54  -2.304  0.0132
##  ali - mis inv         con           -5.21 11.5 42.1     -Inf    14.17  -0.452  0.3267
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
summary(emm_E1_rt_fi[3:4], side=">")
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc            35.2 11.3 41.6    16.12      Inf   3.105  0.0017
##  ali - mis inv         inc            27.0 11.6 42.2     7.48      Inf   2.325  0.0125
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E1_cffi_rt <- summary(emm_E1_rt_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=100, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E1_fi_rt.pdf", plot_E1_cffi_rt, width = 7, height = 4.55)
plot_E1_cffi_rt

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of rt
emm_E1_rt_fi_ui <- contrast(emm_E1_rt, 
                            interaction = "pairwise", 
                            by = "Congruency", 
                            infer = TRUE, 
                            adjust = "none")

emm_E1_rt_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise Congruency estimate     SE   df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con        -0.02343 0.0215 9.22  -0.0718   0.0249  -1.092  0.3025
##  upr - inv            ali - mis          inc         0.00966 0.0208 9.33  -0.0371   0.0565   0.464  0.6530
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: satterthwaite 
## Results are given on the log (not the response) scale. 
## Confidence level used: 0.95

4.2.2.4 Comparisons between facilitation and interference

contrast(emm_E1_rt_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2]
##  contrast  Orientation estimate   SE   df lower.CL upper.CL t.ratio p.value
##  faci-inte upr             10.9 15.2 41.4    -19.7     41.6   0.720  0.4754
##  faci-inte inv             21.8 16.2 42.1    -10.8     54.4   1.351  0.1839
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

4.2.3 Plot

plot_E1_cf_rt_ <- plot_E1_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E1_rt <- ggarrange(plot_E1_cf_rt_, plot_E1_cffi_rt, 
                        labels = c("a", "b"),
                        font.label = (list(size = 18)),
                        widths = c(1.5, 1),
                        nrow = 1)

plot_E1_rt

4.3 Plot

plot_E1 <- ggarrange(plot_E1_cf_d_, plot_E1_cffi_d, 
                     plot_E1_cf_rt_, plot_E1_cffi_rt,
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 18)),
                     widths = c(1.5, 1),
                     nrow = 2,
                     ncol = 2)

plot_E1

5 Experiment 2

Visual angle: 5.57°×7.12°

5.1 Behavioral choices (d’)

5.1.1 Fitting the generalized linear mixed-effects models

5.1.1.1 The maximal model

# file_E2_resp_max <- file.path(dir_lmm, "lmm_E2_resp_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E2_resp_max)) {
#   glmm_E2_resp_max <- glmer(
#     isSame ~ Orientation * Congruency * Alignment * CA + Cue +
#       (Orientation * Congruency * Alignment * CA | SubjCode) +
#       (Orientation * Congruency * Alignment * CA | StimGroup), 
#     data = df_E2_lmm,
#     family = binomial(link = "probit"),
#     control = glmerControl(optCtrl = list(maxfun = 1e7))
#   )
# 
#   saveRDS(glmm_E2_resp_max, file = file_E2_resp_max)
# } else {
#   glmm_E2_resp_max <- readRDS(file_E2_resp_max)
# }
# 
# print(summary(glmm_E2_resp_max), corr = FALSE)

5.1.1.2 The zero-correlation-parameter model

file_E2_resp_zcp <- file.path(dir_lmm, "lmm_E2_resp_zcp.rds")

# fit the zcp model
if (!file.exists(file_E2_resp_zcp)) {
  glmm_E2_resp_zcp <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Con_C + Ali_C + CA_C +  
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + 
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + 
         Ori_Con_Ali_CA || SubjCode) +
      (Ori_C + Con_C + Ali_C + CA_C +  
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + 
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + 
         Ori_Con_Ali_CA || StimGroup), 
    data = df_E2_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E2_resp_zcp, file = file_E2_resp_zcp)
} else {
  glmm_E2_resp_zcp <- readRDS(file_E2_resp_zcp)
}

print(summary(glmm_E2_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA +      Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA +      Con_Ali_CA + Ori_Con_Ali_CA || SubjCode) + (Ori_C + Con_C +      Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA +      Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA +      Ori_Con_Ali_CA || StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24317.5  24716.9 -12109.8  24219.5    25544 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -9.3770 -0.5479  0.1944  0.5237  8.3244 
## 
## Random effects:
##  Groups       Name           Variance  Std.Dev. 
##  SubjCode     (Intercept)    7.863e-02 2.804e-01
##  SubjCode.1   Ori_C          4.847e-02 2.202e-01
##  SubjCode.2   Con_C          8.078e-03 8.988e-02
##  SubjCode.3   Ali_C          2.818e-02 1.679e-01
##  SubjCode.4   CA_C           2.235e-01 4.727e-01
##  SubjCode.5   Ori_Con        6.457e-08 2.541e-04
##  SubjCode.6   Ori_Ali        1.551e-02 1.245e-01
##  SubjCode.7   Con_Ali        3.731e-10 1.932e-05
##  SubjCode.8   Ori_CA         2.890e-01 5.376e-01
##  SubjCode.9   Con_CA         2.610e-01 5.109e-01
##  SubjCode.10  Ali_CA         5.123e-10 2.263e-05
##  SubjCode.11  Ori_Con_Ali    4.667e-02 2.160e-01
##  SubjCode.12  Ori_Con_CA     2.666e-01 5.163e-01
##  SubjCode.13  Ori_Ali_CA     6.641e-10 2.577e-05
##  SubjCode.14  Con_Ali_CA     3.270e-02 1.808e-01
##  SubjCode.15  Ori_Con_Ali_CA 5.601e-06 2.367e-03
##  StimGroup    (Intercept)    8.713e-03 9.335e-02
##  StimGroup.1  Ori_C          2.001e-02 1.414e-01
##  StimGroup.2  Con_C          4.608e-02 2.147e-01
##  StimGroup.3  Ali_C          0.000e+00 0.000e+00
##  StimGroup.4  CA_C           2.145e-02 1.465e-01
##  StimGroup.5  Ori_Con        1.411e-02 1.188e-01
##  StimGroup.6  Ori_Ali        0.000e+00 0.000e+00
##  StimGroup.7  Con_Ali        2.607e-09 5.106e-05
##  StimGroup.8  Ori_CA         2.524e-02 1.589e-01
##  StimGroup.9  Con_CA         1.330e-01 3.647e-01
##  StimGroup.10 Ali_CA         2.780e-03 5.273e-02
##  StimGroup.11 Ori_Con_Ali    4.581e-03 6.768e-02
##  StimGroup.12 Ori_Con_CA     7.916e-07 8.897e-04
##  StimGroup.13 Ori_Ali_CA     1.845e-09 4.296e-05
##  StimGroup.14 Con_Ali_CA     2.824e-02 1.681e-01
##  StimGroup.15 Ori_Con_Ali_CA 1.665e-03 4.080e-02
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16071    0.05423   2.964  0.00304 ** 
## Orientation2-1                                   0.14941    0.06015   2.484  0.01300 *  
## Congruency2-1                                    0.03120    0.07217   0.432  0.66548    
## Alignment2-1                                     0.18949    0.03297   5.748 9.02e-09 ***
## CA2-1                                           -1.75056    0.09036 -19.373  < 2e-16 ***
## Cue2-1                                           0.01578    0.01870   0.844  0.39878    
## Orientation2-1:Congruency2-1                     0.09971    0.05454   1.828  0.06750 .  
## Orientation2-1:Alignment2-1                     -0.09997    0.04363  -2.292  0.02193 *  
## Congruency2-1:Alignment2-1                       0.11981    0.03891   3.079  0.00208 ** 
## Orientation2-1:CA2-1                             0.82057    0.10678   7.685 1.53e-14 ***
## Congruency2-1:CA2-1                              1.03144    0.14640   7.045 1.85e-12 ***
## Alignment2-1:CA2-1                              -0.03507    0.04262  -0.823  0.41056    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.13590    0.08755  -1.552  0.12060    
## Orientation2-1:Congruency2-1:CA2-1              -0.91281    0.11385  -8.017 1.08e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.21323    0.07784   2.739  0.00616 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.44154    0.09832  -4.491 7.10e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.59126    0.15598   3.791  0.00015 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

5.1.1.3 The reduced model

summary(rePCA(glmm_E2_resp_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]    [,8]   [,9]   [,10]   [,11]    [,12]     [,13]     [,14]     [,15]     [,16]
## Standard deviation     0.5376 0.5163 0.5109 0.4727 0.28041 0.22016 0.21602 0.18083 0.1679 0.12454 0.08988 0.002367 0.0002541 2.577e-05 2.263e-05 1.932e-05
## Proportion of Variance 0.2226 0.2053 0.2011 0.1721 0.06056 0.03733 0.03594 0.02518 0.0217 0.01195 0.00622 0.000000 0.0000000 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion  0.2226 0.4279 0.6290 0.8011 0.86167 0.89900 0.93494 0.96013 0.9818 0.99377 1.00000 1.000000 1.0000000 1.000e+00 1.000e+00 1.000e+00
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]   [,6]    [,7]    [,8]    [,9]   [,10]   [,11]     [,12]     [,13]     [,14] [,15] [,16]
## Standard deviation     0.3647 0.2147 0.16806 0.15888 0.14645 0.1414 0.11880 0.09335 0.06768 0.05273 0.04080 0.0008897 5.106e-05 4.296e-05     0     0
## Proportion of Variance 0.4349 0.1506 0.09233 0.08252 0.07011 0.0654 0.04614 0.02848 0.01497 0.00909 0.00544 0.0000000 0.000e+00 0.000e+00     0     0
## Cumulative Proportion  0.4349 0.5855 0.67784 0.76036 0.83047 0.8959 0.94201 0.97049 0.98547 0.99456 1.00000 1.0000000 1.000e+00 1.000e+00     1     1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_Ali, Ali_CA, Ori_Con, Ori_Ali_CA, and Ori_Con_Ali_CA;
  • by-StimGroup: Ali_C, Ori_Ali, Con_Ali, Ori_Con_CA, and Ori_Ali_CA.
file_E2_resp_rdc <- file.path(dir_lmm, "lmm_E2_resp_rdc.rds")

# fit the reduced model
if (!file.exists(file_E2_resp_rdc)) {
  glmm_E2_resp_rdc <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con +
         Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA || SubjCode # + Ori_Ali_CA +
      ) + # Ori_Con_Ali_CA
      (Ori_C + Con_C + CA_C +  # Ali_C +
         Ori_Con + Ori_CA + Con_CA + Ali_CA + # Ori_Ali + Con_Ali + 
         Ori_Con_Ali + Con_Ali_CA + # Ori_Con_CA + Ori_Ali_CA +
         Ori_Con_Ali_CA || StimGroup),
    data = df_E2_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E2_resp_rdc, file = file_E2_resp_rdc)
} else {
  glmm_E2_resp_rdc <- readRDS(file_E2_resp_rdc)
}

print(summary(glmm_E2_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Con_C + Ali_C + CA_C + Ori_Ali + Ori_CA + Con_CA + Ori_Con_Ali +      Ori_Con_CA + Con_Ali_CA || SubjCode) + (Ori_C + Con_C + CA_C +      Ori_Con + Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Con_Ali_CA +      Ori_Con_Ali_CA || StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24297.5  24615.4 -12109.8  24219.5    25554 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -9.3764 -0.5479  0.1944  0.5237  8.3235 
## 
## Random effects:
##  Groups       Name           Variance Std.Dev.
##  SubjCode     (Intercept)    0.078661 0.28047 
##  SubjCode.1   Ori_C          0.048485 0.22019 
##  SubjCode.2   Con_C          0.008082 0.08990 
##  SubjCode.3   Ali_C          0.028147 0.16777 
##  SubjCode.4   CA_C           0.223514 0.47277 
##  SubjCode.5   Ori_Ali        0.015514 0.12456 
##  SubjCode.6   Ori_CA         0.289040 0.53762 
##  SubjCode.7   Con_CA         0.260946 0.51083 
##  SubjCode.8   Ori_Con_Ali    0.046578 0.21582 
##  SubjCode.9   Ori_Con_CA     0.266491 0.51623 
##  SubjCode.10  Con_Ali_CA     0.032721 0.18089 
##  StimGroup    (Intercept)    0.008721 0.09339 
##  StimGroup.1  Ori_C          0.019992 0.14139 
##  StimGroup.2  Con_C          0.046057 0.21461 
##  StimGroup.3  CA_C           0.021446 0.14645 
##  StimGroup.4  Ori_Con        0.014106 0.11877 
##  StimGroup.5  Ori_CA         0.025244 0.15888 
##  StimGroup.6  Con_CA         0.133154 0.36490 
##  StimGroup.7  Ali_CA         0.002774 0.05267 
##  StimGroup.8  Ori_Con_Ali    0.004614 0.06793 
##  StimGroup.9  Con_Ali_CA     0.028261 0.16811 
##  StimGroup.10 Ori_Con_Ali_CA 0.001513 0.03890 
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16069    0.05424   2.963  0.00305 ** 
## Orientation2-1                                   0.14950    0.06015   2.486  0.01293 *  
## Congruency2-1                                    0.03122    0.07216   0.433  0.66531    
## Alignment2-1                                     0.18948    0.03295   5.750 8.93e-09 ***
## CA2-1                                           -1.75077    0.09037 -19.374  < 2e-16 ***
## Cue2-1                                           0.01576    0.01870   0.843  0.39929    
## Orientation2-1:Congruency2-1                     0.09969    0.05453   1.828  0.06751 .  
## Orientation2-1:Alignment2-1                     -0.09994    0.04363  -2.291  0.02198 *  
## Congruency2-1:Alignment2-1                       0.11985    0.03891   3.080  0.00207 ** 
## Orientation2-1:CA2-1                             0.82052    0.10678   7.684 1.54e-14 ***
## Congruency2-1:CA2-1                              1.03147    0.14643   7.044 1.86e-12 ***
## Alignment2-1:CA2-1                              -0.03505    0.04261  -0.823  0.41077    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.13594    0.08755  -1.553  0.12049    
## Orientation2-1:Congruency2-1:CA2-1              -0.91272    0.11381  -8.020 1.06e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.21328    0.07784   2.740  0.00615 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.44141    0.09834  -4.489 7.17e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.59115    0.15590   3.792  0.00015 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.1.1.4 The extended model

file_E2_resp_etd <- file.path(dir_lmm, "lmm_E2_resp_etd.rds")

# fit the reduced model
if (!file.exists(file_E2_resp_etd)) {
  glmm_E2_resp_etd <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con +
         Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA | SubjCode # + Ori_Ali_CA +
      ) + # Ori_Con_Ali_CA
      (Ori_C + Con_C + CA_C +  # Ali_C +
         Ori_Con + Ori_CA + Con_CA + Ali_CA + # Ori_Ali + Con_Ali + 
         Ori_Con_Ali + Con_Ali_CA + # Ori_Con_CA + Ori_Ali_CA +
         Ori_Con_Ali_CA | StimGroup),
    data = df_E2_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E2_resp_etd, file = file_E2_resp_etd)
} else {
  glmm_E2_resp_etd <- readRDS(file_E2_resp_etd)
}

print(summary(glmm_E2_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Con_C + Ali_C + CA_C + Ori_Ali + Ori_CA + Con_CA + Ori_Con_Ali +      Ori_Con_CA + Con_Ali_CA | SubjCode) + (Ori_C + Con_C + CA_C +      Ori_Con + Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Con_Ali_CA +      Ori_Con_Ali_CA | StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24364.9  25579.3 -12033.5  24066.9    25444 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -11.8795  -0.5479   0.1705   0.5252   7.7222 
## 
## Random effects:
##  Groups    Name           Variance Std.Dev. Corr                                                       
##  SubjCode  (Intercept)    0.080015 0.28287                                                             
##            Ori_C          0.049231 0.22188   0.04                                                      
##            Con_C          0.010746 0.10366  -0.10 -0.08                                                
##            Ali_C          0.029271 0.17109   0.58  0.01 -0.22                                          
##            CA_C           0.232291 0.48197  -0.24  0.27 -0.41 -0.15                                    
##            Ori_Ali        0.025487 0.15965  -0.28  0.06  0.60 -0.29 -0.34                              
##            Ori_CA         0.316858 0.56290   0.17  0.11 -0.06 -0.09 -0.36  0.11                        
##            Con_CA         0.277643 0.52692   0.18  0.02 -0.65  0.22  0.00 -0.63 -0.14                  
##            Ori_Con_Ali    0.095177 0.30851  -0.37  0.55  0.29 -0.20  0.38 -0.06 -0.26 -0.05            
##            Ori_Con_CA     0.327049 0.57188  -0.01  0.03  0.50 -0.37  0.19  0.50 -0.44 -0.47  0.23      
##            Con_Ali_CA     0.070766 0.26602  -0.25  0.00 -0.42  0.12  0.23 -0.06 -0.65  0.56 -0.06 -0.03
##  StimGroup (Intercept)    0.008301 0.09111                                                             
##            Ori_C          0.019411 0.13932   0.11                                                      
##            Con_C          0.047449 0.21783  -0.20 -0.57                                                
##            CA_C           0.022579 0.15026   0.81 -0.04 -0.46                                          
##            Ori_Con        0.016526 0.12855  -0.42  0.47 -0.71 -0.02                                    
##            Ori_CA         0.030375 0.17428  -0.28  0.80 -0.42 -0.48  0.38                              
##            Con_CA         0.134526 0.36678  -0.33 -0.45  0.97 -0.55 -0.60 -0.29                        
##            Ali_CA         0.009877 0.09938   0.52  0.25 -0.03  0.31 -0.01 -0.16 -0.14                  
##            Ori_Con_Ali    0.043920 0.20957  -0.04 -0.35  0.43  0.11 -0.35 -0.43  0.52 -0.50            
##            Con_Ali_CA     0.048000 0.21909  -0.34  0.10 -0.03 -0.49  0.27  0.31 -0.10  0.41 -0.87      
##            Ori_Con_Ali_CA 0.068844 0.26238  -0.59 -0.44  0.12 -0.31  0.40 -0.27  0.07  0.11 -0.35  0.65
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16377    0.05424   3.020 0.002532 ** 
## Orientation2-1                                   0.13990    0.06012   2.327 0.019967 *  
## Congruency2-1                                    0.03053    0.07380   0.414 0.679068    
## Alignment2-1                                     0.19273    0.03380   5.701 1.19e-08 ***
## CA2-1                                           -1.76452    0.09231 -19.115  < 2e-16 ***
## Cue2-1                                           0.01553    0.01873   0.829 0.407003    
## Orientation2-1:Congruency2-1                     0.10403    0.05780   1.800 0.071899 .  
## Orientation2-1:Alignment2-1                     -0.10273    0.04773  -2.152 0.031366 *  
## Congruency2-1:Alignment2-1                       0.12646    0.04052   3.121 0.001801 ** 
## Orientation2-1:CA2-1                             0.85247    0.11297   7.546 4.49e-14 ***
## Congruency2-1:CA2-1                              1.04972    0.14890   7.050 1.79e-12 ***
## Alignment2-1:CA2-1                              -0.05672    0.05103  -1.111 0.266407    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.13499    0.11518  -1.172 0.241178    
## Orientation2-1:Congruency2-1:CA2-1              -0.93868    0.12263  -7.654 1.94e-14 ***
## Orientation2-1:Alignment2-1:CA2-1                0.22215    0.08063   2.755 0.005866 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.44647    0.11383  -3.922 8.77e-05 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.62810    0.18083   3.473 0.000514 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(glmm_E2_resp_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]    [,10]     [,11]
## Standard deviation     0.7428 0.6493 0.4620 0.33199 0.31252 0.26350 0.19634 0.09705 0.05046 0.001481 0.0005527
## Proportion of Variance 0.3643 0.2783 0.1409 0.07277 0.06449 0.04584 0.02545 0.00622 0.00168 0.000000 0.0000000
## Cumulative Proportion  0.3643 0.6426 0.7835 0.85631 0.92080 0.96664 0.99210 0.99832 1.00000 1.000000 1.0000000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]     [,6]      [,7]      [,8]      [,9]     [,10]     [,11]
## Standard deviation     0.4674 0.3553 0.2466 0.18359 0.10307 0.001793 0.0004636 0.0001787 0.0001428 9.252e-05 1.218e-06
## Proportion of Variance 0.4856 0.2807 0.1352 0.07494 0.02362 0.000010 0.0000000 0.0000000 0.0000000 0.000e+00 0.000e+00
## Cumulative Proportion  0.4856 0.7663 0.9014 0.97638 0.99999 1.000000 1.0000000 1.0000000 1.0000000 1.000e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C, Ori_Ali, Ali_C, and Ori_C;
  • by-StimGroup: (Intercept), Ori_C, Ori_Con, Ali_CA, CA_C, and Ori_CA.
file_E2_resp_etd2 <- file.path(dir_lmm, "lmm_E2_resp_etd2.rds")

# fit the reduced model
if (!file.exists(file_E2_resp_etd2)) {
  glmm_E2_resp_etd2 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (CA_C +  # Con_C + Ali_C + Ori_C + 
         Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
         Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA | SubjCode # + Ori_Ali_CA +
      ) + # Ori_Con_Ali_CA
      (0 + Con_C + # Ali_C +   Ori_C + CA_C + 
         Con_CA + # Ori_Ali + Con_Ali + Ori_Con + Ali_CA + Ori_CA + 
         Ori_Con_Ali + Con_Ali_CA + # Ori_Con_CA + Ori_Ali_CA +
         Ori_Con_Ali_CA | StimGroup),
    data = df_E2_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E2_resp_etd2, file = file_E2_resp_etd2)
} else {
  glmm_E2_resp_etd2 <- readRDS(file_E2_resp_etd2)
}

print(summary(glmm_E2_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (CA_C +      Ori_CA + Con_CA + Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA |      SubjCode) + (0 + Con_C + Con_CA + Ori_Con_Ali + Con_Ali_CA +      Ori_Con_Ali_CA | StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24559.1  25048.1 -12219.5  24439.1    25533 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -13.9049  -0.5604   0.2071   0.5267   8.4867 
## 
## Random effects:
##  Groups    Name           Variance Std.Dev. Corr                               
##  SubjCode  (Intercept)    0.07560  0.2750                                      
##            CA_C           0.22945  0.4790   -0.24                              
##            Ori_CA         0.29734  0.5453    0.13 -0.34                        
##            Con_CA         0.24662  0.4966    0.17  0.00 -0.14                  
##            Ori_Con_Ali    0.05579  0.2362   -0.54  0.43 -0.25 -0.26            
##            Ori_Con_CA     0.30738  0.5544    0.04  0.18 -0.46 -0.48  0.61      
##            Con_Ali_CA     0.05233  0.2287   -0.29  0.23 -0.73  0.55 -0.06 -0.04
##  StimGroup Con_C          0.04569  0.2137                                      
##            Con_CA         0.12156  0.3487    0.98                              
##            Ori_Con_Ali    0.04025  0.2006    0.51  0.63                        
##            Con_Ali_CA     0.05067  0.2251   -0.05 -0.21 -0.89                  
##            Ori_Con_Ali_CA 0.03302  0.1817   -0.03 -0.05 -0.54  0.64            
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16334    0.04461   3.661 0.000251 ***
## Orientation2-1                                   0.14587    0.01973   7.393 1.43e-13 ***
## Congruency2-1                                    0.02215    0.07039   0.315 0.752970    
## Alignment2-1                                     0.18006    0.01926   9.347  < 2e-16 ***
## CA2-1                                           -1.72180    0.07847 -21.942  < 2e-16 ***
## Cue2-1                                           0.01550    0.01853   0.836 0.403015    
## Orientation2-1:Congruency2-1                     0.09630    0.03924   2.454 0.014121 *  
## Orientation2-1:Alignment2-1                     -0.09553    0.03856  -2.478 0.013219 *  
## Congruency2-1:Alignment2-1                       0.12991    0.03913   3.320 0.000901 ***
## Orientation2-1:CA2-1                             0.81874    0.09510   8.609  < 2e-16 ***
## Congruency2-1:CA2-1                              1.01926    0.14118   7.219 5.22e-13 ***
## Alignment2-1:CA2-1                              -0.01356    0.03851  -0.352 0.724732    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.15794    0.10707  -1.475 0.140202    
## Orientation2-1:Congruency2-1:CA2-1              -0.92910    0.11872  -7.826 5.04e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.18486    0.07708   2.398 0.016472 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.45846    0.11143  -4.114 3.89e-05 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.66619    0.16671   3.996 6.44e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0227189 (tol = 0.002, component 1)
summary(rePCA(glmm_E2_resp_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]     [,7]
## Standard deviation     0.7232 0.6017 0.4443 0.31396 0.26356 0.11813 0.002299
## Proportion of Variance 0.4136 0.2863 0.1561 0.07795 0.05493 0.01104 0.000000
## Cumulative Proportion  0.4136 0.7000 0.8561 0.93403 0.98896 1.00000 1.000000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]      [,5]
## Standard deviation     0.4362 0.2909 0.12752 0.00148 0.0007104
## Proportion of Variance 0.6535 0.2906 0.05585 0.00001 0.0000000
## Cumulative Proportion  0.6535 0.9441 0.99999 1.00000 1.0000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_Ali_CA;
  • by-StimGroup: Con_C, and Ori_Con_Ali.
file_E2_resp_etd3 <- file.path(dir_lmm, "lmm_E2_resp_etd3.rds")

# fit the reduced model
if (!file.exists(file_E2_resp_etd3)) {
  glmm_E2_resp_etd3 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (CA_C +  # Con_C + Ali_C + Ori_C + 
         Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
         Ori_Con_Ali + Ori_Con_CA | SubjCode # + Ori_Ali_CA + + Con_Ali_CA
      ) + # Ori_Con_Ali_CA
      (0 + # Ali_C + Ori_C + CA_C + Con_C + 
         Con_CA + # Ori_Ali + Con_Ali + Ori_Con + Ali_CA + Ori_CA + 
         Con_Ali_CA + # Ori_Con_CA + Ori_Ali_CA + Ori_Con_Ali + 
         Ori_Con_Ali_CA | StimGroup),
    data = df_E2_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E2_resp_etd3, file = file_E2_resp_etd3)
} else {
  glmm_E2_resp_etd3 <- readRDS(file_E2_resp_etd3)
}

print(summary(glmm_E2_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (CA_C +      Ori_CA + Con_CA + Ori_Con_Ali + Ori_Con_CA | SubjCode) +      (0 + Con_CA + Con_Ali_CA + Ori_Con_Ali_CA | StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24666.4  25025.0 -12289.2  24578.4    25549 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -12.5553  -0.5650   0.2032   0.5294   6.9378 
## 
## Random effects:
##  Groups    Name           Variance Std.Dev. Corr                         
##  SubjCode  (Intercept)    0.07506  0.2740                                
##            CA_C           0.22593  0.4753   -0.25                        
##            Ori_CA         0.28797  0.5366    0.13 -0.32                  
##            Con_CA         0.24688  0.4969    0.17  0.00 -0.14            
##            Ori_Con_Ali    0.04712  0.2171   -0.57  0.48 -0.30 -0.27      
##            Ori_Con_CA     0.30165  0.5492    0.04  0.17 -0.46 -0.48  0.69
##  StimGroup Con_CA         0.14647  0.3827                                
##            Con_Ali_CA     0.03001  0.1732   -0.05                        
##            Ori_Con_Ali_CA 0.02413  0.1553   -0.05  1.00                  
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16790    0.04445   3.778 0.000158 ***
## Orientation2-1                                   0.14167    0.01962   7.222 5.13e-13 ***
## Congruency2-1                                    0.01737    0.01958   0.887 0.374897    
## Alignment2-1                                     0.17791    0.01913   9.300  < 2e-16 ***
## CA2-1                                           -1.71265    0.07788 -21.991  < 2e-16 ***
## Cue2-1                                           0.01590    0.01847   0.861 0.389412    
## Orientation2-1:Congruency2-1                     0.10054    0.03911   2.571 0.010154 *  
## Orientation2-1:Alignment2-1                     -0.09243    0.03832  -2.412 0.015857 *  
## Congruency2-1:Alignment2-1                       0.12660    0.03837   3.300 0.000969 ***
## Orientation2-1:CA2-1                             0.80702    0.09380   8.604  < 2e-16 ***
## Congruency2-1:CA2-1                              1.01338    0.14979   6.765 1.33e-11 ***
## Alignment2-1:CA2-1                              -0.01584    0.03822  -0.414 0.678607    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.16045    0.08470  -1.894 0.058189 .  
## Orientation2-1:Congruency2-1:CA2-1              -0.92640    0.11792  -7.856 3.96e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.19515    0.07651   2.551 0.010752 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.44413    0.09397  -4.726 2.29e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.63604    0.16274   3.908 9.30e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0228383 (tol = 0.002, component 1)
summary(rePCA(glmm_E2_resp_etd3))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]     [,6]
## Standard deviation     0.7129 0.5689 0.4414 0.30413 0.25590 0.003967
## Proportion of Variance 0.4290 0.2732 0.1645 0.07808 0.05528 0.000010
## Cumulative Proportion  0.4290 0.7022 0.8666 0.94471 0.99999 1.000000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]      [,3]
## Standard deviation     0.3830 0.2322 0.0005789
## Proportion of Variance 0.7311 0.2689 0.0000000
## Cumulative Proportion  0.7311 1.0000 1.0000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con_Ali;
  • by-StimGroup: Ori_Con_Ali_CA.
file_E2_resp_etd4 <- file.path(dir_lmm, "lmm_E2_resp_etd4.rds")

# fit the reduced model
if (!file.exists(file_E2_resp_etd4)) {
  glmm_E2_resp_etd4 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (CA_C +  # Con_C + Ali_C + Ori_C + 
         Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
         Ori_Con_CA | SubjCode # + Ori_Ali_CA + + Con_Ali_CA + Ori_Con_Ali
      ) + # Ori_Con_Ali_CA
      (0 + # Ali_C + Ori_C + CA_C + Con_C + 
         Con_CA + # Ori_Ali + Con_Ali + Ori_Con + Ali_CA + Ori_CA + 
         Con_Ali_CA | StimGroup # Ori_Con_CA + Ori_Ali_CA + Ori_Con_Ali + 
      ), # Ori_Con_Ali_CA
    data = df_E2_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E2_resp_etd4, file = file_E2_resp_etd4)
} else {
  glmm_E2_resp_etd4 <- readRDS(file_E2_resp_etd4)
}

print(summary(glmm_E2_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (CA_C +      Ori_CA + Con_CA + Ori_Con_CA | SubjCode) + (0 + Con_CA +      Con_Ali_CA | StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24654.8  24940.0 -12292.4  24584.8    25558 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -12.1589  -0.5663   0.2062   0.5279   6.7438 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                   
##  SubjCode  (Intercept) 0.07469  0.2733                          
##            CA_C        0.22552  0.4749   -0.25                  
##            Ori_CA      0.28794  0.5366    0.13 -0.32            
##            Con_CA      0.24538  0.4954    0.18  0.00 -0.14      
##            Ori_Con_CA  0.30144  0.5490    0.03  0.18 -0.46 -0.48
##  StimGroup Con_CA      0.14633  0.3825                          
##            Con_Ali_CA  0.03129  0.1769   -0.05                  
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16756    0.04434   3.779 0.000158 ***
## Orientation2-1                                   0.14212    0.01961   7.249 4.20e-13 ***
## Congruency2-1                                    0.01727    0.01957   0.883 0.377388    
## Alignment2-1                                     0.18074    0.01907   9.479  < 2e-16 ***
## CA2-1                                           -1.71177    0.07781 -22.000  < 2e-16 ***
## Cue2-1                                           0.01584    0.01847   0.858 0.390921    
## Orientation2-1:Congruency2-1                     0.10204    0.03908   2.611 0.009034 ** 
## Orientation2-1:Alignment2-1                     -0.09708    0.03813  -2.546 0.010902 *  
## Congruency2-1:Alignment2-1                       0.12105    0.03813   3.175 0.001501 ** 
## Orientation2-1:CA2-1                             0.80695    0.09378   8.605  < 2e-16 ***
## Congruency2-1:CA2-1                              1.01398    0.14955   6.780 1.20e-11 ***
## Alignment2-1:CA2-1                              -0.01781    0.03819  -0.466 0.640886    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.13768    0.07626  -1.805 0.071017 .  
## Orientation2-1:Congruency2-1:CA2-1              -0.92989    0.11786  -7.890 3.03e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.20020    0.07625   2.625 0.008653 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.43929    0.09458  -4.645 3.40e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.58678    0.15253   3.847 0.000120 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.1.1.5 The optimal model

anova(glmm_E2_resp_rdc, glmm_E2_resp_etd4, refit=FALSE)

According to BIC, the reduced model is used as the optimal model.

glmm_E2_resp_opt <- glmm_E2_resp_rdc

print(summary(glmm_E2_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Con_C + Ali_C + CA_C + Ori_Ali + Ori_CA + Con_CA + Ori_Con_Ali +      Ori_Con_CA + Con_Ali_CA || SubjCode) + (Ori_C + Con_C + CA_C +      Ori_Con + Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Con_Ali_CA +      Ori_Con_Ali_CA || StimGroup)
##    Data: df_E2_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  24297.5  24615.4 -12109.8  24219.5    25554 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -9.3764 -0.5479  0.1944  0.5237  8.3235 
## 
## Random effects:
##  Groups       Name           Variance Std.Dev.
##  SubjCode     (Intercept)    0.078661 0.28047 
##  SubjCode.1   Ori_C          0.048485 0.22019 
##  SubjCode.2   Con_C          0.008082 0.08990 
##  SubjCode.3   Ali_C          0.028147 0.16777 
##  SubjCode.4   CA_C           0.223514 0.47277 
##  SubjCode.5   Ori_Ali        0.015514 0.12456 
##  SubjCode.6   Ori_CA         0.289040 0.53762 
##  SubjCode.7   Con_CA         0.260946 0.51083 
##  SubjCode.8   Ori_Con_Ali    0.046578 0.21582 
##  SubjCode.9   Ori_Con_CA     0.266491 0.51623 
##  SubjCode.10  Con_Ali_CA     0.032721 0.18089 
##  StimGroup    (Intercept)    0.008721 0.09339 
##  StimGroup.1  Ori_C          0.019992 0.14139 
##  StimGroup.2  Con_C          0.046057 0.21461 
##  StimGroup.3  CA_C           0.021446 0.14645 
##  StimGroup.4  Ori_Con        0.014106 0.11877 
##  StimGroup.5  Ori_CA         0.025244 0.15888 
##  StimGroup.6  Con_CA         0.133154 0.36490 
##  StimGroup.7  Ali_CA         0.002774 0.05267 
##  StimGroup.8  Ori_Con_Ali    0.004614 0.06793 
##  StimGroup.9  Con_Ali_CA     0.028261 0.16811 
##  StimGroup.10 Ori_Con_Ali_CA 0.001513 0.03890 
## Number of obs: 25593, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.16069    0.05424   2.963  0.00305 ** 
## Orientation2-1                                   0.14950    0.06015   2.486  0.01293 *  
## Congruency2-1                                    0.03122    0.07216   0.433  0.66531    
## Alignment2-1                                     0.18948    0.03295   5.750 8.93e-09 ***
## CA2-1                                           -1.75077    0.09037 -19.374  < 2e-16 ***
## Cue2-1                                           0.01576    0.01870   0.843  0.39929    
## Orientation2-1:Congruency2-1                     0.09969    0.05453   1.828  0.06751 .  
## Orientation2-1:Alignment2-1                     -0.09994    0.04363  -2.291  0.02198 *  
## Congruency2-1:Alignment2-1                       0.11985    0.03891   3.080  0.00207 ** 
## Orientation2-1:CA2-1                             0.82052    0.10678   7.684 1.54e-14 ***
## Congruency2-1:CA2-1                              1.03147    0.14643   7.044 1.86e-12 ***
## Alignment2-1:CA2-1                              -0.03505    0.04261  -0.823  0.41077    
## Orientation2-1:Congruency2-1:Alignment2-1       -0.13594    0.08755  -1.553  0.12049    
## Orientation2-1:Congruency2-1:CA2-1              -0.91272    0.11381  -8.020 1.06e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.21328    0.07784   2.740  0.00615 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.44141    0.09834  -4.489 7.17e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.59115    0.15590   3.792  0.00015 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.1.2 Estimated marginal means

# hit and false alarm
emm_E2_probit <- emmeans(glmm_E2_resp_opt, 
                         ~ Orientation + Congruency + Alignment + CA,
                         type = "response")
emm_E2_probit
##  Orientation Congruency Alignment CA    prob     SE  df asymp.LCL asymp.UCL
##  upr         con        ali       sam 0.9372 0.0133 Inf    0.9066     0.959
##  inv         con        ali       sam 0.8385 0.0252 Inf    0.7842     0.883
##  upr         inc        ali       sam 0.6883 0.0359 Inf    0.6149     0.755
##  inv         inc        ali       sam 0.7641 0.0314 Inf    0.6984     0.821
##  upr         con        mis       sam 0.9411 0.0127 Inf    0.9117     0.962
##  inv         con        mis       sam 0.8484 0.0243 Inf    0.7958     0.891
##  upr         inc        mis       sam 0.8598 0.0232 Inf    0.8094     0.900
##  inv         inc        mis       sam 0.8121 0.0277 Inf    0.7531     0.861
##  upr         con        ali       dif 0.0685 0.0142 Inf    0.0449     0.101
##  inv         con        ali       dif 0.2382 0.0316 Inf    0.1809     0.304
##  upr         inc        ali       dif 0.2511 0.0324 Inf    0.1920     0.319
##  inv         inc        ali       dif 0.3696 0.0382 Inf    0.2977     0.446
##  upr         con        mis       dif 0.1098 0.0197 Inf    0.0759     0.153
##  inv         con        mis       dif 0.2994 0.0353 Inf    0.2341     0.372
##  upr         inc        mis       dif 0.2767 0.0341 Inf    0.2141     0.347
##  inv         inc        mis       dif 0.4332 0.0397 Inf    0.3572     0.512
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Intervals are back-transformed from the probit scale

Sensitivity d’ in each condition:

# sensitivity d'
emm_E2_d <- contrast(emm_E2_probit, 
                     "pairwise", 
                     simple="CA",
                     infer=c(TRUE,FALSE), 
                     adjust="none")
# emmip(emm_E2_d, Congruency ~ Alignment | Orientation, CIs = TRUE)

emm_E2_d[1:8]
##  contrast  Orientation Congruency Alignment estimate    SE  df asymp.LCL asymp.UCL
##  sam - dif upr         con        ali           3.02 0.144 Inf     2.736      3.30
##  sam - dif inv         con        ali           1.70 0.137 Inf     1.433      1.97
##  sam - dif upr         inc        ali           1.16 0.135 Inf     0.897      1.43
##  sam - dif inv         inc        ali           1.05 0.135 Inf     0.788      1.32
##  sam - dif upr         con        mis           2.79 0.143 Inf     2.512      3.07
##  sam - dif inv         con        mis           1.56 0.137 Inf     1.288      1.82
##  sam - dif upr         inc        mis           1.67 0.137 Inf     1.404      1.94
##  sam - dif inv         inc        mis           1.05 0.135 Inf     0.788      1.32
## 
## Results are averaged over the levels of: Cue 
## Note: contrasts are still on the probit scale. Consider using
##       regrid() if you want contrasts of back-transformed estimates. 
## Confidence level used: 0.95

5.1.2.1 Composite effect

Composite effect of d’:

emm_E2_cf_d <- contrast(emm_E2_d, 
                        interaction="pairwise", 
                        simple = c("Congruency", "Alignment"),
                        by = "Orientation",
                        infer = TRUE)

summary(emm_E2_cf_d[1:2], side=">")
##  Congruency_pairwise Alignment_pairwise contrast  Orientation estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis          sam - dif upr            0.737 0.133 Inf    0.5189       Inf   5.560  <.0001
##  con - inc           ali - mis          sam - dif inv            0.146 0.118 Inf   -0.0482       Inf   1.236  0.1082
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed

Congruency effect of d’ in aligned condition:

emm_E2_con_d <- contrast(emm_E2_d, 
                         interaction="pairwise", 
                         simple = "Congruency",
                         infer = TRUE)

summary(emm_E2_con_d[c(1,2)], side=">")
##  Congruency_pairwise contrast  Orientation Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           sam - dif upr         ali          1.856 0.172 Inf     1.573       Inf  10.779  <.0001
##  con - inc           sam - dif inv         ali          0.648 0.166 Inf     0.375       Inf   3.906  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E2_cf_d <- emm_E2_d %>%
  summary(infer=TRUE) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(Alignment, estimate, color=Congruency, group=Congruency)) +
  geom_point(size = 2) + # position = position_dodge(width = 0.1),
  geom_line(aes(linetype = Congruency), linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Orientation, switch = "both") +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), linewidth=1.5, width=0, 
                alpha = .6, # position = position_dodge(width = 0.1),
                show.legend = F) + 
  coord_cartesian(ylim = c(0,3.5)) +  # set the limit for y axis c(0, 1100)
  labs(y = expression("Sensitivity"~italic("d'")), fill = "Congruency",
       x = NULL) +  # set the names for main, x and y axises
  geom_text(label = c("***", "", "", "", "", "", "", ""),
            color = "red",
            size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
  NULL
# ggsave(filename = "ccf_d.pdf", plot_ccf_d, width = 8, height = 6)
plot_E2_cf_d

5.1.2.2 Compare composite effects between upright and inverted faces

contrast(emm_E2_d, 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.591 0.156 Inf     0.286     0.897   3.792  0.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

5.1.2.3 Facilitation and interference

# facilitation and interference of d'
emm_E2_d_fi <- contrast(emm_E2_d, 
                        "pairwise", 
                        simple = "Alignment",
                        infer = TRUE, 
                        adjust = "none")
# emmip(emm_E2_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 

emm_E2_d_fi[1:4]
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con         0.22680 0.0997 Inf    0.0314     0.422   2.275  0.0229
##  ali - mis sam - dif inv         con         0.14451 0.0818 Inf   -0.0158     0.305   1.767  0.0773
##  ali - mis sam - dif upr         inc        -0.51018 0.0803 Inf   -0.6675    -0.353  -6.356  <.0001
##  ali - mis sam - dif inv         inc        -0.00132 0.0774 Inf   -0.1531     0.150  -0.017  0.9864
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95
summary(emm_E2_d_fi[1:2], side=">")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con           0.227 0.0997 Inf   0.06281       Inf   2.275  0.0115
##  ali - mis sam - dif inv         con           0.145 0.0818 Inf   0.00997       Inf   1.767  0.0386
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed
summary(emm_E2_d_fi[3:4], side="<")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         inc        -0.51018 0.0803 Inf      -Inf    -0.378  -6.356  <.0001
##  ali - mis sam - dif inv         inc        -0.00132 0.0774 Inf      -Inf     0.126  -0.017  0.4932
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E2_cffi_d <- summary(emm_E2_d_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=1.1, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, 
       y = expression("Sensitivity"~italic(d)*"' (aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E2_fi_d.pdf", plot_E2_cffi_d, width = 7, height = 4.55)
plot_E2_cffi_d

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of d'
emm_E2_d_fi_ui <- contrast(emm_E2_d, 
                           interaction = "pairwise", 
                           simple = c("Orientation", "Alignment"), 
                           infer = TRUE, 
                           adjust = "none")

emm_E2_d_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise contrast  Congruency estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif con          0.0823 0.119 Inf    -0.151     0.316   0.690  0.4902
##  upr - inv            ali - mis          sam - dif inc         -0.5089 0.100 Inf    -0.705    -0.312  -5.077  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

5.1.2.4 Comparisons between facilitation and interference

contrast(emm_E2_d_fi, 
         method = list("faci-inte"=c(1, 1)), 
         simple = "Congruency",
         infer = TRUE)[1:2]
##  contrast2 contrast1 contrast  Orientation estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte ali - mis sam - dif upr           -0.283 0.123 Inf   -0.5250   -0.0418  -2.299  0.0215
##  faci-inte ali - mis sam - dif inv            0.143 0.107 Inf   -0.0665    0.3529   1.338  0.1808
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

5.1.3 Plot

plot_E2_cf_d_ <- plot_E2_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E2_d <- ggarrange(plot_E2_cf_d_, plot_E2_cffi_d, 
                       labels = c("a", "b"),
                       font.label = (list(size = 18)),
                       widths = c(1.5, 1),
                       nrow = 1)

plot_E2_d

5.2 Correct response times

5.2.1 Fitting the linear mixed-effects models

5.2.1.1 The maximal model

# file_E2_rt_max <- file.path(dir_lmm, "lmm_E2_rt_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E2_rt_max)) {
#   lmm_E2_rt_max <- lmer(
#     log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
#       (Orientation * Congruency * Alignment | SubjCode) +
#       (Orientation * Congruency * Alignment | StimGroup),
#     data = df_E2_lmm |> dplyr::filter(isCorrect==1),
#     control = lmerControl(optCtrl = list(maxfun = 1e7))
#   )
#   
#   saveRDS(lmm_E2_rt_max, file = file_E2_rt_max)
# } else {
#   lmm_E2_rt_max <- readRDS(file_E2_rt_max)
# }
# 
# print(summary(lmm_E2_rt_max), corr = FALSE)

5.2.1.2 The zero-correlation-parameter model

file_E2_rt_zcp <- file.path(dir_lmm, "lmm_E2_rt_zcp.rds")

# fit the zcp model
if (!file.exists(file_E2_rt_zcp)) {
  lmm_E2_rt_zcp <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || SubjCode) +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || StimGroup), 
    data = df_E2_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E2_rt_zcp, file = file_E2_rt_zcp)
} else {
  lmm_E2_rt_zcp <- readRDS(file_E2_rt_zcp)
}

print(summary(lmm_E2_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali ||      SubjCode) + (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali +      Con_Ali + Ori_Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E2_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17838.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5627 -0.6463 -0.1684  0.4609  6.8346 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 4.189e-02 0.204670
##  SubjCode.1  Ori_C       7.936e-02 0.281710
##  SubjCode.2  Con_C       3.628e-04 0.019049
##  SubjCode.3  Ali_C       6.429e-04 0.025356
##  SubjCode.4  Ori_Con     2.163e-03 0.046504
##  SubjCode.5  Ori_Ali     1.170e-03 0.034210
##  SubjCode.6  Con_Ali     1.557e-03 0.039464
##  SubjCode.7  Ori_Con_Ali 8.511e-03 0.092254
##  StimGroup   (Intercept) 0.000e+00 0.000000
##  StimGroup.1 Ori_C       9.803e-05 0.009901
##  StimGroup.2 Con_C       6.094e-04 0.024687
##  StimGroup.3 Ali_C       0.000e+00 0.000000
##  StimGroup.4 Ori_Con     1.577e-04 0.012559
##  StimGroup.5 Ori_Ali     0.000e+00 0.000000
##  StimGroup.6 Con_Ali     9.796e-05 0.009898
##  StimGroup.7 Ori_Con_Ali 0.000e+00 0.000000
##  Residual                1.412e-01 0.375754
## Number of obs: 19672, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.790e+00  3.247e-02  3.897e+01 209.070  < 2e-16 ***
## Orientation2-1                             7.759e-02  4.498e-02  3.934e+01   1.725 0.092392 .  
## Congruency2-1                              4.653e-02  9.965e-03  1.045e+01   4.669 0.000783 ***
## Alignment2-1                              -1.283e-02  6.732e-03  3.763e+01  -1.906 0.064345 .  
## Cue2-1                                     2.209e-02  5.371e-03  1.941e+04   4.113 3.92e-05 ***
## CA2-1                                      5.342e-02  5.419e-03  1.945e+04   9.857  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.636e-02  1.368e-02  1.285e+01  -3.389 0.004912 ** 
## Orientation2-1:Alignment2-1               -8.647e-03  1.208e-02  3.774e+01  -0.716 0.478643    
## Congruency2-1:Alignment2-1                -5.131e-02  1.287e-02  1.131e+01  -3.987 0.002021 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  4.581e-02  2.608e-02  4.012e+01   1.757 0.086561 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

5.2.1.3 The reduced model

summary(rePCA(lmm_E2_rt_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]
## Standard deviation     0.7497 0.5447 0.24552 0.12376 0.10503 0.09104 0.06748 0.05069
## Proportion of Variance 0.5850 0.3088 0.06274 0.01594 0.01148 0.00863 0.00474 0.00267
## Cumulative Proportion  0.5850 0.8938 0.95654 0.97248 0.98396 0.99259 0.99733 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]    [,3]    [,4] [,5] [,6] [,7] [,8]
## Standard deviation     0.0657 0.03342 0.02635 0.02634    0    0    0    0
## Proportion of Variance 0.6327 0.16377 0.10178 0.10171    0    0    0    0
## Cumulative Proportion  0.6327 0.79651 0.89829 1.00000    1    1    1    1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-StimGroup: (Intercept), Ali_C, Ori_Ali, and Ori_Con_Ali.
file_E2_rt_rdc <- file.path(dir_lmm, "lmm_E2_rt_rdc.rds")

# fit the max model
if (!file.exists(file_E2_rt_rdc)) {
  lmm_E2_rt_rdc <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || SubjCode) +
      (0 + Ori_C + Con_C +  # Ali_C + 
         Ori_Con + Con_Ali || StimGroup # Ori_Ali + 
      ), # Ori_Con_Ali
    data = df_E2_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E2_rt_rdc, file = file_E2_rt_rdc)
} else {
  lmm_E2_rt_rdc <- readRDS(file_E2_rt_rdc)
}

print(summary(lmm_E2_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali ||      SubjCode) + (0 + Ori_C + Con_C + Ori_Con + Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E2_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17838.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5628 -0.6463 -0.1684  0.4609  6.8346 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 4.188e-02 0.204657
##  SubjCode.1  Ori_C       7.932e-02 0.281646
##  SubjCode.2  Con_C       3.628e-04 0.019046
##  SubjCode.3  Ali_C       6.431e-04 0.025359
##  SubjCode.4  Ori_Con     2.162e-03 0.046501
##  SubjCode.5  Ori_Ali     1.172e-03 0.034230
##  SubjCode.6  Con_Ali     1.558e-03 0.039469
##  SubjCode.7  Ori_Con_Ali 8.512e-03 0.092263
##  StimGroup   Ori_C       9.801e-05 0.009900
##  StimGroup.1 Con_C       6.095e-04 0.024688
##  StimGroup.2 Ori_Con     1.573e-04 0.012542
##  StimGroup.3 Con_Ali     9.871e-05 0.009935
##  Residual                1.412e-01 0.375754
## Number of obs: 19672, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.790e+00  3.247e-02  3.898e+01 209.084  < 2e-16 ***
## Orientation2-1                             7.759e-02  4.497e-02  3.936e+01   1.725 0.092317 .  
## Congruency2-1                              4.653e-02  9.965e-03  1.045e+01   4.669 0.000783 ***
## Alignment2-1                              -1.283e-02  6.732e-03  3.763e+01  -1.906 0.064359 .  
## Cue2-1                                     2.209e-02  5.371e-03  1.941e+04   4.113 3.92e-05 ***
## CA2-1                                      5.342e-02  5.419e-03  1.945e+04   9.857  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.636e-02  1.368e-02  1.285e+01  -3.390 0.004911 ** 
## Orientation2-1:Alignment2-1               -8.647e-03  1.209e-02  3.775e+01  -0.716 0.478672    
## Congruency2-1:Alignment2-1                -5.131e-02  1.287e-02  1.133e+01  -3.986 0.002017 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  4.581e-02  2.608e-02  4.012e+01   1.757 0.086574 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.2.1.4 The extended model

file_E2_rt_etd <- file.path(dir_lmm, "lmm_E2_rt_etd.rds")

# fit the max model
if (!file.exists(file_E2_rt_etd)) {
  lmm_E2_rt_etd <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +  
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali | SubjCode) +
      (0 + Ori_C + Con_C +  # Ali_C + 
         Ori_Con + Con_Ali | StimGroup # Ori_Ali + 
      ), # Ori_Con_Ali
    data = df_E2_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E2_rt_etd, file = file_E2_rt_etd)
} else {
  lmm_E2_rt_etd <- readRDS(file_E2_rt_etd)
}

print(summary(lmm_E2_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali |      SubjCode) + (0 + Ori_C + Con_C + Ori_Con + Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E2_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17776.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6530 -0.6462 -0.1676  0.4622  6.7894 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr                                     
##  SubjCode  (Intercept) 0.0419584 0.20484                                           
##            Ori_C       0.0792874 0.28158   0.01                                    
##            Con_C       0.0007319 0.02705   0.11  0.10                              
##            Ali_C       0.0007451 0.02730  -0.20 -0.15  0.72                        
##            Ori_Con     0.0037017 0.06084  -0.62 -0.01 -0.75 -0.53                  
##            Ori_Ali     0.0020021 0.04474  -0.33  0.22 -0.03 -0.24  0.06            
##            Con_Ali     0.0031765 0.05636   0.65 -0.38 -0.45 -0.19 -0.19 -0.38      
##            Ori_Con_Ali 0.0112122 0.10589   0.06  0.03  0.22  0.44 -0.55  0.46  0.22
##  StimGroup Ori_C       0.0001343 0.01159                                           
##            Con_C       0.0006292 0.02508  -0.59                                    
##            Ori_Con     0.0007519 0.02742   0.33 -0.96                              
##            Con_Ali     0.0004054 0.02013   0.62 -1.00  0.95                        
##  Residual              0.1407351 0.37515                                           
## Number of obs: 19672, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.790e+00  3.250e-02  3.896e+01 208.908  < 2e-16 ***
## Orientation2-1                             7.702e-02  4.500e-02  3.946e+01   1.712 0.094826 .  
## Congruency2-1                              4.685e-02  1.051e-02  1.296e+01   4.459 0.000648 ***
## Alignment2-1                              -1.309e-02  6.908e-03  4.491e+01  -1.894 0.064623 .  
## Cue2-1                                     2.191e-02  5.363e-03  1.948e+04   4.085 4.42e-05 ***
## CA2-1                                      5.324e-02  5.410e-03  1.949e+04   9.842  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.720e-02  1.687e-02  2.205e+01  -2.799 0.010443 *  
## Orientation2-1:Alignment2-1               -1.040e-02  1.290e-02  4.478e+01  -0.806 0.424368    
## Congruency2-1:Alignment2-1                -4.905e-02  1.537e-02  2.483e+01  -3.191 0.003822 ** 
## Orientation2-1:Congruency2-1:Alignment2-1  4.560e-02  2.731e-02  4.570e+01   1.669 0.101887    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E2_rt_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]      [,6]      [,7]      [,8]
## Standard deviation     0.7535 0.5666 0.30291 0.14978 0.10872 0.0001698 2.632e-05 3.442e-07
## Proportion of Variance 0.5595 0.3164 0.09042 0.02211 0.01165 0.0000000 0.000e+00 0.000e+00
## Cumulative Proportion  0.5595 0.8758 0.96625 0.98835 1.00000 1.0000000 1.000e+00 1.000e+00
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]      [,3]      [,4]
## Standard deviation     0.1124 0.03169 3.428e-05 1.553e-23
## Proportion of Variance 0.9264 0.07357 0.000e+00 0.000e+00
## Cumulative Proportion  0.9264 1.00000 1.000e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C, Ali_C, and Ori_Ali;
  • by-StimGroup: Ori_C and Con_Ali.
file_E2_rt_etd2 <- file.path(dir_lmm, "lmm_E2_rt_etd2.rds")

# fit the max model
if (!file.exists(file_E2_rt_etd2)) {
  lmm_E2_rt_etd2 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + # Con_C + Ali_C +  
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali | SubjCode) +
      (0 + Con_C + # Ali_C + Ori_C + 
         Ori_Con | StimGroup # Ori_Ali + + Con_Ali 
      ), # Ori_Con_Ali
    data = df_E2_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E2_rt_etd2, file = file_E2_rt_etd2)
} else {
  lmm_E2_rt_etd2 <- readRDS(file_E2_rt_etd2)
}

print(summary(lmm_E2_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ori_Con + Con_Ali + Ori_Con_Ali | SubjCode) + (0 + Con_C +      Ori_Con | StimGroup)
##    Data: dplyr::filter(df_E2_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17813.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5839 -0.6473 -0.1672  0.4650  6.8219 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr                   
##  SubjCode  (Intercept) 0.0418521 0.20458                         
##            Ori_C       0.0792220 0.28146   0.01                  
##            Ori_Con     0.0030810 0.05551  -0.67 -0.03            
##            Con_Ali     0.0024920 0.04992   0.72 -0.40 -0.35      
##            Ori_Con_Ali 0.0106134 0.10302   0.08  0.00 -0.65  0.23
##  StimGroup Con_C       0.0005985 0.02446                         
##            Ori_Con     0.0007224 0.02688  -1.00                  
##  Residual              0.1413554 0.37597                         
## Number of obs: 19672, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.789e+00  3.246e-02  3.897e+01 209.159  < 2e-16 ***
## Orientation2-1                             7.767e-02  4.483e-02  3.903e+01   1.732 0.091108 .  
## Congruency2-1                              4.626e-02  9.439e-03  9.407e+00   4.901 0.000744 ***
## Alignment2-1                              -1.341e-02  5.400e-03  1.954e+04  -2.484 0.013006 *  
## Cue2-1                                     2.220e-02  5.373e-03  1.952e+04   4.133  3.6e-05 ***
## CA2-1                                      5.309e-02  5.418e-03  1.952e+04   9.799  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.601e-02  1.632e-02  2.053e+01  -2.819 0.010426 *  
## Orientation2-1:Alignment2-1               -8.227e-03  1.079e-02  1.954e+04  -0.762 0.445953    
## Congruency2-1:Alignment2-1                -5.143e-02  1.338e-02  4.335e+01  -3.844 0.000391 ***
## Orientation2-1:Congruency2-1:Alignment2-1  4.721e-02  2.706e-02  4.468e+01   1.745 0.087937 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E2_rt_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]      [,5]
## Standard deviation     0.7506 0.5628 0.28651 0.09411 3.385e-05
## Proportion of Variance 0.5802 0.3262 0.08454 0.00912 0.000e+00
## Cumulative Proportion  0.5802 0.9063 0.99088 1.00000 1.000e+00
## 
## $StimGroup
## Importance of components:
##                           [,1] [,2]
## Standard deviation     0.09667    0
## Proportion of Variance 1.00000    0
## Cumulative Proportion  1.00000    1

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con and Con_Ali;
  • by-StimGroup: Con_C.
file_E2_rt_etd3 <- file.path(dir_lmm, "lmm_E2_rt_etd3.rds")

# fit the max model
if (!file.exists(file_E2_rt_etd3)) {
  lmm_E2_rt_etd3 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + # Con_C + Ali_C +  
         # Ori_Ali + Ori_Con + Con_Ali + 
         Ori_Con_Ali | SubjCode) +
      (0 + # Ali_C + Ori_C + Con_C + 
         Ori_Con | StimGroup # Ori_Ali + + Con_Ali 
      ), # Ori_Con_Ali
    data = df_E2_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E2_rt_etd3, file = file_E2_rt_etd3)
} else {
  lmm_E2_rt_etd3 <- readRDS(file_E2_rt_etd3)
}

print(summary(lmm_E2_rt_etd3), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ori_Con_Ali | SubjCode) + (0 + Ori_Con | StimGroup)
##    Data: dplyr::filter(df_E2_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17859.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5165 -0.6468 -0.1687  0.4646  6.8509 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr     
##  SubjCode  (Intercept) 0.0418598 0.20460           
##            Ori_C       0.0792968 0.28160  0.02     
##            Ori_Con_Ali 0.0085761 0.09261  0.00 0.05
##  StimGroup Ori_Con     0.0003714 0.01927           
##  Residual              0.1418814 0.37667           
## Number of obs: 19672, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.789e+00  3.246e-02  3.898e+01 209.133  < 2e-16 ***
## Orientation2-1                             7.773e-02  4.486e-02  3.903e+01   1.733  0.09099 .  
## Congruency2-1                              4.676e-02  5.415e-03  1.955e+04   8.636  < 2e-16 ***
## Alignment2-1                              -1.348e-02  5.408e-03  1.956e+04  -2.492  0.01271 *  
## Cue2-1                                     2.205e-02  5.379e-03  1.955e+04   4.099 4.16e-05 ***
## CA2-1                                      5.295e-02  5.425e-03  1.956e+04   9.761  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.578e-02  1.243e-02  9.177e+00  -3.684  0.00488 ** 
## Orientation2-1:Alignment2-1               -8.088e-03  1.081e-02  1.958e+04  -0.748  0.45449    
## Congruency2-1:Alignment2-1                -5.287e-02  1.081e-02  1.958e+04  -4.889 1.02e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1  4.615e-02  2.613e-02  4.013e+01   1.766  0.08496 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.2.1.5 The optimal model

anova(lmm_E2_rt_rdc, lmm_E2_rt_etd3, refit=FALSE)

According to BIC, the extended model is used as the optimal model.

lmm_E2_rt_opt <- lmm_E2_rt_etd3

print(summary(lmm_E2_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ori_Con_Ali | SubjCode) + (0 + Ori_Con | StimGroup)
##    Data: dplyr::filter(df_E2_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 17859.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5165 -0.6468 -0.1687  0.4646  6.8509 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr     
##  SubjCode  (Intercept) 0.0418598 0.20460           
##            Ori_C       0.0792968 0.28160  0.02     
##            Ori_Con_Ali 0.0085761 0.09261  0.00 0.05
##  StimGroup Ori_Con     0.0003714 0.01927           
##  Residual              0.1418814 0.37667           
## Number of obs: 19672, groups:  SubjCode, 40; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.789e+00  3.246e-02  3.898e+01 209.133  < 2e-16 ***
## Orientation2-1                             7.773e-02  4.486e-02  3.903e+01   1.733  0.09099 .  
## Congruency2-1                              4.676e-02  5.415e-03  1.955e+04   8.636  < 2e-16 ***
## Alignment2-1                              -1.348e-02  5.408e-03  1.956e+04  -2.492  0.01271 *  
## Cue2-1                                     2.205e-02  5.379e-03  1.955e+04   4.099 4.16e-05 ***
## CA2-1                                      5.295e-02  5.425e-03  1.956e+04   9.761  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.578e-02  1.243e-02  9.177e+00  -3.684  0.00488 ** 
## Orientation2-1:Alignment2-1               -8.088e-03  1.081e-02  1.958e+04  -0.748  0.45449    
## Congruency2-1:Alignment2-1                -5.287e-02  1.081e-02  1.958e+04  -4.889 1.02e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1  4.615e-02  2.613e-02  4.013e+01   1.766  0.08496 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.2.2 Estimated marginal means

emm_E2_rt <- emmeans(lmm_E2_rt_opt, 
                     ~ Orientation + Congruency + Alignment,
                     pbkrtest.limit = 2e5,
                     lmerTest.limit = 2e5)
# emmip(regrid(emm_E2_rt), Congruency ~ Alignment | Orientation, CIs = TRUE)

summary(emm_E2_rt, type = "response") # equivalent to regrid(emm_E2_rt)
##  Orientation Congruency Alignment response   SE   df lower.CL upper.CL
##  upr         con        ali            813 32.3 40.5      751      881
##  inv         con        ali            914 36.9 40.8      842      991
##  upr         inc        ali            906 36.0 41.3      836      982
##  inv         inc        ali            950 38.4 41.1      875     1031
##  upr         con        mis            837 33.1 40.5      773      907
##  inv         con        mis            911 36.8 40.9      840      989
##  upr         inc        mis            864 34.4 41.1      797      936
##  inv         inc        mis            920 37.3 41.2      847      998
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale

5.2.2.1 Composite effect

Composite effect of rt:

emm_E2_rt_cf <- contrast(regrid(emm_E2_rt), 
                         interaction = "pairwise", 
                         by = "Orientation", 
                         infer = TRUE)

summary(emm_E2_rt_cf[1:2], side="<")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr            -65.5 14.4 40.5     -Inf  -41.227  -4.543  <.0001
##  con - inc           ali - mis          inv            -27.9 16.1 40.8     -Inf   -0.872  -1.737  0.0449
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
emm_E2_rt_con <- contrast(regrid(emm_E2_rt), 
                          interaction = "pairwise", 
                          by = c("Orientation", "Alignment"),
                          infer = TRUE)

summary(emm_E2_rt_con[1:2], side="<")
##  Congruency_pairwise Orientation Alignment estimate   SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           upr         ali          -92.4 10.7 40.5     -Inf    -74.5  -8.668  <.0001
##  con - inc           inv         ali          -36.1 11.3 40.8     -Inf    -17.1  -3.193  0.0014
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E2_cf_rt <- summary(emm_E2_rt, type = "response") %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Orientation, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "*", "", "", "", ""), color = sig_color, size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  NULL

# ggsave(filename = "E2_cf_rt.pdf", plot_E2_cf_rt, width = 8, height = 4.8)

plot_E2_cf_rt

5.2.2.2 Compare composite effects between upright and inverted faces

contrast(regrid(emm_E2_rt), 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE   df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -37.6 23.4 40.5    -84.9     9.67  -1.607  0.1159
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

5.2.2.3 Facilitation and interference

emm_E2_rt_fi <- contrast(regrid(emm_E2_rt), 
                         "pairwise", 
                         by = c("Orientation", "Congruency"), 
                         infer = TRUE, 
                         adjust = "none")
# emmip(emm_E2_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 

emm_E2_rt_fi[1:4]
##  contrast  Orientation Congruency estimate    SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con          -23.55  8.78 40.5   -41.28    -5.82  -2.684  0.0105
##  ali - mis inv         con            2.39 10.39 40.8   -18.60    23.39   0.230  0.8189
##  ali - mis upr         inc           41.95 10.43 41.1    20.89    63.01   4.022  0.0002
##  ali - mis inv         inc           30.30 11.28 41.1     7.51    53.08   2.685  0.0104
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95
summary(emm_E2_rt_fi[1:2], side="<")
##  contrast  Orientation Congruency estimate    SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con          -23.55  8.78 40.5     -Inf    -8.78  -2.684  0.0052
##  ali - mis inv         con            2.39 10.39 40.8     -Inf    19.89   0.230  0.5905
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
summary(emm_E2_rt_fi[3:4], side=">")
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc            41.9 10.4 41.1     24.4      Inf   4.022  0.0001
##  ali - mis inv         inc            30.3 11.3 41.1     11.3      Inf   2.685  0.0052
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E2_cffi_rt <- summary(emm_E2_rt_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=100, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E2_fi_rt.pdf", plot_E2_cffi_rt, width = 7, height = 4.55)
plot_E2_cffi_rt

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of d'
emm_E2_rt_fi_ui <- contrast(emm_E2_rt, 
                            interaction = "pairwise", 
                            by = "Congruency", 
                            infer = TRUE, 
                            adjust = "none")

emm_E2_rt_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise Congruency estimate     SE    df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con         -0.0312 0.0164  99.4  -0.0637  0.00135  -1.902  0.0601
##  upr - inv            ali - mis          inc          0.0150 0.0175 128.4  -0.0197  0.04964   0.856  0.3937
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: satterthwaite 
## Results are given on the log (not the response) scale. 
## Confidence level used: 0.95

5.2.2.4 Comparisons between facilitation and interference

contrast(emm_E2_rt_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2]
##  contrast  Orientation estimate   SE   df lower.CL upper.CL t.ratio p.value
##  faci-inte upr             18.4 12.8 40.5    -7.45     44.2   1.438  0.1582
##  faci-inte inv             32.7 14.6 40.8     3.23     62.2   2.241  0.0305
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

5.2.3 Plot

plot_E2_cf_rt_ <- plot_E2_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E2_rt <- ggarrange(plot_E2_cf_rt_, plot_E2_cffi_rt, 
                        labels = c("a", "b"),
                        font.label = (list(size = 18)),
                        widths = c(1.5, 1),
                        nrow = 1)

plot_E2_rt

5.3 Plot

plot_E2 <- ggarrange(plot_E2_cf_d_, plot_E2_cffi_d, 
                     plot_E2_cf_rt_, plot_E2_cffi_rt,
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 18)),
                     widths = c(1.5, 1),
                     nrow = 2,
                     ncol = 2)

plot_E2

6 Experiment 1 and 2

6.1 Behavioral choices (d’)

6.1.1 Fitting the generalized linear mixed-effects models

6.1.1.1 The maximal model

# file_E12_resp_max <- file.path(dir_lmm, "lmm_E12_resp_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E12_resp_max)) {
#   glmm_E12_resp_max <- glmer(
#     isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +
#       (Orientation * Congruency * Alignment * CA | SubjCode) +
#       (Orientation * Congruency * Alignment * CA | StimGroup), 
#     data = df_E12_lmm,
#     family = binomial(link = "probit"),
#     control = glmerControl(optCtrl = list(maxfun = 1e7))
#   )
# 
#   saveRDS(glmm_E12_resp_max, file = file_E12_resp_max)
# } else {
#   glmm_E12_resp_max <- readRDS(file_E12_resp_max)
# }
# 
# print(summary(glmm_E12_resp_max), corr = FALSE)

6.1.1.2 The zero-correlation-parameter model

file_E12_resp_zcp <- file.path(dir_lmm, "lmm_E12_resp_zcp.rds")

# fit the max model
if (!file.exists(file_E12_resp_zcp)) {
  glmm_E12_resp_zcp <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + 
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + 
         Ori_Con_Ali_CA || SubjCode) +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA + 
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA + 
         Ori_Con_Ali_CA || StimGroup), 
    data = df_E12_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E12_resp_zcp, file = file_E12_resp_zcp)
} else {
  glmm_E12_resp_zcp <- readRDS(file_E12_resp_zcp)
}

print(summary(glmm_E12_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +      (Ori_C + Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali +          Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA +          Ori_Ali_CA + Con_Ali_CA + Ori_Con_Ali_CA || SubjCode) +      (Ori_C + Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali +          Ori_CA + Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA +          Ori_Ali_CA + Con_Ali_CA + Ori_Con_Ali_CA || StimGroup)
##    Data: df_E12_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  49187.5  49629.6 -24543.8  49087.5    51100 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -9.8722 -0.5714  0.2138  0.5290  6.9872 
## 
## Random effects:
##  Groups       Name           Variance  Std.Dev. 
##  SubjCode     (Intercept)    8.139e-02 2.853e-01
##  SubjCode.1   Ori_C          4.915e-02 2.217e-01
##  SubjCode.2   Con_C          3.439e-03 5.864e-02
##  SubjCode.3   Ali_C          2.793e-02 1.671e-01
##  SubjCode.4   CA_C           2.464e-01 4.964e-01
##  SubjCode.5   Ori_Con        2.270e-03 4.764e-02
##  SubjCode.6   Ori_Ali        2.288e-02 1.513e-01
##  SubjCode.7   Con_Ali        1.073e-10 1.036e-05
##  SubjCode.8   Ori_CA         1.821e-01 4.267e-01
##  SubjCode.9   Con_CA         2.329e-01 4.826e-01
##  SubjCode.10  Ali_CA         5.998e-10 2.449e-05
##  SubjCode.11  Ori_Con_Ali    2.754e-09 5.248e-05
##  SubjCode.12  Ori_Con_CA     1.368e-01 3.699e-01
##  SubjCode.13  Ori_Ali_CA     1.582e-09 3.978e-05
##  SubjCode.14  Con_Ali_CA     1.765e-08 1.329e-04
##  SubjCode.15  Ori_Con_Ali_CA 3.301e-08 1.817e-04
##  StimGroup    (Intercept)    6.998e-03 8.366e-02
##  StimGroup.1  Ori_C          1.755e-02 1.325e-01
##  StimGroup.2  Con_C          3.764e-02 1.940e-01
##  StimGroup.3  Ali_C          0.000e+00 0.000e+00
##  StimGroup.4  CA_C           1.801e-02 1.342e-01
##  StimGroup.5  Ori_Con        1.776e-02 1.333e-01
##  StimGroup.6  Ori_Ali        2.817e-08 1.679e-04
##  StimGroup.7  Con_Ali        1.209e-09 3.477e-05
##  StimGroup.8  Ori_CA         2.171e-02 1.473e-01
##  StimGroup.9  Con_CA         1.084e-01 3.292e-01
##  StimGroup.10 Ali_CA         8.343e-04 2.888e-02
##  StimGroup.11 Ori_Con_Ali    1.282e-09 3.581e-05
##  StimGroup.12 Ori_Con_CA     1.229e-08 1.108e-04
##  StimGroup.13 Ori_Ali_CA     9.572e-04 3.094e-02
##  StimGroup.14 Con_Ali_CA     8.704e-09 9.329e-05
##  StimGroup.15 Ori_Con_Ali_CA 1.609e-07 4.011e-04
## Number of obs: 51150, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.21100    0.04205   5.018 5.21e-07 ***
## Orientation2-1                                   0.08785    0.05066   1.734 0.082926 .  
## Congruency2-1                                    0.02501    0.06325   0.395 0.692580    
## Alignment2-1                                     0.16904    0.02316   7.298 2.93e-13 ***
## CA2-1                                           -1.69784    0.07134 -23.799  < 2e-16 ***
## Cue2-1                                           0.01157    0.01312   0.882 0.377837    
## VA2-1                                            0.09670    0.06527   1.481 0.138474    
## Orientation2-1:Congruency2-1                     0.10027    0.05062   1.981 0.047603 *  
## Orientation2-1:Alignment2-1                     -0.04610    0.03206  -1.438 0.150496    
## Congruency2-1:Alignment2-1                       0.10124    0.02712   3.732 0.000190 ***
## Orientation2-1:CA2-1                             0.76094    0.07245  10.503  < 2e-16 ***
## Congruency2-1:CA2-1                              0.91184    0.12054   7.564 3.89e-14 ***
## Alignment2-1:CA2-1                              -0.07199    0.02890  -2.490 0.012759 *  
## Orientation2-1:Congruency2-1:Alignment2-1       -0.19070    0.05420  -3.519 0.000434 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.84611    0.06891 -12.278  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.22642    0.05539   4.088 4.35e-05 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.41618    0.05413  -7.689 1.48e-14 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.54948    0.10826   5.076 3.86e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

6.1.1.3 The reduced model

summary(rePCA(glmm_E12_resp_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]   [,5]    [,6]    [,7]    [,8]    [,9]   [,10]     [,11]     [,12]     [,13]     [,14]     [,15]     [,16]
## Standard deviation     0.4964 0.4826 0.4267 0.3699 0.2853 0.22171 0.16712 0.15126 0.05864 0.04764 0.0001817 0.0001329 5.248e-05 3.978e-05 2.449e-05 1.036e-05
## Proportion of Variance 0.2500 0.2364 0.1848 0.1389 0.0826 0.04989 0.02835 0.02322 0.00349 0.00230 0.0000000 0.0000000 0.000e+00 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion  0.2500 0.4865 0.6713 0.8102 0.8928 0.94264 0.97098 0.99421 0.99770 1.00000 1.0000000 1.0000000 1.000e+00 1.000e+00 1.000e+00 1.000e+00
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]     [,10]     [,11]     [,12]     [,13]     [,14]     [,15] [,16]
## Standard deviation     0.3292 0.1940 0.14734 0.13419 0.13328 0.13246 0.08366 0.03094 0.02888 0.0004011 0.0001679 0.0001108 9.329e-05 3.581e-05 3.477e-05     0
## Proportion of Variance 0.4715 0.1638 0.09446 0.07835 0.07729 0.07635 0.03045 0.00416 0.00363 0.0000000 0.0000000 0.0000000 0.000e+00 0.000e+00 0.000e+00     0
## Cumulative Proportion  0.4715 0.6353 0.72976 0.80812 0.88541 0.96175 0.99220 0.99637 1.00000 1.0000000 1.0000000 1.0000000 1.000e+00 1.000e+00 1.000e+00     1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_Ali, Ori_Con_Ali, Ori_Ali_CA, Con_Ali_CA, Ori_Con_Ali_CA, and Ali_CA;
  • by-StimGroup: Ali_C, Ori_Ali, Con_Ali, Ori_Con_Ali, Ori_Con_CA, Con_Ali_CA, and Ori_Con_Ali_CA.
file_E12_resp_rdc <- file.path(dir_lmm, "lmm_E12_resp_rdc.rds")

# fit the reduced model
if (!file.exists(file_E12_resp_rdc)) {
  glmm_E12_resp_rdc <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + 
         Ori_Con_CA || SubjCode # Ori_Con_Ali + Ori_Ali_CA + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA
      (Ori_C + Con_C + CA_C + # Ali_C + 
         Ori_Con + Ori_CA + Con_CA + Ali_CA + # Ori_Ali + Con_Ali + 
         Ori_Ali_CA || StimGroup # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA + 
      ), # Ori_Con_Ali_CA 
    data = df_E12_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E12_resp_rdc, file = file_E12_resp_rdc)
} else {
  glmm_E12_resp_rdc <- readRDS(file_E12_resp_rdc)
}

print(summary(glmm_E12_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +      (Ori_C + Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Ori_CA +          Con_CA + Ori_Con_CA || SubjCode) + (Ori_C + Con_C + CA_C +      Ori_Con + Ori_CA + Con_CA + Ali_CA + Ori_Ali_CA || StimGroup)
##    Data: df_E12_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  49161.5  49488.7 -24543.8  49087.5    51113 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -9.8722 -0.5714  0.2138  0.5290  6.9872 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 0.0813975 0.28530 
##  SubjCode.1  Ori_C       0.0491501 0.22170 
##  SubjCode.2  Con_C       0.0034362 0.05862 
##  SubjCode.3  Ali_C       0.0279300 0.16712 
##  SubjCode.4  CA_C        0.2464305 0.49642 
##  SubjCode.5  Ori_Con     0.0022671 0.04761 
##  SubjCode.6  Ori_Ali     0.0228744 0.15124 
##  SubjCode.7  Ori_CA      0.1820641 0.42669 
##  SubjCode.8  Con_CA      0.2329315 0.48263 
##  SubjCode.9  Ori_Con_CA  0.1368329 0.36991 
##  StimGroup   (Intercept) 0.0069962 0.08364 
##  StimGroup.1 Ori_C       0.0175483 0.13247 
##  StimGroup.2 Con_C       0.0376596 0.19406 
##  StimGroup.3 CA_C        0.0180077 0.13419 
##  StimGroup.4 Ori_Con     0.0177709 0.13331 
##  StimGroup.5 Ori_CA      0.0217109 0.14735 
##  StimGroup.6 Con_CA      0.1083992 0.32924 
##  StimGroup.7 Ali_CA      0.0008330 0.02886 
##  StimGroup.8 Ori_Ali_CA  0.0009597 0.03098 
## Number of obs: 51150, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.21096    0.04204   5.018 5.21e-07 ***
## Orientation2-1                                   0.08786    0.05066   1.734 0.082894 .  
## Congruency2-1                                    0.02505    0.06325   0.396 0.692084    
## Alignment2-1                                     0.16908    0.02316   7.300 2.89e-13 ***
## CA2-1                                           -1.69781    0.07133 -23.804  < 2e-16 ***
## Cue2-1                                           0.01157    0.01312   0.882 0.377788    
## VA2-1                                            0.09665    0.06526   1.481 0.138571    
## Orientation2-1:Congruency2-1                     0.10028    0.05062   1.981 0.047580 *  
## Orientation2-1:Alignment2-1                     -0.04608    0.03206  -1.437 0.150581    
## Congruency2-1:Alignment2-1                       0.10122    0.02712   3.732 0.000190 ***
## Orientation2-1:CA2-1                             0.76087    0.07242  10.506  < 2e-16 ***
## Congruency2-1:CA2-1                              0.91178    0.12043   7.571 3.70e-14 ***
## Alignment2-1:CA2-1                              -0.07201    0.02890  -2.492 0.012717 *  
## Orientation2-1:Congruency2-1:Alignment2-1       -0.19071    0.05419  -3.519 0.000432 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.84615    0.06890 -12.282  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.22645    0.05538   4.089 4.33e-05 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.41612    0.05412  -7.689 1.48e-14 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.54933    0.10815   5.079 3.79e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rePCA(glmm_E12_resp_rdc))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]    [,8]    [,9]   [,10]
## Standard deviation     0.4964 0.4826 0.4267 0.3699 0.28530 0.22170 0.16712 0.15124 0.05862 0.04761
## Proportion of Variance 0.2501 0.2364 0.1848 0.1389 0.08261 0.04988 0.02835 0.02322 0.00349 0.00230
## Cumulative Proportion  0.2501 0.4865 0.6713 0.8102 0.89277 0.94265 0.97100 0.99421 0.99770 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]   [,5]    [,6]    [,7]    [,8]    [,9]
## Standard deviation     0.3292 0.1941 0.14735 0.13419 0.1333 0.13247 0.08364 0.03098 0.02886
## Proportion of Variance 0.4715 0.1638 0.09444 0.07833 0.0773 0.07633 0.03043 0.00417 0.00362
## Cumulative Proportion  0.4715 0.6353 0.72980 0.80813 0.8854 0.96177 0.99220 0.99638 1.00000

6.1.1.4 The extended model

file_E12_resp_etd <- file.path(dir_lmm, "lmm_E12_resp_etd.rds")

# fit the reduced model
if (!file.exists(file_E12_resp_etd)) {
  glmm_E12_resp_etd <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Ori_CA + Con_CA + # Con_Ali + Ali_CA + 
         Ori_Con_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA
      (Ori_C + Con_C + CA_C + # Ali_C + 
         Ori_Con + Ori_CA + Con_CA + Ali_CA + # Ori_Ali + Con_Ali + 
         Ori_Ali_CA | StimGroup # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA + 
      ), # Ori_Con_Ali_CA 
    data = df_E12_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E12_resp_etd, file = file_E12_resp_etd)
} else {
  glmm_E12_resp_etd <- readRDS(file_E12_resp_etd)
}

print(summary(glmm_E12_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +      (Ori_C + Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Ori_CA +          Con_CA + Ori_Con_CA | SubjCode) + (Ori_C + Con_C + CA_C +      Ori_Con + Ori_CA + Con_CA + Ali_CA + Ori_Ali_CA | StimGroup)
##    Data: df_E12_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  49143.9  50187.4 -24454.0  48907.9    51032 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.1167  -0.5734   0.1999   0.5336   7.5829 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                                                 
##  SubjCode  (Intercept) 0.082799 0.28775                                                       
##            Ori_C       0.048995 0.22135   0.00                                                
##            Con_C       0.008251 0.09083  -0.08 -0.28                                          
##            Ali_C       0.029213 0.17092   0.41  0.11 -0.15                                    
##            CA_C        0.254892 0.50487  -0.24  0.24 -0.53 -0.36                              
##            Ori_Con     0.015598 0.12489   0.18 -0.26 -0.60  0.29 -0.13                        
##            Ori_Ali     0.026440 0.16260  -0.40  0.04  0.43 -0.34  0.16 -0.26                  
##            Ori_CA      0.201202 0.44856   0.14  0.04 -0.26  0.12 -0.25  0.49 -0.05            
##            Con_CA      0.262939 0.51278  -0.01  0.16 -0.66  0.29 -0.03  0.74 -0.35  0.05      
##            Ori_Con_CA  0.198518 0.44555   0.09 -0.11  0.70 -0.31  0.01 -0.66  0.44 -0.47 -0.73
##  StimGroup (Intercept) 0.006623 0.08138                                                       
##            Ori_C       0.016775 0.12952   0.06                                                
##            Con_C       0.038042 0.19504  -0.19 -0.75                                          
##            CA_C        0.017362 0.13177   0.72  0.30 -0.54                                    
##            Ori_Con     0.018295 0.13526  -0.24  0.78 -0.73  0.27                              
##            Ori_CA      0.021700 0.14731   0.07  0.54 -0.23 -0.21  0.14                        
##            Con_CA      0.108850 0.32992  -0.26 -0.62  0.97 -0.54 -0.56 -0.16                  
##            Ali_CA      0.004600 0.06782   0.50  0.07  0.29  0.12 -0.38  0.00  0.26            
##            Ori_Ali_CA  0.022992 0.15163   0.14  0.44 -0.72  0.73  0.76 -0.32 -0.65 -0.36      
## Number of obs: 51150, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.21507    0.04186   5.138 2.78e-07 ***
## Orientation2-1                                   0.07413    0.05009   1.480 0.138879    
## Congruency2-1                                    0.02363    0.06420   0.368 0.712797    
## Alignment2-1                                     0.17848    0.02367   7.539 4.74e-14 ***
## CA2-1                                           -1.70984    0.07171 -23.842  < 2e-16 ***
## Cue2-1                                           0.01140    0.01313   0.868 0.385512    
## VA2-1                                            0.12537    0.06284   1.995 0.046041 *  
## Orientation2-1:Congruency2-1                     0.10947    0.05379   2.035 0.041864 *  
## Orientation2-1:Alignment2-1                     -0.06206    0.03333  -1.862 0.062631 .  
## Congruency2-1:Alignment2-1                       0.09047    0.02744   3.297 0.000978 ***
## Orientation2-1:CA2-1                             0.79632    0.07465  10.668  < 2e-16 ***
## Congruency2-1:CA2-1                              0.92735    0.12258   7.565 3.87e-14 ***
## Alignment2-1:CA2-1                              -0.08799    0.03517  -2.502 0.012359 *  
## Orientation2-1:Congruency2-1:Alignment2-1       -0.16857    0.05488  -3.071 0.002130 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.87764    0.07729 -11.356  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.25299    0.07350   3.442 0.000578 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.41221    0.05466  -7.541 4.67e-14 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.53588    0.10930   4.903 9.44e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.167639 (tol = 0.002, component 1)
summary(rePCA(glmm_E12_resp_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]    [,8]    [,9]    [,10]
## Standard deviation     0.6713 0.5445 0.4265 0.2950 0.21966 0.19769 0.13048 0.09137 0.01150 0.001109
## Proportion of Variance 0.3992 0.2626 0.1611 0.0771 0.04274 0.03462 0.01508 0.00740 0.00012 0.000000
## Cumulative Proportion  0.3992 0.6618 0.8229 0.9000 0.94278 0.97740 0.99249 0.99988 1.00000 1.000000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]     [,7]      [,8]      [,9]
## Standard deviation     0.4244 0.1831 0.14501 0.12200 0.06957 0.02868 0.001474 0.0002811 0.0002621
## Proportion of Variance 0.7057 0.1314 0.08239 0.05831 0.01896 0.00322 0.000010 0.0000000 0.0000000
## Cumulative Proportion  0.7057 0.8371 0.91949 0.97780 0.99677 0.99999 1.000000 1.0000000 1.0000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C, Ori_Con, and Ori_Ali;
  • by-StimGroup: (Intercept), Ali_CA, CA_C, and Ori_C.
file_E12_resp_etd2 <- file.path(dir_lmm, "lmm_E12_resp_etd2.rds")

# fit the reduced model
if (!file.exists(file_E12_resp_etd2)) {
  glmm_E12_resp_etd2 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
         Ori_Con_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA
      (0 + Con_C + CA_C + # Ali_C + Ori_C + 
         Ori_Con + Ori_CA + Con_CA + # Ori_Ali + Con_Ali + Ali_CA + 
         Ori_Ali_CA | StimGroup # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA + 
      ), # Ori_Con_Ali_CA 
    data = df_E12_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E12_resp_etd2, file = file_E12_resp_etd2)
} else {
  glmm_E12_resp_etd2 <- readRDS(file_E12_resp_etd2)
}

print(summary(glmm_E12_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +      (Ori_C + Ali_C + CA_C + Ori_CA + Con_CA + Ori_Con_CA | SubjCode) +      (0 + Con_C + CA_C + Ori_Con + Ori_CA + Con_CA + Ori_Ali_CA |          StimGroup)
##    Data: df_E12_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  49321.8  49914.2 -24593.9  49187.8    51083 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -12.3248  -0.5807   0.2078   0.5344   7.0013 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                               
##  SubjCode  (Intercept) 0.08073  0.2841                                      
##            Ori_C       0.04856  0.2204    0.00                              
##            Ali_C       0.02769  0.1664    0.38  0.15                        
##            CA_C        0.25377  0.5038   -0.25  0.24 -0.34                  
##            Ori_CA      0.19709  0.4439    0.12  0.06  0.11 -0.27            
##            Con_CA      0.24356  0.4935   -0.03  0.25  0.28 -0.06  0.04      
##            Ori_Con_CA  0.17579  0.4193    0.15 -0.19 -0.28  0.03 -0.46 -0.72
##  StimGroup Con_C       0.03990  0.1998                                      
##            CA_C        0.02085  0.1444   -0.41                              
##            Ori_Con     0.02740  0.1655   -0.75  0.05                        
##            Ori_CA      0.02566  0.1602   -0.35 -0.14  0.37                  
##            Con_CA      0.10596  0.3255    0.95 -0.54 -0.51 -0.22            
##            Ori_Ali_CA  0.02337  0.1529   -0.75  0.68  0.71 -0.10 -0.69      
## Number of obs: 51150, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.21325    0.03257   6.548 5.85e-11 ***
## Orientation2-1                                   0.08276    0.02851   2.903 0.003694 ** 
## Congruency2-1                                    0.02204    0.06467   0.341 0.733219    
## Alignment2-1                                     0.17513    0.02314   7.570 3.74e-14 ***
## CA2-1                                           -1.69662    0.07395 -22.942  < 2e-16 ***
## Cue2-1                                           0.01220    0.01309   0.932 0.351394    
## VA2-1                                            0.11317    0.06276   1.803 0.071338 .  
## Orientation2-1:Congruency2-1                     0.09286    0.05933   1.565 0.117548    
## Orientation2-1:Alignment2-1                     -0.05133    0.02719  -1.888 0.059039 .  
## Congruency2-1:Alignment2-1                       0.09406    0.02717   3.462 0.000536 ***
## Orientation2-1:CA2-1                             0.78373    0.07664  10.226  < 2e-16 ***
## Congruency2-1:CA2-1                              0.92335    0.12007   7.690 1.47e-14 ***
## Alignment2-1:CA2-1                              -0.08005    0.02753  -2.907 0.003644 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.17787    0.05426  -3.278 0.001044 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.87621    0.07319 -11.972  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.21477    0.07269   2.954 0.003133 ** 
## Congruency2-1:Alignment2-1:CA2-1                -0.41801    0.05406  -7.733 1.05e-14 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.57149    0.10807   5.288 1.23e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0122015 (tol = 0.002, component 1)
summary(rePCA(glmm_E12_resp_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]
## Standard deviation     0.6307 0.5366 0.4210 0.28319 0.20289 0.17142 0.11621
## Proportion of Variance 0.3872 0.2803 0.1725 0.07807 0.04007 0.02861 0.01315
## Cumulative Proportion  0.3872 0.6675 0.8401 0.91817 0.95824 0.98685 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]      [,5]      [,6]
## Standard deviation     0.4183 0.1858 0.14738 0.10933 0.0003776 9.047e-05
## Proportion of Variance 0.7196 0.1419 0.08933 0.04916 0.0000000 0.000e+00
## Cumulative Proportion  0.7196 0.8615 0.95084 1.00000 1.0000000 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-StimGroup: Ori_Ali_CA and Con_C.
file_E12_resp_etd3 <- file.path(dir_lmm, "lmm_E12_resp_etd3.rds")

# fit the reduced model
if (!file.exists(file_E12_resp_etd3)) {
  glmm_E12_resp_etd3 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_CA + Con_CA + # Con_Ali + Ali_CA + Ori_Con + Ori_Ali + 
         Ori_Con_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + Con_Ali_CA + 
      ) + # Ori_Con_Ali_CA
      (0 + CA_C + # Ali_C + Ori_C + Con_C + 
         Ori_Con + Ori_CA + Con_CA | StimGroup # Ori_Ali + Con_Ali + Ali_CA + 
       # Ori_Con_Ali + Ori_Con_CA + Con_Ali_CA + Ori_Ali_CA
      ), # Ori_Con_Ali_CA 
    data = df_E12_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E12_resp_etd3, file = file_E12_resp_etd3)
} else {
  glmm_E12_resp_etd3 <- readRDS(file_E12_resp_etd3)
}

print(summary(glmm_E12_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +      (Ori_C + Ali_C + CA_C + Ori_CA + Con_CA + Ori_Con_CA | SubjCode) +      (0 + CA_C + Ori_Con + Ori_CA + Con_CA | StimGroup)
##    Data: df_E12_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  49538.1  50033.3 -24713.0  49426.1    51094 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -11.9717  -0.5871   0.2062   0.5380   7.1299 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                               
##  SubjCode  (Intercept) 0.08026  0.2833                                      
##            Ori_C       0.04794  0.2189    0.00                              
##            Ali_C       0.02721  0.1649    0.39  0.15                        
##            CA_C        0.25136  0.5014   -0.27  0.25 -0.34                  
##            Ori_CA      0.19279  0.4391    0.12  0.04  0.11 -0.26            
##            Con_CA      0.24213  0.4921   -0.02  0.25  0.28 -0.06  0.04      
##            Ori_Con_CA  0.17017  0.4125    0.15 -0.17 -0.28  0.03 -0.46 -0.72
##  StimGroup CA_C        0.02313  0.1521                                      
##            Ori_Con     0.01739  0.1319   -0.01                              
##            Ori_CA      0.02486  0.1577   -0.22  0.31                        
##            Con_CA      0.13239  0.3639   -0.57 -0.37 -0.13                  
## Number of obs: 51150, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.21782    0.03247   6.708 1.97e-11 ***
## Orientation2-1                                   0.07944    0.02835   2.802 0.005079 ** 
## Congruency2-1                                    0.01701    0.01392   1.222 0.221645    
## Alignment2-1                                     0.17363    0.02299   7.554 4.23e-14 ***
## CA2-1                                           -1.69105    0.07527 -22.466  < 2e-16 ***
## Cue2-1                                           0.01256    0.01306   0.962 0.335981    
## VA2-1                                            0.11412    0.06234   1.831 0.067165 .  
## Orientation2-1:Congruency2-1                     0.09549    0.05014   1.904 0.056874 .  
## Orientation2-1:Alignment2-1                     -0.04988    0.02713  -1.839 0.065976 .  
## Congruency2-1:Alignment2-1                       0.09749    0.02710   3.598 0.000321 ***
## Orientation2-1:CA2-1                             0.77198    0.07570  10.198  < 2e-16 ***
## Congruency2-1:CA2-1                              0.92266    0.13054   7.068 1.57e-12 ***
## Alignment2-1:CA2-1                              -0.08228    0.02747  -2.996 0.002739 ** 
## Orientation2-1:Congruency2-1:Alignment2-1       -0.18609    0.05409  -3.440 0.000581 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.87360    0.07263 -12.028  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.21948    0.05416   4.052 5.07e-05 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.41294    0.05394  -7.655 1.93e-14 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.56182    0.10780   5.211 1.87e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6.1.1.5 The optimal model

anova(glmm_E12_resp_rdc, glmm_E12_resp_etd3, refit=FALSE)

According to BIC, the reduced model is used as the optimal model.

glmm_E12_resp_opt <- glmm_E12_resp_rdc

print(summary(glmm_E12_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + VA +      (Ori_C + Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Ori_CA +          Con_CA + Ori_Con_CA || SubjCode) + (Ori_C + Con_C + CA_C +      Ori_Con + Ori_CA + Con_CA + Ali_CA + Ori_Ali_CA || StimGroup)
##    Data: df_E12_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  49161.5  49488.7 -24543.8  49087.5    51113 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -9.8722 -0.5714  0.2138  0.5290  6.9872 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 0.0813975 0.28530 
##  SubjCode.1  Ori_C       0.0491501 0.22170 
##  SubjCode.2  Con_C       0.0034362 0.05862 
##  SubjCode.3  Ali_C       0.0279300 0.16712 
##  SubjCode.4  CA_C        0.2464305 0.49642 
##  SubjCode.5  Ori_Con     0.0022671 0.04761 
##  SubjCode.6  Ori_Ali     0.0228744 0.15124 
##  SubjCode.7  Ori_CA      0.1820641 0.42669 
##  SubjCode.8  Con_CA      0.2329315 0.48263 
##  SubjCode.9  Ori_Con_CA  0.1368329 0.36991 
##  StimGroup   (Intercept) 0.0069962 0.08364 
##  StimGroup.1 Ori_C       0.0175483 0.13247 
##  StimGroup.2 Con_C       0.0376596 0.19406 
##  StimGroup.3 CA_C        0.0180077 0.13419 
##  StimGroup.4 Ori_Con     0.0177709 0.13331 
##  StimGroup.5 Ori_CA      0.0217109 0.14735 
##  StimGroup.6 Con_CA      0.1083992 0.32924 
##  StimGroup.7 Ali_CA      0.0008330 0.02886 
##  StimGroup.8 Ori_Ali_CA  0.0009597 0.03098 
## Number of obs: 51150, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.21096    0.04204   5.018 5.21e-07 ***
## Orientation2-1                                   0.08786    0.05066   1.734 0.082894 .  
## Congruency2-1                                    0.02505    0.06325   0.396 0.692084    
## Alignment2-1                                     0.16908    0.02316   7.300 2.89e-13 ***
## CA2-1                                           -1.69781    0.07133 -23.804  < 2e-16 ***
## Cue2-1                                           0.01157    0.01312   0.882 0.377788    
## VA2-1                                            0.09665    0.06526   1.481 0.138571    
## Orientation2-1:Congruency2-1                     0.10028    0.05062   1.981 0.047580 *  
## Orientation2-1:Alignment2-1                     -0.04608    0.03206  -1.437 0.150581    
## Congruency2-1:Alignment2-1                       0.10122    0.02712   3.732 0.000190 ***
## Orientation2-1:CA2-1                             0.76087    0.07242  10.506  < 2e-16 ***
## Congruency2-1:CA2-1                              0.91178    0.12043   7.571 3.70e-14 ***
## Alignment2-1:CA2-1                              -0.07201    0.02890  -2.492 0.012717 *  
## Orientation2-1:Congruency2-1:Alignment2-1       -0.19071    0.05419  -3.519 0.000432 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.84615    0.06890 -12.282  < 2e-16 ***
## Orientation2-1:Alignment2-1:CA2-1                0.22645    0.05538   4.089 4.33e-05 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.41612    0.05412  -7.689 1.48e-14 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.54933    0.10815   5.079 3.79e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6.1.2 Estimated marginal means

# hit and false alarm
emm_E12_probit <- emmeans(glmm_E12_resp_opt, 
                          ~ Orientation + Congruency + Alignment + CA,
                          type = "response")
emm_E12_probit
##  Orientation Congruency Alignment CA   prob     SE  df asymp.LCL asymp.UCL
##  upr         con        ali       sam 0.939 0.0102 Inf    0.9162     0.956
##  inv         con        ali       sam 0.830 0.0205 Inf    0.7868     0.867
##  upr         inc        ali       sam 0.720 0.0271 Inf    0.6643     0.770
##  inv         inc        ali       sam 0.773 0.0244 Inf    0.7221     0.817
##  upr         con        mis       sam 0.941 0.0100 Inf    0.9183     0.958
##  inv         con        mis       sam 0.851 0.0189 Inf    0.8111     0.885
##  upr         inc        mis       sam 0.872 0.0172 Inf    0.8356     0.903
##  inv         inc        mis       sam 0.819 0.0214 Inf    0.7739     0.858
##  upr         con        ali       dif 0.100 0.0145 Inf    0.0746     0.132
##  inv         con        ali       dif 0.254 0.0258 Inf    0.2058     0.307
##  upr         inc        ali       dif 0.287 0.0274 Inf    0.2355     0.342
##  inv         inc        ali       dif 0.378 0.0304 Inf    0.3199     0.439
##  upr         con        mis       dif 0.134 0.0177 Inf    0.1026     0.172
##  inv         con        mis       dif 0.321 0.0288 Inf    0.2671     0.380
##  upr         inc        mis       dif 0.295 0.0277 Inf    0.2432     0.352
##  inv         inc        mis       dif 0.430 0.0314 Inf    0.3693     0.492
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95 
## Intervals are back-transformed from the probit scale

Sensitivity d’ in each condition:

# sensitivity d'
emm_E12_d <- contrast(emm_E12_probit, 
                      "pairwise", 
                      simple="CA", 
                      infer=c(TRUE,FALSE),
                      adjust="none")
# emmip(emm_E12_d, Congruency ~ Alignment | Orientation, CIs = TRUE)

emm_E12_d[1:8]
##  contrast  Orientation Congruency Alignment estimate    SE  df asymp.LCL asymp.UCL
##  sam - dif upr         con        ali           2.83 0.109 Inf     2.613      3.04
##  sam - dif inv         con        ali           1.62 0.104 Inf     1.413      1.82
##  sam - dif upr         inc        ali           1.15 0.104 Inf     0.942      1.35
##  sam - dif inv         inc        ali           1.06 0.104 Inf     0.855      1.26
##  sam - dif upr         con        mis           2.67 0.108 Inf     2.454      2.88
##  sam - dif inv         con        mis           1.51 0.105 Inf     1.301      1.71
##  sam - dif upr         inc        mis           1.68 0.105 Inf     1.470      1.88
##  sam - dif inv         inc        mis           1.09 0.104 Inf     0.884      1.29
## 
## Results are averaged over the levels of: Cue, VA 
## Note: contrasts are still on the probit scale. Consider using
##       regrid() if you want contrasts of back-transformed estimates. 
## Confidence level used: 0.95

6.1.2.1 Composite effect

Composite effect of d’:

emm_E12_cf_d <- contrast(emm_E12_d, 
                         interaction = "pairwise", 
                         simple = c("Congruency", "Alignment"),
                         infer = TRUE)
summary(emm_E12_cf_d, side = ">")
## contrast = sam - dif, Orientation = upr:
##  Congruency_pairwise Alignment_pairwise estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis             0.691 0.0815 Inf    0.5568       Inf   8.478  <.0001
## 
## contrast = sam - dif, Orientation = inv:
##  Congruency_pairwise Alignment_pairwise estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis             0.141 0.0712 Inf    0.0244       Inf   1.987  0.0234
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95 
## P values are right-tailed

Congruency effect of d’ in aligned condition:

emm_E12_con_d <- contrast(emm_E12_d, 
                          interaction = "pairwise", 
                          simple = "Congruency",
                          infer = TRUE)
summary(emm_E12_con_d[1:2], side = ">")
##  Congruency_pairwise contrast  Orientation Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           sam - dif upr         ali          1.680 0.132 Inf     1.462       Inf  12.685  <.0001
##  con - inc           sam - dif inv         ali          0.559 0.129 Inf     0.347       Inf   4.331  <.0001
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E12_cf_d <- emm_E12_d %>%
  summary(infer=TRUE) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(Alignment, estimate, color=Congruency, group=Congruency)) +
  geom_point(size = 2) + # position = position_dodge(width = 0.1),
  geom_line(aes(linetype = Congruency), linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Orientation, switch = "both") +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), linewidth=1.5, width=0, 
                alpha = .6, # position = position_dodge(width = 0.1),
                show.legend = F) + 
  coord_cartesian(ylim = c(0,3.5)) +  # set the limit for y axis c(0, 1100)
  labs(y = expression("Sensitivity"~italic("d'")), fill = "Congruency",
       x = NULL) +  # set the names for main, x and y axises
  geom_text(label = c("***", "*", "", "", "", "", "", ""),
            color = "red",
            size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
  NULL
# ggsave(filename = "ccf_d.pdf", plot_ccf_d, width = 8, height = 6)
plot_E12_cf_d

6.1.2.2 Compare composite effects between upright and inverted faces

contrast(emm_E12_d, 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.549 0.108 Inf     0.337     0.761   5.079  <.0001
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95

6.1.2.3 Facilitation and interference

# facilitation and interference of d'
emm_E12_d_fi <- contrast(emm_E12_d, 
                         interaction = "pairwise", 
                         simple = "Alignment", 
                         infer = TRUE, 
                         adjust = "none")

# emmip(emm_E12_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 
emm_E12_d_fi[1:4]
##  Alignment_pairwise contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis          sam - dif upr         con          0.1602 0.0649 Inf   0.03295    0.2874   2.468  0.0136
##  ali - mis          sam - dif inv         con          0.1119 0.0529 Inf   0.00826    0.2156   2.116  0.0343
##  ali - mis          sam - dif upr         inc         -0.5306 0.0523 Inf  -0.63306   -0.4282 -10.152  <.0001
##  ali - mis          sam - dif inv         inc         -0.0295 0.0502 Inf  -0.12786    0.0688  -0.588  0.5565
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95
summary(emm_E12_d_fi[1:2], side=">")
##  Alignment_pairwise contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis          sam - dif upr         con           0.160 0.0649 Inf    0.0534       Inf   2.468  0.0068
##  ali - mis          sam - dif inv         con           0.112 0.0529 Inf    0.0249       Inf   2.116  0.0172
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95 
## P values are right-tailed
summary(emm_E12_d_fi[3:4], side="<")
##  Alignment_pairwise contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis          sam - dif upr         inc         -0.5306 0.0523 Inf      -Inf    -0.445 -10.152  <.0001
##  ali - mis          sam - dif inv         inc         -0.0295 0.0502 Inf      -Inf     0.053  -0.588  0.2782
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E12_cffi_d <- summary(emm_E12_d_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=1.1, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, 
       y = expression("Sensitivity"~italic("d")*"' (aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E12_fi_d.pdf", plot_E12_cffi_d, width = 7, height = 4.55)
plot_E12_cffi_d

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of d'
emm_E12_d_fi_ui <- contrast(emm_E12_probit, 
                            interaction = "pairwise", 
                            by = "Congruency", 
                            infer = TRUE, 
                            adjust = "none")

emm_E12_d_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise CA_pairwise Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif   con          0.0482 0.0829 Inf    -0.114     0.211   0.582  0.5607
##  upr - inv            ali - mis          sam - dif   inc         -0.5011 0.0715 Inf    -0.641    -0.361  -7.007  <.0001
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95

6.1.2.4 Comparisons between facilitation and interference

contrast(emm_E12_d_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2] 
##  contrast  Orientation estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte upr          -0.3705 0.0851 Inf   -0.5373    -0.204  -4.351  <.0001
##  faci-inte inv           0.0824 0.0746 Inf   -0.0638     0.229   1.105  0.2693
## 
## Results are averaged over the levels of: Cue, VA 
## Confidence level used: 0.95

6.1.3 Plot

plot_E12_cf_d_ <- plot_E12_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E12_d <- ggarrange(plot_E12_cf_d_, plot_E12_cffi_d, 
                        labels = c("a", "b"),
                        font.label = (list(size = 18)),
                        widths = c(1.5, 1),
                        nrow = 1)

plot_E12_d

6.2 Correct response times

6.2.1 Fitting the linear mixed-effects models

6.2.1.1 The maximal model

# file_E12_rt_max <- file.path(dir_lmm, "lmm_E12_rt_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E12_rt_max)) {
#   lmm_E12_rt_max <- lmer(
#     log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
#       (Orientation * Congruency * Alignment | SubjCode) +
#       (Orientation * Congruency * Alignment | StimGroup),
#     data = df_E12_lmm |> dplyr::filter(isCorrect==1),
#     control = lmerControl(optCtrl = list(maxfun = 1e7))
#   )
#   
#   saveRDS(lmm_E12_rt_max, file = file_E12_rt_max)
# } else {
#   lmm_E12_rt_max <- readRDS(file_E12_rt_max)
# }
# 
# print(summary(lmm_E12_rt_max), corr = FALSE)

6.2.1.2 The zero-correlation-parameter model

file_E12_rt_zcp <- file.path(dir_lmm, "lmm_E12_rt_zcp.rds")

# fit the zcp model
if (!file.exists(file_E12_rt_zcp)) {
  lmm_E12_rt_zcp <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || SubjCode) +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || StimGroup), 
    data = df_E12_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_rt_zcp, file = file_E12_rt_zcp)
} else {
  lmm_E12_rt_zcp <- readRDS(file_E12_rt_zcp)
}

print(summary(lmm_E12_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali ||          SubjCode) + (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali +      Con_Ali + Ori_Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35753.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2878 -0.6334 -0.1654  0.4552  7.7361 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. 
##  SubjCode    (Intercept) 4.133e-02 0.2033065
##  SubjCode.1  Ori_C       8.418e-02 0.2901417
##  SubjCode.2  Con_C       3.208e-04 0.0179120
##  SubjCode.3  Ali_C       8.941e-04 0.0299008
##  SubjCode.4  Ori_Con     1.437e-03 0.0379061
##  SubjCode.5  Ori_Ali     5.811e-04 0.0241056
##  SubjCode.6  Con_Ali     2.724e-04 0.0165057
##  SubjCode.7  Ori_Con_Ali 5.268e-04 0.0229523
##  StimGroup   (Intercept) 1.042e-05 0.0032287
##  StimGroup.1 Ori_C       1.002e-04 0.0100088
##  StimGroup.2 Con_C       2.891e-04 0.0170033
##  StimGroup.3 Ali_C       4.625e-06 0.0021505
##  StimGroup.4 Ori_Con     3.934e-04 0.0198331
##  StimGroup.5 Ori_Ali     1.754e-04 0.0132447
##  StimGroup.6 Con_Ali     1.320e-04 0.0114887
##  StimGroup.7 Ori_Con_Ali 3.097e-10 0.0000176
##  Residual                1.429e-01 0.3779884
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.770e+00  2.284e-02  7.824e+01 296.441  < 2e-16 ***
## Orientation2-1                             5.118e-02  3.282e-02  8.011e+01   1.559 0.122877    
## Congruency2-1                              3.988e-02  6.916e-03  1.048e+01   5.766 0.000151 ***
## Alignment2-1                              -1.036e-02  5.150e-03  2.073e+01  -2.013 0.057322 .  
## Cue2-1                                     2.000e-02  3.837e-03  3.816e+04   5.212 1.88e-07 ***
## VA2-1                                     -3.988e-02  4.562e-02  7.798e+01  -0.874 0.384786    
## CA2-1                                      5.980e-02  3.875e-03  3.847e+04  15.432  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.005e-02  1.081e-02  1.185e+01  -3.704 0.003077 ** 
## Orientation2-1:Alignment2-1               -7.841e-03  9.174e-03  1.021e+01  -0.855 0.412303    
## Congruency2-1:Alignment2-1                -5.207e-02  8.715e-03  9.031e+00  -5.974 0.000206 ***
## Orientation2-1:Congruency2-1:Alignment2-1  3.945e-02  1.562e-02  8.011e+01   2.526 0.013494 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

6.2.1.3 The reduced model

summary(rePCA(lmm_E12_rt_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]   [,4]    [,5]    [,6]    [,7]    [,8]
## Standard deviation     0.7676 0.5379 0.10028 0.0791 0.06377 0.06072 0.04739 0.04367
## Proportion of Variance 0.6498 0.3191 0.01109 0.0069 0.00449 0.00407 0.00248 0.00210
## Cumulative Proportion  0.6498 0.9689 0.97997 0.9869 0.99135 0.99542 0.99790 1.00000
## 
## $StimGroup
## Importance of components:
##                           [,1]    [,2]    [,3]    [,4]    [,5]     [,6]     [,7]      [,8]
## Standard deviation     0.05247 0.04498 0.03504 0.03039 0.02648 0.008542 0.005689 4.656e-05
## Proportion of Variance 0.35594 0.26162 0.15874 0.11944 0.09065 0.009430 0.004180 0.000e+00
## Cumulative Proportion  0.35594 0.61756 0.77630 0.89573 0.98638 0.995810 1.000000 1.000e+00

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-StimGroup: Ori_Con_Ali.
file_E12_rt_rdc <- file.path(dir_lmm, "lmm_E12_rt_rdc.rds")

# fit the max model
if (!file.exists(file_E12_rt_rdc)) {
  lmm_E12_rt_rdc <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali || SubjCode) +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali || StimGroup
      ), # Ori_Con_Ali 
    data = df_E12_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_rt_rdc, file = file_E12_rt_rdc)
} else {
  lmm_E12_rt_rdc <- readRDS(file_E12_rt_rdc)
}

print(summary(lmm_E12_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali ||          SubjCode) + (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali +      Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35753.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2878 -0.6335 -0.1654  0.4552  7.7361 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 4.132e-02 0.203267
##  SubjCode.1  Ori_C       8.412e-02 0.290041
##  SubjCode.2  Con_C       3.214e-04 0.017927
##  SubjCode.3  Ali_C       8.945e-04 0.029908
##  SubjCode.4  Ori_Con     1.436e-03 0.037895
##  SubjCode.5  Ori_Ali     5.795e-04 0.024073
##  SubjCode.6  Con_Ali     2.715e-04 0.016478
##  SubjCode.7  Ori_Con_Ali 5.250e-04 0.022912
##  StimGroup   (Intercept) 1.042e-05 0.003228
##  StimGroup.1 Ori_C       9.997e-05 0.009999
##  StimGroup.2 Con_C       2.890e-04 0.017001
##  StimGroup.3 Ali_C       4.767e-06 0.002183
##  StimGroup.4 Ori_Con     3.939e-04 0.019847
##  StimGroup.5 Ori_Ali     1.754e-04 0.013245
##  StimGroup.6 Con_Ali     1.318e-04 0.011481
##  Residual                1.429e-01 0.377989
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.770e+00  2.283e-02  7.829e+01 296.498  < 2e-16 ***
## Orientation2-1                             5.118e-02  3.281e-02  8.019e+01   1.560 0.122744    
## Congruency2-1                              3.988e-02  6.916e-03  1.048e+01   5.766 0.000151 ***
## Alignment2-1                              -1.036e-02  5.152e-03  2.093e+01  -2.012 0.057283 .  
## Cue2-1                                     2.000e-02  3.837e-03  3.815e+04   5.212 1.88e-07 ***
## VA2-1                                     -3.988e-02  4.562e-02  7.802e+01  -0.874 0.384691    
## CA2-1                                      5.980e-02  3.875e-03  3.847e+04  15.432  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.005e-02  1.081e-02  1.185e+01  -3.703 0.003084 ** 
## Orientation2-1:Alignment2-1               -7.841e-03  9.173e-03  1.021e+01  -0.855 0.412275    
## Congruency2-1:Alignment2-1                -5.207e-02  8.714e-03  9.026e+00  -5.975 0.000206 ***
## Orientation2-1:Congruency2-1:Alignment2-1  3.945e-02  1.561e-02  7.999e+01   2.527 0.013492 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00494732 (tol = 0.002, component 1)
summary(rePCA(lmm_E12_rt_rdc))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]
## Standard deviation     0.7673 0.5378 0.10025 0.07913 0.06369 0.06062 0.04743 0.04359
## Proportion of Variance 0.6498 0.3191 0.01109 0.00691 0.00448 0.00405 0.00248 0.00210
## Cumulative Proportion  0.6498 0.9689 0.97998 0.98689 0.99137 0.99542 0.99790 1.00000
## 
## $StimGroup
## Importance of components:
##                           [,1]    [,2]    [,3]    [,4]    [,5]     [,6]     [,7]
## Standard deviation     0.05251 0.04498 0.03504 0.03037 0.02645 0.008541 0.005776
## Proportion of Variance 0.35636 0.26150 0.15871 0.11925 0.09045 0.009430 0.004310
## Cumulative Proportion  0.35636 0.61786 0.77657 0.89581 0.98626 0.995690 1.000000
summary(rePCA(lmm_E12_rt_rdc))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]    [,7]    [,8]
## Standard deviation     0.7673 0.5378 0.10025 0.07913 0.06369 0.06062 0.04743 0.04359
## Proportion of Variance 0.6498 0.3191 0.01109 0.00691 0.00448 0.00405 0.00248 0.00210
## Cumulative Proportion  0.6498 0.9689 0.97998 0.98689 0.99137 0.99542 0.99790 1.00000
## 
## $StimGroup
## Importance of components:
##                           [,1]    [,2]    [,3]    [,4]    [,5]     [,6]     [,7]
## Standard deviation     0.05251 0.04498 0.03504 0.03037 0.02645 0.008541 0.005776
## Proportion of Variance 0.35636 0.26150 0.15871 0.11925 0.09045 0.009430 0.004310
## Cumulative Proportion  0.35636 0.61786 0.77657 0.89581 0.98626 0.995690 1.000000

6.2.1.4 The extended model

file_E12_rt_etd <- file.path(dir_lmm, "lmm_E12_rt_etd.rds")

# fit the max model
if (!file.exists(file_E12_rt_etd)) {
  lmm_E12_rt_etd <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali + 
         Ori_Con_Ali | SubjCode) +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali | StimGroup
      ), # Ori_Con_Ali 
    data = df_E12_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_rt_etd, file = file_E12_rt_etd)
} else {
  lmm_E12_rt_etd <- readRDS(file_E12_rt_etd)
}

print(summary(lmm_E12_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali |          SubjCode) + (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali +      Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35704.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3233 -0.6338 -0.1647  0.4544  7.7486 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr                                     
##  SubjCode  (Intercept) 4.140e-02 0.203477                                          
##            Ori_C       8.419e-02 0.290158 -0.03                                    
##            Con_C       5.146e-04 0.022685  0.12 -0.23                              
##            Ali_C       9.304e-04 0.030503 -0.14  0.00 -0.04                        
##            Ori_Con     2.153e-03 0.046397 -0.40 -0.13 -0.71 -0.31                  
##            Ori_Ali     1.158e-03 0.034033 -0.10 -0.07 -0.18  0.08  0.11            
##            Con_Ali     1.041e-03 0.032258  0.34 -0.47 -0.29  0.21 -0.04 -0.19      
##            Ori_Con_Ali 4.001e-03 0.063255 -0.03 -0.20  0.49  0.07 -0.58  0.55  0.04
##  StimGroup (Intercept) 3.185e-05 0.005644                                          
##            Ori_C       1.198e-04 0.010944 -0.14                                    
##            Con_C       3.030e-04 0.017405 -0.21  0.05                              
##            Ali_C       5.812e-05 0.007624 -0.51 -0.40 -0.01                        
##            Ori_Con     6.597e-04 0.025685 -0.56  0.17 -0.68  0.41                  
##            Ori_Ali     4.193e-04 0.020477  0.51  0.30 -0.37  0.11  0.06            
##            Con_Ali     5.095e-04 0.022571 -0.92 -0.09  0.08  0.37  0.55 -0.74      
##  Residual              1.426e-01 0.377570                                          
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.770e+00  2.290e-02  7.896e+01 295.597  < 2e-16 ***
## Orientation2-1                             5.105e-02  3.285e-02  8.038e+01   1.554 0.124165    
## Congruency2-1                              3.968e-02  7.183e-03  1.197e+01   5.523 0.000132 ***
## Alignment2-1                              -1.014e-02  5.684e-03  2.589e+01  -1.784 0.086156 .  
## Cue2-1                                     2.002e-02  3.834e-03  3.827e+04   5.222 1.78e-07 ***
## VA2-1                                     -2.874e-02  4.349e-02  7.833e+01  -0.661 0.510639    
## CA2-1                                      5.985e-02  3.871e-03  3.853e+04  15.461  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.049e-02  1.234e-02  1.521e+01  -3.280 0.004981 ** 
## Orientation2-1:Alignment2-1               -7.876e-03  1.076e-02  1.409e+01  -0.732 0.476099    
## Congruency2-1:Alignment2-1                -5.106e-02  1.110e-02  1.400e+01  -4.599 0.000413 ***
## Orientation2-1:Congruency2-1:Alignment2-1  3.842e-02  1.695e-02  1.233e+02   2.267 0.025116 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E12_rt_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]      [,7] [,8]
## Standard deviation     0.7710 0.5417 0.1932 0.10900 0.08900 0.06904 0.0002651    0
## Proportion of Variance 0.6258 0.3090 0.0393 0.01251 0.00834 0.00502 0.0000000    0
## Cumulative Proportion  0.6258 0.9348 0.9741 0.98664 0.99498 1.00000 1.0000000    1
## 
## $StimGroup
## Importance of components:
##                           [,1]    [,2]    [,3]    [,4]      [,5]      [,6]      [,7]
## Standard deviation     0.08559 0.07355 0.03474 0.02821 4.121e-05 1.764e-05 8.203e-21
## Proportion of Variance 0.49707 0.36705 0.08187 0.05401 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion  0.49707 0.86412 0.94599 1.00000 1.000e+00 1.000e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C, Ali_C, Con_Ali, and Ori_Ali;
  • by-StimGroup: (Intercept), Ali_C, and Ori_C.
file_E12_rt_etd2 <- file.path(dir_lmm, "lmm_E12_rt_etd2.rds")

# fit the max model
if (!file.exists(file_E12_rt_etd2)) {
  lmm_E12_rt_etd2 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +
      (Ori_C + # Con_C + Ali_C + 
         Ori_Con + # Ori_Ali + Con_Ali + 
         Ori_Con_Ali | SubjCode) +
      (0 + Con_C + # Ali_C + Ori_C + 
         Ori_Con + Ori_Ali + Con_Ali | StimGroup
      ), # Ori_Con_Ali 
    data = df_E12_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_rt_etd2, file = file_E12_rt_etd2)
} else {
  lmm_E12_rt_etd2 <- readRDS(file_E12_rt_etd2)
}

print(summary(lmm_E12_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C + Ori_Con + Ori_Con_Ali | SubjCode) + (0 + Con_C +      Ori_Con + Ori_Ali + Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35756.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2807 -0.6339 -0.1646  0.4563  7.7748 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr             
##  SubjCode  (Intercept) 0.0413464 0.20334                   
##            Ori_C       0.0840286 0.28988  -0.03            
##            Ori_Con     0.0017853 0.04225  -0.43 -0.14      
##            Ori_Con_Ali 0.0029594 0.05440  -0.06 -0.17 -0.82
##  StimGroup Con_C       0.0002823 0.01680                   
##            Ori_Con     0.0004521 0.02126  -1.00            
##            Ori_Ali     0.0003796 0.01948  -0.30  0.30      
##            Con_Ali     0.0003359 0.01833  -0.14  0.14 -0.90
##  Residual              0.1431726 0.37838                   
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.769e+00  2.282e-02  7.806e+01 296.688  < 2e-16 ***
## Orientation2-1                             5.115e-02  3.264e-02  7.903e+01   1.567 0.121099    
## Congruency2-1                              3.987e-02  6.567e-03  9.143e+00   6.072 0.000174 ***
## Alignment2-1                              -1.118e-02  3.854e-03  3.877e+04  -2.901 0.003724 ** 
## Cue2-1                                     2.013e-02  3.839e-03  3.880e+04   5.243 1.59e-07 ***
## VA2-1                                     -3.465e-02  4.432e-02  7.808e+01  -0.782 0.436688    
## CA2-1                                      5.976e-02  3.875e-03  3.876e+04  15.420  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.986e-02  1.128e-02  1.537e+01  -3.535 0.002901 ** 
## Orientation2-1:Alignment2-1               -7.404e-03  9.866e-03  1.178e+01  -0.750 0.467698    
## Congruency2-1:Alignment2-1                -5.328e-02  9.642e-03  1.220e+01  -5.526 0.000123 ***
## Orientation2-1:Congruency2-1:Alignment2-1  3.937e-02  1.657e-02  1.499e+02   2.375 0.018798 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E12_rt_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]      [,4]
## Standard deviation     0.7670 0.5393 0.17250 0.0001197
## Proportion of Variance 0.6473 0.3200 0.03274 0.0000000
## Cumulative Proportion  0.6473 0.9673 1.00000 1.0000000
## 
## $StimGroup
## Importance of components:
##                           [,1]    [,2]      [,3] [,4]
## Standard deviation     0.07497 0.06713 2.343e-06    0
## Proportion of Variance 0.55504 0.44496 0.000e+00    0
## Cumulative Proportion  0.55504 1.00000 1.000e+00    1

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con;
  • by-StimGroup: Con_C and Con_Ali.
file_E12_rt_etd3 <- file.path(dir_lmm, "lmm_E12_rt_etd3.rds")

# fit the max model
if (!file.exists(file_E12_rt_etd3)) {
  lmm_E12_rt_etd3 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +
      (Ori_C + # Con_C + Ali_C + 
         # Ori_Ali + Con_Ali + Ori_Con + 
         Ori_Con_Ali | SubjCode) +
      (0 + # Ali_C + Ori_C + Con_C + 
         Ori_Con + Ori_Ali | StimGroup # + Con_Ali
      ), # Ori_Con_Ali 
    data = df_E12_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_rt_etd3, file = file_E12_rt_etd3)
} else {
  lmm_E12_rt_etd3 <- readRDS(file_E12_rt_etd3)
}

print(summary(lmm_E12_rt_etd3), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C + Ori_Con_Ali | SubjCode) + (0 + Ori_Con + Ori_Ali |      StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35783.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2811 -0.6345 -0.1651  0.4563  7.7589 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr       
##  SubjCode  (Intercept) 0.0413047 0.20324             
##            Ori_C       0.0841002 0.29000  -0.03      
##            Ori_Con_Ali 0.0005221 0.02285  -0.17 -0.39
##  StimGroup Ori_Con     0.0004563 0.02136             
##            Ori_Ali     0.0001667 0.01291  0.39       
##  Residual              0.1434171 0.37870             
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.769e+00  2.280e-02  7.799e+01 296.830  < 2e-16 ***
## Orientation2-1                             5.121e-02  3.265e-02  7.902e+01   1.568  0.12081    
## Congruency2-1                              4.017e-02  3.861e-03  3.880e+04  10.404  < 2e-16 ***
## Alignment2-1                              -1.126e-02  3.857e-03  3.882e+04  -2.920  0.00351 ** 
## Cue2-1                                     2.005e-02  3.840e-03  3.880e+04   5.223 1.77e-07 ***
## VA2-1                                     -4.125e-02  4.557e-02  7.798e+01  -0.905  0.36817    
## CA2-1                                      5.964e-02  3.876e-03  3.881e+04  15.384  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.984e-02  1.026e-02  9.170e+00  -3.883  0.00359 ** 
## Orientation2-1:Alignment2-1               -7.572e-03  8.724e-03  9.278e+00  -0.868  0.40731    
## Congruency2-1:Alignment2-1                -5.311e-02  7.710e-03  3.885e+04  -6.888 5.73e-12 ***
## Orientation2-1:Congruency2-1:Alignment2-1  4.030e-02  1.563e-02  8.097e+01   2.578  0.01176 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00342339 (tol = 0.002, component 1)
summary(rePCA(lmm_E12_rt_etd3))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]
## Standard deviation     0.7664 0.5363 0.05445
## Proportion of Variance 0.6690 0.3276 0.00338
## Cumulative Proportion  0.6690 0.9966 1.00000
## 
## $StimGroup
## Importance of components:
##                           [,1]    [,2]
## Standard deviation     0.05852 0.03032
## Proportion of Variance 0.78835 0.21165
## Cumulative Proportion  0.78835 1.00000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con_Ali;
file_E12_rt_etd4 <- file.path(dir_lmm, "lmm_E12_rt_etd4.rds")

# fit the max model
if (!file.exists(file_E12_rt_etd4)) {
  lmm_E12_rt_etd4 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +
      (Ori_C | SubjCode # Con_C + Ali_C + 
       # Ori_Ali + Con_Ali + Ori_Con + 
      ) + # Ori_Con_Ali
      (0 + # Ali_C + Ori_C + Con_C + 
         Ori_Con + Ori_Ali | StimGroup # + Con_Ali
      ), # Ori_Con_Ali 
    data = df_E12_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_rt_etd4, file = file_E12_rt_etd4)
} else {
  lmm_E12_rt_etd4 <- readRDS(file_E12_rt_etd4)
}

print(summary(lmm_E12_rt_etd4), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C | SubjCode) + (0 + Ori_Con + Ori_Ali | StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35783.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2742 -0.6346 -0.1657  0.4563  7.7606 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr 
##  SubjCode  (Intercept) 0.0413028 0.20323       
##            Ori_C       0.0840821 0.28997  -0.03
##  StimGroup Ori_Con     0.0004562 0.02136       
##            Ori_Ali     0.0001675 0.01294  0.39 
##  Residual              0.1434251 0.37872       
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.769e+00  2.280e-02  7.799e+01 296.837  < 2e-16 ***
## Orientation2-1                             5.119e-02  3.265e-02  7.901e+01   1.568  0.12090    
## Congruency2-1                              4.018e-02  3.861e-03  3.886e+04  10.405  < 2e-16 ***
## Alignment2-1                              -1.127e-02  3.857e-03  3.885e+04  -2.921  0.00349 ** 
## Cue2-1                                     2.005e-02  3.840e-03  3.885e+04   5.222 1.77e-07 ***
## VA2-1                                     -4.068e-02  4.559e-02  7.798e+01  -0.892  0.37494    
## CA2-1                                      5.963e-02  3.876e-03  3.886e+04  15.383  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.983e-02  1.026e-02  9.169e+00  -3.882  0.00359 ** 
## Orientation2-1:Alignment2-1               -7.605e-03  8.729e-03  9.276e+00  -0.871  0.40560    
## Congruency2-1:Alignment2-1                -5.305e-02  7.710e-03  3.885e+04  -6.881 6.04e-12 ***
## Orientation2-1:Congruency2-1:Alignment2-1  4.027e-02  1.542e-02  3.879e+04   2.611  0.00903 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6.2.1.5 The optimal model

anova(lmm_E12_rt_rdc, lmm_E12_rt_etd4, refit=FALSE)

According to AIC, the extended model is used as the optimal model.

lmm_E12_rt_opt <- lmm_E12_rt_etd4

print(summary(lmm_E12_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + VA + CA +      (Ori_C | SubjCode) + (0 + Ori_Con + Ori_Ali | StimGroup)
##    Data: dplyr::filter(df_E12_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 35783.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2742 -0.6346 -0.1657  0.4563  7.7606 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr 
##  SubjCode  (Intercept) 0.0413028 0.20323       
##            Ori_C       0.0840821 0.28997  -0.03
##  StimGroup Ori_Con     0.0004562 0.02136       
##            Ori_Ali     0.0001675 0.01294  0.39 
##  Residual              0.1434251 0.37872       
## Number of obs: 39029, groups:  SubjCode, 80; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.769e+00  2.280e-02  7.799e+01 296.837  < 2e-16 ***
## Orientation2-1                             5.119e-02  3.265e-02  7.901e+01   1.568  0.12090    
## Congruency2-1                              4.018e-02  3.861e-03  3.886e+04  10.405  < 2e-16 ***
## Alignment2-1                              -1.127e-02  3.857e-03  3.885e+04  -2.921  0.00349 ** 
## Cue2-1                                     2.005e-02  3.840e-03  3.885e+04   5.222 1.77e-07 ***
## VA2-1                                     -4.068e-02  4.559e-02  7.798e+01  -0.892  0.37494    
## CA2-1                                      5.963e-02  3.876e-03  3.886e+04  15.383  < 2e-16 ***
## Orientation2-1:Congruency2-1              -3.983e-02  1.026e-02  9.169e+00  -3.882  0.00359 ** 
## Orientation2-1:Alignment2-1               -7.605e-03  8.729e-03  9.276e+00  -0.871  0.40560    
## Congruency2-1:Alignment2-1                -5.305e-02  7.710e-03  3.885e+04  -6.881 6.04e-12 ***
## Orientation2-1:Congruency2-1:Alignment2-1  4.027e-02  1.542e-02  3.879e+04   2.611  0.00903 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6.2.2 Estimated marginal means

emm_E12_rt <- emmeans(lmm_E12_rt_opt, 
                      ~ Orientation + Congruency + Alignment,
                      pbkrtest.limit = 2e5,
                      lmerTest.limit = 2e5)
# emmip(regrid(emm_E12_rt), Congruency ~ Alignment | Orientation, CIs = TRUE)

summary(emm_E12_rt, type = "response") # equivalent to regrid(emm_E12_rt)
##  Orientation Congruency Alignment response   SE   df lower.CL upper.CL
##  upr         con        ali            812 23.4 82.7      766      860
##  inv         con        ali            884 24.9 83.5      836      935
##  upr         inc        ali            894 25.8 83.7      844      947
##  inv         inc        ali            917 25.8 83.8      867      970
##  upr         con        mis            836 24.1 82.3      789      885
##  inv         con        mis            885 24.9 83.3      837      936
##  upr         inc        mis            856 24.7 83.6      808      906
##  inv         inc        mis            888 25.1 84.4      840      940
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale

6.2.2.1 Composite effect

Composite effect of rt:

emm_E12_rt_cf <- contrast(regrid(emm_E12_rt), 
                          interaction = "pairwise", 
                          by = "Orientation", 
                          infer = TRUE,
                          side="<")
emm_E12_rt_cf
## Orientation = upr:
##  Congruency_pairwise Alignment_pairwise estimate    SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis             -62.5  9.21 82.3     -Inf    -47.2  -6.788  <.0001
## 
## Orientation = inv:
##  Congruency_pairwise Alignment_pairwise estimate    SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis             -29.7 10.05 83.3     -Inf    -13.0  -2.954  0.0020
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed

Congruency effect of rt in aligned conditions:

emm_E12_rt_con <- contrast(regrid(emm_E12_rt), 
                           interaction = "pairwise", 
                           by = c("Orientation", "Alignment"),
                           infer = TRUE,
                           side="<")
emm_E12_rt_con[1:2]
##  Congruency_pairwise Orientation Alignment estimate   SE   df lower.CL upper.CL t.ratio p.value
##  con - inc           upr         ali          -82.4 7.48 82.7     -Inf    -70.0 -11.019  <.0001
##  con - inc           inv         ali          -33.1 7.78 83.5     -Inf    -20.1  -4.247  <.0001
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E12_cf_rt <- summary(emm_E12_rt, type = "response") %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Orientation, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "**", "", "", "", ""), color = sig_color, size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  NULL

# ggsave(filename = "E12_cf_rt.pdf", plot_E12_cf_rt, width = 8, height = 4.8)

plot_E12_cf_rt

6.2.2.2 Compare composite effects between upright and inverted faces

contrast(regrid(emm_E12_rt), 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE   df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -32.8 13.6 82.3    -59.9     -5.8  -2.416  0.0179
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

6.2.2.3 Facilitation and interference

emm_E12_rt_fi <- contrast(regrid(emm_E12_rt), 
                          "pairwise", 
                          by = c("Orientation", "Congruency"), 
                          infer = TRUE, 
                          adjust = "none")

# emmip(emm_E12_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 
emm_E12_rt_fi[1:4]
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con          -23.99 6.13 82.3    -36.2    -11.8  -3.912  0.0002
##  ali - mis inv         con           -1.23 7.06 83.3    -15.3     12.8  -0.174  0.8621
##  ali - mis upr         inc           38.54 7.19 83.6     24.2     52.8   5.361  <.0001
##  ali - mis inv         inc           28.45 7.59 83.8     13.3     43.6   3.746  0.0003
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95
summary(emm_E12_rt_fi[1:2], side="<")
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con          -23.99 6.13 82.3     -Inf    -13.8  -3.912  0.0001
##  ali - mis inv         con           -1.23 7.06 83.3     -Inf     10.5  -0.174  0.4310
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed
summary(emm_E12_rt_fi[3:4], side=">")
##  contrast  Orientation Congruency estimate   SE   df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc            38.5 7.19 83.6     26.6      Inf   5.361  <.0001
##  ali - mis inv         inc            28.5 7.59 83.8     15.8      Inf   3.746  0.0002
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E12_cffi_rt <- summary(emm_E12_rt_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=100, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E12_fi_rt.pdf", plot_E12_cffi_rt, width = 7, height = 4.55)
plot_E12_cffi_rt

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of d'
emm_E12_rt_fi_ui <- contrast(emm_E12_rt, 
                             interaction = "pairwise", 
                             by = "Congruency", 
                             infer = TRUE, 
                             adjust = "none")

emm_E12_rt_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise Congruency estimate     SE   df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con         -0.0277 0.0113 25.7  -0.0509 -0.00457  -2.462  0.0208
##  upr - inv            ali - mis          inc          0.0125 0.0120 33.3  -0.0119  0.03697   1.043  0.3046
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: satterthwaite 
## Results are given on the log (not the response) scale. 
## Confidence level used: 0.95

6.2.2.4 Comparisons between facilitation and interference

contrast(emm_E12_rt_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2] 
##  contrast  Orientation estimate    SE   df lower.CL upper.CL t.ratio p.value
##  faci-inte upr             14.5  9.68 82.3    -4.72     33.8   1.502  0.1369
##  faci-inte inv             27.2 10.68 83.3     5.98     48.5   2.549  0.0127
## 
## Results are averaged over the levels of: Cue, VA, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

6.2.3 Plot

plot_E12_cf_rt_ <- plot_E12_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E12_rt <- ggarrange(plot_E12_cf_rt_, plot_E12_cffi_rt, 
                         labels = c("a", "b"),
                         font.label = (list(size = 18)),
                         widths = c(1.5, 1),
                         nrow = 1)

plot_E12_rt

6.3 Plot

plot_E12 <- ggarrange(plot_E12_cf_d_, plot_E12_cffi_d, 
                      plot_E12_cf_rt_, plot_E12_cffi_rt,
                      labels = c("A", "B", "C", "D"),
                      font.label = (list(size = 18)),
                      widths = c(1.5, 1),
                      nrow = 2,
                      ncol = 2)

plot_E12

7 Experiment 3 (pre-registered analysis)

Visual angle: 3.2°×4°

7.1 Behavioral choices (d’)

7.1.1 Fitting the generalized linear mixed-effects models

7.1.1.1 The maximal model

# file_E3_resp_max <- file.path(dir_lmm, "lmm_E3_resp_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E3_resp_max)) {
#   glmm_E3_resp_max <- glmer(
#     isSame ~ Orientation * Congruency * Alignment * CA + Cue +
#       (Orientation * Congruency * Alignment * CA | SubjCode) +
#       (Orientation * Congruency * Alignment * CA | StimGroup),
#     data = df_E3_lmm,
#     family = binomial(link = "probit"),
#     control = glmerControl(optCtrl = list(maxfun = 1e7))
#   )
# 
#   saveRDS(glmm_E3_resp_max, file = file_E3_resp_max)
# } else {
#   glmm_E3_resp_max <- readRDS(file_E3_resp_max)
# }
# 
# print(summary(glmm_E3_resp_max), corr = FALSE)

7.1.1.2 The zero-correlation-parameter model

file_E3_resp_zcp <- file.path(dir_lmm, "lmm_E3_resp_zcp.rds")

# fit the max model
if (!file.exists(file_E3_resp_zcp)) {
  glmm_E3_resp_zcp <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA +
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA +
         Ori_Con_Ali_CA || SubjCode) +
      (Ori_C + Con_C + Ali_C + CA_C + 
         Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA + Ali_CA +
         Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA +
         Ori_Con_Ali_CA || StimGroup),
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E3_resp_zcp, file = file_E3_resp_zcp)
} else {
  glmm_E3_resp_zcp <- readRDS(file_E3_resp_zcp)
}

print(summary(glmm_E3_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Con_C + Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA +      Con_CA + Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA +      Con_Ali_CA + Ori_Con_Ali_CA || SubjCode) + (Ori_C + Con_C +      Ali_C + CA_C + Ori_Con + Ori_Ali + Con_Ali + Ori_CA + Con_CA +      Ali_CA + Ori_Con_Ali + Ori_Con_CA + Ori_Ali_CA + Con_Ali_CA +      Ori_Con_Ali_CA || StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  71328.8  71781.9 -35615.4  71230.8    76629 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.6819  -0.5410   0.2114   0.4992   7.3080 
## 
## Random effects:
##  Groups       Name           Variance  Std.Dev. 
##  SubjCode     (Intercept)    7.006e-02 2.647e-01
##  SubjCode.1   Ori_C          6.830e-02 2.614e-01
##  SubjCode.2   Con_C          1.209e-04 1.100e-02
##  SubjCode.3   Ali_C          2.540e-02 1.594e-01
##  SubjCode.4   CA_C           1.893e-01 4.350e-01
##  SubjCode.5   Ori_Con        0.000e+00 0.000e+00
##  SubjCode.6   Ori_Ali        2.109e-02 1.452e-01
##  SubjCode.7   Con_Ali        2.969e-09 5.449e-05
##  SubjCode.8   Ori_CA         1.072e-01 3.275e-01
##  SubjCode.9   Con_CA         2.203e-01 4.694e-01
##  SubjCode.10  Ali_CA         3.163e-03 5.624e-02
##  SubjCode.11  Ori_Con_Ali    1.224e-09 3.499e-05
##  SubjCode.12  Ori_Con_CA     4.222e-02 2.055e-01
##  SubjCode.13  Ori_Ali_CA     1.918e-09 4.379e-05
##  SubjCode.14  Con_Ali_CA     4.048e-02 2.012e-01
##  SubjCode.15  Ori_Con_Ali_CA 2.126e-10 1.458e-05
##  StimGroup    (Intercept)    1.328e-02 1.152e-01
##  StimGroup.1  Ori_C          1.744e-02 1.321e-01
##  StimGroup.2  Con_C          4.844e-02 2.201e-01
##  StimGroup.3  Ali_C          0.000e+00 0.000e+00
##  StimGroup.4  CA_C           3.738e-02 1.933e-01
##  StimGroup.5  Ori_Con        1.453e-02 1.205e-01
##  StimGroup.6  Ori_Ali        1.421e-09 3.770e-05
##  StimGroup.7  Con_Ali        6.957e-04 2.638e-02
##  StimGroup.8  Ori_CA         2.700e-02 1.643e-01
##  StimGroup.9  Con_CA         9.342e-02 3.056e-01
##  StimGroup.10 Ali_CA         1.404e-10 1.185e-05
##  StimGroup.11 Ori_Con_Ali    4.522e-09 6.725e-05
##  StimGroup.12 Ori_Con_CA     4.308e-02 2.076e-01
##  StimGroup.13 Ori_Ali_CA     2.414e-02 1.554e-01
##  StimGroup.14 Con_Ali_CA     3.377e-09 5.811e-05
##  StimGroup.15 Ori_Con_Ali_CA 1.394e-09 3.733e-05
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.251191   0.044121   5.693 1.25e-08 ***
## Orientation2-1                                  -0.004616   0.049488  -0.093 0.925689    
## Congruency2-1                                    0.027899   0.070558   0.395 0.692538    
## Alignment2-1                                     0.155321   0.018507   8.392  < 2e-16 ***
## CA2-1                                           -1.775409   0.073897 -24.026  < 2e-16 ***
## Cue2-1                                           0.095623   0.010865   8.801  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.118771   0.044475   2.670 0.007574 ** 
## Orientation2-1:Alignment2-1                     -0.015723   0.026318  -0.597 0.550223    
## Congruency2-1:Alignment2-1                       0.084999   0.024195   3.513 0.000443 ***
## Orientation2-1:CA2-1                             0.753740   0.064362  11.711  < 2e-16 ***
## Congruency2-1:CA2-1                              0.993299   0.108289   9.173  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.106580   0.023462  -4.543 5.56e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.149685   0.045299  -3.304 0.000952 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.641746   0.082209  -7.806 5.89e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.165783   0.066994   2.475 0.013338 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.471182   0.048925  -9.631  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.620971   0.090569   6.856 7.06e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

7.1.1.3 The reduced model

summary(rePCA(glmm_E3_resp_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]   [,6]    [,7]    [,8]    [,9]   [,10]   [,11]     [,12]     [,13]     [,14]     [,15] [,16]
## Standard deviation     0.4694 0.4350 0.3275 0.26470 0.26135 0.2055 0.20120 0.15939 0.14523 0.05624 0.01100 5.449e-05 4.379e-05 3.499e-05 1.458e-05     0
## Proportion of Variance 0.2797 0.2403 0.1362 0.08895 0.08672 0.0536 0.05139 0.03225 0.02678 0.00402 0.00015 0.000e+00 0.000e+00 0.000e+00 0.000e+00     0
## Cumulative Proportion  0.2797 0.5200 0.6561 0.74509 0.83181 0.8854 0.93680 0.96905 0.99583 0.99985 1.00000 1.000e+00 1.000e+00 1.000e+00 1.000e+00     1
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]   [,8]    [,9]   [,10]     [,11]     [,12]    [,13]     [,14]     [,15] [,16]
## Standard deviation     0.3056 0.2201 0.2076 0.1933 0.16432 0.15538 0.13205 0.1205 0.11524 0.02638 6.725e-05 5.811e-05 3.77e-05 3.733e-05 1.185e-05     0
## Proportion of Variance 0.2925 0.1517 0.1349 0.1170 0.08454 0.07558 0.05459 0.0455 0.04158 0.00218 0.000e+00 0.000e+00 0.00e+00 0.000e+00 0.000e+00     0
## Cumulative Proportion  0.2925 0.4441 0.5790 0.6960 0.78057 0.85615 0.91075 0.9562 0.99782 1.00000 1.000e+00 1.000e+00 1.00e+00 1.000e+00 1.000e+00     1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_C, Ori_Con, Con_Ali, Ori_Con_Ali, Ori_Ali_CA, and Ori_Con_Ali_CA;
  • by-StimGroup: Ali_C, Ori_Ali, Ali_CA, Ori_Con_Ali, Con_Ali_CA, and Ori_Con_Ali_CA.
file_E3_resp_rdc <- file.path(dir_lmm, "lmm_E3_resp_rdc.rds")

# fit the reduced model
if (!file.exists(file_E3_resp_rdc)) {
  glmm_E3_resp_rdc <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_Ali + Ori_CA + Con_CA + Ali_CA + # Ori_Con + Con_Ali + 
         Ori_Con_CA + Con_Ali_CA || SubjCode # Ori_Con_Ali + Ori_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (Ori_C + Con_C + CA_C + # Ali_C + 
         Ori_Con + Con_Ali + Ori_CA + Con_CA + # Ori_Ali + Ali_CA + 
         Ori_Con_CA + Ori_Ali_CA || StimGroup # Ori_Con_Ali + Con_Ali_CA + 
      ), # Ori_Con_Ali_CA 
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E3_resp_rdc, file = file_E3_resp_rdc)
} else {
  glmm_E3_resp_rdc <- readRDS(file_E3_resp_rdc)
}

print(summary(glmm_E3_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_Ali + Ori_CA + Con_CA + Ali_CA + Ori_Con_CA +      Con_Ali_CA || SubjCode) + (Ori_C + Con_C + CA_C + Ori_Con +      Con_Ali + Ori_CA + Con_CA + Ori_Con_CA + Ori_Ali_CA || StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  71304.8  71647.0 -35615.4  71230.8    76641 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.6910  -0.5409   0.2115   0.4993   7.3167 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  SubjCode    (Intercept) 0.070040 0.26465 
##  SubjCode.1  Ori_C       0.068311 0.26136 
##  SubjCode.2  Ali_C       0.025407 0.15939 
##  SubjCode.3  CA_C        0.189252 0.43503 
##  SubjCode.4  Ori_Ali     0.021090 0.14522 
##  SubjCode.5  Ori_CA      0.107253 0.32750 
##  SubjCode.6  Con_CA      0.220262 0.46932 
##  SubjCode.7  Ali_CA      0.003169 0.05629 
##  SubjCode.8  Ori_Con_CA  0.042261 0.20557 
##  SubjCode.9  Con_Ali_CA  0.040514 0.20128 
##  StimGroup   (Intercept) 0.013287 0.11527 
##  StimGroup.1 Ori_C       0.017443 0.13207 
##  StimGroup.2 Con_C       0.048426 0.22006 
##  StimGroup.3 CA_C        0.037367 0.19331 
##  StimGroup.4 Ori_Con     0.014522 0.12051 
##  StimGroup.5 Con_Ali     0.000695 0.02636 
##  StimGroup.6 Ori_CA      0.027001 0.16432 
##  StimGroup.7 Con_CA      0.093397 0.30561 
##  StimGroup.8 Ori_Con_CA  0.043115 0.20764 
##  StimGroup.9 Ori_Ali_CA  0.024149 0.15540 
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.251177   0.044124   5.693 1.25e-08 ***
## Orientation2-1                                  -0.004564   0.049492  -0.092 0.926518    
## Congruency2-1                                    0.027936   0.070539   0.396 0.692075    
## Alignment2-1                                     0.155320   0.018507   8.392  < 2e-16 ***
## CA2-1                                           -1.775326   0.073875 -24.032  < 2e-16 ***
## Cue2-1                                           0.095627   0.010865   8.802  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.118759   0.044459   2.671 0.007558 ** 
## Orientation2-1:Alignment2-1                     -0.015732   0.026317  -0.598 0.549973    
## Congruency2-1:Alignment2-1                       0.085009   0.024192   3.514 0.000442 ***
## Orientation2-1:CA2-1                             0.753719   0.064359  11.711  < 2e-16 ***
## Congruency2-1:CA2-1                              0.993139   0.108285   9.172  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.106607   0.023462  -4.544 5.52e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.149687   0.045293  -3.305 0.000950 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.641655   0.082207  -7.805 5.93e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.165826   0.066985   2.476 0.013303 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.471165   0.048928  -9.630  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.620925   0.090550   6.857 7.02e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

7.1.1.4 The extended model

file_E3_resp_etd <- file.path(dir_lmm, "lmm_E3_resp_etd.rds")

# fit the reduced model
if (!file.exists(file_E3_resp_etd)) {
  glmm_E3_resp_etd <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_Ali + Ori_CA + Con_CA + Ali_CA + # Ori_Con + Con_Ali + 
         Ori_Con_CA + Con_Ali_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (Ori_C + Con_C + CA_C + # Ali_C + 
         Ori_Con + Con_Ali + Ori_CA + Con_CA + # Ori_Ali + Ali_CA + 
         Ori_Con_CA + Ori_Ali_CA | StimGroup # Ori_Con_Ali + Con_Ali_CA + 
      ), # Ori_Con_Ali_CA 
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E3_resp_etd, file = file_E3_resp_etd)
} else {
  glmm_E3_resp_etd <- readRDS(file_E3_resp_etd)
}

print(summary(glmm_E3_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_Ali + Ori_CA + Con_CA + Ali_CA + Ori_Con_CA +      Con_Ali_CA | SubjCode) + (Ori_C + Con_C + CA_C + Ori_Con +      Con_Ali + Ori_CA + Con_CA + Ori_Con_CA + Ori_Ali_CA | StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  71302.8  72477.2 -35524.4  71048.8    76551 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -13.5135  -0.5419   0.2069   0.5022   7.6015 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                                                 
##  SubjCode  (Intercept) 0.070482 0.26548                                                       
##            Ori_C       0.068056 0.26088   0.07                                                
##            Ali_C       0.026977 0.16425   0.18  0.00                                          
##            CA_C        0.197809 0.44476   0.08 -0.08 -0.16                                    
##            Ori_Ali     0.024359 0.15607   0.03 -0.06 -0.14  0.12                              
##            Ori_CA      0.117181 0.34232  -0.02 -0.14  0.19 -0.57 -0.07                        
##            Con_CA      0.225724 0.47510   0.05  0.12 -0.03  0.00  0.33  0.02                  
##            Ali_CA      0.014621 0.12092  -0.67 -0.25 -0.37  0.23  0.01 -0.14  0.28            
##            Ori_Con_CA  0.081224 0.28500   0.17 -0.15 -0.34  0.32 -0.28 -0.22 -0.35 -0.38      
##            Con_Ali_CA  0.060546 0.24606   0.20 -0.05 -0.52  0.47  0.70 -0.28  0.02 -0.18  0.43
##  StimGroup (Intercept) 0.012985 0.11395                                                       
##            Ori_C       0.016351 0.12787   0.02                                                
##            Con_C       0.048557 0.22036  -0.05 -0.72                                          
##            CA_C        0.036713 0.19161   0.76  0.30 -0.43                                    
##            Ori_Con     0.016269 0.12755  -0.12  0.57 -0.64  0.13                              
##            Con_Ali     0.004501 0.06709  -0.35  0.75 -0.71  0.26  0.40                        
##            Ori_CA      0.027619 0.16619  -0.29  0.76 -0.56  0.06  0.32  0.78                  
##            Con_CA      0.094037 0.30665  -0.45 -0.68  0.90 -0.68 -0.45 -0.52 -0.47            
##            Ori_Con_CA  0.048152 0.21944  -0.43 -0.02  0.09 -0.59  0.60 -0.22 -0.19  0.33      
##            Ori_Ali_CA  0.032402 0.18001  -0.17  0.14 -0.47  0.35  0.63  0.47  0.23 -0.28  0.13
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.251703   0.043836   5.742 9.36e-09 ***
## Orientation2-1                                  -0.005973   0.048427  -0.123  0.90183    
## Congruency2-1                                    0.032701   0.070639   0.463  0.64342    
## Alignment2-1                                     0.166603   0.019101   8.722  < 2e-16 ***
## CA2-1                                           -1.783417   0.073907 -24.130  < 2e-16 ***
## Cue2-1                                           0.095441   0.010873   8.778  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.110615   0.046665   2.370  0.01777 *  
## Orientation2-1:Alignment2-1                     -0.022137   0.027335  -0.810  0.41802    
## Congruency2-1:Alignment2-1                       0.079511   0.031492   2.525  0.01158 *  
## Orientation2-1:CA2-1                             0.773073   0.065721  11.763  < 2e-16 ***
## Congruency2-1:CA2-1                              1.000041   0.108745   9.196  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.115127   0.026168  -4.400 1.08e-05 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.147458   0.046023  -3.204  0.00136 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.655134   0.087690  -7.471 7.96e-14 ***
## Orientation2-1:Alignment2-1:CA2-1                0.162795   0.073729   2.208  0.02724 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.485340   0.051449  -9.433  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.638437   0.091668   6.965 3.29e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(glmm_E3_resp_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]     [,10]
## Standard deviation     0.5369 0.4923 0.3071 0.28989 0.25213 0.22551 0.21565 0.13058 0.00237 0.0004827
## Proportion of Variance 0.3250 0.2732 0.1064 0.09474 0.07167 0.05733 0.05243 0.01922 0.00001 0.0000000
## Cumulative Proportion  0.3250 0.5982 0.7046 0.79934 0.87101 0.92834 0.98077 0.99999 1.00000 1.0000000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]      [,7]     [,8]      [,9]     [,10]
## Standard deviation     0.4317 0.2716 0.1896 0.16523 0.10334 0.05920 0.0003448 9.67e-05 3.518e-05 1.605e-06
## Proportion of Variance 0.5522 0.2185 0.1065 0.08087 0.03164 0.01038 0.0000000 0.00e+00 0.000e+00 0.000e+00
## Cumulative Proportion  0.5522 0.7707 0.8771 0.95798 0.98962 1.00000 1.0000000 1.00e+00 1.000e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ali_CA and Ori_Ali;
  • by-StimGroup: Con_Ali, (Intercept), Ori_C, and Ori_Con.
file_E3_resp_etd2 <- file.path(dir_lmm, "lmm_E3_resp_etd2.rds")

# fit the reduced model
if (!file.exists(file_E3_resp_etd2)) {
  glmm_E3_resp_etd2 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + CA_C + # Con_C + 
         Ori_CA + Con_CA + # Ori_Con + Con_Ali + Ali_CA + Ori_Ali + 
         Ori_Con_CA + Con_Ali_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (0 + Con_C + CA_C + # Ali_C + Ori_C + 
         Ori_CA + Con_CA + # Ori_Ali + Ali_CA + Con_Ali + Ori_Con + 
         Ori_Con_CA + Ori_Ali_CA | StimGroup # Ori_Con_Ali + Con_Ali_CA + 
      ), # Ori_Con_Ali_CA 
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E3_resp_etd2, file = file_E3_resp_etd2)
} else {
  glmm_E3_resp_etd2 <- readRDS(file_E3_resp_etd2)
}

print(summary(glmm_E3_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_CA + Con_CA + Ori_Con_CA + Con_Ali_CA |      SubjCode) + (0 + Con_C + CA_C + Ori_CA + Con_CA + Ori_Con_CA +      Ori_Ali_CA | StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  71802.4  72486.7 -35827.2  71654.4    76604 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -15.0164  -0.5528   0.2079   0.5047   8.0870 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                                     
##  SubjCode  (Intercept) 0.06823  0.2612                                            
##            Ori_C       0.06720  0.2592    0.07                                    
##            Ali_C       0.02544  0.1595    0.15 -0.03                              
##            CA_C        0.19340  0.4398    0.07 -0.07 -0.13                        
##            Ori_CA      0.11582  0.3403   -0.02 -0.17  0.18 -0.56                  
##            Con_CA      0.22023  0.4693    0.07  0.12 -0.01  0.00  0.03            
##            Ori_Con_CA  0.06001  0.2450    0.19 -0.16 -0.47  0.40 -0.26 -0.38      
##            Con_Ali_CA  0.04202  0.2050    0.14 -0.11 -0.65  0.61 -0.38  0.12  0.76
##  StimGroup Con_C       0.04939  0.2222                                            
##            CA_C        0.04565  0.2136   -0.25                                    
##            Ori_CA      0.03845  0.1961   -0.62 -0.08                              
##            Con_CA      0.09817  0.3133    0.81 -0.72 -0.37                        
##            Ori_Con_CA  0.04537  0.2130    0.03 -0.46 -0.19  0.30                  
##            Ori_Ali_CA  0.03217  0.1794   -0.61  0.32  0.43 -0.41  0.17            
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.256484   0.024573  10.438  < 2e-16 ***
## Orientation2-1                                  -0.007856   0.026460  -0.297 0.766549    
## Congruency2-1                                    0.021422   0.071258   0.301 0.763703    
## Alignment2-1                                     0.156989   0.018514   8.479  < 2e-16 ***
## CA2-1                                           -1.769699   0.079511 -22.257  < 2e-16 ***
## Cue2-1                                           0.096443   0.010821   8.912  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.115914   0.023244   4.987 6.14e-07 ***
## Orientation2-1:Alignment2-1                     -0.022020   0.022711  -0.970 0.332270    
## Congruency2-1:Alignment2-1                       0.085782   0.022975   3.734 0.000189 ***
## Orientation2-1:CA2-1                             0.765300   0.073352  10.433  < 2e-16 ***
## Congruency2-1:CA2-1                              0.999037   0.110465   9.044  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.110035   0.023012  -4.782 1.74e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.137248   0.045504  -3.016 0.002560 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.676251   0.084902  -7.965 1.65e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.159594   0.072766   2.193 0.028290 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.481587   0.049366  -9.755  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.635024   0.090815   6.992 2.70e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0405417 (tol = 0.002, component 1)
summary(rePCA(glmm_E3_resp_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]   [,6]    [,7]    [,8]
## Standard deviation     0.5320 0.4799 0.2948 0.27133 0.24381 0.2123 0.10765 0.04877
## Proportion of Variance 0.3572 0.2907 0.1096 0.09292 0.07502 0.0569 0.01463 0.00300
## Cumulative Proportion  0.3572 0.6479 0.7575 0.85046 0.92548 0.9824 0.99700 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]      [,6]
## Standard deviation     0.4197 0.2543 0.1997 0.14644 0.08399 0.0008002
## Proportion of Variance 0.5697 0.2092 0.1289 0.06935 0.02282 0.0000000
## Cumulative Proportion  0.5697 0.7789 0.9078 0.97718 1.00000 1.0000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: CA_C;
  • by-StimGroup: Ori_Ali_CA.
file_E3_resp_etd3 <- file.path(dir_lmm, "lmm_E3_resp_etd3.rds")

# fit the reduced model
if (!file.exists(file_E3_resp_etd3)) {
  glmm_E3_resp_etd3 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + # Con_C + CA_C + 
         Ori_CA + Con_CA + # Ori_Con + Con_Ali + Ali_CA + Ori_Ali + 
         Ori_Con_CA + Con_Ali_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + 
      ) + # Ori_Con_Ali_CA 
      (0 + Con_C + CA_C + # Ali_C + Ori_C + 
         Ori_CA + Con_CA + # Ori_Ali + Ali_CA + Con_Ali + Ori_Con + 
         Ori_Con_CA | StimGroup # Ori_Con_Ali + Con_Ali_CA + + Ori_Ali_CA
      ), # Ori_Con_Ali_CA 
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(glmm_E3_resp_etd3, file = file_E3_resp_etd3)
} else {
  glmm_E3_resp_etd3 <- readRDS(file_E3_resp_etd3)
}

print(summary(glmm_E3_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + Ori_CA + Con_CA + Ori_Con_CA + Con_Ali_CA | SubjCode) +      (0 + Con_C + CA_C + Ori_CA + Con_CA + Ori_Con_CA | StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  72934.9  73489.7 -36407.4  72814.9    76618 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -12.8428  -0.5681   0.2251   0.5140   9.6449 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                               
##  SubjCode  (Intercept) 0.07172  0.2678                                      
##            Ori_C       0.07865  0.2804   -0.02                              
##            Ali_C       0.02378  0.1542    0.16 -0.02                        
##            Ori_CA      0.08889  0.2981    0.03 -0.30  0.13                  
##            Con_CA      0.27307  0.5226    0.14  0.05 -0.02  0.03            
##            Ori_Con_CA  0.04287  0.2070    0.06 -0.11 -0.39  0.00 -0.61      
##            Con_Ali_CA  0.02025  0.1423    0.24 -0.10 -0.72 -0.18  0.37  0.30
##  StimGroup Con_C       0.04769  0.2184                                      
##            CA_C        0.04272  0.2067   -0.25                              
##            Ori_CA      0.03696  0.1923   -0.63 -0.05                        
##            Con_CA      0.09208  0.3035    0.81 -0.72 -0.38                  
##            Ori_Con_CA  0.04534  0.2129    0.09 -0.52 -0.24  0.34            
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.253248   0.025093  10.092  < 2e-16 ***
## Orientation2-1                                  -0.006717   0.028028  -0.240 0.810600    
## Congruency2-1                                    0.014614   0.070008   0.209 0.834648    
## Alignment2-1                                     0.150481   0.017974   8.372  < 2e-16 ***
## CA2-1                                           -1.733588   0.066390 -26.112  < 2e-16 ***
## Cue2-1                                           0.094888   0.010715   8.855  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.118080   0.022884   5.160 2.47e-07 ***
## Orientation2-1:Alignment2-1                     -0.016306   0.022380  -0.729 0.466251    
## Congruency2-1:Alignment2-1                       0.081706   0.022643   3.608 0.000308 ***
## Orientation2-1:CA2-1                             0.728984   0.070450  10.347  < 2e-16 ***
## Congruency2-1:CA2-1                              0.970787   0.109545   8.862  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.108883   0.022647  -4.808 1.53e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.139687   0.044846  -3.115 0.001841 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.631891   0.083299  -7.586 3.30e-14 ***
## Orientation2-1:Alignment2-1:CA2-1                0.160220   0.044866   3.571 0.000355 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.447678   0.046531  -9.621  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.594008   0.089405   6.644 3.05e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0143617 (tol = 0.002, component 1)
summary(rePCA(glmm_E3_resp_etd3))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]
## Standard deviation     0.5428 0.3317 0.2714 0.2502 0.21436 0.10082 0.04712
## Proportion of Variance 0.4917 0.1836 0.1229 0.1045 0.07668 0.01696 0.00371
## Cumulative Proportion  0.4917 0.6753 0.7982 0.9026 0.97933 0.99629 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]
## Standard deviation     0.4022 0.2370 0.1920 0.08953 0.04491
## Proportion of Variance 0.6107 0.2122 0.1392 0.03027 0.00762
## Cumulative Proportion  0.6107 0.8229 0.9621 0.99238 1.00000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_Ali_CA;
  • by-StimGroup: Ori_CA.
file_E3_resp_etd4 <- file.path(dir_lmm, "lmm_E3_resp_etd4.rds")

# fit the reduced model
if (!file.exists(file_E3_resp_etd4)) {
  glmm_E3_resp_etd4 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + # Con_C + CA_C + 
         Ori_CA + Con_CA + # Ori_Con + Con_Ali + Ali_CA + Ori_Ali + 
         Ori_Con_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + + Con_Ali_CA 
      ) + # Ori_Con_Ali_CA 
      (0 + Con_C + CA_C + # Ali_C + Ori_C + 
         Con_CA + # Ori_Ali + Ali_CA + Con_Ali + Ori_Con + Ori_CA + 
         Ori_Con_CA | StimGroup # Ori_Con_Ali + Con_Ali_CA + + Ori_Ali_CA
      ), # Ori_Con_Ali_CA 
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  
  saveRDS(glmm_E3_resp_etd4, file = file_E3_resp_etd4)
} else {
  glmm_E3_resp_etd4 <- readRDS(file_E3_resp_etd4)
}

print(summary(glmm_E3_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + Ori_CA + Con_CA + Ori_Con_CA | SubjCode) + (0 + Con_C +      CA_C + Con_CA + Ori_Con_CA | StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  72976.1  73419.9 -36440.0  72880.1    76630 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -14.1409  -0.5713   0.2259   0.5147  10.6594 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                         
##  SubjCode  (Intercept) 0.07161  0.2676                                
##            Ori_C       0.07841  0.2800   -0.02                        
##            Ali_C       0.02379  0.1542    0.16 -0.02                  
##            Ori_CA      0.08752  0.2958    0.03 -0.30  0.13            
##            Con_CA      0.27182  0.5214    0.14  0.06 -0.03  0.04      
##            Ori_Con_CA  0.04358  0.2088    0.09 -0.11 -0.38  0.01 -0.61
##  StimGroup Con_C       0.04659  0.2158                                
##            CA_C        0.04193  0.2048   -0.29                        
##            Con_CA      0.09552  0.3091    0.82 -0.73                  
##            Ori_Con_CA  0.04341  0.2083   -0.08 -0.56  0.24            
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.253074   0.025076  10.092  < 2e-16 ***
## Orientation2-1                                  -0.005758   0.027991  -0.206 0.837029    
## Congruency2-1                                    0.015103   0.069252   0.218 0.827360    
## Alignment2-1                                     0.149531   0.017959   8.326  < 2e-16 ***
## CA2-1                                           -1.731578   0.065793 -26.319  < 2e-16 ***
## Cue2-1                                           0.094798   0.010709   8.852  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.111425   0.022821   4.883 1.05e-06 ***
## Orientation2-1:Alignment2-1                     -0.016526   0.022361  -0.739 0.459893    
## Congruency2-1:Alignment2-1                       0.084231   0.022350   3.769 0.000164 ***
## Orientation2-1:CA2-1                             0.728006   0.035393  20.569  < 2e-16 ***
## Congruency2-1:CA2-1                              0.971155   0.111106   8.741  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.106468   0.022547  -4.722 2.33e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.140301   0.044627  -3.144 0.001667 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.632521   0.082085  -7.706 1.30e-14 ***
## Orientation2-1:Alignment2-1:CA2-1                0.159840   0.044756   3.571 0.000355 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.449333   0.044587 -10.078  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.594099   0.089072   6.670 2.56e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00720821 (tol = 0.002, component 1)
summary(rePCA(glmm_E3_resp_etd4))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]   [,4]    [,5]    [,6]
## Standard deviation     0.5399 0.3298 0.2690 0.2406 0.19103 0.09870
## Proportion of Variance 0.5054 0.1886 0.1255 0.1003 0.06327 0.01689
## Cumulative Proportion  0.5054 0.6940 0.8195 0.9198 0.98311 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]
## Standard deviation     0.3928 0.2369 0.12246 0.04533
## Proportion of Variance 0.6784 0.2467 0.06594 0.00903
## Cumulative Proportion  0.6784 0.9250 0.99097 1.00000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-StimGroup: Con_CA.
file_E3_resp_etd5 <- file.path(dir_lmm, "lmm_E3_resp_etd5.rds")

# fit the reduced model
if (!file.exists(file_E3_resp_etd5)) {
  glmm_E3_resp_etd5 <- glmer(
    isSame ~ Orientation * Congruency * Alignment * CA + Cue +
      (Ori_C + Ali_C + # Con_C + CA_C + 
         Ori_CA + Con_CA + # Ori_Con + Con_Ali + Ali_CA + Ori_Ali + 
         Ori_Con_CA | SubjCode # Ori_Con_Ali + Ori_Ali_CA + + Con_Ali_CA 
      ) + # Ori_Con_Ali_CA 
      (0 + Con_C + CA_C + # Ali_C + Ori_C + 
         # Ori_Ali + Ali_CA + Con_Ali + Ori_Con + Ori_CA + Con_CA + 
         Ori_Con_CA | StimGroup # Ori_Con_Ali + Con_Ali_CA + + Ori_Ali_CA
      ), # Ori_Con_Ali_CA 
    data = df_E3_lmm,
    family = binomial(link = "probit"),
    control = glmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  
  saveRDS(glmm_E3_resp_etd5, file = file_E3_resp_etd5)
} else {
  glmm_E3_resp_etd5 <- readRDS(file_E3_resp_etd5)
}

print(summary(glmm_E3_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + Ori_CA + Con_CA + Ori_Con_CA | SubjCode) + (0 + Con_C +      CA_C + Ori_Con_CA | StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  73168.0  73574.9 -36540.0  73080.0    76634 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -13.2584  -0.5765   0.2243   0.5101  10.0948 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr                         
##  SubjCode  (Intercept) 0.07121  0.2669                                
##            Ori_C       0.07829  0.2798   -0.02                        
##            Ali_C       0.02359  0.1536    0.16 -0.02                  
##            Ori_CA      0.08760  0.2960    0.03 -0.32  0.12            
##            Con_CA      0.27046  0.5201    0.14  0.06 -0.03  0.04      
##            Ori_Con_CA  0.04122  0.2030    0.10 -0.11 -0.38  0.05 -0.63
##  StimGroup Con_C       0.05498  0.2345                                
##            CA_C        0.03613  0.1901   -0.28                        
##            Ori_Con_CA  0.05490  0.2343    0.19 -0.70                  
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.256698   0.025004  10.266  < 2e-16 ***
## Orientation2-1                                  -0.008846   0.027968  -0.316 0.751793    
## Congruency2-1                                    0.013956   0.075000   0.186 0.852380    
## Alignment2-1                                     0.149328   0.017903   8.341  < 2e-16 ***
## CA2-1                                           -1.728440   0.061180 -28.252  < 2e-16 ***
## Cue2-1                                           0.093884   0.010695   8.778  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.112733   0.022796   4.945 7.61e-07 ***
## Orientation2-1:Alignment2-1                     -0.017243   0.022337  -0.772 0.440142    
## Congruency2-1:Alignment2-1                       0.086831   0.022324   3.890 0.000100 ***
## Orientation2-1:CA2-1                             0.726408   0.035369  20.538  < 2e-16 ***
## Congruency2-1:CA2-1                              0.957404   0.052504  18.235  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.109033   0.022520  -4.842 1.29e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.141927   0.044573  -3.184 0.001452 ** 
## Orientation2-1:Congruency2-1:CA2-1              -0.624941   0.088653  -7.049 1.80e-12 ***
## Orientation2-1:Alignment2-1:CA2-1                0.161710   0.044702   3.618 0.000297 ***
## Congruency2-1:Alignment2-1:CA2-1                -0.448507   0.044528 -10.072  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.595044   0.088916   6.692 2.20e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

7.1.1.5 The optimal model

anova(glmm_E3_resp_rdc, glmm_E3_resp_etd5, refit=FALSE)

According to BIC, the reduced model is used as the optimal model.

glmm_E3_resp_opt <- glmm_E3_resp_rdc

print(summary(glmm_E3_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: isSame ~ Orientation * Congruency * Alignment * CA + Cue + (Ori_C +      Ali_C + CA_C + Ori_Ali + Ori_CA + Con_CA + Ali_CA + Ori_Con_CA +      Con_Ali_CA || SubjCode) + (Ori_C + Con_C + CA_C + Ori_Con +      Con_Ali + Ori_CA + Con_CA + Ori_Con_CA + Ori_Ali_CA || StimGroup)
##    Data: df_E3_lmm
## Control: glmerControl(optCtrl = list(maxfun = 1e+07))
## 
##      AIC      BIC   logLik deviance df.resid 
##  71304.8  71647.0 -35615.4  71230.8    76641 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.6910  -0.5409   0.2115   0.4993   7.3167 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  SubjCode    (Intercept) 0.070040 0.26465 
##  SubjCode.1  Ori_C       0.068311 0.26136 
##  SubjCode.2  Ali_C       0.025407 0.15939 
##  SubjCode.3  CA_C        0.189252 0.43503 
##  SubjCode.4  Ori_Ali     0.021090 0.14522 
##  SubjCode.5  Ori_CA      0.107253 0.32750 
##  SubjCode.6  Con_CA      0.220262 0.46932 
##  SubjCode.7  Ali_CA      0.003169 0.05629 
##  SubjCode.8  Ori_Con_CA  0.042261 0.20557 
##  SubjCode.9  Con_Ali_CA  0.040514 0.20128 
##  StimGroup   (Intercept) 0.013287 0.11527 
##  StimGroup.1 Ori_C       0.017443 0.13207 
##  StimGroup.2 Con_C       0.048426 0.22006 
##  StimGroup.3 CA_C        0.037367 0.19331 
##  StimGroup.4 Ori_Con     0.014522 0.12051 
##  StimGroup.5 Con_Ali     0.000695 0.02636 
##  StimGroup.6 Ori_CA      0.027001 0.16432 
##  StimGroup.7 Con_CA      0.093397 0.30561 
##  StimGroup.8 Ori_Con_CA  0.043115 0.20764 
##  StimGroup.9 Ori_Ali_CA  0.024149 0.15540 
## Number of obs: 76678, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                      0.251177   0.044124   5.693 1.25e-08 ***
## Orientation2-1                                  -0.004564   0.049492  -0.092 0.926518    
## Congruency2-1                                    0.027936   0.070539   0.396 0.692075    
## Alignment2-1                                     0.155320   0.018507   8.392  < 2e-16 ***
## CA2-1                                           -1.775326   0.073875 -24.032  < 2e-16 ***
## Cue2-1                                           0.095627   0.010865   8.802  < 2e-16 ***
## Orientation2-1:Congruency2-1                     0.118759   0.044459   2.671 0.007558 ** 
## Orientation2-1:Alignment2-1                     -0.015732   0.026317  -0.598 0.549973    
## Congruency2-1:Alignment2-1                       0.085009   0.024192   3.514 0.000442 ***
## Orientation2-1:CA2-1                             0.753719   0.064359  11.711  < 2e-16 ***
## Congruency2-1:CA2-1                              0.993139   0.108285   9.172  < 2e-16 ***
## Alignment2-1:CA2-1                              -0.106607   0.023462  -4.544 5.52e-06 ***
## Orientation2-1:Congruency2-1:Alignment2-1       -0.149687   0.045293  -3.305 0.000950 ***
## Orientation2-1:Congruency2-1:CA2-1              -0.641655   0.082207  -7.805 5.93e-15 ***
## Orientation2-1:Alignment2-1:CA2-1                0.165826   0.066985   2.476 0.013303 *  
## Congruency2-1:Alignment2-1:CA2-1                -0.471165   0.048928  -9.630  < 2e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1:CA2-1  0.620925   0.090550   6.857 7.02e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

7.1.2 Estimated marginal means

# hit and false alarm
emm_E3_probit <- emmeans(glmm_E3_resp_opt,
                         ~ Orientation + Congruency + Alignment + CA,
                         type = "response")
emm_E3_probit
##  Orientation Congruency Alignment CA   prob      SE  df asymp.LCL asymp.UCL
##  upr         con        ali       sam 0.954 0.00822 Inf    0.9353     0.968
##  inv         con        ali       sam 0.845 0.01955 Inf    0.8036     0.880
##  upr         inc        ali       sam 0.764 0.02514 Inf    0.7118     0.810
##  inv         inc        ali       sam 0.765 0.02508 Inf    0.7128     0.811
##  upr         con        mis       sam 0.952 0.00845 Inf    0.9331     0.966
##  inv         con        mis       sam 0.871 0.01736 Inf    0.8335     0.902
##  upr         inc        mis       sam 0.895 0.01509 Inf    0.8621     0.921
##  inv         inc        mis       sam 0.823 0.02128 Inf    0.7780     0.861
##  upr         con        ali       dif 0.110 0.01555 Inf    0.0823     0.143
##  inv         con        ali       dif 0.227 0.02465 Inf    0.1821     0.279
##  upr         inc        ali       dif 0.313 0.02885 Inf    0.2592     0.372
##  inv         inc        ali       dif 0.386 0.03107 Inf    0.3271     0.448
##  upr         con        mis       dif 0.148 0.01904 Inf    0.1142     0.189
##  inv         con        mis       dif 0.282 0.02753 Inf    0.2307     0.338
##  upr         inc        mis       dif 0.297 0.02818 Inf    0.2441     0.354
##  inv         inc        mis       dif 0.425 0.03181 Inf    0.3641     0.488
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Intervals are back-transformed from the probit scale

Sensitivity d’ in each condition:

# sensitivity d'
emm_E3_d <- contrast(emm_E3_probit, "pairwise", simple="CA")
# emmip(emm_E3_d, Congruency ~ Alignment | Orientation, CIs = TRUE)

summary(emm_E3_d[1:8], infer=c(TRUE,FALSE), adjust="none")
##  contrast  Orientation Congruency Alignment estimate    SE  df asymp.LCL asymp.UCL
##  sam - dif upr         con        ali           2.91 0.105 Inf     2.703      3.12
##  sam - dif inv         con        ali           1.76 0.102 Inf     1.563      1.96
##  sam - dif upr         inc        ali           1.21 0.101 Inf     1.006      1.40
##  sam - dif inv         inc        ali           1.01 0.101 Inf     0.812      1.21
##  sam - dif upr         con        mis           2.71 0.105 Inf     2.503      2.91
##  sam - dif inv         con        mis           1.71 0.102 Inf     1.506      1.91
##  sam - dif upr         inc        mis           1.79 0.103 Inf     1.584      1.99
##  sam - dif inv         inc        mis           1.11 0.102 Inf     0.915      1.31
## 
## Results are averaged over the levels of: Cue 
## Note: contrasts are still on the probit scale. Consider using
##       regrid() if you want contrasts of back-transformed estimates. 
## Confidence level used: 0.95

7.1.2.1 Composite effect

Composite effect of d’:

emm_E3_cf_d <- contrast(emm_E3_d, 
                        interaction = "pairwise", 
                        simple = c("Congruency", "Alignment"),
                        infer = TRUE)

summary(emm_E3_cf_d[1:2], side = ">")
##  Congruency_pairwise Alignment_pairwise contrast  Orientation estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis          sam - dif upr            0.782 0.0713 Inf    0.6643       Inf  10.957  <.0001
##  con - inc           ali - mis          sam - dif inv            0.161 0.0616 Inf    0.0593       Inf   2.607  0.0046
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed

Congruency effect of d’ in aligned condition:

emm_E3_con_d <- contrast(emm_E3_d, 
                         interaction = "pairwise", 
                         simple = "Congruency",
                         infer = TRUE)
summary(emm_E3_con_d[1:2], side=">")
##  Congruency_pairwise contrast  Orientation Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           sam - dif upr         ali          1.705 0.122 Inf     1.504       Inf  13.998  <.0001
##  con - inc           sam - dif inv         ali          0.753 0.119 Inf     0.557       Inf   6.326  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed

Equivalence tests for composite effect:

summary(emm_E3_cf_d[1:2], delta = .2, level=.9)
##  Congruency_pairwise Alignment_pairwise contrast  Orientation estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis          sam - dif upr            0.782 0.0713 Inf    0.6643     0.899   8.154  1.0000
##  con - inc           ali - mis          sam - dif inv            0.161 0.0616 Inf    0.0593     0.262  -0.638  0.2619
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 0.2 
## P values are left-tailed
summary(emm_E3_cf_d[1:2], delta = .2, side = ">") # > -.2
##  Congruency_pairwise Alignment_pairwise contrast  Orientation estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis          sam - dif upr            0.782 0.0713 Inf    0.6643       Inf  13.761  <.0001
##  con - inc           ali - mis          sam - dif inv            0.161 0.0616 Inf    0.0593       Inf   5.852  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 0.2 
## P values are right-tailed
summary(emm_E3_cf_d[1:2], delta = .2, side = "<") # < .2
##  Congruency_pairwise Alignment_pairwise contrast  Orientation estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  con - inc           ali - mis          sam - dif upr            0.782 0.0713 Inf      -Inf     0.899   8.154  1.0000
##  con - inc           ali - mis          sam - dif inv            0.161 0.0616 Inf      -Inf     0.262  -0.638  0.2619
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 0.2 
## P values are left-tailed
plot_E3_cf_d <- emm_E3_d %>%
  summary(infer=TRUE) %>%
  as_tibble() %>%
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(Alignment, estimate, color=Congruency, group=Congruency)) +
  geom_point(size = 2) + # position = position_dodge(width = 0.1),
  geom_line(aes(linetype = Congruency), linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Orientation, switch = "both") +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), linewidth=1.5, width=0,
                alpha = .6, # position = position_dodge(width = 0.1),
                show.legend = F) +
  coord_cartesian(ylim = c(0,3.5)) +  # set the limit for y axis c(0, 1100)
  labs(y = expression("Sensitivity"~italic("d'")), fill = "Congruency",
       x = NULL) +  # set the names for main, x and y axises
  geom_text(label = c("***", "***", "", "", "", "", "", ""),
            color = "red",
            size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
  NULL
# ggsave(filename = "ccf_d.pdf", plot_ccf_d, width = 8, height = 6)
plot_E3_cf_d

7.1.2.2 Compare composite effects between upright and inverted faces

emm_E3_cf_ui_d <- contrast(emm_E3_d, 
                           interaction="pairwise", 
                           simple = c("Orientation", "Congruency", "Alignment"),
                           infer = TRUE)

summary(emm_E3_cf_ui_d, side=">")
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.621 0.0906 Inf     0.472       Inf   6.857  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed

Equivalence tests

summary(emm_E3_cf_ui_d, delta = .25, level=.9)
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.621 0.0906 Inf     0.472      0.77   4.096  1.0000
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 0.25 
## P values are left-tailed
summary(emm_E3_cf_ui_d, delta = .25, side = ">") # > -.25
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.621 0.0906 Inf     0.472       Inf   9.618  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 0.25 
## P values are right-tailed
summary(emm_E3_cf_ui_d, delta = .25, side = "<") # < .25
## contrast = sam - dif:
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            con - inc           ali - mis             0.621 0.0906 Inf      -Inf      0.77   4.096  1.0000
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 0.25 
## P values are left-tailed

7.1.2.3 Facilitation

# facilitation and interference of d'
emm_E3_d_fi <- contrast(emm_E3_d, 
                        "pairwise", 
                        simple = "Alignment",
                        infer = TRUE, 
                        adjust = "none")
# emmip(emm_E3_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 

emm_E3_d_fi[1:4]
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.2013 0.0607 Inf    0.0824   0.32021   3.318  0.0009
##  ali - mis sam - dif inv         con          0.0567 0.0510 Inf   -0.0432   0.15652   1.112  0.2661
##  ali - mis sam - dif upr         inc         -0.5803 0.0504 Inf   -0.6791  -0.48154 -11.514  <.0001
##  ali - mis sam - dif inv         inc         -0.1040 0.0481 Inf   -0.1984  -0.00974  -2.162  0.0306
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95
summary(emm_E3_d_fi[1:2], side=">")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.2013 0.0607 Inf    0.1015       Inf   3.318  0.0005
##  ali - mis sam - dif inv         con          0.0567 0.0510 Inf   -0.0271       Inf   1.112  0.1331
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are right-tailed

Equivalence tests:

summary(emm_E3_d_fi[1:2], delta=.15, level=.9)
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.2013 0.0607 Inf    0.1015     0.301   0.845  0.8011
##  ali - mis sam - dif inv         con          0.0567 0.0510 Inf   -0.0271     0.140  -1.832  0.0335
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 0.15 
## P values are left-tailed
summary(emm_E3_d_fi[1:2], delta=.15, side=">")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.2013 0.0607 Inf    0.1015       Inf   5.790  <.0001
##  ali - mis sam - dif inv         con          0.0567 0.0510 Inf   -0.0271       Inf   4.056  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 0.15 
## P values are right-tailed
summary(emm_E3_d_fi[1:2], delta=.15, side="<")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         con          0.2013 0.0607 Inf      -Inf     0.301   0.845  0.8011
##  ali - mis sam - dif inv         con          0.0567 0.0510 Inf      -Inf     0.140  -1.832  0.0335
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 0.15 
## P values are left-tailed

7.1.2.4 Interference

summary(emm_E3_d_fi[3:4], side="<")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         inc          -0.580 0.0504 Inf      -Inf   -0.4974 -11.514  <.0001
##  ali - mis sam - dif inv         inc          -0.104 0.0481 Inf      -Inf   -0.0249  -2.162  0.0153
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## P values are left-tailed

Equivalence tests:

summary(emm_E3_d_fi[3:4], delta=.15, level=.9)
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         inc          -0.580 0.0504 Inf    -0.663   -0.4974   8.538  1.0000
##  ali - mis sam - dif inv         inc          -0.104 0.0481 Inf    -0.183   -0.0249  -0.955  0.1698
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 0.15 
## P values are left-tailed
summary(emm_E3_d_fi[3:4], delta=.15, side=">")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         inc          -0.580 0.0504 Inf    -0.663       Inf  -8.538  1.0000
##  ali - mis sam - dif inv         inc          -0.104 0.0481 Inf    -0.183       Inf   0.955  0.1698
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 0.15 
## P values are right-tailed
summary(emm_E3_d_fi[3:4], delta=.15, side="<")
##  contrast1 contrast  Orientation Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  ali - mis sam - dif upr         inc          -0.580 0.0504 Inf      -Inf   -0.4974 -14.490  <.0001
##  ali - mis sam - dif inv         inc          -0.104 0.0481 Inf      -Inf   -0.0249  -5.280  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 0.15 
## P values are left-tailed
plot_E3_cffi_d <- summary(emm_E3_d_fi[1:4], level=.95) %>%
  as_tibble() %>%
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=1.1, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin=asymp.LCL, ymax=asymp.UCL),
                linewidth=1.5, width=0, alpha=.6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL,
       y = expression("Sensitivity"~italic(d)*"' (aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E3_fi_d.pdf", plot_E3_cffi_d, width = 7, height = 4.55)
plot_E3_cffi_d

7.1.2.5 Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of d'
emm_E3_d_fi_ui <- contrast(emm_E3_d, 
                           interaction = "pairwise", 
                           simple = c("Orientation", "Alignment"),
                           infer = TRUE, 
                           adjust = "none")

emm_E3_d_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise contrast  Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif con           0.145 0.0851 Inf   -0.0222     0.311   1.699  0.0893
##  upr - inv            ali - mis          sam - dif inc          -0.476 0.0763 Inf   -0.6259    -0.327  -6.239  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

Equivalence tests:

summary(emm_E3_d_fi_ui[1:2], delta=.2, level=.9)
##  Orientation_pairwise Alignment_pairwise contrast  Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif con           0.145 0.0851 Inf   0.00463     0.285  -0.650  0.2577
##  upr - inv            ali - mis          sam - dif inc          -0.476 0.0763 Inf  -0.60187    -0.351   3.619  0.9999
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 0.2 
## P values are left-tailed
summary(emm_E3_d_fi_ui[1:2], delta=.2, side=">")
##  Orientation_pairwise Alignment_pairwise contrast  Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif con           0.145 0.0851 Inf   0.00463       Inf   4.049  <.0001
##  upr - inv            ali - mis          sam - dif inc          -0.476 0.0763 Inf  -0.60187       Inf  -3.619  0.9999
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 0.2 
## P values are right-tailed
summary(emm_E3_d_fi_ui[1:2], delta=.2, side="<")
##  Orientation_pairwise Alignment_pairwise contrast  Congruency estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  upr - inv            ali - mis          sam - dif con           0.145 0.0851 Inf      -Inf     0.285  -0.650  0.2577
##  upr - inv            ali - mis          sam - dif inc          -0.476 0.0763 Inf      -Inf    -0.351  -8.858  <.0001
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 0.2 
## P values are left-tailed

7.1.2.6 Comparisons between facilitation and interference

contrast(emm_E3_d_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2] 
##  contrast  Orientation estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte upr          -0.3790 0.0858 Inf    -0.547    -0.211  -4.420  <.0001
##  faci-inte inv          -0.0474 0.0776 Inf    -0.200     0.105  -0.611  0.5415
## 
## Results are averaged over the levels of: Cue 
## Confidence level used: 0.95

7.1.3 Plot

plot_E3_cf_d_ <- plot_E3_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E3_d <- ggarrange(plot_E3_cf_d_, plot_E3_cffi_d, 
                       labels = c("a", "b"),
                       font.label = (list(size = 18)),
                       widths = c(1.5, 1),
                       nrow = 1)

plot_E3_d

7.2 Correct response times

7.2.1 Fitting the linear mixed-effects models

7.2.1.1 The maximal model

# file_E3_rt_max <- file.path(dir_lmm, "lmm_E3_rt_max.rds")
# 
# # fit the max model
# if (!file.exists(file_E3_rt_max)) {
#   lmm_E3_rt_max <- lmer(
#     log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
#       (Orientation * Congruency * Alignment | SubjCode) +
#       (Orientation * Congruency * Alignment | StimGroup),
#     data = df_E3_lmm |> dplyr::filter(isCorrect==1),
#     control = lmerControl(optCtrl = list(maxfun = 1e7))
#   )
#   
#   saveRDS(lmm_E3_rt_max, file = file_E3_rt_max)
# } else {
#   lmm_E3_rt_max <- readRDS(file_E3_rt_max)
# }
# 
# print(summary(lmm_E3_rt_max), corr = FALSE)

7.2.1.2 The zero-correlation-parameter model

file_E3_rt_zcp <- file.path(dir_lmm, "lmm_E3_rt_zcp.rds")

# fit the zcp model
if (!file.exists(file_E3_rt_zcp)) {
  lmm_E3_rt_zcp <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +
         Ori_Con + Ori_Ali + Con_Ali +
         Ori_Con_Ali || SubjCode) +
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali +
         Ori_Con_Ali || StimGroup),
    data = df_E3_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_rt_zcp, file = file_E3_rt_zcp)
} else {
  lmm_E3_rt_zcp <- readRDS(file_E3_rt_zcp)
}

print(summary(lmm_E3_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali ||      SubjCode) + (Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali +      Con_Ali + Ori_Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 61831.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3954 -0.6326 -0.1829  0.4209  8.3008 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 4.630e-02 0.215175
##  SubjCode.1  Ori_C       8.678e-02 0.294589
##  SubjCode.2  Con_C       1.662e-04 0.012893
##  SubjCode.3  Ali_C       1.503e-03 0.038771
##  SubjCode.4  Ori_Con     9.227e-04 0.030376
##  SubjCode.5  Ori_Ali     8.266e-04 0.028751
##  SubjCode.6  Con_Ali     0.000e+00 0.000000
##  SubjCode.7  Ori_Con_Ali 3.239e-10 0.000018
##  StimGroup   (Intercept) 7.894e-05 0.008885
##  StimGroup.1 Ori_C       6.339e-05 0.007961
##  StimGroup.2 Con_C       2.067e-04 0.014378
##  StimGroup.3 Ali_C       0.000e+00 0.000000
##  StimGroup.4 Ori_Con     2.558e-04 0.015994
##  StimGroup.5 Ori_Ali     0.000e+00 0.000000
##  StimGroup.6 Con_Ali     1.640e-04 0.012805
##  StimGroup.7 Ori_Con_Ali 1.705e-03 0.041293
##  Residual                1.623e-01 0.402845
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.818e+00  1.991e-02  1.227e+02 342.354  < 2e-16 ***
## Orientation2-1                             3.934e-02  2.722e-02  1.203e+02   1.445 0.150943    
## Congruency2-1                              4.904e-02  5.761e-03  9.599e+00   8.512  8.9e-06 ***
## Alignment2-1                              -2.122e-03  4.863e-03  1.174e+02  -0.436 0.663400    
## Cue2-1                                     4.162e-02  3.324e-03  5.872e+04  12.520  < 2e-16 ***
## CA2-1                                      5.586e-02  3.353e-03  5.851e+04  16.657  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.909e-02  8.818e-03  1.109e+01  -5.567 0.000164 ***
## Orientation2-1:Alignment2-1                1.780e-02  7.157e-03  1.175e+02   2.487 0.014283 *  
## Congruency2-1:Alignment2-1                -4.337e-02  7.793e-03  9.147e+00  -5.566 0.000330 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.824e-02  1.865e-02  9.038e+00   3.123 0.012193 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')

7.2.1.3 The reduced model

summary(rePCA(lmm_E3_rt_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]      [,7] [,8]
## Standard deviation     0.7313 0.5341 0.09624 0.07540 0.07137 0.03200 4.468e-05    0
## Proportion of Variance 0.6358 0.3392 0.01101 0.00676 0.00606 0.00122 0.000e+00    0
## Cumulative Proportion  0.6358 0.9749 0.98597 0.99273 0.99878 1.00000 1.000e+00    1
## 
## $StimGroup
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6] [,7] [,8]
## Standard deviation     0.1025 0.0397 0.03569 0.03179 0.02206 0.01976    0    0
## Proportion of Variance 0.6892 0.1034 0.08356 0.06627 0.03191 0.02562    0    0
## Cumulative Proportion  0.6892 0.7926 0.87620 0.94247 0.97438 1.00000    1    1

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_Ali and Ori_Con_Ali.
  • by-StimGroup: Ali_C and Ori_Ali.
file_E3_rt_rdc <- file.path(dir_lmm, "lmm_E3_rt_rdc.rds")

# fit the max model
if (!file.exists(file_E3_rt_rdc)) {
  lmm_E3_rt_rdc <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +
         Ori_Con + Ori_Ali || SubjCode # + Con_Ali +
      ) + # Ori_Con_Ali
      (Ori_C + Con_C + # Ali_C + 
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali || StimGroup),
    data = df_E3_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e8))
  )
  
  saveRDS(lmm_E3_rt_rdc, file = file_E3_rt_rdc)
} else {
  lmm_E3_rt_rdc <- readRDS(file_E3_rt_rdc)
}

print(summary(lmm_E3_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali || SubjCode) + (Ori_C +      Con_C + Ori_Con + Con_Ali + Ori_Con_Ali || StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+08))
## 
## REML criterion at convergence: 61831.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3954 -0.6326 -0.1829  0.4209  8.3007 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev.
##  SubjCode    (Intercept) 4.628e-02 0.215136
##  SubjCode.1  Ori_C       8.684e-02 0.294683
##  SubjCode.2  Con_C       1.666e-04 0.012905
##  SubjCode.3  Ali_C       1.503e-03 0.038766
##  SubjCode.4  Ori_Con     9.231e-04 0.030383
##  SubjCode.5  Ori_Ali     8.276e-04 0.028768
##  StimGroup   (Intercept) 7.889e-05 0.008882
##  StimGroup.1 Ori_C       6.344e-05 0.007965
##  StimGroup.2 Con_C       2.063e-04 0.014365
##  StimGroup.3 Ori_Con     2.564e-04 0.016012
##  StimGroup.4 Con_Ali     1.642e-04 0.012813
##  StimGroup.5 Ori_Con_Ali 1.706e-03 0.041305
##  Residual                1.623e-01 0.402845
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.818e+00  1.991e-02  1.228e+02 342.417  < 2e-16 ***
## Orientation2-1                             3.934e-02  2.722e-02  1.202e+02   1.445 0.151073    
## Congruency2-1                              4.904e-02  5.758e-03  9.616e+00   8.516 8.76e-06 ***
## Alignment2-1                              -2.122e-03  4.862e-03  1.174e+02  -0.436 0.663366    
## Cue2-1                                     4.162e-02  3.324e-03  5.872e+04  12.520  < 2e-16 ***
## CA2-1                                      5.585e-02  3.353e-03  5.851e+04  16.657  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.909e-02  8.822e-03  1.108e+01  -5.565 0.000164 ***
## Orientation2-1:Alignment2-1                1.780e-02  7.158e-03  1.175e+02   2.487 0.014291 *  
## Congruency2-1:Alignment2-1                -4.337e-02  7.795e-03  9.147e+00  -5.565 0.000330 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.824e-02  1.865e-02  9.036e+00   3.123 0.012206 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00554055 (tol = 0.002, component 1)
summary(rePCA(lmm_E3_rt_rdc))
## $SubjCode
## Importance of components:
##                          [,1]  [,2]    [,3]    [,4]    [,5]    [,6]
## Standard deviation     0.7315 0.534 0.09623 0.07542 0.07141 0.03204
## Proportion of Variance 0.6360 0.339 0.01101 0.00676 0.00606 0.00122
## Cumulative Proportion  0.6360 0.975 0.98596 0.99272 0.99878 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]    [,3]    [,4]    [,5]    [,6]
## Standard deviation     0.1025 0.03975 0.03566 0.03181 0.02205 0.01977
## Proportion of Variance 0.6892 0.10357 0.08336 0.06633 0.03187 0.02563
## Cumulative Proportion  0.6892 0.79281 0.87617 0.94250 0.97437 1.00000

7.2.1.4 The extended model

file_E3_rt_etd <- file.path(dir_lmm, "lmm_E3_rt_etd.rds")

# fit the max model
if (!file.exists(file_E3_rt_etd)) {
  lmm_E3_rt_etd <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Con_C + Ali_C +
         Ori_Con + Ori_Ali | SubjCode # + Con_Ali +
      ) + # Ori_Con_Ali
      (Ori_C + Con_C + # Ali_C + 
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali | StimGroup),
    data = df_E3_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e8))
  )
  
  saveRDS(lmm_E3_rt_etd, file = file_E3_rt_etd)
} else {
  lmm_E3_rt_etd <- readRDS(file_E3_rt_etd)
}

print(summary(lmm_E3_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Con_C + Ali_C + Ori_Con + Ori_Ali | SubjCode) + (Ori_C +      Con_C + Ori_Con + Con_Ali + Ori_Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+08))
## 
## REML criterion at convergence: 61793.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4252 -0.6321 -0.1845  0.4208  8.3172 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr                         
##  SubjCode  (Intercept) 4.637e-02 0.21535                               
##            Ori_C       8.716e-02 0.29523  -0.02                        
##            Con_C       2.681e-04 0.01637   0.19 -0.11                  
##            Ali_C       1.525e-03 0.03906   0.16  0.13  0.34            
##            Ori_Con     9.836e-04 0.03136  -0.31  0.42  0.37  0.05      
##            Ori_Ali     1.350e-03 0.03674   0.32 -0.44  0.92  0.28  0.20
##  StimGroup (Intercept) 7.903e-05 0.00889                               
##            Ori_C       6.147e-05 0.00784  -0.28                        
##            Con_C       2.132e-04 0.01460  -0.79  0.30                  
##            Ori_Con     3.693e-04 0.01922   0.06 -0.31 -0.13            
##            Con_Ali     3.808e-04 0.01951  -0.14 -0.36 -0.29  0.81      
##            Ori_Con_Ali 1.850e-03 0.04302  -0.24  0.40 -0.29 -0.38  0.15
##  Residual              1.622e-01 0.40274                               
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.818e+00  1.993e-02  1.227e+02 342.092  < 2e-16 ***
## Orientation2-1                             3.929e-02  2.727e-02  1.201e+02   1.441 0.152193    
## Congruency2-1                              4.908e-02  5.889e-03  1.060e+01   8.334 5.64e-06 ***
## Alignment2-1                              -2.224e-03  4.881e-03  1.171e+02  -0.456 0.649448    
## Cue2-1                                     4.163e-02  3.320e-03  5.786e+04  12.540  < 2e-16 ***
## CA2-1                                      5.582e-02  3.350e-03  5.816e+04  16.661  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.918e-02  9.464e-03  1.270e+01  -5.197 0.000186 ***
## Orientation2-1:Alignment2-1                1.797e-02  7.454e-03  1.728e+02   2.411 0.016957 *  
## Congruency2-1:Alignment2-1                -4.314e-02  9.078e-03  1.144e+01  -4.752 0.000536 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.878e-02  1.903e-02  9.512e+00   3.089 0.012145 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E3_rt_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]      [,6]
## Standard deviation     0.7353 0.5359 0.11014 0.08402 0.04081 2.955e-05
## Proportion of Variance 0.6371 0.3383 0.01429 0.00832 0.00196 0.000e+00
## Cumulative Proportion  0.6371 0.9754 0.98972 0.99804 1.00000 1.000e+00
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]    [,3]    [,4]      [,5]      [,6]
## Standard deviation     0.1096 0.06538 0.03961 0.01879 2.258e-05 2.151e-21
## Proportion of Variance 0.6598 0.23470 0.08613 0.01939 0.000e+00 0.000e+00
## Cumulative Proportion  0.6598 0.89448 0.98061 1.00000 1.000e+00 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C, Ori_Con, and Ori_Ali;
  • by-StimGroup: (Intercept) and Ori_C.
file_E3_rt_etd2 <- file.path(dir_lmm, "lmm_E3_rt_etd2.rds")

# fit the max model
if (!file.exists(file_E3_rt_etd2)) {
  lmm_E3_rt_etd2 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Ali_C | SubjCode # Con_C +
       # + Con_Ali + Ori_Con + Ori_Ali
      ) + # Ori_Con_Ali
      (0 + Con_C + # Ali_C + Ori_C + 
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali | StimGroup),
    data = df_E3_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e8))
  )
  
  saveRDS(lmm_E3_rt_etd2, file = file_E3_rt_etd2)
} else {
  lmm_E3_rt_etd2 <- readRDS(file_E3_rt_etd2)
}

print(summary(lmm_E3_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ali_C | SubjCode) + (0 + Con_C + Ori_Con + Con_Ali + Ori_Con_Ali |      StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+08))
## 
## REML criterion at convergence: 61841.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3733 -0.6324 -0.1838  0.4234  8.3293 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr             
##  SubjCode  (Intercept) 0.0463005 0.21518                   
##            Ori_C       0.0868050 0.29463  -0.02            
##            Ali_C       0.0014959 0.03868   0.16  0.14      
##  StimGroup Con_C       0.0002268 0.01506                   
##            Ori_Con     0.0003985 0.01996  -0.09            
##            Con_Ali     0.0003179 0.01783  -0.44  0.94      
##            Ori_Con_Ali 0.0017055 0.04130  -0.29 -0.26 -0.14
##  Residual              0.1625015 0.40311                   
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.817e+00  1.971e-02  1.190e+02 345.805  < 2e-16 ***
## Orientation2-1                             3.919e-02  2.710e-02  1.190e+02   1.446 0.150767    
## Congruency2-1                              4.910e-02  5.814e-03  8.944e+00   8.445 1.49e-05 ***
## Alignment2-1                              -2.189e-03  4.857e-03  1.174e+02  -0.451 0.653000    
## Cue2-1                                     4.170e-02  3.323e-03  5.889e+04  12.550  < 2e-16 ***
## CA2-1                                      5.560e-02  3.352e-03  5.884e+04  16.589  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.893e-02  9.182e-03  1.095e+01  -5.328 0.000245 ***
## Orientation2-1:Alignment2-1                1.770e-02  6.659e-03  5.895e+04   2.658 0.007868 ** 
## Congruency2-1:Alignment2-1                -4.308e-02  8.728e-03  1.159e+01  -4.936 0.000382 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.813e-02  1.865e-02  9.012e+00   3.116 0.012374 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E3_rt_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]
## Standard deviation     0.7312 0.5337 0.09367
## Proportion of Variance 0.6455 0.3439 0.01059
## Cumulative Proportion  0.6455 0.9894 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]    [,3]     [,4]
## Standard deviation     0.1045 0.06485 0.03434 1.64e-18
## Proportion of Variance 0.6696 0.25801 0.07236 0.00e+00
## Cumulative Proportion  0.6696 0.92764 1.00000 1.00e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-StimGroup: Con_C.
file_E3_rt_etd3 <- file.path(dir_lmm, "lmm_E3_rt_etd3.rds")

# fit the max model
if (!file.exists(file_E3_rt_etd3)) {
  lmm_E3_rt_etd3 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Ali_C | SubjCode # Con_C +
       # + Con_Ali + Ori_Con + Ori_Ali
      ) + # Ori_Con_Ali
      (0 + # Ali_C + Ori_C + Con_C + 
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali | StimGroup),
    data = df_E3_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_rt_etd3, file = file_E3_rt_etd3)
} else {
  lmm_E3_rt_etd3 <- readRDS(file_E3_rt_etd3)
}

print(summary(lmm_E3_rt_etd3), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ali_C | SubjCode) + (0 + Ori_Con + Con_Ali + Ori_Con_Ali |      StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 61850.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3914 -0.6324 -0.1843  0.4224  8.3160 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr       
##  SubjCode  (Intercept) 0.0463073 0.21519             
##            Ori_C       0.0867992 0.29462  -0.02      
##            Ali_C       0.0014940 0.03865   0.16  0.14
##  StimGroup Ori_Con     0.0004248 0.02061             
##            Con_Ali     0.0003214 0.01793   0.92      
##            Ori_Con_Ali 0.0018542 0.04306  -0.34  0.06
##  Residual              0.1625496 0.40317             
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.817e+00  1.972e-02  1.190e+02 345.772  < 2e-16 ***
## Orientation2-1                             3.905e-02  2.710e-02  1.190e+02   1.441 0.152201    
## Congruency2-1                              4.941e-02  3.334e-03  5.897e+04  14.817  < 2e-16 ***
## Alignment2-1                              -2.198e-03  4.856e-03  1.174e+02  -0.453 0.651706    
## Cue2-1                                     4.154e-02  3.321e-03  5.897e+04  12.505  < 2e-16 ***
## CA2-1                                      5.521e-02  3.350e-03  5.902e+04  16.482  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.868e-02  9.325e-03  1.093e+01  -5.221 0.000291 ***
## Orientation2-1:Alignment2-1                1.786e-02  6.660e-03  5.896e+04   2.682 0.007326 ** 
## Congruency2-1:Alignment2-1                -4.327e-02  8.749e-03  1.169e+01  -4.945 0.000367 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.813e-02  1.905e-02  9.163e+00   3.052 0.013476 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00264032 (tol = 0.002, component 1)
summary(rePCA(lmm_E3_rt_etd3))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]
## Standard deviation     0.7311 0.5337 0.09359
## Proportion of Variance 0.6454 0.3440 0.01058
## Cumulative Proportion  0.6454 0.9894 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]      [,3]
## Standard deviation     0.1085 0.06498 1.584e-05
## Proportion of Variance 0.7361 0.26393 0.000e+00
## Cumulative Proportion  0.7361 1.00000 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-StimGroup: Con_Ali.
file_E3_rt_etd4 <- file.path(dir_lmm, "lmm_E3_rt_etd4.rds")

# fit the max model
if (!file.exists(file_E3_rt_etd4)) {
  lmm_E3_rt_etd4 <- lmer(
    log(RT) ~ Orientation * Congruency * Alignment + Cue + CA +
      (Ori_C + Ali_C | SubjCode # Con_C +
       # + Con_Ali + Ori_Con + Ori_Ali
      ) + # Ori_Con_Ali
      (0 + # Ali_C + Ori_C + Con_C + 
         Ori_Con + # Ori_Ali + Con_Ali + 
         Ori_Con_Ali | StimGroup),
    data = df_E3_lmm |> dplyr::filter(isCorrect==1),
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_rt_etd4, file = file_E3_rt_etd4)
} else {
  lmm_E3_rt_etd4 <- readRDS(file_E3_rt_etd4)
}

print(summary(lmm_E3_rt_etd4), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ali_C | SubjCode) + (0 + Ori_Con + Ori_Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 61854.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3874 -0.6325 -0.1841  0.4227  8.3233 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr       
##  SubjCode  (Intercept) 0.0462913 0.21515             
##            Ori_C       0.0867930 0.29461  -0.02      
##            Ali_C       0.0014940 0.03865   0.16  0.14
##  StimGroup Ori_Con     0.0002798 0.01673             
##            Ori_Con_Ali 0.0017631 0.04199  -0.64      
##  Residual              0.1625771 0.40321             
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.817e+00  1.971e-02  1.190e+02 345.832  < 2e-16 ***
## Orientation2-1                             3.907e-02  2.710e-02  1.191e+02   1.442 0.151971    
## Congruency2-1                              4.943e-02  3.335e-03  5.898e+04  14.823  < 2e-16 ***
## Alignment2-1                              -2.174e-03  4.856e-03  1.174e+02  -0.448 0.655166    
## Cue2-1                                     4.154e-02  3.322e-03  5.897e+04  12.506  < 2e-16 ***
## CA2-1                                      5.523e-02  3.350e-03  5.902e+04  16.488  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.881e-02  8.512e-03  9.424e+00  -5.734 0.000237 ***
## Orientation2-1:Alignment2-1                1.799e-02  6.660e-03  5.896e+04   2.701 0.006923 ** 
## Congruency2-1:Alignment2-1                -4.351e-02  6.663e-03  5.906e+04  -6.531 6.59e-11 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.822e-02  1.881e-02  9.037e+00   3.095 0.012753 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00373015 (tol = 0.002, component 1)
summary(rePCA(lmm_E3_rt_etd4))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]
## Standard deviation     0.7310 0.5336 0.09359
## Proportion of Variance 0.6455 0.3439 0.01058
## Cumulative Proportion  0.6455 0.9894 1.00000
## 
## $StimGroup
## Importance of components:
##                          [,1]    [,2]
## Standard deviation     0.1078 0.03071
## Proportion of Variance 0.9249 0.07507
## Cumulative Proportion  0.9249 1.00000

7.2.1.5 The optimal model

anova(lmm_E3_rt_rdc, lmm_E3_rt_etd4, refit=FALSE)

According to BIC, the extended model is used as the optimal model.

lmm_E3_rt_opt <- lmm_E3_rt_etd4

print(summary(lmm_E3_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Orientation * Congruency * Alignment + Cue + CA + (Ori_C +      Ali_C | SubjCode) + (0 + Ori_Con + Ori_Con_Ali | StimGroup)
##    Data: dplyr::filter(df_E3_lmm, isCorrect == 1)
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 61854.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.3874 -0.6325 -0.1841  0.4227  8.3233 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr       
##  SubjCode  (Intercept) 0.0462913 0.21515             
##            Ori_C       0.0867930 0.29461  -0.02      
##            Ali_C       0.0014940 0.03865   0.16  0.14
##  StimGroup Ori_Con     0.0002798 0.01673             
##            Ori_Con_Ali 0.0017631 0.04199  -0.64      
##  Residual              0.1625771 0.40321             
## Number of obs: 59327, groups:  SubjCode, 120; StimGroup, 10
## 
## Fixed effects:
##                                             Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                6.817e+00  1.971e-02  1.190e+02 345.832  < 2e-16 ***
## Orientation2-1                             3.907e-02  2.710e-02  1.191e+02   1.442 0.151971    
## Congruency2-1                              4.943e-02  3.335e-03  5.898e+04  14.823  < 2e-16 ***
## Alignment2-1                              -2.174e-03  4.856e-03  1.174e+02  -0.448 0.655166    
## Cue2-1                                     4.154e-02  3.322e-03  5.897e+04  12.506  < 2e-16 ***
## CA2-1                                      5.523e-02  3.350e-03  5.902e+04  16.488  < 2e-16 ***
## Orientation2-1:Congruency2-1              -4.881e-02  8.512e-03  9.424e+00  -5.734 0.000237 ***
## Orientation2-1:Alignment2-1                1.799e-02  6.660e-03  5.896e+04   2.701 0.006923 ** 
## Congruency2-1:Alignment2-1                -4.351e-02  6.663e-03  5.906e+04  -6.531 6.59e-11 ***
## Orientation2-1:Congruency2-1:Alignment2-1  5.822e-02  1.881e-02  9.037e+00   3.095 0.012753 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00373015 (tol = 0.002, component 1)

7.2.2 Estimated marginal means

emm_E3_rt <- emmeans(lmm_E3_rt_opt, ~ Orientation + Congruency + Alignment,
                     pbkrtest.limit = 2e5,
                     lmerTest.limit = 2e5)
# emmip(regrid(emm_E3_rt), Congruency ~ Alignment | Orientation, CIs = TRUE)

summary(emm_E3_rt, type = "response") # equivalent to regrid(emm_E3_rt)
##  Orientation Congruency Alignment response   SE  df lower.CL upper.CL
##  upr         con        ali            853 20.9 126      812      895
##  inv         con        ali            913 21.8 127      871      958
##  upr         inc        ali            952 23.5 128      906      999
##  inv         inc        ali            943 22.6 129      900      989
##  upr         con        mis            874 21.5 124      833      918
##  inv         con        mis            926 22.7 125      883      972
##  upr         inc        mis            908 22.4 125      864      953
##  inv         inc        mis            943 23.1 126      898      990
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale

7.2.2.1 Composite effect

Composite effect of RT:

emm_E3_rt_cf <- contrast(regrid(emm_E3_rt), 
                         interaction = "pairwise", 
                         by = "Orientation", 
                         infer = TRUE)

summary(emm_E3_rt_cf[1:2], side="<")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr            -65.8 10.3 124     -Inf   -48.74  -6.382  <.0001
##  con - inc           ali - mis          inv            -13.3 10.9 125     -Inf     4.85  -1.213  0.1137
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed

Congruency effect of rt in aligned condition:

emm_E3_rt_con <- contrast(regrid(emm_E3_rt), 
                          interaction = "pairwise", 
                          by = c("Orientation", "Alignment"),
                          infer = TRUE)

summary(emm_E3_rt_con[1:2], side="<")
##  Congruency_pairwise Orientation Alignment estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           upr         ali          -99.3 8.07 126     -Inf    -85.9 -12.306  <.0001
##  con - inc           inv         ali          -29.9 8.13 127     -Inf    -16.4  -3.678  0.0002
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed

Equivalence tests for composite effect:

summary(emm_E3_rt_cf[1:2], delta=50, level=.9)
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr            -65.8 10.3 124    -82.9   -48.74   1.535  0.9364
##  con - inc           ali - mis          inv            -13.3 10.9 125    -31.4     4.85  -3.362  0.0005
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 50 
## P values are left-tailed
summary(emm_E3_rt_cf[1:2], delta=50, side=">")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr            -65.8 10.3 124    -82.9      Inf  -1.535  0.9364
##  con - inc           ali - mis          inv            -13.3 10.9 125    -31.4      Inf   3.362  0.0005
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 50 
## P values are right-tailed
summary(emm_E3_rt_cf[1:2], delta=50, side="<")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr            -65.8 10.3 124     -Inf   -48.74 -11.228  <.0001
##  con - inc           ali - mis          inv            -13.3 10.9 125     -Inf     4.85  -5.788  <.0001
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 50 
## P values are left-tailed
plot_E3_cf_rt <- summary(emm_E3_rt, type = "response") %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Orientation, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "", "", "", "", ""), color = sig_color, size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  NULL

# ggsave(filename = "E3_cf_rt.pdf", plot_E3_cf_rt, width = 8, height = 4.8)

plot_E3_cf_rt

7.2.2.2 Compare composite effects between upright and inverted faces

emm_E3_rt_cf_uni <- contrast(regrid(emm_E3_rt), 
                             interaction="pairwise", 
                             simple = c("Orientation", "Congruency", "Alignment"),
                             infer = TRUE)

summary(emm_E3_rt_cf_uni, side="<")
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -52.6 17.3 124     -Inf    -23.9  -3.040  0.0014
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed

Equivalence tests:

summary(emm_E3_rt_cf_uni, delta=60, level=.9)
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -52.6 17.3 124    -81.2    -23.9  -0.429  0.3344
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 60 
## P values are left-tailed
summary(emm_E3_rt_cf_uni, delta=60, side=">")
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -52.6 17.3 124    -81.2      Inf   0.429  0.3344
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 60 
## P values are right-tailed
summary(emm_E3_rt_cf_uni, delta=60, side="<")
##  Orientation_pairwise Congruency_pairwise Alignment_pairwise estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            con - inc           ali - mis             -52.6 17.3 124     -Inf    -23.9  -6.509  <.0001
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 60 
## P values are left-tailed

7.2.2.3 Facilitation

emm_E3_rt_fi <- contrast(regrid(emm_E3_rt), 
                         "pairwise", 
                         by = c("Orientation", "Congruency"), 
                         infer = TRUE, 
                         adjust = "none")
# emmip(emm_E3_rt_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 

emm_E3_rt_fi[1:4]
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con         -21.708 6.80 124    -35.2    -8.24  -3.190  0.0018
##  ali - mis inv         con         -12.898 7.56 125    -27.9     2.07  -1.705  0.0906
##  ali - mis upr         inc          44.134 7.82 125     28.7    59.61   5.644  <.0001
##  ali - mis inv         inc           0.361 8.08 126    -15.6    16.35   0.045  0.9645
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95
summary(emm_E3_rt_fi[1:2], side="<")
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con           -21.7 6.80 124     -Inf  -10.432  -3.190  0.0009
##  ali - mis inv         con           -12.9 7.56 125     -Inf   -0.364  -1.705  0.0453
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are left-tailed

Equivalence tests:

summary(emm_E3_rt_fi[1:2], delta=30, level=.9)
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con           -21.7 6.80 124    -33.0  -10.432  -1.219  0.1126
##  ali - mis inv         con           -12.9 7.56 125    -25.4   -0.364  -2.261  0.0127
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 30 
## P values are left-tailed
summary(emm_E3_rt_fi[1:2], delta=30, side=">")
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con           -21.7 6.80 124    -33.0      Inf   1.219  0.1126
##  ali - mis inv         con           -12.9 7.56 125    -25.4      Inf   2.261  0.0127
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 30 
## P values are right-tailed
summary(emm_E3_rt_fi[1:2], delta=30, side="<")
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         con           -21.7 6.80 124     -Inf  -10.432  -7.600  <.0001
##  ali - mis inv         con           -12.9 7.56 125     -Inf   -0.364  -5.672  <.0001
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 30 
## P values are left-tailed

7.2.2.4 Interference

summary(emm_E3_rt_fi[3:4], side=">")
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc          44.134 7.82 125     31.2      Inf   5.644  <.0001
##  ali - mis inv         inc           0.361 8.08 126    -13.0      Inf   0.045  0.4822
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## P values are right-tailed

Equivalence tests:

summary(emm_E3_rt_fi[3:4], delta=30, level=.9)
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc          44.134 7.82 125     31.2     57.1   1.807  0.9635
##  ali - mis inv         inc           0.361 8.08 126    -13.0     13.7  -3.669  0.0002
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 30 
## P values are left-tailed
summary(emm_E3_rt_fi[3:4], delta=30, side=">")
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc          44.134 7.82 125     31.2      Inf   9.480  <.0001
##  ali - mis inv         inc           0.361 8.08 126    -13.0      Inf   3.759  0.0001
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 30 
## P values are right-tailed
summary(emm_E3_rt_fi[3:4], delta=30, side="<")
##  contrast  Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis upr         inc          44.134 7.82 125     -Inf     57.1   1.807  0.9635
##  ali - mis inv         inc           0.361 8.08 126     -Inf     13.7  -3.669  0.0002
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 30 
## P values are left-tailed
plot_E3_cffi_rt <- summary(emm_E3_rt_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=100, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = NULL, y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axis
  theme(legend.position = "none") +
  NULL

# ggsave(filename = "E3_fi_rt.pdf", plot_E3_cffi_rt, width = 7, height = 4.55)
plot_E3_cffi_rt

7.2.2.5 Comparing facilitation/interference between upright and inverted faces

# facilitation and interference of rt
emm_E3_rt_fi_ui <- contrast(regrid(emm_E3_rt), 
                            interaction = "pairwise", 
                            by = "Congruency", 
                            infer = TRUE, 
                            adjust = "none")

emm_E3_rt_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con           -8.81 10.0 124    -28.6     11.0  -0.879  0.3809
##  upr - inv            ali - mis          inc           43.77 11.1 125     21.7     65.8   3.926  0.0001
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

Equivalence tests:

summary(emm_E3_rt_fi_ui[1:2], delta=50, level=.9)
##  Orientation_pairwise Alignment_pairwise Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con           -8.81 10.0 124    -25.4     7.79  -4.112  <.0001
##  upr - inv            ali - mis          inc           43.77 11.1 125     25.3    62.25  -0.558  0.2888
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.9 
## Statistics are tests of equivalence with a threshold of 50 
## P values are left-tailed
summary(emm_E3_rt_fi_ui[1:2], delta=50, side=">")
##  Orientation_pairwise Alignment_pairwise Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con           -8.81 10.0 124    -25.4      Inf   4.112  <.0001
##  upr - inv            ali - mis          inc           43.77 11.1 125     25.3      Inf   8.410  <.0001
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of noninferiority with a threshold of 50 
## P values are right-tailed
summary(emm_E3_rt_fi_ui[1:2], delta=50, side="<")
##  Orientation_pairwise Alignment_pairwise Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con           -8.81 10.0 124     -Inf     7.79  -5.870  <.0001
##  upr - inv            ali - mis          inc           43.77 11.1 125     -Inf    62.25  -0.558  0.2888
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95 
## Statistics are tests of nonsuperiority with a threshold of 50 
## P values are left-tailed

7.2.2.6 Comparisons between facilitation and interference

contrast(emm_E3_rt_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2]
##  contrast  Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  faci-inte upr             22.4 10.4 124     1.81    43.04   2.154  0.0332
##  faci-inte inv            -12.5 11.2 125   -34.71     9.63  -1.119  0.2652
## 
## Results are averaged over the levels of: Cue, CA 
## Degrees-of-freedom method: inherited from satterthwaite when re-gridding 
## Confidence level used: 0.95

7.2.3 Plot

plot_E3_cf_rt_ <- plot_E3_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E3_rt <- ggarrange(plot_E3_cf_rt_, plot_E3_cffi_rt, 
                        labels = c("a", "b"),
                        font.label = (list(size = 18)),
                        widths = c(1.5, 1),
                        nrow = 1)

plot_E3_rt

7.3 Plot

plot_E3 <- ggarrange(plot_E3_cf_d_, plot_E3_cffi_d, 
                     plot_E3_cf_rt_, plot_E3_cffi_rt,
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 18)),
                     widths = c(1.5, 1),
                     nrow = 2,
                     ncol = 2)

plot_E3

8 Exploratory analysis: Inverse efficiency

8.1 Experiment 1 & 2

RM-ANOVA is used to analyze the inverse efficiency.

8.1.1 Calculate inverse efficiency

df_E12_acc <- df_E12_lmm %>% 
  group_by(SubjCode, Orientation, Congruency, Alignment) %>%
  summarise(acc = mean(isCorrect),
            .groups = "drop")

df_E12_rt <- df_E12_lmm %>% 
  filter(isCorrect==1) %>% 
  group_by(SubjCode, Orientation, Congruency, Alignment) %>%
  summarise(rt = mean(RT),
            .groups = "drop") 

df_E12_ie <- left_join(df_E12_acc, df_E12_rt, 
                       by = c("SubjCode", "Orientation", "Congruency", "Alignment")) %>% 
  mutate(IE = rt/acc) %>% 
  select(SubjCode, Orientation, Congruency, Alignment, IE) 

df_E12_ie 
df_E12_ie <- df_E12_ie %>% 
  psychr::set_contr(c(Orientation, Congruency, Alignment)) %>% 
  psychr::add_lmmcols(IE ~ Orientation * Congruency * Alignment) 
##                                              old_name
## Ori_C                                  Orientation2-1
## Con_C                                   Congruency2-1
## Ali_C                                    Alignment2-1
## Ori_Con                  Orientation2-1:Congruency2-1
## Ori_Ali                   Orientation2-1:Alignment2-1
## Con_Ali                    Congruency2-1:Alignment2-1
## Ori_Con_Ali Orientation2-1:Congruency2-1:Alignment2-1
## [1] "Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali"

8.1.2 Fitting linear mixed-effects models

8.1.2.1 The zero-correlation-parameter model

file_E12_ie_zcp <- file.path(dir_lmm, "lmm_E12_ie_zcp.rds")

# fit the max model
if (!file.exists(file_E12_ie_zcp)) {
  lmm_E12_ie_zcp <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali +
         Ori_Con_Ali || SubjCode),
    data = df_E12_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_ie_zcp, file = file_E12_ie_zcp)
} else {
  lmm_E12_ie_zcp <- readRDS(file_E12_ie_zcp)
}

print(summary(lmm_E12_ie_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali || SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 9157.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4496 -0.3196 -0.0310  0.2332  7.1264 
## 
## Random effects:
##  Groups     Name        Variance  Std.Dev. 
##  SubjCode   (Intercept) 1.757e+05 419.13798
##  SubjCode.1 Ori_C       3.185e+05 564.34717
##  SubjCode.2 Con_C       6.671e+04 258.28403
##  SubjCode.3 Ali_C       5.541e+03  74.43744
##  SubjCode.4 Ori_Con     8.352e+04 288.99234
##  SubjCode.5 Ori_Ali     8.874e-04   0.02979
##  SubjCode.6 Con_Ali     2.880e+03  53.66181
##  SubjCode.7 Ori_Con_Ali 6.694e+04 258.73607
##  Residual               3.117e+04 176.56247
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.38   79.00  28.588  < 2e-16 ***
## Orientation2-1                              235.59      64.62   79.00   3.646 0.000476 ***
## Congruency2-1                               272.64      32.07   79.00   8.500 9.20e-13 ***
## Alignment2-1                                -27.30      16.25   79.00  -1.680 0.096878 .  
## Orientation2-1:Congruency2-1               -217.06      42.70   79.00  -5.083 2.43e-06 ***
## Orientation2-1:Alignment2-1                  77.93      27.92   79.00   2.791 0.006577 ** 
## Congruency2-1:Alignment2-1                 -167.41      28.55   79.00  -5.863 1.01e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      62.88   79.00   1.788 0.077637 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## unable to evaluate scaled gradient
## Model failed to converge: degenerate  Hessian with 1 negative eigenvalues

8.1.2.2 The reduced model

summary(rePCA(lmm_E12_ie_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]   [,6]   [,7]      [,8]
## Standard deviation     3.1963 2.3739 1.6368 1.46541 1.46285 0.4216 0.3039 0.0001687
## Proportion of Variance 0.4425 0.2441 0.1160 0.09301 0.09269 0.0077 0.0040 0.0000000
## Cumulative Proportion  0.4425 0.6866 0.8026 0.89562 0.98830 0.9960 1.0000 1.0000000

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Ori_Ali;
file_E12_ie_rdc <- file.path(dir_lmm, "lmm_E12_ie_rdc.rds")

# fit the reduced model
if (!file.exists(file_E12_ie_rdc)) {
  lmm_E12_ie_rdc <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali || SubjCode),
    data = df_E12_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_ie_rdc, file = file_E12_ie_rdc)
} else {
  lmm_E12_ie_rdc <- readRDS(file_E12_ie_rdc)
}

print(summary(lmm_E12_ie_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Con_Ali + Ori_Con_Ali || SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 9157.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4496 -0.3196 -0.0310  0.2332  7.1265 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  SubjCode   (Intercept) 175679   419.14  
##  SubjCode.1 Ori_C       318488   564.35  
##  SubjCode.2 Con_C        66709   258.28  
##  SubjCode.3 Ali_C         5541    74.44  
##  SubjCode.4 Ori_Con      83518   288.99  
##  SubjCode.5 Con_Ali       2879    53.66  
##  SubjCode.6 Ori_Con_Ali  66942   258.73  
##  Residual                31174   176.56  
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.38   79.00  28.588  < 2e-16 ***
## Orientation2-1                              235.59      64.62   79.00   3.646 0.000476 ***
## Congruency2-1                               272.64      32.07   79.00   8.501 9.20e-13 ***
## Alignment2-1                                -27.30      16.25   79.00  -1.680 0.096877 .  
## Orientation2-1:Congruency2-1               -217.06      42.70   79.00  -5.083 2.43e-06 ***
## Orientation2-1:Alignment2-1                  77.93      27.92   79.00   2.791 0.006577 ** 
## Congruency2-1:Alignment2-1                 -167.41      28.55   79.00  -5.863 1.01e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      62.88   79.00   1.788 0.077636 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rePCA(lmm_E12_ie_rdc))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]   [,6]   [,7]
## Standard deviation     3.1963 2.3739 1.6368 1.46538 1.46283 0.4216 0.3039
## Proportion of Variance 0.4425 0.2441 0.1160 0.09301 0.09268 0.0077 0.0040
## Cumulative Proportion  0.4425 0.6866 0.8026 0.89562 0.98830 0.9960 1.0000

8.1.2.3 The extended model

file_E12_ie_etd <- file.path(dir_lmm, "lmm_E12_ie_etd.rds")

# fit the reduced model
if (!file.exists(file_E12_ie_etd)) {
  lmm_E12_ie_etd <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Con_Ali + # Ori_Ali + 
         Ori_Con_Ali | SubjCode),
    data = df_E12_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_ie_etd, file = file_E12_ie_etd)
} else {
  lmm_E12_ie_etd <- readRDS(file_E12_ie_etd)
}

print(summary(lmm_E12_ie_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Con_Ali + Ori_Con_Ali | SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 8968.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3901 -0.3550 -0.0354  0.3611  4.3024 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                               
##  SubjCode (Intercept) 177200   421.0                                       
##           Ori_C       324947   570.0     0.32                              
##           Con_C        73115   270.4     0.31 -0.44                        
##           Ali_C        13465   116.0     0.45  0.39  0.13                  
##           Ori_Con     109267   330.6    -0.77 -0.03 -0.53 -0.67            
##           Con_Ali      40765   201.9    -0.35 -0.51  0.29  0.18  0.01      
##           Ori_Con_Ali 193700   440.1    -0.24 -0.56  0.15 -0.36  0.19  0.75
##  Residual              18457   135.9                                       
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.37   79.04  28.593  < 2e-16 ***
## Orientation2-1                              235.59      64.63   78.97   3.645 0.000477 ***
## Congruency2-1                               272.64      32.08   78.97   8.498 9.32e-13 ***
## Alignment2-1                                -27.30      16.84   83.63  -1.621 0.108743    
## Orientation2-1:Congruency2-1               -217.06      42.75   79.12  -5.078 2.48e-06 ***
## Orientation2-1:Alignment2-1                  77.93      21.48  158.06   3.628 0.000385 ***
## Congruency2-1:Alignment2-1                 -167.41      31.16   89.49  -5.373 6.10e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      65.32   84.22   1.721 0.088908 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0046076 (tol = 0.002, component 1)
summary(rePCA(lmm_E12_ie_etd))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]   [,5]    [,6]      [,7]
## Standard deviation     5.1015 3.7399 2.4886 1.54805 1.2393 0.61993 0.0002099
## Proportion of Variance 0.5151 0.2768 0.1226 0.04743 0.0304 0.00761 0.0000000
## Cumulative Proportion  0.5151 0.7920 0.9146 0.96199 0.9924 1.00000 1.0000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ali_C and Con_Ali;
file_E12_ie_etd2 <- file.path(dir_lmm, "lmm_E12_ie_etd2.rds")

# fit the reduced model
if (!file.exists(file_E12_ie_etd2)) {
  lmm_E12_ie_etd2 <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + # Ali_C + 
         Ori_Con + # Con_Ali + Ori_Ali + 
         Ori_Con_Ali | SubjCode),
    data = df_E12_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_ie_etd2, file = file_E12_ie_etd2)
} else {
  lmm_E12_ie_etd2 <- readRDS(file_E12_ie_etd2)
}

print(summary(lmm_E12_ie_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ori_Con + Ori_Con_Ali | SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 9044.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8971 -0.3912 -0.0504  0.3572  6.9800 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                   
##  SubjCode (Intercept) 175314   418.7                           
##           Ori_C       317206   563.2     0.33                  
##           Con_C        65356   255.6     0.33 -0.47            
##           Ori_Con      80284   283.3    -0.90 -0.04 -0.66      
##           Ori_Con_Ali  70035   264.6    -0.41 -0.94  0.25  0.24
##  Residual              33907   184.1                           
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.38   79.02  28.590  < 2e-16 ***
## Orientation2-1                              235.59      64.63   78.98   3.645 0.000477 ***
## Congruency2-1                               272.64      32.08   79.00   8.500 9.23e-13 ***
## Alignment2-1                                -27.30      14.56  315.95  -1.876 0.061625 .  
## Orientation2-1:Congruency2-1               -217.06      43.03   84.44  -5.045 2.56e-06 ***
## Orientation2-1:Alignment2-1                  77.93      29.11  315.95   2.677 0.007824 ** 
## Congruency2-1:Alignment2-1                 -167.41      29.11  315.95  -5.750 2.10e-08 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      65.32  135.78   1.721 0.087483 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rePCA(lmm_E12_ie_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]      [,5]
## Standard deviation     3.5466 2.6827 0.97892 0.39110 0.0001945
## Proportion of Variance 0.6022 0.3446 0.04588 0.00732 0.0000000
## Cumulative Proportion  0.6022 0.9468 0.99268 1.00000 1.0000000

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Con_C and Ori_Con_Ali;
file_E12_ie_etd3 <- file.path(dir_lmm, "lmm_E12_ie_etd3.rds")

# fit the reduced model
if (!file.exists(file_E12_ie_etd3)) {
  lmm_E12_ie_etd3 <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + # Ali_C + Con_C + 
         Ori_Con | SubjCode # Con_Ali + Ori_Ali + Ori_Con_Ali
          ),
    data = df_E12_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_ie_etd3, file = file_E12_ie_etd3)
} else {
  lmm_E12_ie_etd3 <- readRDS(file_E12_ie_etd3)
}

print(summary(lmm_E12_ie_etd3), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Ori_Con |      SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 9200.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2966 -0.4005 -0.0051  0.3281  7.2966 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr       
##  SubjCode (Intercept) 172408   415.2               
##           Ori_C       305181   552.4     0.33      
##           Ori_Con      70047   264.7    -0.96 -0.05
##  Residual              57902   240.6               
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.39   79.00  28.582  < 2e-16 ***
## Orientation2-1                              235.59      64.63   79.00   3.645 0.000476 ***
## Congruency2-1                               272.64      19.02  474.00  14.332  < 2e-16 ***
## Alignment2-1                                -27.30      19.02  474.00  -1.435 0.151856    
## Orientation2-1:Congruency2-1               -217.06      48.20  114.80  -4.504 1.62e-05 ***
## Orientation2-1:Alignment2-1                  77.93      38.05  474.00   2.048 0.041084 *  
## Congruency2-1:Alignment2-1                 -167.41      38.05  474.00  -4.400 1.34e-05 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      76.09  474.00   1.477 0.140219    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E12_ie_etd3))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]      [,3]
## Standard deviation     2.4610 1.8443 6.284e-05
## Proportion of Variance 0.6404 0.3596 0.000e+00
## Cumulative Proportion  0.6404 1.0000 1.000e+00
file_E12_ie_etd4 <- file.path(dir_lmm, "lmm_E12_ie_etd4.rds")

# fit the reduced model
if (!file.exists(file_E12_ie_etd4)) {
  lmm_E12_ie_etd4 <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C | SubjCode# Ali_C + Con_C + 
           # Con_Ali + Ori_Ali + Ori_Con_Ali + Ori_Con
          ),
    data = df_E12_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E12_ie_etd4, file = file_E12_ie_etd4)
} else {
  lmm_E12_ie_etd4 <- readRDS(file_E12_ie_etd4)
}

print(summary(lmm_E12_ie_etd4), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C | SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 9244.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6424 -0.4165 -0.0259  0.3123  7.9382 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  SubjCode (Intercept) 171590   414.2        
##           Ori_C       302150   549.7    0.34
##  Residual              63852   252.7        
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.38   79.00  28.588  < 2e-16 ***
## Orientation2-1                              235.59      64.62   79.00   3.646 0.000476 ***
## Congruency2-1                               272.64      19.98  474.00  13.648  < 2e-16 ***
## Alignment2-1                                -27.30      19.98  474.00  -1.367 0.172335    
## Orientation2-1:Congruency2-1               -217.06      39.95  474.00  -5.433 8.88e-08 ***
## Orientation2-1:Alignment2-1                  77.93      39.95  474.00   1.950 0.051706 .  
## Congruency2-1:Alignment2-1                 -167.41      39.95  474.00  -4.190 3.33e-05 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      79.91  474.00   1.407 0.160105    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

8.1.2.4 The optimal model

anova(lmm_E12_ie_rdc, lmm_E12_ie_etd4, refit=FALSE)

According to BIC, the extended model is used as the optimal model.

lmm_E12_ie_opt <- lmm_E12_ie_rdc

print(summary(lmm_E12_ie_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Con_Ali + Ori_Con_Ali || SubjCode)
##    Data: df_E12_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 9157.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4496 -0.3196 -0.0310  0.2332  7.1265 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  SubjCode   (Intercept) 175679   419.14  
##  SubjCode.1 Ori_C       318488   564.35  
##  SubjCode.2 Con_C        66709   258.28  
##  SubjCode.3 Ali_C         5541    74.44  
##  SubjCode.4 Ori_Con      83518   288.99  
##  SubjCode.5 Con_Ali       2879    53.66  
##  SubjCode.6 Ori_Con_Ali  66942   258.73  
##  Residual                31174   176.56  
## Number of obs: 640, groups:  SubjCode, 80
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1354.45      47.38   79.00  28.588  < 2e-16 ***
## Orientation2-1                              235.59      64.62   79.00   3.646 0.000476 ***
## Congruency2-1                               272.64      32.07   79.00   8.501 9.20e-13 ***
## Alignment2-1                                -27.30      16.25   79.00  -1.680 0.096877 .  
## Orientation2-1:Congruency2-1               -217.06      42.70   79.00  -5.083 2.43e-06 ***
## Orientation2-1:Alignment2-1                  77.93      27.92   79.00   2.791 0.006577 ** 
## Congruency2-1:Alignment2-1                 -167.41      28.55   79.00  -5.863 1.01e-07 ***
## Orientation2-1:Congruency2-1:Alignment2-1   112.42      62.88   79.00   1.788 0.077636 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

8.1.3 Estimated marginal means

# hit and false alarm
emm_E12_ie <- emmeans(lmm_E12_ie_opt, 
                      ~ Orientation + Congruency + Alignment)
emm_E12_ie
##  Orientation Congruency Alignment emmean   SE  df lower.CL upper.CL
##  upr         con        ali         1023 62.3 192      900     1146
##  inv         con        ali         1357 62.3 192     1234     1480
##  upr         inc        ali         1516 62.3 192     1393     1639
##  inv         inc        ali         1576 62.3 192     1453     1699
##  upr         con        mis         1069 62.3 192      946     1192
##  inv         con        mis         1424 62.3 192     1301     1547
##  upr         inc        mis         1338 62.3 192     1215     1461
##  inv         inc        mis         1532 62.3 192     1409     1655
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.1.3.1 Composite effect

Composite effect of d’:

emm_E12_cf_ie <- contrast(emm_E12_ie, 
                          interaction = "pairwise", 
                          simple = c("Congruency", "Alignment"),
                          infer = TRUE)

summary(emm_E12_cf_ie[1:2], side="<")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr             -224 42.5 157     -Inf   -153.3  -5.265  <.0001
##  con - inc           ali - mis          inv             -111 42.5 157     -Inf    -40.9  -2.618  0.0049
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are left-tailed

Congruency effect of d’ in aligned condition:

emm_E12_con_ie <- contrast(emm_E12_ie, 
                           interaction = "pairwise", 
                           simple = "Congruency",
                           infer = TRUE)

summary(emm_E12_con_ie[1:2], side="<")
##  Congruency_pairwise Orientation Alignment estimate SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           upr         ali           -493 44 216     -Inf     -420 -11.206  <.0001
##  con - inc           inv         ali           -220 44 216     -Inf     -147  -4.994  <.0001
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E12_cf_ie <- emm_E12_ie %>%
  summary(infer=TRUE) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(Alignment, emmean, color=Congruency, group=Congruency)) +
  geom_point(size = 2) + # position = position_dodge(width = 0.1),
  geom_line(aes(linetype = Congruency), linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Orientation, switch = "both") +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6, # position = position_dodge(width = 0.1),
                show.legend = F) + 
  coord_cartesian(ylim = c(800, 1800)) +  # set the limit for y axis c(0, 1100)
  labs(y = "Inverse efficiency (RT/Accuracy)", fill = "Congruency",
       x = NULL) +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "**", "", "", "", ""),
            color = "red",
            size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  theme(axis.title.x = element_text(margin = margin(t = 0))) +
  NULL
# ggsave(filename = "ccf_ie.pdf", plot_ccf_ie, width = 8, height = 6)
plot_E12_cf_ie

8.1.3.2 Compare composite effects between upright and inverted faces

contrast(emm_E12_cf_ie, 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
## Congruency_pairwise = con - inc, Alignment_pairwise = ali - mis:
##  Orientation_pairwise estimate   SE df lower.CL upper.CL t.ratio p.value
##  upr - inv                -112 62.9 79     -238     12.7  -1.788  0.0776
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.1.3.3 Facilitation and interference

# facilitation and interference
emm_E12_ie_fi <- contrast(emm_E12_ie, 
                          interaction = "pairwise", 
                          simple = "Alignment", 
                          infer = TRUE, 
                          adjust = "none")

# emmip(emm_E12_ie_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 
emm_E12_ie_fi[1:4]
##  Alignment_pairwise Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis          upr         con           -45.5 30.2 311   -104.9    13.81  -1.510  0.1321
##  ali - mis          inv         con           -67.3 30.2 311   -126.6    -7.91  -2.230  0.0265
##  ali - mis          upr         inc           178.1 30.2 311    118.7   237.43   5.904  <.0001
##  ali - mis          inv         inc            43.9 30.2 311    -15.4   103.29   1.457  0.1462
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95
summary(emm_E12_ie_fi[1:2], side="<")
##  Alignment_pairwise Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis          upr         con           -45.5 30.2 311     -Inf     4.22  -1.510  0.0661
##  ali - mis          inv         con           -67.3 30.2 311     -Inf   -17.50  -2.230  0.0132
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are left-tailed
summary(emm_E12_ie_fi[3:4], side=">")
##  Alignment_pairwise Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis          upr         inc           178.1 30.2 311   128.32      Inf   5.904  <.0001
##  ali - mis          inv         inc            43.9 30.2 311    -5.82      Inf   1.457  0.0731
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E12_cffi_ie <- summary(emm_E12_ie_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=300, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_ie) +  
  labs(x = NULL, 
       y = "Inverse efficiency (aligned-misaligned)") +  # set the names for main, x and y axis
  theme(legend.position = "none",
        axis.title.x = element_text(margin = margin(t = 0))) +
  NULL

# ggsave(filename = "E12_fi_ie.pdf", plot_E12_cffi_ie, width = 7, height = 4.55)
plot_E12_cffi_ie

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of
emm_E12_ie_fi_ui <- contrast(emm_E12_ie, 
                             interaction = "pairwise", 
                             by = "Congruency", 
                             infer = TRUE, 
                             adjust = "none")

emm_E12_ie_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise Congruency estimate SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con            21.7 42 156    -61.3      105   0.517  0.6062
##  upr - inv            ali - mis          inc           134.1 42 156     51.1      217   3.190  0.0017
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.1.3.4 Comparisons between facilitation and interference

contrast(emm_E12_ie_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2] 
##  contrast  Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  faci-inte upr            132.5 42.8 154     47.9    217.2   3.093  0.0023
##  faci-inte inv            -23.3 42.8 154   -108.0     61.3  -0.544  0.5870
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.1.4 Bayesian hierarchical model

8.1.4.1 Prior predictive check

brm_E12_ie_ppc <- brm(IE ~ Orientation * Congruency * Alignment +
                        (Orientation * Congruency * Alignment | SubjCode),
                      data = df_E12_ie,
                      prior = c(prior(normal(1000, 300), class = Intercept),
                                prior(normal(0, 200), class = b),
                                prior(normal(0, 50), class = sigma),
                                prior(normal(0, 50), class = sd),
                                prior(lkj(2), class = cor)),
                      sample_prior = "only",
                      chains = 10, 
                      iter = 4000,
                      warmup = 2000,
                      file = file.path("brms", "brmsfit_E12_ie_ppc.rds"))

summary(brm_E12_ie_ppc)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: IE ~ Orientation * Congruency * Alignment + (Orientation * Congruency * Alignment | SubjCode) 
##    Data: df_E12_ie (Number of observations: 640) 
##   Draws: 10 chains, each with iter = 4000; warmup = 2000; thin = 1;
##          total post-warmup draws = 20000
## 
## Multilevel Hyperparameters:
## ~SubjCode (Number of levels: 80) 
##                                                                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                                                                  39.63     29.97     1.56   111.33 1.00    15630     8438
## sd(Orientation2M1)                                                             40.08     30.48     1.63   113.06 1.00    17280     9289
## sd(Congruency2M1)                                                              39.92     30.33     1.57   112.80 1.00    16332     8743
## sd(Alignment2M1)                                                               40.08     30.15     1.79   112.81 1.00    17415     9193
## sd(Orientation2M1:Congruency2M1)                                               39.69     29.97     1.51   112.38 1.00    14535     8333
## sd(Orientation2M1:Alignment2M1)                                                39.95     29.93     1.72   111.68 1.00    16103     9231
## sd(Congruency2M1:Alignment2M1)                                                 39.56     29.88     1.59   110.92 1.00    16179     9445
## sd(Orientation2M1:Congruency2M1:Alignment2M1)                                  40.05     30.46     1.61   112.88 1.00    17638     9178
## cor(Intercept,Orientation2M1)                                                   0.00      0.30    -0.57     0.57 1.00    28668    13982
## cor(Intercept,Congruency2M1)                                                   -0.00      0.30    -0.57     0.57 1.00    30070    13812
## cor(Orientation2M1,Congruency2M1)                                               0.00      0.30    -0.58     0.58 1.00    24092    15209
## cor(Intercept,Alignment2M1)                                                    -0.00      0.30    -0.58     0.57 1.00    28267    14574
## cor(Orientation2M1,Alignment2M1)                                                0.00      0.30    -0.56     0.57 1.00    24148    14547
## cor(Congruency2M1,Alignment2M1)                                                 0.00      0.30    -0.58     0.57 1.00    19516    14754
## cor(Intercept,Orientation2M1:Congruency2M1)                                    -0.00      0.30    -0.58     0.57 1.00    27467    14928
## cor(Orientation2M1,Orientation2M1:Congruency2M1)                               -0.00      0.30    -0.57     0.57 1.00    23699    14819
## cor(Congruency2M1,Orientation2M1:Congruency2M1)                                 0.00      0.30    -0.58     0.58 1.00    20550    14380
## cor(Alignment2M1,Orientation2M1:Congruency2M1)                                 -0.00      0.30    -0.58     0.58 1.00    16124    14644
## cor(Intercept,Orientation2M1:Alignment2M1)                                      0.00      0.30    -0.57     0.59 1.00    26812    13840
## cor(Orientation2M1,Orientation2M1:Alignment2M1)                                 0.00      0.30    -0.57     0.58 1.00    21154    14237
## cor(Congruency2M1,Orientation2M1:Alignment2M1)                                  0.00      0.30    -0.57     0.57 1.00    19221    15847
## cor(Alignment2M1,Orientation2M1:Alignment2M1)                                  -0.00      0.30    -0.58     0.58 1.00    17584    15328
## cor(Orientation2M1:Congruency2M1,Orientation2M1:Alignment2M1)                   0.00      0.30    -0.57     0.58 1.00    16083    15156
## cor(Intercept,Congruency2M1:Alignment2M1)                                      -0.00      0.30    -0.57     0.57 1.00    27683    14358
## cor(Orientation2M1,Congruency2M1:Alignment2M1)                                 -0.00      0.30    -0.59     0.58 1.00    24323    14628
## cor(Congruency2M1,Congruency2M1:Alignment2M1)                                  -0.00      0.30    -0.58     0.58 1.00    18217    14574
## cor(Alignment2M1,Congruency2M1:Alignment2M1)                                   -0.00      0.30    -0.57     0.57 1.00    17445    15553
## cor(Orientation2M1:Congruency2M1,Congruency2M1:Alignment2M1)                   -0.00      0.30    -0.58     0.58 1.00    15259    14664
## cor(Orientation2M1:Alignment2M1,Congruency2M1:Alignment2M1)                     0.00      0.30    -0.57     0.58 1.00    14013    15916
## cor(Intercept,Orientation2M1:Congruency2M1:Alignment2M1)                       -0.00      0.30    -0.58     0.58 1.00    27715    14723
## cor(Orientation2M1,Orientation2M1:Congruency2M1:Alignment2M1)                   0.00      0.30    -0.58     0.58 1.00    23357    14473
## cor(Congruency2M1,Orientation2M1:Congruency2M1:Alignment2M1)                    0.00      0.30    -0.58     0.57 1.00    19399    14483
## cor(Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)                     0.00      0.30    -0.57     0.57 1.00    17248    15611
## cor(Orientation2M1:Congruency2M1,Orientation2M1:Congruency2M1:Alignment2M1)     0.00      0.30    -0.58     0.59 1.00    15744    15176
## cor(Orientation2M1:Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)      0.00      0.30    -0.58     0.58 1.00    14121    15532
## cor(Congruency2M1:Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)      -0.00      0.30    -0.58     0.58 1.00    12435    15481
## 
## Regression Coefficients:
##                                           Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                   999.27    299.90   408.48  1578.08 1.00    28902    14709
## Orientation2M1                                0.14    199.77  -388.79   395.13 1.00    26676    13990
## Congruency2M1                                -1.18    198.90  -390.17   382.86 1.00    29174    14902
## Alignment2M1                                 -1.16    200.46  -389.76   393.41 1.00    27481    14741
## Orientation2M1:Congruency2M1                 -1.29    201.06  -390.64   392.75 1.00    27597    15491
## Orientation2M1:Alignment2M1                   0.02    200.13  -392.74   392.80 1.00    28575    14815
## Congruency2M1:Alignment2M1                    1.34    199.69  -390.69   393.17 1.00    27035    14735
## Orientation2M1:Congruency2M1:Alignment2M1    -0.50    201.99  -396.50   394.45 1.00    24974    15198
## 
## Further Distributional Parameters:
##       Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma    40.04     29.59     1.60   110.27 1.00    14794     7048
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
emmb_E12_ie_ppc <- emmeans(brm_E12_ie_ppc, ~ Orientation + Congruency + Alignment)
emmb_E12_ie_ppc
##  Orientation Congruency Alignment emmean lower.HPD upper.HPD
##  upr         con        ali         1003       290      1691
##  inv         con        ali         1004       307      1704
##  upr         inc        ali         1001       295      1702
##  inv         inc        ali          998       302      1702
##  upr         con        mis         1001       290      1693
##  inv         con        mis          997       299      1702
##  upr         inc        mis          996       285      1672
##  inv         inc        mis         1000       257      1667
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
emmip(brm_E12_ie_ppc, 
      Congruency ~ Alignment | Orientation, 
      CIs = TRUE, 
      adjust = "sidak")

8.1.4.2 Model fitting

brm_E12_ie <- brm(IE ~ Orientation * Congruency * Alignment +
                    (Orientation * Congruency * Alignment | SubjCode),
                  data = df_E12_ie,
                  prior = c(prior(normal(1000, 300), class = Intercept),
                            prior(normal(0, 200), class = b),
                            prior(normal(0, 50), class = sigma),
                            prior(normal(0, 50), class = sd),
                            prior(lkj(2), class = cor)),
                  save_pars = save_pars(all = TRUE),
                  chains = 10, 
                  iter = 8000,
                  warmup = 2000,
                  control = list(adapt_delta = .999, 
                                 max_treedepth = 15),  
                  file = file.path("brms", "brmsfit_E12_ie.rds"))

summary(brm_E12_ie)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: IE ~ Orientation * Congruency * Alignment + (Orientation * Congruency * Alignment | SubjCode) 
##    Data: df_E12_ie (Number of observations: 640) 
##   Draws: 10 chains, each with iter = 8000; warmup = 2000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~SubjCode (Number of levels: 80) 
##                                                                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                                                                 316.01     16.81   284.57   350.27 1.00     7193    14422
## sd(Orientation2M1)                                                            395.74     19.90   358.60   436.40 1.00    17782    31977
## sd(Congruency2M1)                                                             210.81     16.37   180.05   244.36 1.00    21816    36357
## sd(Alignment2M1)                                                               83.36     16.03    50.88   114.24 1.00    12113    18455
## sd(Orientation2M1:Congruency2M1)                                              211.61     23.70   165.13   258.09 1.00    15207    30125
## sd(Orientation2M1:Alignment2M1)                                               103.34     28.19    45.13   156.41 1.00    11616    13341
## sd(Congruency2M1:Alignment2M1)                                                106.05     29.06    47.09   161.29 1.00    10046    15971
## sd(Orientation2M1:Congruency2M1:Alignment2M1)                                 132.17     50.48    26.89   229.69 1.00     7725    11063
## cor(Intercept,Orientation2M1)                                                   0.23      0.07     0.09     0.36 1.00    10908    20666
## cor(Intercept,Congruency2M1)                                                    0.28      0.08     0.11     0.43 1.00    20780    34548
## cor(Orientation2M1,Congruency2M1)                                              -0.36      0.08    -0.51    -0.21 1.00    23962    35450
## cor(Intercept,Alignment2M1)                                                     0.32      0.13     0.06     0.58 1.00    28550    29278
## cor(Orientation2M1,Alignment2M1)                                                0.31      0.12     0.07     0.56 1.00    37506    32347
## cor(Congruency2M1,Alignment2M1)                                                 0.12      0.15    -0.18     0.41 1.00    41045    39834
## cor(Intercept,Orientation2M1:Congruency2M1)                                    -0.69      0.08    -0.84    -0.51 1.00    24930    34266
## cor(Orientation2M1,Orientation2M1:Congruency2M1)                                0.01      0.10    -0.19     0.21 1.00    38258    42188
## cor(Congruency2M1,Orientation2M1:Congruency2M1)                                -0.47      0.11    -0.67    -0.25 1.00    39222    39977
## cor(Alignment2M1,Orientation2M1:Congruency2M1)                                 -0.53      0.14    -0.77    -0.23 1.00    36607    42319
## cor(Intercept,Orientation2M1:Alignment2M1)                                      0.41      0.16     0.08     0.69 1.00    50462    35374
## cor(Orientation2M1,Orientation2M1:Alignment2M1)                                 0.29      0.16    -0.03     0.60 1.00    55389    36368
## cor(Congruency2M1,Orientation2M1:Alignment2M1)                                 -0.31      0.18    -0.62     0.07 1.00    47142    33238
## cor(Alignment2M1,Orientation2M1:Alignment2M1)                                   0.36      0.20    -0.08     0.71 1.00    40795    34329
## cor(Orientation2M1:Congruency2M1,Orientation2M1:Alignment2M1)                  -0.31      0.18    -0.65     0.07 1.00    54457    38566
## cor(Intercept,Congruency2M1:Alignment2M1)                                      -0.31      0.16    -0.61     0.01 1.00    48334    38995
## cor(Orientation2M1,Congruency2M1:Alignment2M1)                                 -0.45      0.15    -0.73    -0.14 1.00    41046    35275
## cor(Congruency2M1,Congruency2M1:Alignment2M1)                                   0.25      0.18    -0.11     0.58 1.00    54833    41011
## cor(Alignment2M1,Congruency2M1:Alignment2M1)                                    0.14      0.23    -0.35     0.53 1.00    18440    26660
## cor(Orientation2M1:Congruency2M1,Congruency2M1:Alignment2M1)                   -0.00      0.19    -0.37     0.38 1.00    50873    38870
## cor(Orientation2M1:Alignment2M1,Congruency2M1:Alignment2M1)                    -0.14      0.24    -0.60     0.32 1.00    26664    40430
## cor(Intercept,Orientation2M1:Congruency2M1:Alignment2M1)                       -0.20      0.20    -0.57     0.20 1.00    57365    33983
## cor(Orientation2M1,Orientation2M1:Congruency2M1:Alignment2M1)                  -0.52      0.18    -0.81    -0.09 1.00    35068    18871
## cor(Congruency2M1,Orientation2M1:Congruency2M1:Alignment2M1)                    0.11      0.21    -0.31     0.52 1.00    63975    37881
## cor(Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)                    -0.24      0.23    -0.65     0.22 1.00    45164    36664
## cor(Orientation2M1:Congruency2M1,Orientation2M1:Congruency2M1:Alignment2M1)     0.11      0.21    -0.32     0.51 1.00    55894    39575
## cor(Orientation2M1:Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)     -0.08      0.25    -0.56     0.40 1.00    30329    42955
## cor(Congruency2M1:Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)       0.41      0.23    -0.12     0.78 1.00    21439    26695
## 
## Regression Coefficients:
##                                           Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                  1342.07     34.95  1272.09  1409.72 1.00     2912     5560
## Orientation2M1                              225.61     44.69   137.64   312.63 1.00     5761    13335
## Congruency2M1                               267.88     26.27   216.27   319.45 1.00    10812    23631
## Alignment2M1                                -28.92     15.59   -59.50     1.48 1.00    30300    42435
## Orientation2M1:Congruency2M1               -206.54     33.87  -272.24  -139.45 1.00    10628    23509
## Orientation2M1:Alignment2M1                  75.04     27.27    21.22   128.38 1.00    38179    40119
## Congruency2M1:Alignment2M1                 -163.24     27.57  -217.34  -109.21 1.00    40608    42814
## Orientation2M1:Congruency2M1:Alignment2M1   107.70     50.59     8.37   206.63 1.00    59753    44676
## 
## Further Distributional Parameters:
##       Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma   157.69     11.01   135.30   178.74 1.00     4641     7839
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

8.1.4.3 Bayes factor

emmb_E12_ie <- emmeans(brm_E12_ie, ~ Orientation + Congruency + Alignment)

emmip(brm_E12_ie, 
      Congruency ~ Alignment | Orientation, 
      CIs = TRUE, 
      adjust = "sidak")

8.1.4.3.1 Composite effect
emm_E12_cfb <- contrast(emmb_E12_ie, 
                        interaction = "pairwise", 
                        simple = c("Congruency", "Alignment")) 
emm_E12_cfb
## Orientation = upr:
##  Congruency_pairwise Alignment_pairwise estimate lower.HPD upper.HPD
##  con - inc           ali - mis              -217      -290    -146.9
## 
## Orientation = inv:
##  Congruency_pairwise Alignment_pairwise estimate lower.HPD upper.HPD
##  con - inc           ali - mis              -109      -186     -35.4
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
# Extract the draws
draws_E12_cfb <- gather_emmeans_draws(emm_E12_cfb) %>% 
  pivot_wider(names_from = Orientation,
              values_from = .value) %>%
  mutate(cf_diff = upr - inv) %>% 
  select(-c(.chain, .iteration))
  
head(draws_E12_cfb)
emm_E12_conb <- contrast(emmb_E12_ie, 
                         "pairwise", 
                         simple = "Congruency") 
emm_E12_conb
## Orientation = upr, Alignment = ali:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -480      -556    -403.6
## 
## Orientation = inv, Alignment = ali:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -219      -280    -155.5
## 
## Orientation = upr, Alignment = mis:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -263      -343    -185.1
## 
## Orientation = inv, Alignment = mis:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -110      -179     -43.6
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
# Extract the draws
draws_E12_conb <- gather_emmeans_draws(emm_E12_conb) %>% 
  filter(Alignment == "ali") %>% 
  pivot_wider(names_from = Orientation,
              values_from = .value) %>%
  mutate(con_diff = upr - inv) %>% 
  select(-c(.chain, .iteration))
  
head(draws_E12_conb)
bf_E12_cf_upr <- bayesfactor_pointnull(draws_E12_cfb$upr,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E12_cf_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.01e+05
## 
## * Evidence Against The Null: 0
as.numeric(bf_E12_cf_upr)
## [1] 101151.5
bf_E12_con_upr <- bayesfactor_pointnull(draws_E12_conb$upr,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_con_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.40e+12
## 
## * Evidence Against The Null: 0
as.numeric(bf_E12_con_upr)
## [1] 1.397503e+12
bf_E12_cf_inv <- bayesfactor_pointnull(draws_E12_cfb$inv,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_cf_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 10.81
## 
## * Evidence Against The Null: 0
bf_E12_con_inv <- bayesfactor_pointnull(draws_E12_conb$inv,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_con_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.89e+07
## 
## * Evidence Against The Null: 0
as.numeric(bf_E12_con_inv)
## [1] 18912082
bf_E12_cf_diff <- bayesfactor_pointnull(draws_E12_cfb$cf_diff,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_cf_diff
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF  
## ----
## 2.47
## 
## * Evidence Against The Null: 0
8.1.4.3.2 Facilitation and interference
emm_E12_fib <- contrast(emmb_E12_ie, 
                        "pairwise", 
                        simple = "Alignment") 
emm_E12_fib
## Orientation = upr, Congruency = con:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis    -42.1     -92.6      9.95
## 
## Orientation = inv, Congruency = con:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis    -63.3    -118.4     -4.84
## 
## Orientation = upr, Congruency = inc:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis    175.1     120.7    229.22
## 
## Orientation = inv, Congruency = inc:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis     46.0     -12.0    100.76
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
# Extract the draws
draws_E12_fib <- gather_emmeans_draws(emm_E12_fib) %>% 
  mutate(Congruency = fct_recode(Congruency, fac="con", int="inc")) %>% 
  pivot_wider(names_from = c(Orientation, Congruency),
              values_from = .value) %>%
  select(-c(.chain, .iteration)) %>%
  mutate(fac_diff = upr_fac - inv_fac,
         int_diff = upr_int - inv_int) 
  
head(draws_E12_fib)

Facilitation:

bf_E12_fac_upr <- bayesfactor_pointnull(draws_E12_fib$upr_fac,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_fac_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 0.491
## 
## * Evidence Against The Null: 0
bf_E12_fac_inv <- bayesfactor_pointnull(draws_E12_fib$inv_fac,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_fac_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF  
## ----
## 1.64
## 
## * Evidence Against The Null: 0
bf_E12_fac_diff <- bayesfactor_pointnull(draws_E12_fib$fac_diff,  
                                         prior = distribution_normal(1000, 0, 200),
                                         null = 0)
bf_E12_fac_diff
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 0.218
## 
## * Evidence Against The Null: 0

Interference:

bf_E12_int_upr <- bayesfactor_pointnull(draws_E12_fib$upr_int,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_int_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.27e+05
## 
## * Evidence Against The Null: 0
bf_E12_int_inv <- bayesfactor_pointnull(draws_E12_fib$inv_int,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E12_int_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 0.514
## 
## * Evidence Against The Null: 0
bf_E12_int_diff <- bayesfactor_pointnull(draws_E12_fib$int_diff,  
                                         prior = distribution_normal(1000, 0, 200),
                                         null = 0)
bf_E12_int_diff
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 70.98
## 
## * Evidence Against The Null: 0

8.1.5 Plot

plot_E12_cf_ie_ <- plot_E12_cf_ie +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E12_ie <- ggarrange(plot_E12_cf_ie_, plot_E12_cffi_ie, 
                         labels = c("A", "B"),
                         font.label = (list(size = 18)),
                         widths = c(1.5, 1),
                         nrow = 1)

plot_E12_ie

8.2 Experiment 3

RM-ANOVA is used to analyze the inverse efficiency.

8.2.1 Calculate inverse efficiency

df_E3_acc <- df_E3_lmm %>% 
  group_by(SubjCode, Orientation, Congruency, Alignment) %>%
  summarise(acc = mean(isCorrect),
            .groups = "drop")

df_E3_rt <- df_E3_lmm %>% 
  filter(isCorrect==1) %>% 
  group_by(SubjCode, Orientation, Congruency, Alignment) %>%
  summarise(rt = mean(RT),
            .groups = "drop") 

df_E3_ie <- left_join(df_E3_acc, df_E3_rt, 
                      by = c("SubjCode", "Orientation", "Congruency", "Alignment")) %>% 
  mutate(IE = rt/acc) %>% 
  select(SubjCode, Orientation, Congruency, Alignment, IE) 

df_E3_ie 
df_E3_ie <- df_E3_ie %>% 
  psychr::set_contr(c(Orientation, Congruency, Alignment)) %>% 
  psychr::add_lmmcols(IE ~ Orientation * Congruency * Alignment) 
##                                              old_name
## Ori_C                                  Orientation2-1
## Con_C                                   Congruency2-1
## Ali_C                                    Alignment2-1
## Ori_Con                  Orientation2-1:Congruency2-1
## Ori_Ali                   Orientation2-1:Alignment2-1
## Con_Ali                    Congruency2-1:Alignment2-1
## Ori_Con_Ali Orientation2-1:Congruency2-1:Alignment2-1
## [1] "Ori_C + Con_C + Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali"

8.2.2 Fitting linear mixed-effects models

8.2.2.1 The zero-correlation-parameter model

file_E3_ie_zcp <- file.path(dir_lmm, "lmm_E3_ie_zcp.rds")

# fit the max model
if (!file.exists(file_E3_ie_zcp)) {
  lmm_E3_ie_zcp <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + Con_Ali +
         Ori_Con_Ali || SubjCode),
    data = df_E3_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_ie_zcp, file = file_E3_ie_zcp)
} else {
  lmm_E3_ie_zcp <- readRDS(file_E3_ie_zcp)
}

print(summary(lmm_E3_ie_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Ori_Ali + Con_Ali + Ori_Con_Ali || SubjCode)
##    Data: df_E3_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 13735.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8412 -0.3705 -0.0477  0.3250  5.0298 
## 
## Random effects:
##  Groups     Name        Variance  Std.Dev.
##  SubjCode   (Intercept) 172436.26 415.254 
##  SubjCode.1 Ori_C       301748.22 549.316 
##  SubjCode.2 Con_C        54382.36 233.200 
##  SubjCode.3 Ali_C         3062.05  55.336 
##  SubjCode.4 Ori_Con      23399.32 152.968 
##  SubjCode.5 Ori_Ali       6967.48  83.471 
##  SubjCode.6 Con_Ali         32.32   5.685 
##  SubjCode.7 Ori_Con_Ali 134338.79 366.523 
##  Residual                33064.10 181.835 
## Number of obs: 960, groups:  SubjCode, 120
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1415.61      38.36  119.00  36.904  < 2e-16 ***
## Orientation2-1                              218.15      51.50  119.00   4.236 4.51e-05 ***
## Congruency2-1                               326.19      24.31  119.01  13.418  < 2e-16 ***
## Alignment2-1                                -24.60      12.78  119.00  -1.925 0.056559 .  
## Orientation2-1:Congruency2-1                -95.10      27.31  119.00  -3.482 0.000698 ***
## Orientation2-1:Alignment2-1                 102.39      24.68  119.02   4.149 6.30e-05 ***
## Congruency2-1:Alignment2-1                 -170.35      23.48  119.02  -7.255 4.45e-11 ***
## Orientation2-1:Congruency2-1:Alignment2-1   150.91      57.65  119.00   2.618 0.010006 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

8.2.2.2 The reduced model

summary(rePCA(lmm_E3_ie_zcp))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]   [,5]    [,6]   [,7]    [,8]
## Standard deviation     3.0210 2.2837 2.0157 1.28248 0.8412 0.45905 0.3043 0.03127
## Proportion of Variance 0.4333 0.2476 0.1929 0.07809 0.0336 0.01001 0.0044 0.00005
## Cumulative Proportion  0.4333 0.6809 0.8739 0.95195 0.9856 0.99556 1.0000 1.00000

Following random effects were removed due to their explained variances being smaller than 0.1%:

  • by-SubjCode: Con_Ali;
file_E3_ie_rdc <- file.path(dir_lmm, "lmm_E3_ie_rdc.rds")

# fit the reduced model
if (!file.exists(file_E3_ie_rdc)) {
  lmm_E3_ie_rdc <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + # Con_Ali +
         Ori_Con_Ali || SubjCode),
    data = df_E3_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_ie_rdc, file = file_E3_ie_rdc)
} else {
  lmm_E3_ie_rdc <- readRDS(file_E3_ie_rdc)
}

print(summary(lmm_E3_ie_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Ori_Ali + Ori_Con_Ali || SubjCode)
##    Data: df_E3_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 13735.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8421 -0.3706 -0.0477  0.3250  5.0310 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  SubjCode   (Intercept) 172434   415.25  
##  SubjCode.1 Ori_C       301746   549.31  
##  SubjCode.2 Con_C        54378   233.19  
##  SubjCode.3 Ali_C         3054    55.27  
##  SubjCode.4 Ori_Con      23366   152.86  
##  SubjCode.5 Ori_Ali       6933    83.27  
##  SubjCode.6 Ori_Con_Ali 134222   366.36  
##  Residual                33080   181.88  
## Number of obs: 960, groups:  SubjCode, 120
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1415.61      38.36  119.00  36.904  < 2e-16 ***
## Orientation2-1                              218.15      51.50  119.00   4.236 4.51e-05 ***
## Congruency2-1                               326.19      24.31  119.00  13.418  < 2e-16 ***
## Alignment2-1                                -24.60      12.78  119.00  -1.925 0.056559 .  
## Orientation2-1:Congruency2-1                -95.10      27.31  119.00  -3.482 0.000698 ***
## Orientation2-1:Alignment2-1                 102.39      24.68  119.00   4.149 6.30e-05 ***
## Congruency2-1:Alignment2-1                 -170.35      23.48  119.00  -7.255 4.45e-11 ***
## Orientation2-1:Congruency2-1:Alignment2-1   150.91      57.65  119.00   2.618 0.010006 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rePCA(lmm_E3_ie_rdc))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]
## Standard deviation     3.0202 2.2831 2.0143 1.28213 0.84045 0.45782 0.30387
## Proportion of Variance 0.4335 0.2477 0.1928 0.07811 0.03357 0.00996 0.00439
## Cumulative Proportion  0.4335 0.6812 0.8740 0.95209 0.98565 0.99561 1.00000

8.2.2.3 The extended model

file_E3_ie_etd <- file.path(dir_lmm, "lmm_E3_ie_etd.rds")

# fit the reduced model
if (!file.exists(file_E3_ie_etd)) {
  lmm_E3_ie_etd <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + Ali_C + 
         Ori_Con + Ori_Ali + # Con_Ali +
         Ori_Con_Ali | SubjCode),
    data = df_E3_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_ie_etd, file = file_E3_ie_etd)
} else {
  lmm_E3_ie_etd <- readRDS(file_E3_ie_etd)
}

print(summary(lmm_E3_ie_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ali_C + Ori_Con + Ori_Ali + Ori_Con_Ali | SubjCode)
##    Data: df_E3_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 13556.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.8108 -0.3692 -0.0456  0.3202  4.0014 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                               
##  SubjCode (Intercept) 173752   416.84                                      
##           Ori_C       307022   554.10    0.16                              
##           Con_C        59688   244.31    0.62  0.06                        
##           Ali_C         9106    95.43    0.39  0.31  0.46                  
##           Ori_Con      44987   212.10    0.00  0.78  0.28  0.30            
##           Ori_Ali      38079   195.14   -0.01 -0.01  0.22  0.35 -0.11      
##           Ori_Con_Ali 246726   496.72   -0.28 -0.10  0.04 -0.14 -0.19  0.86
##  Residual              22547   150.16                                      
## Number of obs: 960, groups:  SubjCode, 120
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1415.61      38.36  119.00  36.904  < 2e-16 ***
## Orientation2-1                              218.15      51.50  119.00   4.236 4.51e-05 ***
## Congruency2-1                               326.19      24.32  119.03  13.414  < 2e-16 ***
## Alignment2-1                                -24.60      13.03  126.15  -1.888 0.061325 .  
## Orientation2-1:Congruency2-1                -95.10      27.40  120.30  -3.471 0.000721 ***
## Orientation2-1:Alignment2-1                 102.39      26.33  136.17   3.889 0.000157 ***
## Congruency2-1:Alignment2-1                 -170.35      19.38  237.98  -8.788 3.09e-16 ***
## Orientation2-1:Congruency2-1:Alignment2-1   150.91      59.66  126.13   2.530 0.012653 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rePCA(lmm_E3_ie_etd))
## $SubjCode
## Importance of components:
##                          [,1]  [,2]   [,3]    [,4]    [,5]    [,6]      [,7]
## Standard deviation     4.0525 3.477 2.8229 1.32993 0.74525 0.44534 6.186e-05
## Proportion of Variance 0.4211 0.310 0.2043 0.04535 0.01424 0.00509 0.000e+00
## Cumulative Proportion  0.4211 0.731 0.9353 0.98067 0.99491 1.00000 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ali_C and Ori_Ali;
file_E3_ie_etd2 <- file.path(dir_lmm, "lmm_E3_ie_etd2.rds")

# fit the reduced model
if (!file.exists(file_E3_ie_etd2)) {
  lmm_E3_ie_etd2 <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + # Ali_C + 
         Ori_Con + # Con_Ali + Ori_Ali + 
         Ori_Con_Ali | SubjCode),
    data = df_E3_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_ie_etd2, file = file_E3_ie_etd2)
} else {
  lmm_E3_ie_etd2 <- readRDS(file_E3_ie_etd2)
}

print(summary(lmm_E3_ie_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ori_Con + Ori_Con_Ali | SubjCode)
##    Data: df_E3_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 13626.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.1391 -0.3798 -0.0546  0.3373  5.0929 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                   
##  SubjCode (Intercept) 172385   415.2                           
##           Ori_C       301784   549.3     0.16                  
##           Con_C        54642   233.8     0.65  0.06            
##           Ori_Con      37650   194.0     0.01  0.85  0.28      
##           Ori_Con_Ali 142006   376.8    -0.38 -0.14  0.05 -0.18
##  Residual              33196   182.2                           
## Number of obs: 960, groups:  SubjCode, 120
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1415.61      38.36  119.04  36.908  < 2e-16 ***
## Orientation2-1                              218.15      51.51  119.00   4.235 4.52e-05 ***
## Congruency2-1                               326.19      24.37  119.36  13.388  < 2e-16 ***
## Alignment2-1                                -24.60      11.76  475.99  -2.092   0.0370 *  
## Orientation2-1:Congruency2-1                -95.10      29.45  160.15  -3.230   0.0015 ** 
## Orientation2-1:Alignment2-1                 102.39      23.52  475.99   4.353 1.64e-05 ***
## Congruency2-1:Alignment2-1                 -170.35      23.52  475.99  -7.242 1.79e-12 ***
## Orientation2-1:Congruency2-1:Alignment2-1   150.91      58.28  125.62   2.589   0.0107 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E3_ie_etd2))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]      [,5]
## Standard deviation     3.2460 2.5247 1.8789 0.94911 4.804e-06
## Proportion of Variance 0.4937 0.2987 0.1654 0.04221 0.000e+00
## Cumulative Proportion  0.4937 0.7924 0.9578 1.00000 1.000e+00

Following random effects were removed due to their explained variances being smaller than 1%:

  • by-SubjCode: Ori_Con;
file_E3_ie_etd3 <- file.path(dir_lmm, "lmm_E3_ie_etd3.rds")

# fit the reduced model
if (!file.exists(file_E3_ie_etd3)) {
  lmm_E3_ie_etd3 <- lmer(
    IE ~ Orientation * Congruency * Alignment + 
      (Ori_C + Con_C + # Ali_C + 
         # Con_Ali + Ori_Ali + Ori_Con + 
         Ori_Con_Ali | SubjCode),
    data = df_E3_ie,
    control = lmerControl(optCtrl = list(maxfun = 1e7))
  )
  
  saveRDS(lmm_E3_ie_etd3, file = file_E3_ie_etd3)
} else {
  lmm_E3_ie_etd3 <- readRDS(file_E3_ie_etd3)
}

print(summary(lmm_E3_ie_etd3), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ori_Con_Ali | SubjCode)
##    Data: df_E3_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 13679.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.1812 -0.4171 -0.0406  0.3727  5.3668 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr             
##  SubjCode (Intercept) 171769   414.4                     
##           Ori_C       299098   546.9     0.17            
##           Con_C        51719   227.4     0.67  0.06      
##           Ori_Con_Ali  91712   302.8    -0.47 -0.17  0.09
##  Residual              38394   195.9                     
## Number of obs: 960, groups:  SubjCode, 120
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1415.61      38.36  119.00  36.904  < 2e-16 ***
## Orientation2-1                              218.15      51.50  119.00   4.236 4.51e-05 ***
## Congruency2-1                               326.19      24.31  119.00  13.418  < 2e-16 ***
## Alignment2-1                                -24.60      12.65  476.00  -1.945 0.052331 .  
## Orientation2-1:Congruency2-1                -95.10      25.30  476.00  -3.759 0.000192 ***
## Orientation2-1:Alignment2-1                 102.39      25.30  476.00   4.048 6.03e-05 ***
## Congruency2-1:Alignment2-1                 -170.35      25.30  476.00  -6.734 4.76e-11 ***
## Orientation2-1:Congruency2-1:Alignment2-1   150.91      57.65  119.00   2.618 0.010007 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(rePCA(lmm_E3_ie_etd3))
## $SubjCode
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]
## Standard deviation     2.8895 2.2796 1.4632 0.55928
## Proportion of Variance 0.5218 0.3248 0.1338 0.01955
## Cumulative Proportion  0.5218 0.8466 0.9805 1.00000

8.2.2.4 The optimal model

anova(lmm_E3_ie_rdc, lmm_E3_ie_etd3, refit=FALSE)

According to BIC, the extended model is used as the optimal model.

lmm_E3_ie_opt <- lmm_E3_ie_etd3

print(summary(lmm_E3_ie_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: IE ~ Orientation * Congruency * Alignment + (Ori_C + Con_C +      Ori_Con_Ali | SubjCode)
##    Data: df_E3_ie
## Control: lmerControl(optCtrl = list(maxfun = 1e+07))
## 
## REML criterion at convergence: 13679.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.1812 -0.4171 -0.0406  0.3727  5.3668 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr             
##  SubjCode (Intercept) 171769   414.4                     
##           Ori_C       299098   546.9     0.17            
##           Con_C        51719   227.4     0.67  0.06      
##           Ori_Con_Ali  91712   302.8    -0.47 -0.17  0.09
##  Residual              38394   195.9                     
## Number of obs: 960, groups:  SubjCode, 120
## 
## Fixed effects:
##                                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                                1415.61      38.36  119.00  36.904  < 2e-16 ***
## Orientation2-1                              218.15      51.50  119.00   4.236 4.51e-05 ***
## Congruency2-1                               326.19      24.31  119.00  13.418  < 2e-16 ***
## Alignment2-1                                -24.60      12.65  476.00  -1.945 0.052331 .  
## Orientation2-1:Congruency2-1                -95.10      25.30  476.00  -3.759 0.000192 ***
## Orientation2-1:Alignment2-1                 102.39      25.30  476.00   4.048 6.03e-05 ***
## Congruency2-1:Alignment2-1                 -170.35      25.30  476.00  -6.734 4.76e-11 ***
## Orientation2-1:Congruency2-1:Alignment2-1   150.91      57.65  119.00   2.618 0.010007 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

8.2.3 Estimated marginal means

# hit and false alarm
emm_E3_ie <- emmeans(lmm_E3_ie_opt, 
                     ~ Orientation + Congruency + Alignment)
emm_E3_ie
##  Orientation Congruency Alignment emmean   SE  df lower.CL upper.CL
##  upr         con        ali         1096 42.3 143     1012     1180
##  inv         con        ali         1348 45.7 139     1258     1439
##  upr         inc        ali         1593 50.8 135     1492     1693
##  inv         inc        ali         1674 59.2 131     1557     1792
##  upr         con        mis         1143 39.9 147     1064     1222
##  inv         con        mis         1422 49.1 136     1325     1519
##  upr         inc        mis         1394 52.5 134     1290     1498
##  inv         inc        mis         1654 56.7 132     1541     1766
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.2.3.1 Composite effect

Composite effect of d’:

emm_E3_cf_ie <- contrast(emm_E3_ie, 
                         interaction = "pairwise", 
                         simple = c("Congruency", "Alignment"),
                         infer = TRUE)

summary(emm_E3_cf_ie[1:2], side="<")
##  Congruency_pairwise Alignment_pairwise Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           ali - mis          upr           -245.8 38.4 325     -Inf   -182.5  -6.409  <.0001
##  con - inc           ali - mis          inv            -94.9 38.4 325     -Inf    -31.6  -2.474  0.0069
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are left-tailed

Congruency effect of d’ in aligned condition:

emm_E3_con_ie <- contrast(emm_E3_ie, 
                          interaction = "pairwise", 
                          simple = "Congruency",
                          infer = TRUE)

summary(emm_E3_con_ie[1:2], side="<")
##  Congruency_pairwise Orientation Alignment estimate   SE  df lower.CL upper.CL t.ratio p.value
##  con - inc           upr         ali           -497 33.8 221     -Inf     -441 -14.680  <.0001
##  con - inc           inv         ali           -326 33.1 228     -Inf     -271  -9.865  <.0001
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are left-tailed
plot_E3_cf_ie <- emm_E3_ie %>%
  summary(infer=TRUE) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Alignment = fct_recode(Alignment, aligned="ali", misaligned="mis"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv")) %>%
  ggplot(aes(Alignment, emmean, color=Congruency, group=Congruency)) +
  geom_point(size = 2) + # position = position_dodge(width = 0.1),
  geom_line(aes(linetype = Congruency), linewidth = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed")) +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Orientation, switch = "both") +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6, # position = position_dodge(width = 0.1),
                show.legend = F) + 
  coord_cartesian(ylim = c(800, 1800)) +  # set the limit for y axis c(0, 1100)
  labs(y = "Inverse efficiency (RT/Accuracy)", fill = "Congruency",
       x = NULL) +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "**", "", "", "", ""),
            color = "red",
            size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  theme(axis.title.x = element_text(margin = margin(t = 0))) +
  NULL
# ggsave(filename = "ccf_ie.pdf", plot_ccf_ie, width = 8, height = 6)
plot_E3_cf_ie

8.2.3.2 Compare composite effects between upright and inverted faces

contrast(emm_E3_cf_ie, 
         interaction="pairwise", 
         simple = c("Orientation", "Congruency", "Alignment"),
         infer = TRUE)
## Congruency_pairwise = con - inc, Alignment_pairwise = ali - mis:
##  Orientation_pairwise estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv                -151 57.7 119     -265    -36.7  -2.618  0.0100
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.2.3.3 Facilitation and interference

# facilitation and interference
emm_E3_ie_fi <- contrast(emm_E3_ie, 
                         interaction = "pairwise", 
                         simple = "Alignment", 
                         infer = TRUE, 
                         adjust = "none")

# emmip(emm_E3_ie_fi[1:4], ~ Orientation | Congruency, CIs = TRUE, adjust = "sidak") 
emm_E3_ie_fi[1:4]
##  Alignment_pairwise Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis          upr         con           -47.1 26.2 559    -98.6     4.41  -1.796  0.0730
##  ali - mis          inv         con           -74.0 26.2 559   -125.5   -22.53  -2.823  0.0049
##  ali - mis          upr         inc           198.7 26.2 559    147.2   250.21   7.577  <.0001
##  ali - mis          inv         inc            20.9 26.2 559    -30.7    72.36   0.795  0.4268
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95
summary(emm_E3_ie_fi[1:2], side="<")
##  Alignment_pairwise Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis          upr         con           -47.1 26.2 559     -Inf     -3.9  -1.796  0.0365
##  ali - mis          inv         con           -74.0 26.2 559     -Inf    -30.8  -2.823  0.0025
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are left-tailed
summary(emm_E3_ie_fi[3:4], side=">")
##  Alignment_pairwise Orientation Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  ali - mis          upr         inc           198.7 26.2 559    155.5      Inf   7.577  <.0001
##  ali - mis          inv         inc            20.9 26.2 559    -22.4      Inf   0.795  0.2134
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95 
## P values are right-tailed
plot_E3_cffi_ie <- summary(emm_E3_ie_fi[1:4], level=.95) %>% 
  as_tibble() %>% 
  mutate(Congruency = fct_recode(Congruency, congruent="con", incongruent="inc"),
         Orientation = fct_recode(Orientation, upright="upr", inverted="inv"),
         Label = ifelse(Orientation=="upright", 
                        ifelse(Congruency=="congruent", "facilitation",
                               "interference"), "")) %>%
  ggplot(aes(y = estimate, x = Orientation, color = Congruency)) +
  geom_point(size = 2) +
  geom_text(aes(label = Label), y=300, x=1.5, fontface="bold", size=5) +
  geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL), linewidth=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  scale_color_manual(values=two_colors) +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_ie) +  
  labs(x = NULL, 
       y = "Inverse efficiency (aligned-misaligned)") +  # set the names for main, x and y axis
  theme(legend.position = "none",
        axis.title.x = element_text(margin = margin(t = 0))) +
  NULL

# ggsave(filename = "E3_fi_ie.pdf", plot_E3_cffi_ie, width = 7, height = 4.55)
plot_E3_cffi_ie

Comparing facilitation/interference between upright and inverted faces:

# facilitation and interference of
emm_E3_ie_fi_ui <- contrast(emm_E3_ie, 
                            interaction = "pairwise", 
                            by = "Congruency", 
                            infer = TRUE, 
                            adjust = "none")

emm_E3_ie_fi_ui[1:2]
##  Orientation_pairwise Alignment_pairwise Congruency estimate   SE  df lower.CL upper.CL t.ratio p.value
##  upr - inv            ali - mis          con            26.9 38.4 325    -48.5      102   0.702  0.4829
##  upr - inv            ali - mis          inc           177.8 38.4 325    102.4      253   4.637  <.0001
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.2.3.4 Comparisons between facilitation and interference

contrast(emm_E3_ie_fi, 
         method = list("faci-inte"=c(1, 1)), 
         by = "Orientation",
         infer = TRUE)[1:2] 
##  contrast  Orientation estimate   SE  df lower.CL upper.CL t.ratio p.value
##  faci-inte upr            151.6 35.8 476     81.3    221.9   4.238  <.0001
##  faci-inte inv            -53.2 35.8 476   -123.5     17.1  -1.487  0.1378
## 
## Degrees-of-freedom method: satterthwaite 
## Confidence level used: 0.95

8.2.4 Bayesian hierarchical model

8.2.4.1 Model fitting

brm_E3_ie <- brm(IE ~ Orientation * Congruency * Alignment +
                   (Orientation * Congruency * Alignment | SubjCode),
                 data = df_E3_ie,
                 prior = c(prior(normal(1000, 300), class = Intercept),
                           prior(normal(0, 200), class = b),
                           prior(normal(0, 50), class = sigma),
                           prior(normal(0, 50), class = sd),
                           prior(lkj(2), class = cor)),
                 save_pars = save_pars(all = TRUE),
                 chains = 10, 
                 iter = 8000,
                 warmup = 2000,
                 control = list(adapt_delta = .999, 
                                max_treedepth = 15),  
                 file = file.path("brms", "brmsfit_E3_ie.rds"))

summary(brm_E3_ie)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: IE ~ Orientation * Congruency * Alignment + (Orientation * Congruency * Alignment | SubjCode) 
##    Data: df_E3_ie (Number of observations: 960) 
##   Draws: 10 chains, each with iter = 8000; warmup = 2000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~SubjCode (Number of levels: 120) 
##                                                                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                                                                 341.91     16.47   311.11   375.71 1.00     9562    18892
## sd(Orientation2M1)                                                            416.02     19.46   379.05   455.66 1.00    18569    31351
## sd(Congruency2M1)                                                             196.03     15.28   167.06   227.14 1.00    25709    38256
## sd(Alignment2M1)                                                               52.91     16.52    19.73    85.31 1.00    17671    17603
## sd(Orientation2M1:Congruency2M1)                                              131.90     22.66    87.71   176.62 1.00    45538    40369
## sd(Orientation2M1:Alignment2M1)                                                44.80     32.47     1.83   119.74 1.00    11106    17569
## sd(Congruency2M1:Alignment2M1)                                                 39.14     27.41     1.67   101.39 1.00    18930    24795
## sd(Orientation2M1:Congruency2M1:Alignment2M1)                                  83.13     51.49     4.36   193.79 1.00    12863    18823
## cor(Intercept,Orientation2M1)                                                   0.12      0.07    -0.01     0.25 1.00    12460    23971
## cor(Intercept,Congruency2M1)                                                    0.55      0.07     0.41     0.68 1.00    29146    40221
## cor(Orientation2M1,Congruency2M1)                                               0.02      0.08    -0.14     0.18 1.00    27558    39694
## cor(Intercept,Alignment2M1)                                                     0.37      0.17     0.02     0.68 1.00    56332    37890
## cor(Orientation2M1,Alignment2M1)                                                0.29      0.17    -0.05     0.62 1.00    60815    38070
## cor(Congruency2M1,Alignment2M1)                                                 0.44      0.18     0.04     0.76 1.00    52597    35067
## cor(Intercept,Orientation2M1:Congruency2M1)                                    -0.03      0.14    -0.31     0.25 1.00    63032    44407
## cor(Orientation2M1,Orientation2M1:Congruency2M1)                                0.69      0.10     0.47     0.87 1.00    59475    42743
## cor(Congruency2M1,Orientation2M1:Congruency2M1)                                 0.21      0.15    -0.10     0.51 1.00    65339    47960
## cor(Alignment2M1,Orientation2M1:Congruency2M1)                                  0.26      0.21    -0.18     0.66 1.00    50249    46307
## cor(Intercept,Orientation2M1:Alignment2M1)                                     -0.01      0.26    -0.52     0.51 1.00    84581    38162
## cor(Orientation2M1,Orientation2M1:Alignment2M1)                                -0.01      0.25    -0.51     0.50 1.00    87792    42799
## cor(Congruency2M1,Orientation2M1:Alignment2M1)                                  0.15      0.28    -0.44     0.64 1.00    60015    41341
## cor(Alignment2M1,Orientation2M1:Alignment2M1)                                   0.13      0.29    -0.47     0.65 1.00    42692    44698
## cor(Orientation2M1:Congruency2M1,Orientation2M1:Alignment2M1)                   0.03      0.27    -0.51     0.55 1.00    64987    47462
## cor(Intercept,Congruency2M1:Alignment2M1)                                      -0.16      0.27    -0.64     0.42 1.00    70608    40048
## cor(Orientation2M1,Congruency2M1:Alignment2M1)                                 -0.03      0.26    -0.53     0.49 1.00    80416    41253
## cor(Congruency2M1,Congruency2M1:Alignment2M1)                                   0.02      0.28    -0.52     0.54 1.00    86848    42652
## cor(Alignment2M1,Congruency2M1:Alignment2M1)                                    0.10      0.30    -0.50     0.63 1.00    46589    46340
## cor(Orientation2M1:Congruency2M1,Congruency2M1:Alignment2M1)                    0.05      0.28    -0.51     0.58 1.00    69579    46805
## cor(Orientation2M1:Alignment2M1,Congruency2M1:Alignment2M1)                     0.03      0.30    -0.56     0.59 1.00    52690    50417
## cor(Intercept,Orientation2M1:Congruency2M1:Alignment2M1)                       -0.28      0.26    -0.71     0.31 1.00    55835    35685
## cor(Orientation2M1,Orientation2M1:Congruency2M1:Alignment2M1)                  -0.10      0.25    -0.57     0.42 1.00    79343    40003
## cor(Congruency2M1,Orientation2M1:Congruency2M1:Alignment2M1)                   -0.00      0.26    -0.51     0.50 1.00    81695    41346
## cor(Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)                    -0.09      0.28    -0.61     0.47 1.00    61479    47759
## cor(Orientation2M1:Congruency2M1,Orientation2M1:Congruency2M1:Alignment2M1)    -0.03      0.27    -0.54     0.50 1.00    65121    45357
## cor(Orientation2M1:Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)      0.16      0.32    -0.48     0.72 1.00    18949    27435
## cor(Congruency2M1:Alignment2M1,Orientation2M1:Congruency2M1:Alignment2M1)       0.07      0.30    -0.52     0.62 1.00    46922    51338
## 
## Regression Coefficients:
##                                           Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                  1408.86     31.11  1348.00  1469.41 1.00     3782     7441
## Orientation2M1                              209.65     38.78   133.85   285.25 1.00     8859    18293
## Congruency2M1                               321.17     21.46   278.93   363.08 1.00    12119    28447
## Alignment2M1                                -25.22     13.09   -51.03     0.12 1.00    65638    44453
## Orientation2M1:Congruency2M1                -95.22     26.82  -147.74   -42.33 1.00    42334    41812
## Orientation2M1:Alignment2M1                 100.78     24.49    52.76   148.80 1.00    98016    43943
## Congruency2M1:Alignment2M1                 -167.86     24.39  -215.89  -119.96 1.00    98369    42919
## Orientation2M1:Congruency2M1:Alignment2M1   142.79     47.60    48.67   235.75 1.00    93718    42405
## 
## Further Distributional Parameters:
##       Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma   186.86      6.87   172.87   200.05 1.00    12952    13889
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

8.2.4.2 Bayes factor

emmb_E3_ie <- emmeans(brm_E3_ie, ~ Orientation + Congruency + Alignment)

emmip(brm_E3_ie, 
      Congruency ~ Alignment | Orientation, 
      CIs = TRUE, 
      adjust = "sidak")

8.2.4.2.1 Composite effect
emm_E3_cfb <- contrast(emmb_E3_ie, 
                       interaction = "pairwise", 
                       simple = c("Congruency", "Alignment")) 
emm_E3_cfb
## Orientation = upr:
##  Congruency_pairwise Alignment_pairwise estimate lower.HPD upper.HPD
##  con - inc           ali - mis            -239.3      -306    -173.0
## 
## Orientation = inv:
##  Congruency_pairwise Alignment_pairwise estimate lower.HPD upper.HPD
##  con - inc           ali - mis             -96.5      -163     -29.3
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
# Extract the draws
draws_E3_cfb <- gather_emmeans_draws(emm_E3_cfb) %>% 
  pivot_wider(names_from = Orientation,
              values_from = .value) %>%
  mutate(cf_diff = upr - inv) %>% 
  select(-c(.chain, .iteration))

head(draws_E3_cfb)
emm_E3_conb <- contrast(emmb_E3_ie, 
                        "pairwise", 
                        simple = "Congruency") 
emm_E3_conb
## Orientation = upr, Alignment = ali:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -489      -546      -430
## 
## Orientation = inv, Alignment = ali:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -322      -383      -261
## 
## Orientation = upr, Alignment = mis:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -249      -307      -191
## 
## Orientation = inv, Alignment = mis:
##  contrast  estimate lower.HPD upper.HPD
##  con - inc     -225      -286      -163
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
# Extract the draws
draws_E3_conb <- gather_emmeans_draws(emm_E3_conb) %>% 
  filter(Alignment == "ali") %>% 
  pivot_wider(names_from = Orientation,
              values_from = .value) %>%
  mutate(con_diff = upr - inv) %>% 
  select(-c(.chain, .iteration))

head(draws_E3_conb)
bf_E3_cf_upr <- bayesfactor_pointnull(draws_E3_cfb$upr,  
                                      prior = distribution_normal(1000, 0, 200),
                                      null = 0)
bf_E3_cf_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 2.95e+07
## 
## * Evidence Against The Null: 0
bf_E3_con_upr <- bayesfactor_pointnull(draws_E3_conb$upr,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_con_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.54e+21
## 
## * Evidence Against The Null: 0
as.numeric(bf_E3_con_upr)
## [1] 1.537454e+21
bf_E3_cf_inv <- bayesfactor_pointnull(draws_E3_cfb$inv,  
                                      prior = distribution_normal(1000, 0, 200),
                                      null = 0)
bf_E3_cf_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF  
## ----
## 9.29
## 
## * Evidence Against The Null: 0
bf_E3_con_inv <- bayesfactor_pointnull(draws_E3_conb$inv,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_con_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.35e+11
## 
## * Evidence Against The Null: 0
as.numeric(bf_E3_con_inv)
## [1] 135069338637
bf_E3_cf_diff <- bayesfactor_pointnull(draws_E3_cfb$cf_diff,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_cf_diff
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 24.56
## 
## * Evidence Against The Null: 0
8.2.4.2.2 Facilitation and interference
emm_E3_fib <- contrast(emmb_E3_ie, 
                       "pairwise", 
                       simple = "Alignment") 
emm_E3_fib
## Orientation = upr, Congruency = con:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis    -44.1     -92.4      4.16
## 
## Orientation = inv, Congruency = con:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis    -73.4    -121.4    -24.97
## 
## Orientation = upr, Congruency = inc:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis    195.4     146.1    242.72
## 
## Orientation = inv, Congruency = inc:
##  contrast  estimate lower.HPD upper.HPD
##  ali - mis     23.0     -26.8     70.72
## 
## Point estimate displayed: median 
## HPD interval probability: 0.95
# Extract the draws
draws_E3_fib <- gather_emmeans_draws(emm_E3_fib) %>% 
  mutate(Congruency = fct_recode(Congruency, fac="con", int="inc")) %>% 
  pivot_wider(names_from = c(Orientation, Congruency),
              values_from = .value) %>%
  select(-c(.chain, .iteration)) %>%
  mutate(fac_diff = upr_fac - inv_fac,
         int_diff = upr_int - inv_int) 

head(draws_E3_fib)

Facilitation:

bf_E3_fac_upr <- bayesfactor_pointnull(draws_E3_fib$upr_fac,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_fac_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 0.612
## 
## * Evidence Against The Null: 0
bf_E3_fac_inv <- bayesfactor_pointnull(draws_E3_fib$inv_fac,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_fac_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 10.58
## 
## * Evidence Against The Null: 0
bf_E3_fac_diff <- bayesfactor_pointnull(draws_E3_fib$fac_diff,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E3_fac_diff
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 0.247
## 
## * Evidence Against The Null: 0

Interference:

bf_E3_int_upr <- bayesfactor_pointnull(draws_E3_fib$upr_int,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_int_upr
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 3.24e+07
## 
## * Evidence Against The Null: 0
bf_E3_int_inv <- bayesfactor_pointnull(draws_E3_fib$inv_int,  
                                       prior = distribution_normal(1000, 0, 200),
                                       null = 0)
bf_E3_int_inv
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF   
## -----
## 0.192
## 
## * Evidence Against The Null: 0
bf_E3_int_diff <- bayesfactor_pointnull(draws_E3_fib$int_diff,  
                                        prior = distribution_normal(1000, 0, 200),
                                        null = 0)
bf_E3_int_diff
## Bayes Factor (Savage-Dickey density ratio)
## 
## BF      
## --------
## 1.14e+04
## 
## * Evidence Against The Null: 0

8.2.5 Plot

plot_E3_cf_ie_ <- plot_E3_cf_ie +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = "inside",
        legend.position.inside = c(0.5, 0.1),
        legend.box = "horizontal",
        legend.key.height = unit(0.01, "cm")) 

plot_E3_ie <- ggarrange(plot_E3_cf_ie_, plot_E3_cffi_ie, 
                        labels = c("A", "B"),
                        font.label = (list(size = 18)),
                        widths = c(1.5, 1),
                        nrow = 1)

plot_E3_ie

8.3 Plot (Experiment 1&2 and Experiment 3)

plot_ie <- ggarrange(plot_E3_cf_ie_, plot_E3_cffi_ie, 
                     plot_E3_cf_ie_, plot_E3_cffi_ie, 
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 18)),
                     widths = c(1.5, 1),
                     nrow = 2,
                     ncol = 2)
plot_ie

Session information

sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: aarch64-apple-darwin20
## Running under: macOS 15.5
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
## LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## time zone: Asia/Shanghai
## tzcode source: internal
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] tidybayes_3.0.7   bayestestR_0.14.0 brms_2.22.0       Rcpp_1.0.13       afex_1.4-1        psychr_0.0.1      here_1.0.1        ggpubr_0.6.0      emmeans_1.10.4    optimx_2023-10.21 lmerTest_3.1-3    lme4_1.1-35.5     Matrix_1.7-0      lubridate_1.9.3   forcats_1.0.0     stringr_1.5.1     dplyr_1.1.4       purrr_1.0.2       readr_2.1.5       tidyr_1.3.1       tibble_3.2.1      ggplot2_3.5.1     tidyverse_2.0.0  
## 
## loaded via a namespace (and not attached):
##   [1] mnormt_2.1.1         gridExtra_2.3        inline_0.3.19        rlang_1.1.4          magrittr_2.0.3       matrixStats_1.4.1    compiler_4.4.1       loo_2.8.0            vctrs_0.6.5          reshape2_1.4.4       pkgconfig_2.0.3      arrayhelpers_1.1-0   fastmap_1.2.0        backports_1.5.0      labeling_0.4.3       logspline_2.1.22     effectsize_0.8.9     utf8_1.2.4           rmarkdown_2.28       tzdb_0.4.0           pracma_2.4.4         nloptr_2.1.1         xfun_0.48            cachem_1.1.0         jsonlite_1.8.9       highr_0.11           uuid_1.2-1           psych_2.4.6.26       broom_1.0.7          parallel_4.4.1       R6_2.5.1             StanHeaders_2.32.10  bslib_0.8.0          stringi_1.8.4        car_3.1-3            boot_1.3-30          jquerylib_0.1.4      numDeriv_2016.8-1.1  estimability_1.5.1   rstan_2.32.6         knitr_1.48           parameters_0.22.2    tinylabels_0.2.4     bayesplot_1.11.1     splines_4.4.1        timechange_0.3.0     tidyselect_1.2.1     rstudioapi_0.16.0    abind_1.4-8          yaml_2.3.10          codetools_0.2-20     pkgbuild_1.4.4       lattice_0.22-6       plyr_1.8.9           withr_3.0.1          bridgesampling_1.1-2 posterior_1.6.0      coda_0.19-4.1        evaluate_1.0.0       RcppParallel_5.1.9   ggdist_3.3.2         pillar_1.9.0         carData_3.0-5        tensorA_0.36.2.1     stats4_4.4.1         checkmate_2.3.2      insight_0.20.5       distributional_0.5.0 generics_0.1.3       rprojroot_2.0.4      papaja_0.1.2        
##  [72] hms_1.1.3            rstantools_2.4.0     munsell_0.5.1        scales_1.3.0         minqa_1.2.8          xtable_1.8-4         glue_1.8.0           tools_4.4.1          xaringanExtra_0.8.0  ggsignif_0.6.4       mvtnorm_1.3-1        cowplot_1.1.3        grid_4.4.1           QuickJSR_1.4.0       datawizard_0.12.3    colorspace_2.1-1     nlme_3.1-164         Formula_1.2-5        cli_3.6.3            fansi_1.0.6          svUnit_1.0.6         Brobdingnag_1.2-9    gtable_0.3.5         rstatix_0.7.2        sass_0.4.9           digest_0.6.37        farver_2.1.2         htmltools_0.5.8.1    lifecycle_1.0.4      MASS_7.3-60.2