## load libraries
library(tidyverse)
library(readxl)
library(lme4)
library(lmerTest)
library(optimx)
library(emmeans)
library(ggpubr)
folder_lmm <- "lmm_output"
ylimit_cf_d <- c(-.5, 3.2)
ylimit_cf_fi_d <- c(-1.1, 1.1)
ylimit_cf_rt <- c(650, 1150)
ylimit_cf_fi_rt <- c(-100, 100)
# colors
con_color <- c("#e28743", "#0000ff") #ffb14e #e3b342
sig_color <- "red"
# APA theme for figures
theme_set(papaja::theme_apa(base_size = 12, base_family = "Helvetica", box = FALSE))
theme_update(strip.placement = "outside")
# list filenames
file1_list <- list.files(file.path("data", "1"), pattern = "*.xlsx", full.names = TRUE)
file2_list <- list.files(file.path("data", "2"), pattern = "*.xlsx", full.names = TRUE)
# load data
df_raw_E1 <- sapply(file1_list, read_excel, na = "NA", simplify = FALSE) %>% bind_rows(.id = "id")
df_raw_E2 <- sapply(file2_list, read_excel, na = "NA", simplify = FALSE) %>% bind_rows(.id = "id")
# combine data from the two experiments
df_raw_E1_temp <- df_raw_E1 %>%
select(-c(SubTrial)) %>%
mutate(Probability = 0.5,
targetDuration = 200, # fix a bug in exp
Participant = Participant + 100)
df_raw_E2_temp <- df_raw_E2 %>%
select(-c(Age, Gender, Ethnicity, Block, FaceIndex)) %>%
mutate(Participant = Participant + 200,
Probability = if_else(grepl("75TopCue", Experiment), 0.75, 0.25))
df_raw <- bind_rows(df_raw_E1_temp, df_raw_E2_temp)
str(df_raw)
## tibble [61,440 × 22] (S3: tbl_df/tbl/data.frame)
## $ id : chr [1:61440] "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" ...
## $ Experiment : chr [1:61440] "109_cue" "109_cue" "109_cue" "109_cue" ...
## $ Participant : num [1:61440] 101 101 101 101 101 101 101 101 101 101 ...
## $ Trial : num [1:61440] 1 2 3 4 5 6 7 8 9 10 ...
## $ Condition : chr [1:61440] "Complete_cue" "Complete_cue" "Complete_cue" "Complete_cue" ...
## $ CuedHalf : chr [1:61440] "T" "T" "B" "B" ...
## $ Congruency : chr [1:61440] "I" "C" "I" "C" ...
## $ Alignment : chr [1:61440] "A" "M" "M" "M" ...
## $ SameDifferent : chr [1:61440] "S" "D" "D" "S" ...
## $ FaceGroup : chr [1:61440] "M5" "M1" "M3" "M1" ...
## $ StudyUpper : chr [1:61440] "M5116.png" "M1110.png" "M3174.png" "M1119.png" ...
## $ StudyLower : chr [1:61440] "M5185.png" "M1119.png" "M3138.png" "M1190.png" ...
## $ TargetUpper : chr [1:61440] "M5116.png" "M1190.png" "M3174.png" "M1119.png" ...
## $ TargetLower : chr [1:61440] "M5126.png" "M1173.png" "M3124.png" "M1190.png" ...
## $ thisResponse : chr [1:61440] "D" "D" "D" "D" ...
## $ isCorrect : num [1:61440] 0 1 1 0 1 1 1 1 1 1 ...
## $ reactionTime : num [1:61440] 0.755 0.634 1.311 0.999 1.376 ...
## $ studyDuration : num [1:61440] 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 ...
## $ targetDuration: num [1:61440] 200 200 200 200 200 200 200 200 200 200 ...
## $ maskDuration : num [1:61440] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
## $ trialEndTime : chr [1:61440] "2019-06-24-15:20:04" "2019-06-24-15:20:07" "2019-06-24-15:20:11" "2019-06-24-15:20:15" ...
## $ Probability : num [1:61440] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
df_tidy <- df_raw %>%
filter(!is.na(thisResponse)) %>% # remove NA trials based on responses
mutate(Cue = if_else(CuedHalf == "T", "top", "bottom"),
Congruency = if_else(Congruency == "C", "congruent", "incongruent"),
Alignment = if_else(Alignment == "A", "aligned", "misaligned"),
SameDifferent = if_else(SameDifferent == "S", "same", "different"),
Participant = as_factor(Participant),
Cue = factor(Cue, levels = c("top", "bottom")),
Congruency = factor(Congruency, levels = c("congruent", "incongruent")),
Alignment = as_factor(Alignment),
SameDifferent = factor(SameDifferent, levels = c("same", "different")),
Probability = as_factor(Probability),
Resp = if_else(thisResponse == "S", 1, 0), # if this response is "same"
RT = round(reactionTime * 1000+200)) # plus the duration of target faces
Number of trials for each participant:
# Trial numbers in each condition
df_tidy %>%
group_by(Participant) %>%
summarize(nTotal = n())
## # A tibble: 64 × 2
## Participant nTotal
## <fct> <int>
## 1 101 640
## 2 102 640
## 3 103 640
## 4 104 640
## 5 105 640
## 6 106 640
## 7 107 640
## 8 108 640
## 9 109 639
## 10 110 640
## # … with 54 more rows
# For 3 participants in E1, one trail was removed due to no response recorded.
# set successive difference coding for fixed effects
contrasts(df_tidy$Cue) <- MASS::contr.sdif(nlevels(df_tidy$Cue))
contrasts(df_tidy$Congruency) <- MASS::contr.sdif(nlevels(df_tidy$Congruency))
contrasts(df_tidy$Alignment) <- MASS::contr.sdif(nlevels(df_tidy$Alignment))
contrasts(df_tidy$SameDifferent) <- MASS::contr.sdif(nlevels(df_tidy$SameDifferent))
# set successive difference coding for random effects
df_lmm <- df_tidy %>%
mutate(
Cue_C = if_else(Cue == "top", -.5, .5),
Con_C = if_else(Congruency == "congruent", -.5, .5),
Ali_C = if_else(Alignment == "aligned", -.5, .5),
Sam_C = if_else(SameDifferent == "same", -.5, .5),
Cue_Con = Cue_C * Con_C,
Cue_Ali = Cue_C * Ali_C,
Cue_Sam = Cue_C * Sam_C,
Con_Ali = Con_C * Ali_C,
Con_Sam = Con_C * Sam_C,
Ali_Sam = Ali_C * Sam_C,
Cue_Con_Ali = Cue_Con * Ali_C,
Cue_Con_Sam = Cue_Con * Sam_C,
Cue_Ali_Sam = Cue_Ali * Sam_C,
Con_Ali_Sam = Con_Ali * Sam_C,
Cue_Con_Ali_Sam = Cue_Con_Ali * Sam_C
)
# save the data (for fitting model in cluster)
# save(df_lmm, file = file.path("data", "df_lmm.RData"))
rePCA()
function was then used to identify random effects that explained less
than 0.1% of the total variances; they were removed from the ZCP model
to make the reduced model.rePCA()
and removed to make the updated extended model;
this step was iterated until an extended model converged.anova()
function and the model that explained the data
better (with smaller Bayesian Information Criterion) was used as the
optimal model.Two sets of analyses were conducted to examine (1) the composite effect and (2) facilitation and interference for each dependent variable.
For behavioral choices, signal detection models were implemented by
GLMM with binomial error distribution and probit
link, in
which sensitivity d’ was defined as z(hits) – z(false alarms) and
same
in SameDifferent
was treated as
“signal”.
For (correct) response times, GLMM with lognormal
transformation was applied.
df_lmm_E1 <- df_lmm %>%
filter(Experiment == "109_cue") %>%
droplevels()
# save(df_lmm_E1, file = file.path("data", "df_lmm_E1.RData"))
There were 32 participants in Experiment 1.
# file_E1_resp_max <- file.path(folder_lmm, "E1_Resp_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E1_resp_max)) {
# glmm_E1_resp_max <- glmer(
# Resp ~ Cue * Congruency * Alignment * SameDifferent +
# (Cue * Congruency * Alignment * SameDifferent | Participant), # Con_Ali_Sam
# family = binomial(link = "probit"),
# data = df_lmm_E1,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_E1_resp_max, file = file_E1_resp_max)
# } else {
# load(file_E1_resp_max)
# }
#
# print(summary(glmm_E1_resp_max), corr = FALSE)
file_E1_resp_zcp <- file.path(folder_lmm, "E1_Resp_lmm_zcp.RData")
# fit the zcp model
if (!file.exists(file_E1_resp_zcp)) {
glmm_E1_resp_zcp <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(Cue_C + Con_C + Ali_C + Sam_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam +
Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam || Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_zcp, file = file_E1_resp_zcp)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam + Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 21936.9 22190.5 -10936.4 21872.9 20445
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.9358 -0.6657 0.2593 0.6445 4.4998
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 6.780e-02 0.2603885
## Participant.1 Cue_C 1.182e-01 0.3438058
## Participant.2 Con_C 3.893e-03 0.0623954
## Participant.3 Ali_C 4.835e-02 0.2198965
## Participant.4 Sam_C 1.695e-01 0.4116669
## Participant.5 Cue_Con 1.529e-02 0.1236598
## Participant.6 Cue_Ali 5.308e-02 0.2303939
## Participant.7 Cue_Sam 9.290e-01 0.9638497
## Participant.8 Con_Ali 0.000e+00 0.0000000
## Participant.9 Con_Sam 3.227e-01 0.5680713
## Participant.10 Ali_Sam 1.166e-10 0.0000108
## Participant.11 Cue_Con_Ali 0.000e+00 0.0000000
## Participant.12 Cue_Con_Sam 1.410e+00 1.1875858
## Participant.13 Cue_Ali_Sam 2.330e-02 0.1526353
## Participant.14 Con_Ali_Sam 1.291e-01 0.3593150
## Participant.15 Cue_Con_Ali_Sam 7.504e-02 0.2739304
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.37684 0.10414 13.221 < 2e-16 ***
## Cuebottom -0.27090 0.13817 -1.961 0.04993 *
## Congruencyincongruent -1.12419 0.09948 -11.300 < 2e-16 ***
## Alignmentmisaligned -0.13601 0.08431 -1.613 0.10672
## SameDifferentdifferent -2.33178 0.15088 -15.454 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.33173 0.13835 2.398 0.01650 *
## Cuebottom:Alignmentmisaligned -0.07531 0.10289 -0.732 0.46421
## Congruencyincongruent:Alignmentmisaligned 0.68120 0.09558 7.127 1.02e-12 ***
## Cuebottom:SameDifferentdifferent 0.69963 0.22026 3.176 0.00149 **
## Congruencyincongruent:SameDifferentdifferent 1.71693 0.17217 9.972 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.44037 0.09795 4.496 6.93e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.35334 0.12287 -2.876 0.00403 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.60078 0.24143 -2.488 0.01283 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13801 0.12738 -1.083 0.27860
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.00373 0.13725 -7.313 2.60e-13 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.72732 0.16944 4.292 1.77e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
## Standard deviation 1.188 0.9638 0.56807 0.41167 0.35932 0.34381 0.2739 0.26039 0.23039 0.21990 0.15264 0.12366 0.06240 1.08e-05 0 0
## Proportion of Variance 0.419 0.2760 0.09588 0.05035 0.03836 0.03512 0.0223 0.02015 0.01577 0.01437 0.00692 0.00454 0.00116 0.00e+00 0 0
## Cumulative Proportion 0.419 0.6951 0.79096 0.84132 0.87968 0.91480 0.9371 0.95724 0.97301 0.98738 0.99430 0.99884 1.00000 1.00e+00 1 1
Con_Ali
, Cue_Con_Ali
, Ali_Sam
,
and Con_C
were removed from extended model
(glmm_E1_resp_zcp
) due to that the variances they explained
were smaller than 0.1%, making glmm_resp_rdc
.
file_E1_resp_rdc <- file.path(folder_lmm, "E1_Resp_lmm_rdc.RData")
# fit the rdc model
if (!file.exists(file_E1_resp_rdc)) {
glmm_E1_resp_rdc <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(Cue_C + Ali_C + Sam_C + # Con_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam +
Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + # Cue_Con_Ali +
Cue_Con_Ali_Sam || Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_rdc, file = file_E1_resp_rdc)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 21930 22152 -10937 21874 20449
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.5380 -0.6704 0.2629 0.6465 4.5875
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.06765 0.2601
## Participant.1 Cue_C 0.11821 0.3438
## Participant.2 Ali_C 0.04840 0.2200
## Participant.3 Sam_C 0.16847 0.4104
## Participant.4 Cue_Con 0.01592 0.1262
## Participant.5 Cue_Ali 0.05315 0.2305
## Participant.6 Cue_Sam 0.92706 0.9628
## Participant.7 Con_Sam 0.32072 0.5663
## Participant.8 Cue_Con_Sam 1.41750 1.1906
## Participant.9 Cue_Ali_Sam 0.02354 0.1534
## Participant.10 Con_Ali_Sam 0.13059 0.3614
## Participant.11 Cue_Con_Ali_Sam 0.07928 0.2816
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.37285 0.10391 13.212 < 2e-16 ***
## Cuebottom -0.26880 0.13829 -1.944 0.05193 .
## Congruencyincongruent -1.12002 0.09891 -11.324 < 2e-16 ***
## Alignmentmisaligned -0.13554 0.08433 -1.607 0.10800
## SameDifferentdifferent -2.32926 0.15105 -15.420 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.32913 0.13879 2.372 0.01771 *
## Cuebottom:Alignmentmisaligned -0.07570 0.10295 -0.735 0.46213
## Congruencyincongruent:Alignmentmisaligned 0.68092 0.09577 7.110 1.16e-12 ***
## Cuebottom:SameDifferentdifferent 0.69963 0.22074 3.169 0.00153 **
## Congruencyincongruent:SameDifferentdifferent 1.71425 0.17253 9.936 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.44093 0.09818 4.491 7.10e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.35335 0.12315 -2.869 0.00411 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.60079 0.24243 -2.478 0.01320 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13815 0.12770 -1.082 0.27932
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.00409 0.13778 -7.288 3.15e-13 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.72745 0.17016 4.275 1.91e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E1_resp_etd <- file.path(folder_lmm, "E1_Resp_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_E1_resp_etd)) {
glmm_E1_resp_etd <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(Cue_C + Ali_C + Sam_C + # Con_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam +
Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + # Cue_Con_Ali +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_etd, file = file_E1_resp_etd)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 21953.0 22698.1 -10882.5 21765.0 20383
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.2143 -0.6713 0.2414 0.6543 5.2009
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.06913 0.2629
## Cue_C 0.11737 0.3426 -0.04
## Ali_C 0.04882 0.2210 0.00 0.11
## Sam_C 0.17347 0.4165 -0.03 -0.23 -0.31
## Cue_Con 0.03555 0.1885 0.03 0.19 -0.04 0.18
## Cue_Ali 0.05718 0.2391 -0.24 -0.09 -0.06 0.10 0.11
## Cue_Sam 0.92879 0.9637 0.45 0.17 0.30 -0.31 -0.67 -0.38
## Con_Sam 0.33820 0.5815 -0.15 0.02 0.03 -0.36 0.21 0.43 -0.23
## Cue_Con_Sam 1.51583 1.2312 0.15 0.00 0.37 -0.06 -0.68 -0.39 0.68 0.02
## Cue_Ali_Sam 0.11897 0.3449 0.12 0.02 -0.11 -0.42 -0.75 -0.60 0.65 -0.09 0.67
## Con_Ali_Sam 0.14149 0.3762 0.30 -0.11 -0.50 0.23 -0.65 -0.37 0.40 -0.49 0.41 0.66
## Cue_Con_Ali_Sam 0.41604 0.6450 0.28 0.10 0.08 -0.42 0.27 -0.03 0.27 0.02 -0.41 -0.13 -0.41
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.37921 0.10376 13.292 < 2e-16 ***
## Cuebottom -0.27976 0.11136 -2.512 0.011997 *
## Congruencyincongruent -1.12484 0.12260 -9.175 < 2e-16 ***
## Alignmentmisaligned -0.14692 0.09122 -1.611 0.107261
## SameDifferentdifferent -2.34239 0.15515 -15.097 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.34124 0.17196 1.984 0.047214 *
## Cuebottom:Alignmentmisaligned -0.06366 0.11998 -0.531 0.595732
## Congruencyincongruent:Alignmentmisaligned 0.71541 0.10524 6.798 1.06e-11 ***
## Cuebottom:SameDifferentdifferent 0.71000 0.17087 4.155 3.25e-05 ***
## Congruencyincongruent:SameDifferentdifferent 1.72964 0.20291 8.524 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.45760 0.11811 3.874 0.000107 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.38787 0.13556 -2.861 0.004221 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.61307 0.27336 -2.243 0.024914 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.14414 0.15375 -0.937 0.348512
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.04984 0.15962 -6.577 4.80e-11 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.75802 0.20051 3.781 0.000156 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
## Standard deviation 1.4977 0.8779 0.6733 0.39416 0.35799 0.31452 0.25116 0.21968 0.0003291 4.271e-06 1.554e-07 0
## Proportion of Variance 0.5663 0.1946 0.1145 0.03923 0.03236 0.02498 0.01593 0.01218 0.0000000 0.000e+00 0.000e+00 0
## Cumulative Proportion 0.5663 0.7609 0.8753 0.91456 0.94691 0.97189 0.98782 1.00000 1.0000000 1.000e+00 1.000e+00 1
Cue_Con
, Ali_C
, Cue_Ali
, and
Intercept
were removed from the extended model.
file_E1_resp_etd1 <- file.path(folder_lmm, "E1_Resp_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E1_resp_etd1)) {
glmm_E1_resp_etd1 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(0 + Cue_C + Sam_C + # Con_C + Ali_C +
Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali +
Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + # Cue_Con_Ali +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_etd1, file = file_E1_resp_etd1)
} else {
load(file_E1_resp_etd1)
}
print(summary(glmm_E1_resp_etd1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 22521.5 22933.7 -11208.8 22417.5 20425
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.8285 -0.6903 0.2899 0.6800 4.5189
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_C 0.10766 0.3281
## Sam_C 0.16290 0.4036 -0.33
## Cue_Sam 0.81035 0.9002 0.26 -0.27
## Con_Sam 0.31546 0.5617 0.02 -0.40 -0.24
## Cue_Con_Sam 1.33283 1.1545 0.00 -0.01 0.65 0.06
## Cue_Ali_Sam 0.06888 0.2625 0.02 -0.42 0.67 -0.05 0.74
## Con_Ali_Sam 0.16811 0.4100 -0.12 0.28 0.42 -0.50 0.42 0.63
## Cue_Con_Ali_Sam 0.36562 0.6047 0.20 -0.45 0.27 -0.01 -0.47 -0.26 -0.40
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.30526 0.08039 16.236 < 2e-16 ***
## Cuebottom -0.21219 0.10068 -2.108 0.0351 *
## Congruencyincongruent -1.07631 0.10762 -10.001 < 2e-16 ***
## Alignmentmisaligned -0.14998 0.07570 -1.981 0.0476 *
## SameDifferentdifferent -2.24075 0.15104 -14.836 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.28714 0.14475 1.984 0.0473 *
## Cuebottom:Alignmentmisaligned -0.07573 0.09926 -0.763 0.4455
## Congruencyincongruent:Alignmentmisaligned 0.67370 0.10185 6.615 3.72e-11 ***
## Cuebottom:SameDifferentdifferent 0.65403 0.16618 3.936 8.30e-05 ***
## Congruencyincongruent:SameDifferentdifferent 1.66402 0.19578 8.500 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.44771 0.11329 3.952 7.75e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.31669 0.12997 -2.437 0.0148 *
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.56755 0.26167 -2.169 0.0301 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13430 0.14522 -0.925 0.3551
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.00715 0.15898 -6.335 2.37e-10 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.70048 0.19374 3.616 0.0003 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 1.3825 0.8423 0.6617 0.33736 0.31331 0.24743 3.564e-06 2.023e-07
## Proportion of Variance 0.5737 0.2129 0.1314 0.03416 0.02946 0.01838 0.000e+00 0.000e+00
## Cumulative Proportion 0.5737 0.7866 0.9180 0.95216 0.98162 1.00000 1.000e+00 1.000e+00
Cue_Ali_Sam
, and Cue_C
were removed from
extended1 model.
file_E1_resp_etd2 <- file.path(folder_lmm, "E1_Resp_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_E1_resp_etd2)) {
glmm_E1_resp_etd2 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(0 + Sam_C + # Con_C + Ali_C + Cue_C +
Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali +
Cue_Con_Sam + Con_Ali_Sam + # Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_etd2, file = file_E1_resp_etd2)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 22716.3 23009.6 -11321.1 22642.3 20440
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.7939 -0.7181 0.2875 0.6817 4.2680
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Sam_C 0.1618 0.4022
## Cue_Sam 0.8394 0.9162 -0.30
## Con_Sam 0.3131 0.5595 -0.41 -0.23
## Cue_Con_Sam 1.2878 1.1348 0.02 0.62 0.06
## Con_Ali_Sam 0.1478 0.3845 0.33 0.41 -0.53 0.45
## Cue_Con_Ali_Sam 0.3708 0.6090 -0.54 0.36 0.01 -0.43 -0.40
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.31967 0.08665 15.231 < 2e-16 ***
## Cuebottom -0.24504 0.09985 -2.454 0.014127 *
## Congruencyincongruent -1.08920 0.10640 -10.237 < 2e-16 ***
## Alignmentmisaligned -0.16465 0.07168 -2.297 0.021627 *
## SameDifferentdifferent -2.23527 0.15677 -14.258 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.31331 0.14175 2.210 0.027084 *
## Cuebottom:Alignmentmisaligned -0.05537 0.09373 -0.591 0.554748
## Congruencyincongruent:Alignmentmisaligned 0.68730 0.10048 6.840 7.93e-12 ***
## Cuebottom:SameDifferentdifferent 0.67090 0.17333 3.871 0.000109 ***
## Congruencyincongruent:SameDifferentdifferent 1.66461 0.19293 8.628 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.46067 0.10223 4.506 6.60e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.33808 0.12902 -2.620 0.008786 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.58192 0.25547 -2.278 0.022737 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.15227 0.13083 -1.164 0.244449
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.01599 0.15525 -6.544 5.98e-11 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.71534 0.19209 3.724 0.000196 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd2))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6]
## Standard deviation 1.3421 0.8715 0.6570 0.26879 0.23697 3.02e-07
## Proportion of Variance 0.5772 0.2434 0.1383 0.02315 0.01799 0.00e+00
## Cumulative Proportion 0.5772 0.8205 0.9588 0.98201 1.00000 1.00e+00
Con_Ali_Sam
was removed from extended2 model.
file_E1_resp_etd3 <- file.path(folder_lmm, "E1_Resp_lmm_etd3.RData")
# fit the etd3 model
if (!file.exists(file_E1_resp_etd3)) {
glmm_E1_resp_etd3 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(0 + Sam_C + # Con_C + Ali_C + Cue_C +
Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_etd3, file = file_E1_resp_etd3)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 22717.1 22962.8 -11327.5 22655.1 20446
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.9575 -0.7151 0.2997 0.6853 3.8068
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Sam_C 0.1599 0.3998
## Cue_Sam 0.8401 0.9166 -0.30
## Con_Sam 0.3070 0.5541 -0.41 -0.22
## Cue_Con_Sam 1.2733 1.1284 0.01 0.62 0.07
## Cue_Con_Ali_Sam 0.3498 0.5914 -0.55 0.39 -0.02 -0.43
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.31216 0.08357 15.701 < 2e-16 ***
## Cuebottom -0.24399 0.09983 -2.444 0.014521 *
## Congruencyincongruent -1.08313 0.09483 -11.422 < 2e-16 ***
## Alignmentmisaligned -0.15610 0.06780 -2.302 0.021308 *
## SameDifferentdifferent -2.22155 0.15012 -14.799 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.31497 0.14097 2.234 0.025466 *
## Cuebottom:Alignmentmisaligned -0.05378 0.09324 -0.577 0.564069
## Congruencyincongruent:Alignmentmisaligned 0.68213 0.08994 7.584 3.35e-14 ***
## Cuebottom:SameDifferentdifferent 0.66779 0.17350 3.849 0.000119 ***
## Congruencyincongruent:SameDifferentdifferent 1.65395 0.16723 9.890 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.44496 0.09150 4.863 1.15e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.34682 0.12811 -2.707 0.006786 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.58436 0.25391 -2.301 0.021366 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.15320 0.12967 -1.181 0.237425
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.00568 0.12728 -7.901 2.76e-15 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.72743 0.18994 3.830 0.000128 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd3))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5]
## Standard deviation 1.3208 0.8690 0.6068 0.24931 0
## Proportion of Variance 0.5954 0.2577 0.1257 0.02121 0
## Cumulative Proportion 0.5954 0.8531 0.9788 1.00000 1
Sam_C
was removed from extended3 model.
file_E1_resp_etd4 <- file.path(folder_lmm, "E1_Resp_lmm_etd4.RData")
# fit the etd4 model
if (!file.exists(file_E1_resp_etd4)) {
glmm_E1_resp_etd4 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(0 + # Con_C + Ali_C + Cue_C + Sam_C +
Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_etd4, file = file_E1_resp_etd4)
} else {
load(file_E1_resp_etd4)
}
print(summary(glmm_E1_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 23054.2 23260.3 -11501.1 23002.2 20451
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7093 -0.7045 0.3406 0.6959 2.6843
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.7870 0.8871
## Con_Sam 0.2681 0.5178 -0.27
## Cue_Con_Sam 1.2556 1.1205 0.66 0.08
## Cue_Con_Ali_Sam 0.3112 0.5579 0.35 -0.05 -0.42
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.25684 0.05822 21.589 < 2e-16 ***
## Cuebottom -0.20869 0.09448 -2.209 0.027191 *
## Congruencyincongruent -1.03225 0.09143 -11.290 < 2e-16 ***
## Alignmentmisaligned -0.14259 0.06604 -2.159 0.030847 *
## SameDifferentdifferent -2.12265 0.09192 -23.092 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.28160 0.13858 2.032 0.042146 *
## Cuebottom:Alignmentmisaligned -0.06807 0.09092 -0.749 0.454019
## Congruencyincongruent:Alignmentmisaligned 0.65469 0.08791 7.447 9.53e-14 ***
## Cuebottom:SameDifferentdifferent 0.59888 0.16245 3.687 0.000227 ***
## Congruencyincongruent:SameDifferentdifferent 1.56822 0.16045 9.774 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.41327 0.08877 4.656 3.23e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.31889 0.12506 -2.550 0.010777 *
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.52439 0.24958 -2.101 0.035634 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.12332 0.12589 -0.980 0.327267
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.95849 0.12374 -7.746 9.48e-15 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.68209 0.18425 3.702 0.000214 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd4))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4]
## Standard deviation 1.3142 0.7964 0.5105 1.346e-07
## Proportion of Variance 0.6587 0.2419 0.0994 0.000e+00
## Cumulative Proportion 0.6587 0.9006 1.0000 1.000e+00
Con_Sam
was removed from extended4 model.
file_E1_resp_etd5 <- file.path(folder_lmm, "E1_Resp_lmm_etd5.RData")
# fit the etd5 model
if (!file.exists(file_E1_resp_etd5)) {
glmm_E1_resp_etd5 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent +
(0 + # Con_C + Ali_C + Cue_C + Sam_C +
Cue_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm_E1,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_resp_etd5, file = file_E1_resp_etd5)
} else {
load(file_E1_resp_etd5)
}
print(summary(glmm_E1_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 23165.7 23340.1 -11560.8 23121.7 20455
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4835 -0.7183 0.3488 0.7120 2.9989
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.8046 0.897
## Cue_Con_Sam 1.3785 1.174 0.63
## Cue_Con_Ali_Sam 0.2820 0.531 0.42 -0.45
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.25396 0.05981 20.964 < 2e-16 ***
## Cuebottom -0.22198 0.09690 -2.291 0.021974 *
## Congruencyincongruent -1.02711 0.08340 -12.316 < 2e-16 ***
## Alignmentmisaligned -0.13955 0.06595 -2.116 0.034355 *
## SameDifferentdifferent -2.11838 0.09607 -22.050 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.29631 0.14241 2.081 0.037468 *
## Cuebottom:Alignmentmisaligned -0.06778 0.09040 -0.750 0.453416
## Congruencyincongruent:Alignmentmisaligned 0.64489 0.08754 7.367 1.75e-13 ***
## Cuebottom:SameDifferentdifferent 0.61898 0.16834 3.677 0.000236 ***
## Congruencyincongruent:SameDifferentdifferent 1.55875 0.14196 10.980 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.40915 0.08855 4.621 3.82e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.31001 0.12406 -2.499 0.012461 *
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.54738 0.25822 -2.120 0.034021 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.12365 0.12482 -0.991 0.321859
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.94527 0.12291 -7.691 1.46e-14 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.67025 0.18186 3.686 0.000228 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
# compare the extended and reduced model
anova(glmm_E1_resp_etd5, glmm_E1_resp_rdc, refit = FALSE)
## Data: df_lmm_E1
## Models:
## glmm_E1_resp_etd5: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## glmm_E1_resp_rdc: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_E1_resp_etd5 22 23166 23340 -11561 23122
## glmm_E1_resp_rdc 28 21930 22152 -10937 21874 1247.6 6 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (glmm_resp_rdc
)
explained the data better than the extended model
(glmm_resp_etd5
) and, therefore, 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: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 21930 22152 -10937 21874 20449
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.5380 -0.6704 0.2629 0.6465 4.5875
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.06765 0.2601
## Participant.1 Cue_C 0.11821 0.3438
## Participant.2 Ali_C 0.04840 0.2200
## Participant.3 Sam_C 0.16847 0.4104
## Participant.4 Cue_Con 0.01592 0.1262
## Participant.5 Cue_Ali 0.05315 0.2305
## Participant.6 Cue_Sam 0.92706 0.9628
## Participant.7 Con_Sam 0.32072 0.5663
## Participant.8 Cue_Con_Sam 1.41750 1.1906
## Participant.9 Cue_Ali_Sam 0.02354 0.1534
## Participant.10 Con_Ali_Sam 0.13059 0.3614
## Participant.11 Cue_Con_Ali_Sam 0.07928 0.2816
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.37285 0.10391 13.212 < 2e-16 ***
## Cuebottom -0.26880 0.13829 -1.944 0.05193 .
## Congruencyincongruent -1.12002 0.09891 -11.324 < 2e-16 ***
## Alignmentmisaligned -0.13554 0.08433 -1.607 0.10800
## SameDifferentdifferent -2.32926 0.15105 -15.420 < 2e-16 ***
## Cuebottom:Congruencyincongruent 0.32913 0.13879 2.372 0.01771 *
## Cuebottom:Alignmentmisaligned -0.07570 0.10295 -0.735 0.46213
## Congruencyincongruent:Alignmentmisaligned 0.68092 0.09577 7.110 1.16e-12 ***
## Cuebottom:SameDifferentdifferent 0.69963 0.22074 3.169 0.00153 **
## Congruencyincongruent:SameDifferentdifferent 1.71425 0.17253 9.936 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.44093 0.09818 4.491 7.10e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.35335 0.12315 -2.869 0.00411 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.60079 0.24243 -2.478 0.01320 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13815 0.12770 -1.082 0.27932
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -1.00409 0.13778 -7.288 3.15e-13 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.72745 0.17016 4.275 1.91e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(emm_E1_resp <- emmeans(glmm_E1_resp_opt, ~ Alignment + Congruency + Cue + SameDifferent))
## Alignment Congruency Cue SameDifferent emmean SE df asymp.LCL asymp.UCL
## aligned congruent top same 1.3728 0.1039 Inf 1.1692 1.5765
## misaligned congruent top same 1.2373 0.1023 Inf 1.0367 1.4379
## aligned incongruent top same 0.2528 0.0976 Inf 0.0615 0.4441
## misaligned incongruent top same 0.7982 0.0996 Inf 0.6030 0.9934
## aligned congruent bottom same 1.1040 0.1007 Inf 0.9066 1.3015
## misaligned congruent bottom same 0.8928 0.0992 Inf 0.6983 1.0873
## aligned incongruent bottom same 0.3132 0.0973 Inf 0.1224 0.5039
## misaligned incongruent bottom same 0.4295 0.0975 Inf 0.2384 0.6206
## aligned congruent top different -0.9564 0.1000 Inf -1.1524 -0.7605
## misaligned congruent top different -0.6510 0.0983 Inf -0.8436 -0.4585
## aligned incongruent top different -0.3622 0.0977 Inf -0.5537 -0.1706
## misaligned incongruent top different -0.3800 0.0975 Inf -0.5710 -0.1889
## aligned congruent bottom different -0.5256 0.0980 Inf -0.7177 -0.3334
## misaligned congruent bottom different -0.4340 0.0976 Inf -0.6254 -0.2427
## aligned incongruent bottom different -0.2030 0.0973 Inf -0.3937 -0.0123
## misaligned incongruent bottom different -0.0605 0.0972 Inf -0.2511 0.1300
##
## Results are given on the probit (not the response) scale.
## Confidence level used: 0.95
emm_E1_d <- contrast(emm_E1_resp, method = "pairwise", simple = "SameDifferent")
summary(emm_E1_d[1:8], infer = c(TRUE, FALSE), adjust = "none")
## contrast Alignment Congruency Cue estimate SE df asymp.LCL asymp.UCL
## same - different aligned congruent top 2.329 0.151 Inf 2.033 2.625
## same - different misaligned congruent top 1.888 0.149 Inf 1.597 2.180
## same - different aligned incongruent top 0.615 0.145 Inf 0.331 0.899
## same - different misaligned incongruent top 1.178 0.146 Inf 0.892 1.465
## same - different aligned congruent bottom 1.630 0.147 Inf 1.341 1.919
## same - different misaligned congruent bottom 1.327 0.146 Inf 1.040 1.613
## same - different aligned incongruent bottom 0.516 0.145 Inf 0.233 0.800
## same - different misaligned incongruent bottom 0.490 0.145 Inf 0.207 0.774
##
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
# quick check (uncorrected)
# emmip(emm_E1_d, Congruency ~ Alignment | Cue, CIs = TRUE)
plot_E1_cf_d <- summary(emm_E1_d[1:8], infer = c(TRUE, FALSE), adjust = "sidak") %>%
as_tibble() %>%
ggplot(aes(y = estimate, 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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed")) +
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(. ~Cue, switch = "both") +
coord_cartesian(ylim = ylimit_cf_d) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", y = expression("Sensitivity"~italic("d'")), fill = "Congruency") + # set the names for main, x and y axises
geom_text(label = c("***", "", "", "", "*", "", "", ""), color = sig_color, size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
NULL
# ggsave(filename = "E1_cf_d.pdf", plot_E1_cf_d, width = 8, height = 4.8)
plot_E1_cf_d
# ggsave(filename = "E1_cf_d.pdf",
# plot_E1_cf_d +
# theme(legend.position=c(0.5, 0.15)),
# width = 7)
Composite face effects for top and bottom parts:
emm_E1_d_cf <- contrast(emm_E1_resp, interaction = "pairwise", by = "Cue")
summary(emm_E1_d_cf[1:2], infer = TRUE)
## Alignment_pairwise Congruency_pairwise SameDifferent_pairwise Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned congruent - incongruent same - different top 1.004 0.138 Inf 0.734 1.274 7.288 <.0001
## aligned - misaligned congruent - incongruent same - different bottom 0.277 0.130 Inf 0.022 0.531 2.129 0.0333
##
## Confidence level used: 0.95
emm_E1_d_con <- contrast(emm_E1_resp, interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_E1_d_con[c(1,3)], infer = TRUE)
## Congruency_pairwise SameDifferent_pairwise Cue Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent same - different top aligned 1.71 0.173 Inf 1.376 2.05 9.936 <.0001
## congruent - incongruent same - different bottom aligned 1.11 0.169 Inf 0.782 1.44 6.583 <.0001
##
## Confidence level used: 0.95
# Sensitivity d'
emm_E1_d_fi <- contrast(emm_E1_resp, interaction = "pairwise", by = c("Cue", "Congruency"), adjust = "sidak")
summary(emm_E1_d_fi[1:4], infer=TRUE)
## Alignment_pairwise SameDifferent_pairwise Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned same - different top congruent 0.4409 0.0982 Inf 0.1964 0.685 4.491 <.0001
## aligned - misaligned same - different top incongruent -0.5632 0.0862 Inf -0.7778 -0.349 -6.536 <.0001
## aligned - misaligned same - different bottom congruent 0.3028 0.0897 Inf 0.0794 0.526 3.376 0.0029
## aligned - misaligned same - different bottom incongruent 0.0261 0.0830 Inf -0.1807 0.233 0.315 0.9963
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: sidak method for 4 tests
# # showing the differences between aligned and misaligned (aligned-misaligned)
# emmip(emm_E1_d_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak") +
# geom_hline(yintercept = 0, linetype = "dashed")
plot_E1_cffi_d <- summary(emm_E1_d_fi[1:4], infer=TRUE, adjust = "sidak") %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(. ~ Congruency, switch = "both") +
coord_cartesian(ylim = ylimit_cf_fi_d) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(italic("d'")~"(aligned-misaligned)")) + # set the names for main, x and y axises
theme(legend.position = "none") +
NULL
# ggsave(filename = "E1_fi_d.pdf", plot_E1_cffi_d, width = 7, height = 4.55)
plot_E1_cffi_d
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 = c(0.6, 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)
# ggsave(filename = "E1_d.pdf", plot_E1_d, width = 10, height = 4.5)
plot_E1_d
contrast(emm_E1_d_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>%
summary(infer = TRUE)
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top -0.122 0.123 Inf -0.363 0.119 -0.993 0.3206
## faci-inte bottom 0.329 0.114 Inf 0.106 0.552 2.886 0.0039
##
## Confidence level used: 0.95
df_lmm_E1_rt <- df_lmm_E1 %>%
filter(isCorrect == 1)
# save(df_lmm_E1_rt, file = file.path("data", "df_lmm_E1_rt.RData"))
with log-transformation. #### The maximal model
# file_E1_rt_max <- file.path(folder_lmm, "E1_rt_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E1_rt_max)) {
# glmm_E1_rt_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment +
# (Cue * Congruency * Alignment | Participant),
# family = lognormal(),
# data = df_lmm_E1_rt,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_E1_rt_max, file = file_E1_rt_max)
# } else {
# load(file_E1_rt_max)
# }
#
# print(summary(glmm_E1_rt_max), corr = FALSE)
file_E1_rt_zcp <- file.path(folder_lmm, "E1_rt_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_E1_rt_zcp)) {
glmm_E1_rt_zcp <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rt_zcp, file = file_E1_rt_zcp)
} else {
load(file_E1_rt_zcp)
}
print(summary(glmm_E1_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 13677.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6186 -0.5735 -0.1346 0.4295 7.6689
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0725762 0.26940
## Participant.1 Cue_C 0.0226908 0.15063
## Participant.2 Con_C 0.0010608 0.03257
## Participant.3 Ali_C 0.0011955 0.03458
## Participant.4 Cue_Con 0.0007338 0.02709
## Participant.5 Cue_Ali 0.0046874 0.06846
## Participant.6 Con_Ali 0.0000000 0.00000
## Participant.7 Cue_Con_Ali 0.0231449 0.15213
## Residual 0.1478702 0.38454
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.689329 0.050535 38.630155 132.371 < 2e-16 ***
## Cuebottom 0.072469 0.030700 46.934968 2.361 0.022456 *
## Congruencyincongruent 0.060203 0.015862 110.775801 3.796 0.000241 ***
## Alignmentmisaligned 0.035569 0.016166 89.228593 2.200 0.030371 *
## Cuebottom:Congruencyincongruent 0.001602 0.023408 52.241192 0.068 0.945697
## Cuebottom:Alignmentmisaligned 0.015209 0.025040 47.196342 0.607 0.546497
## Congruencyincongruent:Alignmentmisaligned -0.039663 0.022484 56.766074 -1.764 0.083102 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.007022 0.037462 27.620253 -0.187 0.852689
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_rt_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 0.7006 0.3956 0.3917 0.17804 0.08992 0.08470 0.07045 0
## Proportion of Variance 0.5756 0.1836 0.1800 0.03718 0.00948 0.00841 0.00582 0
## Cumulative Proportion 0.5756 0.7591 0.9391 0.97629 0.98577 0.99418 1.00000 1
Con_Ali
was removed from extended model
(glmm_E1_rt_zcp
) due to that the variance it explained was
smaller than 0.1%, making glmm_E1_rt_rdc
.
file_E1_rt_rdc <- file.path(folder_lmm, "E1_rt_lmm_rdc.RData")
# fit the rdc1 model
if (!file.exists(file_E1_rt_rdc)) {
glmm_E1_rt_rdc <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + # Con_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rt_rdc, file = file_E1_rt_rdc)
} else {
load(file_E1_rt_rdc)
}
print(summary(glmm_E1_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 13677.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6186 -0.5735 -0.1346 0.4295 7.6689
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0725764 0.26940
## Participant.1 Cue_C 0.0226910 0.15064
## Participant.2 Con_C 0.0010608 0.03257
## Participant.3 Ali_C 0.0011956 0.03458
## Participant.4 Cue_Con 0.0007337 0.02709
## Participant.5 Cue_Ali 0.0046876 0.06847
## Participant.6 Cue_Con_Ali 0.0231478 0.15214
## Residual 0.1478701 0.38454
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.689329 0.050535 38.630041 132.371 < 2e-16 ***
## Cuebottom 0.072469 0.030701 46.934893 2.361 0.022456 *
## Congruencyincongruent 0.060203 0.015862 110.770723 3.796 0.000241 ***
## Alignmentmisaligned 0.035569 0.016166 89.225948 2.200 0.030373 *
## Cuebottom:Congruencyincongruent 0.001602 0.023409 52.237565 0.068 0.945701
## Cuebottom:Alignmentmisaligned 0.015209 0.025040 47.194938 0.607 0.546510
## Congruencyincongruent:Alignmentmisaligned -0.039663 0.022485 56.760997 -1.764 0.083108 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.007021 0.037463 27.618818 -0.187 0.852700
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E1_rt_etd <- file.path(folder_lmm, "E1_rt_lmm_etd.RData")
# fit the etd1 model
if (!file.exists(file_E1_rt_etd)) {
glmm_E1_rt_etd <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + # Con_Ali +
Cue_Con_Ali | Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rt_etd, file = file_E1_rt_etd)
} else {
load(file_E1_rt_etd)
}
print(summary(glmm_E1_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 13639.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7341 -0.5741 -0.1341 0.4281 7.5985
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.072195 0.26869
## Cue_C 0.022630 0.15043 -0.02
## Con_C 0.001094 0.03308 -0.40 0.19
## Ali_C 0.001456 0.03816 -0.30 -0.23 0.54
## Cue_Con 0.002246 0.04739 0.18 0.30 -0.10 -0.89
## Cue_Ali 0.005632 0.07505 -0.05 -0.01 -0.16 0.67 -0.91
## Cue_Con_Ali 0.027429 0.16562 -0.46 -0.25 -0.27 0.52 -0.79 0.82
## Residual 0.147687 0.38430
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.6890097 0.0539790 31.1138223 123.919 < 2e-16 ***
## Cuebottom 0.0724021 0.0269948 31.6152685 2.682 0.01153 *
## Congruencyincongruent 0.0604124 0.0173550 44.2973201 3.481 0.00113 **
## Alignmentmisaligned 0.0361463 0.0139979 47.8768479 2.582 0.01293 *
## Cuebottom:Congruencyincongruent 0.0008654 0.0286328 30.2534505 0.030 0.97609
## Cuebottom:Alignmentmisaligned 0.0154113 0.0192267 39.4831241 0.802 0.42761
## Congruencyincongruent:Alignmentmisaligned -0.0397233 0.0231668 56.6025894 -1.715 0.09188 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.0058548 0.0391678 29.1435306 -0.149 0.88220
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_rt_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## Standard deviation 0.7406 0.4537 0.3537 0.13699 0.01013 0.001418 7.519e-19
## Proportion of Variance 0.6106 0.2291 0.1393 0.02089 0.00011 0.000000 0.000e+00
## Cumulative Proportion 0.6106 0.8397 0.9790 0.99988 1.00000 1.000000 1.000e+00
Con_C
, Ali_C
, and Cue_Con
were
removed from extended model.
file_E1_rt_etd1 <- file.path(folder_lmm, "E1_rt_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E1_rt_etd1)) {
glmm_E1_rt_etd1 <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + # Con_C + Ali_C +
Cue_Ali + # Con_Ali + Cue_Con +
Cue_Con_Ali | Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rt_etd1, file = file_E1_rt_etd1)
} else {
load(file_E1_rt_etd1)
}
print(summary(glmm_E1_rt_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 13678.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7618 -0.5749 -0.1328 0.4291 7.6980
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.072713 0.26965
## Cue_C 0.022643 0.15048 -0.02
## Cue_Ali 0.004764 0.06902 -0.01 0.00
## Cue_Con_Ali 0.026729 0.16349 -0.43 -0.26 0.84
## Residual 0.148441 0.38528
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.689159 0.051646 31.691272 129.520 < 2e-16 ***
## Cuebottom 0.071427 0.027748 33.934439 2.574 0.01459 *
## Congruencyincongruent 0.060875 0.014804 146.126193 4.112 6.52e-05 ***
## Alignmentmisaligned 0.035516 0.012534 87.573213 2.834 0.00571 **
## Cuebottom:Congruencyincongruent 0.002798 0.023482 58.492199 0.119 0.90557
## Cuebottom:Alignmentmisaligned 0.016498 0.018961 28.771290 0.870 0.39145
## Congruencyincongruent:Alignmentmisaligned -0.041767 0.023105 54.360420 -1.808 0.07618 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.007626 0.038908 27.563343 -0.196 0.84604
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(glmm_E1_rt_etd1, glmm_E1_rt_rdc, refit = FALSE)
## Data: df_lmm_E1_rt
## Models:
## glmm_E1_rt_rdc: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
## glmm_E1_rt_etd1: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali | Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_E1_rt_rdc 16 13709 13830 -6838.6 13677
## glmm_E1_rt_etd1 19 13717 13861 -6839.5 13679 0 3 1
According to BIC, the reduced model (glmm_E1_rt_rdc
)
explained the data better than the extended model
(glmm_E1_rt_etd1
) and, therefore, the reduced model is used
as the optimal model.
glmm_E1_rt_opt <- glmm_E1_rt_rdc
print(summary(glmm_E1_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 13677.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6186 -0.5735 -0.1346 0.4295 7.6689
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0725764 0.26940
## Participant.1 Cue_C 0.0226910 0.15064
## Participant.2 Con_C 0.0010608 0.03257
## Participant.3 Ali_C 0.0011956 0.03458
## Participant.4 Cue_Con 0.0007337 0.02709
## Participant.5 Cue_Ali 0.0046876 0.06847
## Participant.6 Cue_Con_Ali 0.0231478 0.15214
## Residual 0.1478701 0.38454
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.689329 0.050535 38.630041 132.371 < 2e-16 ***
## Cuebottom 0.072469 0.030701 46.934893 2.361 0.022456 *
## Congruencyincongruent 0.060203 0.015862 110.770723 3.796 0.000241 ***
## Alignmentmisaligned 0.035569 0.016166 89.225948 2.200 0.030373 *
## Cuebottom:Congruencyincongruent 0.001602 0.023409 52.237565 0.068 0.945701
## Cuebottom:Alignmentmisaligned 0.015209 0.025040 47.194938 0.607 0.546510
## Congruencyincongruent:Alignmentmisaligned -0.039663 0.022485 56.760997 -1.764 0.083108 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.007021 0.037463 27.618818 -0.187 0.852700
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E1_rt_emm <- file.path(folder_lmm, "E1_rt_emm.RData")
if (!file.exists(file_E1_rt_emm)) {
emm_E1_rt <- emmeans(glmm_E1_rt_opt, ~ Cue + Congruency + Alignment)
} else {
load(file_E1_rt_emm)
}
# emmip(regrid(emm_E1_rt), Congruency ~ Alignment | Cue, CIs = TRUE)
summary(emm_E1_rt, type = "response") # equivalent to regrid(emm_rt)
## Cue Congruency Alignment response SE df asymp.LCL asymp.UCL
## top congruent aligned 804 40.6 Inf 728 887
## bottom congruent aligned 864 43.7 Inf 783 954
## top incongruent aligned 854 43.4 Inf 773 943
## bottom incongruent aligned 919 46.7 Inf 832 1016
## top congruent misaligned 833 42.1 Inf 754 920
## bottom congruent misaligned 909 46.1 Inf 823 1004
## top incongruent misaligned 850 43.1 Inf 770 939
## bottom incongruent misaligned 923 46.9 Inf 835 1020
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
plot_E1_cf_rt <- summary(emm_E1_rt, type = "response") %>%
as_tibble() %>%
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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(. ~Cue, switch = "both") +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", 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
Composite face effects for top and bottom parts:
emm_E1_rt_cf <- contrast(regrid(emm_E1_rt), interaction = "pairwise", by = "Cue", infer = TRUE)
emm_E1_rt_cf[1:2]
## Congruency_pairwise Alignment_pairwise Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top -32.6 18.9 Inf -69.6 4.424 -1.726 0.0844
## congruent - incongruent aligned - misaligned bottom -41.2 21.1 Inf -82.6 0.119 -1.954 0.0507
##
## Confidence level used: 0.95
emm_E1_rt_con <- contrast(regrid(emm_E1_rt), interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_E1_rt_con[c(1,2)], infer = TRUE)
## Congruency_pairwise Cue Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top aligned -49.9 13.4 Inf -76.2 -23.6 -3.715 0.0002
## congruent - incongruent bottom aligned -55.1 14.7 Inf -83.9 -26.3 -3.748 0.0002
##
## Confidence level used: 0.95
emm_E1_rt_fi <- contrast(regrid(emm_E1_rt), "pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "sidak")
# emmip(emm_E1_rt_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak")
emm_E1_rt_fi[1:4]
## contrast Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent -29.10 13.3 Inf -62.3 4.06 -2.186 0.1103
## aligned - misaligned bottom congruent -45.02 14.9 Inf -82.2 -7.85 -3.017 0.0102
## aligned - misaligned top incongruent 3.49 14.8 Inf -33.4 40.38 0.236 0.9988
## aligned - misaligned bottom incongruent -3.77 16.5 Inf -44.8 37.22 -0.229 0.9989
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: sidak method for 4 tests
plot_E1_cffi_rt <- emm_E1_rt_fi[1:4] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(. ~ Congruency, switch = "both") +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", 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
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 = c(0.6, 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)
# ggsave(filename = "E1_rt.pdf", plot_E1_rt, width = 10, height = 4.5)
plot_E1_rt
contrast(emm_E1_rt_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>%
summary(infer = TRUE)
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top -25.6 20.9 Inf -66.6 15.33 -1.226 0.2201
## faci-inte bottom -48.8 23.3 Inf -94.4 -3.19 -2.097 0.0360
##
## Confidence level used: 0.95
df_lmm_E2 <- df_lmm %>%
filter(Experiment != "109_cue") %>%
droplevels()
contrasts(df_lmm_E2$Probability) <- MASS::contr.sdif(2)
df_lmm_E2 <- df_lmm_E2 %>%
mutate(Pro_C = if_else(Probability == 0.25, -0.5, 0.5),
Cue_Pro = Cue_C * Pro_C,
Con_Pro = Con_C * Pro_C,
Ali_Pro = Ali_C * Pro_C,
Sam_Pro = Sam_C * Pro_C,
Cue_Con_Pro = Cue_Con * Pro_C,
Cue_Ali_Pro = Cue_Ali * Pro_C,
Cue_Sam_Pro = Cue_Sam * Pro_C,
Con_Ali_Pro = Con_Ali * Pro_C,
Con_Sam_Pro = Con_Sam * Pro_C,
Ali_Sam_Pro = Ali_Sam * Pro_C,
Cue_Con_Ali_Pro = Cue_Con_Ali * Pro_C,
Cue_Con_Sam_Pro = Cue_Con_Sam * Pro_C,
Cue_Ali_Sam_Pro = Cue_Ali_Sam * Pro_C,
Con_Ali_Sam_Pro = Con_Ali_Sam * Pro_C,
Cue_Con_Ali_Sam_Pro = Cue_Con_Ali_Sam * Pro_C
)
# save(df_lmm_E2, file = file.path("data", "df_lmm_E2.RData"))
There were 32 participants in Experiment 2.
# file_E2_resp_max <- file.path(folder_lmm, "E2_Resp_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E2_resp_max)) {
# glmm_E2_resp_max <- glmer(
# Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
# (Cue * Congruency * Alignment * SameDifferent * Probability | Participant), # Con_Ali_Sam
# family = binomial(link = "probit"),
# data = df_lmm_E2,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_E2_resp_max, file = file_E2_resp_max)
# } else {
# load(file_E2_resp_max)
# }
#
# print(summary(glmm_E2_resp_max), corr = FALSE)
file_E2_resp_zcp <- file.path(folder_lmm, "E2_Resp_lmm_zcp.RData")
# fit the zcp model
if (!file.exists(file_E2_resp_zcp)) {
glmm_E2_resp_zcp <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(Cue_C + Con_C + Ali_C + Sam_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam +
Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam +
Pro_C +
Cue_Pro + Con_Pro + Ali_Pro + Sam_Pro +
Cue_Con_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Ali_Pro + Con_Sam_Pro + Ali_Sam_Pro +
Cue_Con_Ali_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Con_Ali_Sam_Pro +
Cue_Con_Ali_Sam_Pro || Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_zcp, file = file_E2_resp_zcp)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam + Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Con_Pro + Ali_Pro + Sam_Pro + Cue_Con_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Ali_Pro + Con_Sam_Pro + Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Con_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 39518.4 40070.1 -19695.2 39390.4 40896
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -10.0859 -0.5478 0.1864 0.5144 6.1841
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 7.235e-02 2.690e-01
## Participant.1 Cue_C 1.301e-01 3.606e-01
## Participant.2 Con_C 5.310e-03 7.287e-02
## Participant.3 Ali_C 3.194e-02 1.787e-01
## Participant.4 Sam_C 2.027e-01 4.502e-01
## Participant.5 Cue_Con 8.565e-04 2.927e-02
## Participant.6 Cue_Ali 3.749e-02 1.936e-01
## Participant.7 Cue_Sam 5.871e-01 7.662e-01
## Participant.8 Con_Ali 0.000e+00 0.000e+00
## Participant.9 Con_Sam 3.870e-01 6.221e-01
## Participant.10 Ali_Sam 0.000e+00 0.000e+00
## Participant.11 Cue_Con_Ali 0.000e+00 0.000e+00
## Participant.12 Cue_Con_Sam 1.168e+00 1.081e+00
## Participant.13 Cue_Ali_Sam 3.098e-09 5.566e-05
## Participant.14 Con_Ali_Sam 1.058e-01 3.253e-01
## Participant.15 Cue_Con_Ali_Sam 7.473e-02 2.734e-01
## Participant.16 Pro_C 5.746e-02 2.397e-01
## Participant.17 Cue_Pro 4.125e-01 6.422e-01
## Participant.18 Con_Pro 1.446e-03 3.803e-02
## Participant.19 Ali_Pro 2.664e-03 5.161e-02
## Participant.20 Sam_Pro 4.237e-02 2.058e-01
## Participant.21 Cue_Con_Pro 1.238e-10 1.113e-05
## Participant.22 Cue_Ali_Pro 5.495e-02 2.344e-01
## Participant.23 Cue_Sam_Pro 1.568e+00 1.252e+00
## Participant.24 Con_Ali_Pro 4.282e-08 2.069e-04
## Participant.25 Con_Sam_Pro 1.252e-01 3.538e-01
## Participant.26 Ali_Sam_Pro 0.000e+00 0.000e+00
## Participant.27 Cue_Con_Ali_Pro 1.121e-10 1.059e-05
## Participant.28 Cue_Con_Sam_Pro 2.502e+00 1.582e+00
## Participant.29 Cue_Ali_Sam_Pro 7.879e-02 2.807e-01
## Participant.30 Con_Ali_Sam_Pro 0.000e+00 0.000e+00
## Participant.31 Cue_Con_Ali_Sam_Pro 7.265e-02 2.695e-01
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.167240 0.096271 12.125 < 2e-16 ***
## Cuebottom 0.136779 0.120487 1.135 0.256284
## Congruencyincongruent -0.924275 0.090843 -10.174 < 2e-16 ***
## Alignmentmisaligned -0.162074 0.064753 -2.503 0.012316 *
## SameDifferentdifferent -2.085094 0.139008 -15.000 < 2e-16 ***
## Probability2-1 0.504956 0.127782 3.952 7.76e-05 ***
## Cuebottom:Congruencyincongruent 0.078762 0.120912 0.651 0.514790
## Cuebottom:Alignmentmisaligned -0.004857 0.082901 -0.059 0.953278
## Congruencyincongruent:Alignmentmisaligned 0.528911 0.075136 7.039 1.93e-12 ***
## Cuebottom:SameDifferentdifferent 0.141044 0.183222 0.770 0.441419
## Congruencyincongruent:SameDifferentdifferent 1.488729 0.164982 9.024 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.310225 0.076795 4.040 5.35e-05 ***
## Cuebottom:Probability2-1 -0.809106 0.211692 -3.822 0.000132 ***
## Congruencyincongruent:Probability2-1 0.111238 0.126787 0.877 0.380289
## Alignmentmisaligned:Probability2-1 -0.063634 0.107096 -0.594 0.552396
## SameDifferentdifferent:Probability2-1 -0.791074 0.177872 -4.447 8.69e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.318486 0.100998 -3.153 0.001614 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.221842 0.217551 -1.020 0.307860
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.122133 0.102062 -1.197 0.231440
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.813040 0.112991 -7.196 6.22e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.429262 0.203762 -2.107 0.035145 *
## Cuebottom:Alignmentmisaligned:Probability2-1 0.040635 0.158902 0.256 0.798162
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.118865 0.138386 0.859 0.390376
## Cuebottom:SameDifferentdifferent:Probability2-1 1.359361 0.309491 4.392 1.12e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.262296 0.208444 -1.258 0.208266
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.171116 0.144253 1.186 0.235533
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.600009 0.141603 4.237 2.26e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.146778 0.199783 -0.735 0.462528
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.778487 0.347609 2.240 0.025120 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.135719 0.209018 -0.649 0.516132
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.291421 0.192026 -1.518 0.129112
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.441127 0.274619 1.606 0.108203
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_resp_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32]
## Standard deviation 1.582 1.2521 1.0807 0.76621 0.64223 0.62211 0.45022 0.36064 0.35380 0.3253 0.2807 0.27336 0.26953 0.26898 0.23971 0.23442 0.20585 0.19362 0.17872 0.07287 0.05161 0.03803 0.02927 0.0002069 5.566e-05 1.113e-05 1.059e-05 1.58e-16 1.58e-16 1.58e-16 1.58e-16 1.58e-16
## Proportion of Variance 0.324 0.2031 0.1513 0.07604 0.05342 0.05013 0.02625 0.01685 0.01621 0.0137 0.0102 0.00968 0.00941 0.00937 0.00744 0.00712 0.00549 0.00486 0.00414 0.00069 0.00035 0.00019 0.00011 0.0000000 0.000e+00 0.000e+00 0.000e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
## Cumulative Proportion 0.324 0.5271 0.6784 0.75440 0.80782 0.85795 0.88420 0.90105 0.91726 0.9310 0.9412 0.95085 0.96026 0.96963 0.97707 0.98419 0.98968 0.99453 0.99867 0.99936 0.99970 0.99989 1.00000 1.0000000 1.000e+00 1.000e+00 1.000e+00 1.00e+00 1.00e+00 1.00e+00 1.00e+00 1.00e+00
Con_Ali
, Ali_Sam
, Cue_Con_Ali
,
Ali_Sam_Pro
, Con_Ali_Sam_Pro
,
Cue_Con_Pro
, Cue_Con_Ali_Pro
,
Cue_Ali_Sam
, Con_Ali_Pro
,
Cue_Con
, Con_C
, Con_Pro
, and
Ali_Pro
were removed from extended model
(glmm_E2_resp_zcp
) due to that the variances they explained
were smaller than 0.1%, making glmm_E2_resp_rdc
.
file_E2_resp_rdc <- file.path(folder_lmm, "E2_Resp_lmm_rdc.RData")
# fit the rdc model
if (!file.exists(file_E2_resp_rdc)) {
glmm_E2_resp_rdc <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(Cue_C + Ali_C + Sam_C + # Con_C +
Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con +
Cue_Con_Sam + Con_Ali_Sam + # Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam +
Pro_C +
Cue_Pro + Sam_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro +
Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro +
Cue_Con_Ali_Sam_Pro || Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_rdc, file = file_E2_resp_rdc)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Ali_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 39499.3 39938.9 -19698.6 39397.3 40909
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -10.0280 -0.5442 0.1864 0.5132 6.4343
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.07191 0.2682
## Participant.1 Cue_C 0.12974 0.3602
## Participant.2 Ali_C 0.03200 0.1789
## Participant.3 Sam_C 0.20136 0.4487
## Participant.4 Cue_Ali 0.03777 0.1943
## Participant.5 Cue_Sam 0.58652 0.7658
## Participant.6 Con_Sam 0.38686 0.6220
## Participant.7 Cue_Con_Sam 1.16357 1.0787
## Participant.8 Con_Ali_Sam 0.10664 0.3266
## Participant.9 Cue_Con_Ali_Sam 0.07529 0.2744
## Participant.10 Pro_C 0.05742 0.2396
## Participant.11 Cue_Pro 0.41100 0.6411
## Participant.12 Sam_Pro 0.04238 0.2059
## Participant.13 Cue_Ali_Pro 0.05527 0.2351
## Participant.14 Cue_Sam_Pro 1.56194 1.2498
## Participant.15 Con_Sam_Pro 0.12776 0.3574
## Participant.16 Cue_Con_Sam_Pro 2.51204 1.5849
## Participant.17 Cue_Ali_Sam_Pro 0.07806 0.2794
## Participant.18 Cue_Con_Ali_Sam_Pro 0.08202 0.2864
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.161577 0.095404 12.175 < 2e-16 ***
## Cuebottom 0.133927 0.119341 1.122 0.26177
## Congruencyincongruent -0.918154 0.089221 -10.291 < 2e-16 ***
## Alignmentmisaligned -0.161014 0.064543 -2.495 0.01261 *
## SameDifferentdifferent -2.080834 0.138032 -15.075 < 2e-16 ***
## Probability2-1 0.500358 0.124609 4.015 5.93e-05 ***
## Cuebottom:Congruencyincongruent 0.082352 0.119444 0.689 0.49053
## Cuebottom:Alignmentmisaligned -0.003579 0.082497 -0.043 0.96540
## Congruencyincongruent:Alignmentmisaligned 0.528746 0.074825 7.066 1.59e-12 ***
## Cuebottom:SameDifferentdifferent 0.144919 0.181197 0.800 0.42384
## Congruencyincongruent:SameDifferentdifferent 1.484702 0.163887 9.059 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.309695 0.076405 4.053 5.05e-05 ***
## Cuebottom:Probability2-1 -0.799695 0.205177 -3.898 9.72e-05 ***
## Congruencyincongruent:Probability2-1 0.115795 0.124101 0.933 0.35079
## Alignmentmisaligned:Probability2-1 -0.062760 0.104884 -0.598 0.54959
## SameDifferentdifferent:Probability2-1 -0.782907 0.172408 -4.541 5.60e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.320274 0.100435 -3.189 0.00143 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.227217 0.215256 -1.056 0.29117
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.123808 0.101420 -1.221 0.22218
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.813777 0.112578 -7.229 4.88e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.441175 0.198630 -2.221 0.02635 *
## Cuebottom:Alignmentmisaligned:Probability2-1 0.039556 0.155778 0.254 0.79955
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.118771 0.136061 0.873 0.38270
## Cuebottom:SameDifferentdifferent:Probability2-1 1.347036 0.298311 4.516 6.32e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.270481 0.204823 -1.321 0.18665
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.169703 0.141541 1.199 0.23054
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.602570 0.140816 4.279 1.88e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.146111 0.196348 -0.744 0.45679
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.792652 0.339792 2.333 0.01966 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.135063 0.204362 -0.661 0.50867
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.291600 0.188664 -1.546 0.12220
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.441772 0.269640 1.638 0.10134
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.0036263 (tol = 0.001, component 1)
file_E2_resp_rdc1 <- file.path(folder_lmm, "E2_Resp_lmm_rdc1.RData")
# fit the rdc1 model
if (!file.exists(file_E2_resp_rdc1)) {
ss <- getME(glmm_E2_resp_rdc, c("theta","fixef"))
glmm_E2_resp_rdc1 <- update(
glmm_E2_resp_rdc, start=ss,
control=glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
# save(glmm_E2_resp_rdc1, file = file_E2_resp_rdc1)
} else {
load(file_E2_resp_rdc1)
}
print(summary(glmm_E2_resp_rdc1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Ali_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 39499.3 39938.9 -19698.6 39397.3 40909
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -10.0280 -0.5442 0.1864 0.5132 6.4344
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.07191 0.2682
## Participant.1 Cue_C 0.12974 0.3602
## Participant.2 Ali_C 0.03200 0.1789
## Participant.3 Sam_C 0.20136 0.4487
## Participant.4 Cue_Ali 0.03777 0.1943
## Participant.5 Cue_Sam 0.58652 0.7658
## Participant.6 Con_Sam 0.38689 0.6220
## Participant.7 Cue_Con_Sam 1.16352 1.0787
## Participant.8 Con_Ali_Sam 0.10663 0.3265
## Participant.9 Cue_Con_Ali_Sam 0.07532 0.2744
## Participant.10 Pro_C 0.05742 0.2396
## Participant.11 Cue_Pro 0.41100 0.6411
## Participant.12 Sam_Pro 0.04238 0.2059
## Participant.13 Cue_Ali_Pro 0.05528 0.2351
## Participant.14 Cue_Sam_Pro 1.56195 1.2498
## Participant.15 Con_Sam_Pro 0.12775 0.3574
## Participant.16 Cue_Con_Sam_Pro 2.51212 1.5850
## Participant.17 Cue_Ali_Sam_Pro 0.07809 0.2795
## Participant.18 Cue_Con_Ali_Sam_Pro 0.08224 0.2868
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.161644 0.095789 12.127 < 2e-16 ***
## Cuebottom 0.133884 0.119940 1.116 0.264310
## Congruencyincongruent -0.918241 0.089631 -10.245 < 2e-16 ***
## Alignmentmisaligned -0.161054 0.064846 -2.484 0.013005 *
## SameDifferentdifferent -2.080951 0.138735 -14.999 < 2e-16 ***
## Probability2-1 0.500269 0.126476 3.955 7.64e-05 ***
## Cuebottom:Congruencyincongruent 0.082398 0.120225 0.685 0.493116
## Cuebottom:Alignmentmisaligned -0.003555 0.082858 -0.043 0.965777
## Congruencyincongruent:Alignmentmisaligned 0.528811 0.075317 7.021 2.20e-12 ***
## Cuebottom:SameDifferentdifferent 0.145001 0.182228 0.796 0.426201
## Congruencyincongruent:SameDifferentdifferent 1.484846 0.164570 9.023 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.309744 0.076963 4.025 5.71e-05 ***
## Cuebottom:Probability2-1 -0.799515 0.208879 -3.828 0.000129 ***
## Congruencyincongruent:Probability2-1 0.115955 0.125358 0.925 0.354972
## Alignmentmisaligned:Probability2-1 -0.062710 0.106376 -0.590 0.555521
## SameDifferentdifferent:Probability2-1 -0.782734 0.175982 -4.448 8.68e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.320322 0.101029 -3.171 0.001521 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.227313 0.216593 -1.049 0.293950
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.123835 0.102075 -1.213 0.225065
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.813867 0.113356 -7.180 6.98e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.441463 0.201487 -2.191 0.028450 *
## Cuebottom:Alignmentmisaligned:Probability2-1 0.039470 0.158284 0.249 0.803082
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.118690 0.138420 0.857 0.391191
## Cuebottom:SameDifferentdifferent:Probability2-1 1.346692 0.304851 4.418 9.98e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.270748 0.207217 -1.307 0.191353
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.169636 0.144319 1.175 0.239825
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.602634 0.141749 4.251 2.12e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.145973 0.200610 -0.728 0.466829
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.793152 0.344651 2.301 0.021374 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.134931 0.208670 -0.647 0.517875
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.291497 0.193049 -1.510 0.131053
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.441598 0.276719 1.596 0.110525
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00152842 (tol = 0.001, component 1)
Ali_C
was further removed.
file_E2_resp_rdc2 <- file.path(folder_lmm, "E2_Resp_lmm_rdc2.RData")
# fit the rdc2 model
if (!file.exists(file_E2_resp_rdc2)) {
glmm_E2_resp_rdc2 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(Cue_C + Sam_C + # Con_C + Ali_C +
Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con +
Cue_Con_Sam + Con_Ali_Sam + # Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam +
Pro_C +
Cue_Pro + Sam_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro +
Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro +
Cue_Con_Ali_Sam_Pro || Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_rdc2, file = file_E2_resp_rdc2)
} else {
load(file_E2_resp_rdc2)
}
print(summary(glmm_E2_resp_rdc2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 39575.2 40006.3 -19737.6 39475.2 40910
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -10.6455 -0.5528 0.1967 0.5113 5.7139
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.07145 0.2673
## Participant.1 Cue_C 0.12947 0.3598
## Participant.2 Sam_C 0.19931 0.4464
## Participant.3 Cue_Ali 0.04192 0.2047
## Participant.4 Cue_Sam 0.58683 0.7660
## Participant.5 Con_Sam 0.38364 0.6194
## Participant.6 Cue_Con_Sam 1.15766 1.0759
## Participant.7 Con_Ali_Sam 0.10035 0.3168
## Participant.8 Cue_Con_Ali_Sam 0.07774 0.2788
## Participant.9 Pro_C 0.05713 0.2390
## Participant.10 Cue_Pro 0.40833 0.6390
## Participant.11 Sam_Pro 0.04196 0.2048
## Participant.12 Cue_Ali_Pro 0.10085 0.3176
## Participant.13 Cue_Sam_Pro 1.54889 1.2445
## Participant.14 Con_Sam_Pro 0.12625 0.3553
## Participant.15 Cue_Con_Sam_Pro 2.48434 1.5762
## Participant.16 Cue_Ali_Sam_Pro 0.08956 0.2993
## Participant.17 Cue_Con_Ali_Sam_Pro 0.09184 0.3030
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.164756 0.093859 12.410 < 2e-16 ***
## Cuebottom 0.133595 0.119396 1.119 0.26317
## Congruencyincongruent -0.919451 0.088659 -10.371 < 2e-16 ***
## Alignmentmisaligned -0.175552 0.056182 -3.125 0.00178 **
## SameDifferentdifferent -2.082488 0.137486 -15.147 < 2e-16 ***
## Probability2-1 0.504191 0.124335 4.055 5.01e-05 ***
## Cuebottom:Congruencyincongruent 0.082452 0.119261 0.691 0.48934
## Cuebottom:Alignmentmisaligned -0.002788 0.083158 -0.034 0.97325
## Congruencyincongruent:Alignmentmisaligned 0.535632 0.074313 7.208 5.69e-13 ***
## Cuebottom:SameDifferentdifferent 0.144981 0.180905 0.801 0.42289
## Congruencyincongruent:SameDifferentdifferent 1.484362 0.162668 9.125 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.327358 0.075751 4.322 1.55e-05 ***
## Cuebottom:Probability2-1 -0.800391 0.204913 -3.906 9.38e-05 ***
## Congruencyincongruent:Probability2-1 0.113429 0.123145 0.921 0.35699
## Alignmentmisaligned:Probability2-1 -0.071931 0.106629 -0.675 0.49994
## SameDifferentdifferent:Probability2-1 -0.786107 0.171382 -4.587 4.50e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.319841 0.100426 -3.185 0.00145 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.226218 0.214466 -1.055 0.29152
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.126699 0.101285 -1.251 0.21097
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.820362 0.111485 -7.358 1.86e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.441981 0.197312 -2.240 0.02509 *
## Cuebottom:Alignmentmisaligned:Probability2-1 0.041045 0.160452 0.256 0.79810
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.120043 0.136301 0.881 0.37847
## Cuebottom:SameDifferentdifferent:Probability2-1 1.351061 0.297076 4.548 5.42e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.270287 0.202271 -1.336 0.18146
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.179901 0.141997 1.267 0.20518
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.601164 0.140948 4.265 2.00e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.134248 0.196907 -0.682 0.49538
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.790854 0.336433 2.351 0.01874 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.144169 0.205911 -0.700 0.48383
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.284773 0.188893 -1.508 0.13166
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.426096 0.270915 1.573 0.11576
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E2_resp_etd <- file.path(folder_lmm, "E2_Resp_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_E2_resp_etd)) {
glmm_E2_resp_etd <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(Cue_C + Sam_C + # Con_C + Ali_C +
Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con +
Cue_Con_Sam + Con_Ali_Sam + # Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam +
Pro_C +
Cue_Pro + Sam_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro +
Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro +
Cue_Con_Ali_Sam_Pro | Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_etd, file = file_E2_resp_etd)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 39642.9 41392.8 -19618.4 39236.9 40757
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -11.1243 -0.5461 0.1847 0.5087 5.4164
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.07234 0.2690
## Cue_C 0.13027 0.3609 -0.24
## Sam_C 0.19650 0.4433 -0.28 -0.08
## Cue_Ali 0.04713 0.2171 -0.45 -0.06 0.48
## Cue_Sam 0.56720 0.7531 0.02 -0.05 0.11 -0.15
## Con_Sam 0.41210 0.6420 -0.02 -0.12 -0.12 -0.13 0.24
## Cue_Con_Sam 1.24842 1.1173 -0.07 -0.12 0.12 -0.11 0.93 0.34
## Con_Ali_Sam 0.12819 0.3580 0.03 0.24 0.36 0.22 0.40 -0.48 0.36
## Cue_Con_Ali_Sam 0.14618 0.3823 -0.20 -0.05 -0.38 0.11 -0.43 -0.04 -0.35 -0.33
## Pro_C 0.05618 0.2370 0.08 -0.06 -0.41 -0.25 0.01 0.56 0.15 -0.23 -0.06
## Cue_Pro 0.41443 0.6438 0.25 -0.35 -0.05 0.16 0.00 -0.01 -0.04 0.04 -0.29 0.17
## Sam_Pro 0.04925 0.2219 -0.10 0.66 -0.20 0.09 -0.17 -0.11 -0.19 0.11 -0.31 0.04 0.18
## Cue_Ali_Pro 0.10190 0.3192 -0.05 0.01 -0.04 -0.13 0.26 0.10 0.32 0.25 -0.16 0.08 -0.14 -0.04
## Cue_Sam_Pro 1.50213 1.2256 -0.10 0.37 -0.40 0.17 -0.22 -0.19 -0.13 -0.04 0.48 0.00 -0.07 0.24 -0.11
## Con_Sam_Pro 0.16649 0.4080 -0.37 0.28 0.11 0.42 0.20 0.01 0.29 0.41 0.36 -0.32 -0.45 0.01 0.30 0.34
## Cue_Con_Sam_Pro 2.68063 1.6373 -0.23 0.25 0.10 0.17 -0.07 0.55 -0.01 -0.26 0.25 0.04 -0.25 0.01 0.04 0.28 0.44
## Cue_Ali_Sam_Pro 0.30480 0.5521 -0.10 -0.02 0.10 -0.14 0.20 0.12 0.10 -0.08 0.10 0.18 -0.08 -0.57 -0.18 0.10 -0.18 0.19
## Cue_Con_Ali_Sam_Pro 1.29026 1.1359 0.39 -0.14 -0.27 -0.16 -0.02 -0.68 -0.14 0.27 -0.12 -0.37 0.48 0.19 0.05 0.05 -0.27 -0.70 -0.34
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.16378 0.09577 12.152 < 2e-16 ***
## Cuebottom 0.13693 0.08922 1.535 0.12482
## Congruencyincongruent -0.92047 0.09260 -9.940 < 2e-16 ***
## Alignmentmisaligned -0.17366 0.05836 -2.976 0.00292 **
## SameDifferentdifferent -2.08752 0.12560 -16.620 < 2e-16 ***
## Probability2-1 0.50859 0.11888 4.278 1.89e-05 ***
## Cuebottom:Congruencyincongruent 0.08571 0.12854 0.667 0.50489
## Cuebottom:Alignmentmisaligned -0.02252 0.08692 -0.259 0.79560
## Congruencyincongruent:Alignmentmisaligned 0.53997 0.08036 6.720 1.82e-11 ***
## Cuebottom:SameDifferentdifferent 0.14393 0.08868 1.623 0.10458
## Congruencyincongruent:SameDifferentdifferent 1.49226 0.17075 8.739 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.33908 0.08183 4.144 3.42e-05 ***
## Cuebottom:Probability2-1 -0.81784 0.20095 -4.070 4.70e-05 ***
## Congruencyincongruent:Probability2-1 0.10829 0.13738 0.788 0.43054
## Alignmentmisaligned:Probability2-1 -0.08277 0.12098 -0.684 0.49385
## SameDifferentdifferent:Probability2-1 -0.76710 0.17398 -4.409 1.04e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.31111 0.10459 -2.975 0.00293 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.23602 0.23437 -1.007 0.31393
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.11179 0.10543 -1.060 0.28900
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.84234 0.12582 -6.695 2.16e-11 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.43512 0.24535 -1.773 0.07615 .
## Cuebottom:Alignmentmisaligned:Probability2-1 0.05710 0.19223 0.297 0.76644
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.14020 0.15284 0.917 0.35897
## Cuebottom:SameDifferentdifferent:Probability2-1 1.33822 0.31295 4.276 1.90e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.28488 0.23036 -1.237 0.21621
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.16430 0.17149 0.958 0.33804
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.60574 0.15049 4.025 5.70e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.15098 0.23349 -0.647 0.51788
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.81564 0.43657 1.868 0.06172 .
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.12617 0.27134 -0.465 0.64192
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.27745 0.22776 -1.218 0.22316
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.40220 0.35575 1.131 0.25825
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_resp_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18]
## Standard deviation 1.9646 1.4686 1.1837 0.76286 0.68384 0.57853 0.48431 0.41992 0.30652 0.28379 0.24972 0.1799 0.14908 0.10023 0.01389 0.003311 0.0003458 7.185e-21
## Proportion of Variance 0.4057 0.2267 0.1473 0.06117 0.04915 0.03518 0.02465 0.01853 0.00987 0.00846 0.00655 0.0034 0.00234 0.00106 0.00002 0.000000 0.0000000 0.000e+00
## Cumulative Proportion 0.4057 0.6323 0.7796 0.84078 0.88993 0.92510 0.94976 0.96829 0.97816 0.98663 0.99318 0.9966 0.99892 0.99998 1.00000 1.000000 1.0000000 1.000e+00
Sam_Pro
, Cue_Ali
, Pro_C
,
Intercept
, Cue_Ali_Pro
,
Con_Ali_Sam
, Cue_C
,
Cue_Con_Ali_Sam
, Con_Sam_Pro
, and
Sam_C
were removed from extended model
(glmm_E2_resp_etd
) due to that the variances they explained
were smaller than 1%, making glmm_E2_resp_etd1
.
file_E2_resp_etd1 <- file.path(folder_lmm, "E2_Resp_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E2_resp_etd1)) {
glmm_E2_resp_etd1 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(0 + # Con_C + Ali_C + Cue_C + Sam_C +
Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
# Cue_Con_Ali_Sam +
# Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro + Sam_Pro +
Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro +
Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro +
Cue_Con_Ali_Sam_Pro | Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_etd1, file = file_E2_resp_etd1)
} else {
load(file_E2_resp_etd1)
}
print(summary(glmm_E2_resp_etd1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 41926.0 42512.2 -20895.0 41790.0 40892
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.3720 -0.5860 0.2749 0.5384 3.5224
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.5906 0.7685
## Con_Sam 0.3907 0.6251 0.22
## Cue_Con_Sam 1.0738 1.0363 0.87 0.37
## Cue_Pro 0.4212 0.6490 -0.07 0.03 0.04
## Cue_Sam_Pro 2.5569 1.5990 -0.24 -0.09 -0.18 0.01
## Cue_Con_Sam_Pro 2.2046 1.4848 -0.01 0.57 -0.08 -0.10 0.19
## Cue_Ali_Sam_Pro 0.1210 0.3478 0.32 0.17 0.03 -0.05 0.16 0.40
## Cue_Con_Ali_Sam_Pro 0.6926 0.8322 -0.39 -0.56 -0.31 0.26 0.28 -0.72 -0.58
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.065368 0.047269 22.538 < 2e-16 ***
## Cuebottom 0.126927 0.062066 2.045 0.040851 *
## Congruencyincongruent -0.822358 0.073228 -11.230 < 2e-16 ***
## Alignmentmisaligned -0.162130 0.047841 -3.389 0.000702 ***
## SameDifferentdifferent -1.918752 0.079915 -24.010 < 2e-16 ***
## Probability2-1 0.463426 0.116323 3.984 6.78e-05 ***
## Cuebottom:Congruencyincongruent 0.057438 0.112941 0.509 0.611054
## Cuebottom:Alignmentmisaligned 0.006756 0.069246 0.098 0.922276
## Congruencyincongruent:Alignmentmisaligned 0.484561 0.064370 7.528 5.16e-14 ***
## Cuebottom:SameDifferentdifferent 0.123210 0.098882 1.246 0.212753
## Congruencyincongruent:SameDifferentdifferent 1.346494 0.130855 10.290 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.304934 0.065923 4.626 3.74e-06 ***
## Cuebottom:Probability2-1 -0.751581 0.212449 -3.538 0.000404 ***
## Congruencyincongruent:Probability2-1 0.105583 0.121221 0.871 0.383757
## Alignmentmisaligned:Probability2-1 -0.070257 0.100458 -0.699 0.484326
## SameDifferentdifferent:Probability2-1 -0.761049 0.184328 -4.129 3.65e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.288252 0.092384 -3.120 0.001808 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.178150 0.204170 -0.873 0.382906
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.131320 0.093467 -1.405 0.160024
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.754975 0.089568 -8.429 < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.400302 0.206614 -1.937 0.052692 .
## Cuebottom:Alignmentmisaligned:Probability2-1 0.030144 0.151694 0.199 0.842484
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.107291 0.134283 0.799 0.424297
## Cuebottom:SameDifferentdifferent:Probability2-1 1.303589 0.343517 3.795 0.000148 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.239896 0.203854 -1.177 0.239274
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.177388 0.145468 1.219 0.222681
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.556425 0.126888 4.385 1.16e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.120176 0.199616 -0.602 0.547151
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.727077 0.365982 1.987 0.046962 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.134409 0.224072 -0.600 0.548606
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.259861 0.194882 -1.333 0.182392
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.401627 0.296117 1.356 0.175000
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_resp_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 1.735 1.6457 1.1942 0.6756 0.49154 0.36189 0.27765 1.039e-05
## Proportion of Variance 0.374 0.3364 0.1771 0.0567 0.03001 0.01627 0.00957 0.000e+00
## Cumulative Proportion 0.374 0.7103 0.8874 0.9442 0.97416 0.99043 1.00000 1.000e+00
Cue_Ali_Sam_Pro
, and Con_Sam
were removed
from extended model (glmm_E2_resp_etd1
) due to that the
variances they explained were smaller than 1%, making
glmm_E2_resp_etd2
.
file_E2_resp_etd2 <- file.path(folder_lmm, "E2_Resp_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_E2_resp_etd2)) {
glmm_E2_resp_etd2 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(0 + # Con_C + Ali_C + Cue_C + Sam_C +
Cue_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
# Cue_Con_Ali_Sam +
# Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro + Sam_Pro +
Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro +
Cue_Con_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Ali_Sam_Pro +
Cue_Con_Ali_Sam_Pro | Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_etd2, file = file_E2_resp_etd2)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro + Cue_Con_Ali_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 42204.6 42661.5 -21049.3 42098.6 40907
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.7184 -0.6074 0.2827 0.5353 4.0992
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.5933 0.7702
## Cue_Con_Sam 1.1571 1.0757 0.87
## Cue_Pro 0.4151 0.6443 -0.08 0.03
## Cue_Sam_Pro 2.5745 1.6045 -0.25 -0.18 0.01
## Cue_Con_Sam_Pro 1.7821 1.3349 -0.20 -0.41 -0.10 0.27
## Cue_Con_Ali_Sam_Pro 0.3644 0.6037 -0.49 -0.45 0.40 0.42 -0.38
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.05243 0.03888 27.070 < 2e-16 ***
## Cuebottom 0.11590 0.06142 1.887 0.059138 .
## Congruencyincongruent -0.80308 0.06609 -12.151 < 2e-16 ***
## Alignmentmisaligned -0.15843 0.04741 -3.341 0.000833 ***
## SameDifferentdifferent -1.89558 0.05949 -31.862 < 2e-16 ***
## Probability2-1 0.48478 0.11363 4.266 1.99e-05 ***
## Cuebottom:Congruencyincongruent 0.06424 0.11584 0.555 0.579230
## Cuebottom:Alignmentmisaligned 0.01383 0.06842 0.202 0.839856
## Congruencyincongruent:Alignmentmisaligned 0.48017 0.06396 7.508 6.02e-14 ***
## Cuebottom:SameDifferentdifferent 0.13255 0.09821 1.350 0.177113
## Congruencyincongruent:SameDifferentdifferent 1.30716 0.11474 11.392 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.30055 0.06536 4.599 4.25e-06 ***
## Cuebottom:Probability2-1 -0.81512 0.20646 -3.948 7.88e-05 ***
## Congruencyincongruent:Probability2-1 0.07572 0.11354 0.667 0.504852
## Alignmentmisaligned:Probability2-1 -0.08504 0.09628 -0.883 0.377094
## SameDifferentdifferent:Probability2-1 -0.80384 0.17693 -4.543 5.54e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.29510 0.09145 -3.227 0.001251 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.17733 0.21100 -0.840 0.400663
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13908 0.09256 -1.503 0.132953
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.74693 0.08906 -8.387 < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.31900 0.18803 -1.697 0.089788 .
## Cuebottom:Alignmentmisaligned:Probability2-1 0.06144 0.14100 0.436 0.663031
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.12029 0.13133 0.916 0.359701
## Cuebottom:SameDifferentdifferent:Probability2-1 1.39844 0.32765 4.268 1.97e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.17425 0.18472 -0.943 0.345528
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.20587 0.13419 1.534 0.124989
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.55866 0.12589 4.438 9.09e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.14669 0.19247 -0.762 0.445969
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.59352 0.32247 1.841 0.065690 .
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.18205 0.19499 -0.934 0.350503
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.28687 0.18706 -1.534 0.125135
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.44075 0.27631 1.595 0.110683
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.00161086 (tol = 0.001, component 1)
file_E2_resp_etd3 <- file.path(folder_lmm, "E2_Resp_lmm_etd3.RData")
# fit the etd3 model
if (!file.exists(file_E2_resp_etd3)) {
ss <- getME(glmm_E2_resp_etd2, c("theta","fixef"))
glmm_E2_resp_etd3 <- update(
glmm_E2_resp_etd2, start=ss,
control=glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
# save(glmm_E2_resp_etd3, file = file_E2_resp_etd3)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro + Cue_Con_Ali_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 42204.6 42661.5 -21049.3 42098.6 40907
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.7184 -0.6074 0.2827 0.5353 4.0992
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.5932 0.7702
## Cue_Con_Sam 1.1569 1.0756 0.87
## Cue_Pro 0.4151 0.6443 -0.08 0.03
## Cue_Sam_Pro 2.5747 1.6046 -0.25 -0.18 0.01
## Cue_Con_Sam_Pro 1.7820 1.3349 -0.20 -0.41 -0.10 0.27
## Cue_Con_Ali_Sam_Pro 0.3644 0.6036 -0.49 -0.45 0.40 0.42 -0.38
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.05243 0.03867 27.213 < 2e-16 ***
## Cuebottom 0.11590 0.06120 1.894 0.058249 .
## Congruencyincongruent -0.80308 0.06549 -12.263 < 2e-16 ***
## Alignmentmisaligned -0.15843 0.04723 -3.354 0.000795 ***
## SameDifferentdifferent -1.89558 0.05906 -32.098 < 2e-16 ***
## Probability2-1 0.48478 0.11188 4.333 1.47e-05 ***
## Cuebottom:Congruencyincongruent 0.06424 0.11484 0.559 0.575917
## Cuebottom:Alignmentmisaligned 0.01383 0.06823 0.203 0.839430
## Congruencyincongruent:Alignmentmisaligned 0.48017 0.06363 7.546 4.47e-14 ***
## Cuebottom:SameDifferentdifferent 0.13255 0.09775 1.356 0.175109
## Congruencyincongruent:SameDifferentdifferent 1.30716 0.11366 11.501 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.30055 0.06492 4.630 3.66e-06 ***
## Cuebottom:Probability2-1 -0.81512 0.20305 -4.014 5.96e-05 ***
## Congruencyincongruent:Probability2-1 0.07572 0.11037 0.686 0.492703
## Alignmentmisaligned:Probability2-1 -0.08504 0.09467 -0.898 0.368998
## SameDifferentdifferent:Probability2-1 -0.80384 0.17290 -4.649 3.34e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.29510 0.09113 -3.238 0.001202 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.17733 0.20925 -0.847 0.396728
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13908 0.09211 -1.510 0.131055
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.74693 0.08833 -8.457 < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.31900 0.18157 -1.757 0.078940 .
## Cuebottom:Alignmentmisaligned:Probability2-1 0.06144 0.13778 0.446 0.655674
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.12029 0.12891 0.933 0.350730
## Cuebottom:SameDifferentdifferent:Probability2-1 1.39844 0.32002 4.370 1.24e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.17425 0.17857 -0.976 0.329167
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.20587 0.13109 1.570 0.116314
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.55866 0.12517 4.463 8.07e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.14669 0.18728 -0.783 0.433455
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.59352 0.31060 1.911 0.056024 .
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.18205 0.18920 -0.962 0.335966
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.28687 0.18205 -1.576 0.115074
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.44075 0.26661 1.653 0.098299 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.0021675 (tol = 0.001, component 1)
summary(rePCA(glmm_E2_resp_etd3))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6]
## Standard deviation 1.7897 1.3385 1.1614 0.65483 0.33749 0.0001623
## Proportion of Variance 0.4652 0.2602 0.1959 0.06227 0.01654 0.0000000
## Cumulative Proportion 0.4652 0.7253 0.9212 0.98346 1.00000 1.0000000
Cue_Con_Ali_Sam_Pro
was removed from extended model
(glmm_E2_resp_etd3
) due to that the variances it explained
were smaller than 1%, making glmm_E2_resp_etd4
.
file_E2_resp_etd4 <- file.path(folder_lmm, "E2_Resp_lmm_etd4.RData")
# fit the etd4 model
if (!file.exists(file_E2_resp_etd4)) {
glmm_E2_resp_etd4 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(0 + # Con_C + Ali_C + Cue_C + Sam_C +
Cue_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
# Cue_Con_Ali_Sam +
# Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro + Sam_Pro +
Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro +
Cue_Con_Sam_Pro # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Ali_Sam_Pro + + Cue_Con_Ali_Sam_Pro
| Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_etd4, file = file_E2_resp_etd4)
} else {
load(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: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 42198.4 42603.6 -21052.2 42104.4 40913
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.4599 -0.6086 0.2839 0.5376 4.0136
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.5939 0.7707
## Cue_Con_Sam 1.1556 1.0750 0.87
## Cue_Pro 0.4156 0.6447 -0.08 0.03
## Cue_Sam_Pro 2.5692 1.6029 -0.24 -0.18 0.01
## Cue_Con_Sam_Pro 1.7694 1.3302 -0.20 -0.41 -0.10 0.27
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.05176 0.03874 27.147 < 2e-16 ***
## Cuebottom 0.11557 0.06129 1.886 0.059347 .
## Congruencyincongruent -0.80278 0.06584 -12.194 < 2e-16 ***
## Alignmentmisaligned -0.15744 0.04727 -3.331 0.000866 ***
## SameDifferentdifferent -1.89315 0.05924 -31.959 < 2e-16 ***
## Probability2-1 0.48388 0.11091 4.363 1.29e-05 ***
## Cuebottom:Congruencyincongruent 0.06502 0.11547 0.563 0.573373
## Cuebottom:Alignmentmisaligned 0.01428 0.06836 0.209 0.834536
## Congruencyincongruent:Alignmentmisaligned 0.47993 0.06375 7.528 5.15e-14 ***
## Cuebottom:SameDifferentdifferent 0.13278 0.09793 1.356 0.175151
## Congruencyincongruent:SameDifferentdifferent 1.30486 0.11430 11.416 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.29666 0.06509 4.557 5.18e-06 ***
## Cuebottom:Probability2-1 -0.81193 0.20047 -4.050 5.12e-05 ***
## Congruencyincongruent:Probability2-1 0.07495 0.10841 0.691 0.489322
## Alignmentmisaligned:Probability2-1 -0.08376 0.09446 -0.887 0.375222
## SameDifferentdifferent:Probability2-1 -0.80115 0.16663 -4.808 1.52e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.29665 0.09133 -3.248 0.001161 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.17822 0.21033 -0.847 0.396810
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13962 0.09237 -1.512 0.130648
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.74289 0.08870 -8.375 < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.32117 0.17589 -1.826 0.067853 .
## Cuebottom:Alignmentmisaligned:Probability2-1 0.05622 0.13651 0.412 0.680441
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.12276 0.12730 0.964 0.334893
## Cuebottom:SameDifferentdifferent:Probability2-1 1.39232 0.30536 4.560 5.13e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.17475 0.17314 -1.009 0.312836
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.20194 0.13008 1.552 0.120579
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.56031 0.12553 4.464 8.06e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.14297 0.18228 -0.784 0.432829
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.59909 0.29614 2.023 0.043073 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.17184 0.18454 -0.931 0.351765
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.28785 0.17724 -1.624 0.104364
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.43092 0.25103 1.717 0.086052 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00120721 (tol = 0.001, component 1)
file_E2_resp_etd5 <- file.path(folder_lmm, "E2_Resp_lmm_etd5.RData")
# fit the etd5 model
if (!file.exists(file_E2_resp_etd5)) {
ss <- getME(glmm_E2_resp_etd4, c("theta","fixef"))
glmm_E2_resp_etd5 <- update(
glmm_E2_resp_etd4, start=ss,
control=glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
# save(glmm_E2_resp_etd5, file = file_E2_resp_etd5)
} else {
load(file_E2_resp_etd5)
}
print(summary(glmm_E2_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 42198.4 42603.6 -21052.2 42104.4 40913
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.4599 -0.6086 0.2839 0.5376 4.0135
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.5939 0.7706
## Cue_Con_Sam 1.1554 1.0749 0.87
## Cue_Pro 0.4156 0.6447 -0.08 0.03
## Cue_Sam_Pro 2.5695 1.6030 -0.24 -0.18 0.01
## Cue_Con_Sam_Pro 1.7693 1.3301 -0.20 -0.41 -0.10 0.27
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.05176 0.03854 27.292 < 2e-16 ***
## Cuebottom 0.11557 0.06102 1.894 0.058249 .
## Congruencyincongruent -0.80278 0.06508 -12.335 < 2e-16 ***
## Alignmentmisaligned -0.15744 0.04701 -3.349 0.000811 ***
## SameDifferentdifferent -1.89315 0.05884 -32.174 < 2e-16 ***
## Probability2-1 0.48388 0.10960 4.415 1.01e-05 ***
## Cuebottom:Congruencyincongruent 0.06502 0.11415 0.570 0.568940
## Cuebottom:Alignmentmisaligned 0.01428 0.06802 0.210 0.833708
## Congruencyincongruent:Alignmentmisaligned 0.47993 0.06335 7.575 3.59e-14 ***
## Cuebottom:SameDifferentdifferent 0.13278 0.09748 1.362 0.173169
## Congruencyincongruent:SameDifferentdifferent 1.30486 0.11274 11.574 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.29666 0.06459 4.593 4.37e-06 ***
## Cuebottom:Probability2-1 -0.81193 0.19808 -4.099 4.15e-05 ***
## Congruencyincongruent:Probability2-1 0.07495 0.10658 0.703 0.481910
## Alignmentmisaligned:Probability2-1 -0.08376 0.09347 -0.896 0.370187
## SameDifferentdifferent:Probability2-1 -0.80115 0.16416 -4.880 1.06e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.29665 0.09088 -3.264 0.001097 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.17822 0.20761 -0.858 0.390652
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.13962 0.09178 -1.521 0.128201
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.74289 0.08792 -8.449 < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.32117 0.17252 -1.862 0.062657 .
## Cuebottom:Alignmentmisaligned:Probability2-1 0.05622 0.13463 0.418 0.676239
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.12276 0.12586 0.975 0.329387
## Cuebottom:SameDifferentdifferent:Probability2-1 1.39232 0.30097 4.626 3.73e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.17475 0.16950 -1.031 0.302554
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.20194 0.12814 1.576 0.115048
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.56031 0.12472 4.492 7.04e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.14297 0.17941 -0.797 0.425519
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.59909 0.28969 2.068 0.038635 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.17184 0.18106 -0.949 0.342595
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.28785 0.17427 -1.652 0.098582 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.43092 0.24538 1.756 0.079067 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.00217891 (tol = 0.001, component 1)
summary(rePCA(glmm_E2_resp_etd5))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5]
## Standard deviation 1.7783 1.3185 1.0569 0.64072 0.27414
## Proportion of Variance 0.4862 0.2673 0.1718 0.06312 0.01156
## Cumulative Proportion 0.4862 0.7536 0.9253 0.98844 1.00000
Cue_Pro
was removed from extended model
(glmm_E2_resp_etd5
) due to that the variances it explained
were smaller than 1%, making glmm_E2_resp_etd6
.
file_E2_resp_etd6 <- file.path(folder_lmm, "E2_Resp_lmm_etd6.RData")
# fit the etd6 model
if (!file.exists(file_E2_resp_etd6)) {
glmm_E2_resp_etd6 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +
(0 + # Con_C + Ali_C + Cue_C + Sam_C +
Cue_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
# Cue_Con_Ali_Sam +
# Pro_C +
# Con_Pro + Ali_Pro + Sam_Pro + Cue_Pro +
Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro +
Cue_Con_Sam_Pro # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Ali_Sam_Pro + + Cue_Con_Ali_Sam_Pro
| Participant),
family = binomial(link = "probit"),
data = df_lmm_E2,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_resp_etd6, file = file_E2_resp_etd6)
} else {
load(file_E2_resp_etd6)
}
print(summary(glmm_E2_resp_etd6), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Cue_Con_Sam + Cue_Sam_Pro + Cue_Con_Sam_Pro | Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 42628.4 42990.5 -21272.2 42544.4 40918
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.3192 -0.6160 0.2881 0.5504 4.1087
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_Sam 0.5961 0.772
## Cue_Con_Sam 1.1423 1.069 0.86
## Cue_Sam_Pro 2.5914 1.610 -0.25 -0.18
## Cue_Con_Sam_Pro 1.8149 1.347 -0.18 -0.41 0.21
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.04400 0.03863 27.029 < 2e-16 ***
## Cuebottom 0.11384 0.06126 1.858 0.063141 .
## Congruencyincongruent -0.79866 0.06513 -12.262 < 2e-16 ***
## Alignmentmisaligned -0.15812 0.04699 -3.365 0.000765 ***
## SameDifferentdifferent -1.87894 0.05919 -31.744 < 2e-16 ***
## Probability2-1 0.46310 0.09769 4.740 2.13e-06 ***
## Cuebottom:Congruencyincongruent 0.06592 0.11428 0.577 0.564029
## Cuebottom:Alignmentmisaligned 0.01625 0.06793 0.239 0.810968
## Congruencyincongruent:Alignmentmisaligned 0.47686 0.06335 7.527 5.19e-14 ***
## Cuebottom:SameDifferentdifferent 0.13508 0.09819 1.376 0.168917
## Congruencyincongruent:SameDifferentdifferent 1.29626 0.11297 11.475 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.29716 0.06466 4.596 4.31e-06 ***
## Cuebottom:Probability2-1 -0.77821 0.17191 -4.527 5.98e-06 ***
## Congruencyincongruent:Probability2-1 0.09082 0.10744 0.845 0.397969
## Alignmentmisaligned:Probability2-1 -0.07939 0.09375 -0.847 0.397053
## SameDifferentdifferent:Probability2-1 -0.77253 0.16871 -4.579 4.67e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.29537 0.09070 -3.257 0.001127 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.17950 0.20809 -0.863 0.388349
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.14209 0.09169 -1.550 0.121211
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.73732 0.08801 -8.377 < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.34341 0.17504 -1.962 0.049775 *
## Cuebottom:Alignmentmisaligned:Probability2-1 0.05225 0.13589 0.384 0.700610
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.11591 0.12629 0.918 0.358716
## Cuebottom:SameDifferentdifferent:Probability2-1 1.33920 0.31121 4.303 1.68e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.18728 0.17154 -1.092 0.274955
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.19687 0.12910 1.525 0.127272
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.55742 0.12452 4.476 7.59e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.13464 0.18129 -0.743 0.457684
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.61845 0.29449 2.100 0.035722 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.16449 0.18352 -0.896 0.370076
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.28008 0.17539 -1.597 0.110295
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.41619 0.24859 1.674 0.094092 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00127145 (tol = 0.001, component 1)
# compare the extended and reduced model
anova(glmm_E2_resp_etd6, glmm_E2_resp_rdc2, refit = FALSE)
## Data: df_lmm_E2
## Models:
## glmm_E2_resp_etd6: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (0 + Cue_Sam + Cue_Con_Sam + Cue_Sam_Pro + Cue_Con_Sam_Pro | Participant)
## glmm_E2_resp_rdc2: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_E2_resp_etd6 42 42628 42990 -21272 42544
## glmm_E2_resp_rdc2 50 39575 40006 -19738 39475 3069.2 8 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (glmm_E2_resp_rdc2
)
explained the data better than the extended model
(glmm_resp_etd4
) and, therefore, the reduced model is used
as the optimal model.
glmm_E2_resp_opt <- glmm_E2_resp_rdc2
print(summary(glmm_E2_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
## Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 39575.2 40006.3 -19737.6 39475.2 40910
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -10.6455 -0.5528 0.1967 0.5113 5.7139
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.07145 0.2673
## Participant.1 Cue_C 0.12947 0.3598
## Participant.2 Sam_C 0.19931 0.4464
## Participant.3 Cue_Ali 0.04192 0.2047
## Participant.4 Cue_Sam 0.58683 0.7660
## Participant.5 Con_Sam 0.38364 0.6194
## Participant.6 Cue_Con_Sam 1.15766 1.0759
## Participant.7 Con_Ali_Sam 0.10035 0.3168
## Participant.8 Cue_Con_Ali_Sam 0.07774 0.2788
## Participant.9 Pro_C 0.05713 0.2390
## Participant.10 Cue_Pro 0.40833 0.6390
## Participant.11 Sam_Pro 0.04196 0.2048
## Participant.12 Cue_Ali_Pro 0.10085 0.3176
## Participant.13 Cue_Sam_Pro 1.54889 1.2445
## Participant.14 Con_Sam_Pro 0.12625 0.3553
## Participant.15 Cue_Con_Sam_Pro 2.48434 1.5762
## Participant.16 Cue_Ali_Sam_Pro 0.08956 0.2993
## Participant.17 Cue_Con_Ali_Sam_Pro 0.09184 0.3030
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.164756 0.093859 12.410 < 2e-16 ***
## Cuebottom 0.133595 0.119396 1.119 0.26317
## Congruencyincongruent -0.919451 0.088659 -10.371 < 2e-16 ***
## Alignmentmisaligned -0.175552 0.056182 -3.125 0.00178 **
## SameDifferentdifferent -2.082488 0.137486 -15.147 < 2e-16 ***
## Probability2-1 0.504191 0.124335 4.055 5.01e-05 ***
## Cuebottom:Congruencyincongruent 0.082452 0.119261 0.691 0.48934
## Cuebottom:Alignmentmisaligned -0.002788 0.083158 -0.034 0.97325
## Congruencyincongruent:Alignmentmisaligned 0.535632 0.074313 7.208 5.69e-13 ***
## Cuebottom:SameDifferentdifferent 0.144981 0.180905 0.801 0.42289
## Congruencyincongruent:SameDifferentdifferent 1.484362 0.162668 9.125 < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent 0.327358 0.075751 4.322 1.55e-05 ***
## Cuebottom:Probability2-1 -0.800391 0.204913 -3.906 9.38e-05 ***
## Congruencyincongruent:Probability2-1 0.113429 0.123145 0.921 0.35699
## Alignmentmisaligned:Probability2-1 -0.071931 0.106629 -0.675 0.49994
## SameDifferentdifferent:Probability2-1 -0.786107 0.171382 -4.587 4.50e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.319841 0.100426 -3.185 0.00145 **
## Cuebottom:Congruencyincongruent:SameDifferentdifferent -0.226218 0.214466 -1.055 0.29152
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent -0.126699 0.101285 -1.251 0.21097
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent -0.820362 0.111485 -7.358 1.86e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1 -0.441981 0.197312 -2.240 0.02509 *
## Cuebottom:Alignmentmisaligned:Probability2-1 0.041045 0.160452 0.256 0.79810
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 0.120043 0.136301 0.881 0.37847
## Cuebottom:SameDifferentdifferent:Probability2-1 1.351061 0.297076 4.548 5.42e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1 -0.270287 0.202271 -1.336 0.18146
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.179901 0.141997 1.267 0.20518
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent 0.601164 0.140948 4.265 2.00e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -0.134248 0.196907 -0.682 0.49538
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1 0.790854 0.336433 2.351 0.01874 *
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.144169 0.205911 -0.700 0.48383
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 -0.284773 0.188893 -1.508 0.13166
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1 0.426096 0.270915 1.573 0.11576
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(emm_E2_resp <- emmeans(glmm_E2_resp_opt, ~ Alignment + Congruency + Cue + SameDifferent + Probability))
## Alignment Congruency Cue SameDifferent Probability emmean SE df asymp.LCL asymp.UCL
## aligned congruent top same 0.25 0.9127 0.116 Inf 0.6844 1.1409
## misaligned congruent top same 0.25 0.7731 0.116 Inf 0.5464 0.9997
## aligned incongruent top same 0.25 -0.0635 0.113 Inf -0.2850 0.1580
## misaligned incongruent top same 0.25 0.2725 0.113 Inf 0.0501 0.4950
## aligned congruent bottom same 0.25 1.4465 0.109 Inf 1.2332 1.6597
## misaligned congruent bottom same 0.25 1.2836 0.107 Inf 1.0730 1.4941
## aligned incongruent bottom same 0.25 0.7737 0.106 Inf 0.5669 0.9805
## misaligned incongruent bottom same 0.25 0.8337 0.106 Inf 0.6264 1.0411
## aligned congruent top different 0.25 -0.7768 0.115 Inf -1.0027 -0.5508
## misaligned congruent top different 0.25 -0.6790 0.115 Inf -0.9035 -0.4544
## aligned incongruent top different 0.25 -0.1334 0.113 Inf -0.3543 0.0874
## misaligned incongruent top different 0.25 -0.2380 0.113 Inf -0.4589 -0.0171
## aligned congruent bottom different 0.25 -0.7735 0.105 Inf -0.9795 -0.5675
## misaligned congruent bottom different 0.25 -0.7536 0.105 Inf -0.9594 -0.5478
## aligned incongruent bottom different 0.25 -0.4484 0.105 Inf -0.6532 -0.2435
## misaligned incongruent bottom different 0.25 -0.4955 0.105 Inf -0.7004 -0.2906
## aligned congruent top same 0.75 1.4169 0.109 Inf 1.2041 1.6296
## misaligned congruent top same 0.75 1.2053 0.107 Inf 0.9955 1.4152
## aligned incongruent top same 0.75 0.5541 0.105 Inf 0.3492 0.7590
## misaligned incongruent top same 0.75 0.9383 0.106 Inf 0.7308 1.1457
## aligned congruent bottom same 0.75 1.1503 0.119 Inf 0.9166 1.3839
## misaligned congruent bottom same 0.75 0.9565 0.117 Inf 0.7274 1.1855
## aligned incongruent bottom same 0.75 0.1490 0.113 Inf -0.0728 0.3707
## misaligned incongruent bottom same 0.75 0.1639 0.113 Inf -0.0579 0.3857
## aligned congruent top different 0.75 -1.0587 0.106 Inf -1.2664 -0.8510
## misaligned congruent top different 0.75 -0.8529 0.105 Inf -1.0590 -0.6468
## aligned incongruent top different 0.75 -0.5722 0.105 Inf -0.7771 -0.3673
## misaligned incongruent top different 0.75 -0.7335 0.105 Inf -0.9392 -0.5278
## aligned congruent bottom different 0.75 -0.5048 0.113 Inf -0.7269 -0.2826
## misaligned congruent bottom different 0.75 -0.4800 0.113 Inf -0.7016 -0.2585
## aligned incongruent bottom different 0.75 0.0124 0.112 Inf -0.2081 0.2329
## misaligned incongruent bottom different 0.75 0.0973 0.113 Inf -0.1235 0.3180
##
## Results are given on the probit (not the response) scale.
## Confidence level used: 0.95
emm_E2_d <- contrast(emm_E2_resp, method = "pairwise", simple = "SameDifferent")
summary(emm_E2_d[1:16], infer = c(TRUE, FALSE), adjust = "none")
## contrast Alignment Congruency Cue Probability estimate SE df asymp.LCL asymp.UCL
## same - different aligned congruent top 0.25 1.6894 0.168 Inf 1.361 2.018
## same - different misaligned congruent top 0.25 1.4520 0.167 Inf 1.125 1.779
## same - different aligned incongruent top 0.25 0.0699 0.164 Inf -0.251 0.391
## same - different misaligned incongruent top 0.25 0.5105 0.164 Inf 0.189 0.832
## same - different aligned congruent bottom 0.25 2.2200 0.156 Inf 1.915 2.525
## same - different misaligned congruent bottom 0.25 2.0372 0.155 Inf 1.734 2.340
## same - different aligned incongruent bottom 0.25 1.2221 0.153 Inf 0.922 1.522
## same - different misaligned incongruent bottom 0.25 1.3292 0.153 Inf 1.029 1.629
## same - different aligned congruent top 0.75 2.4755 0.156 Inf 2.170 2.781
## same - different misaligned congruent top 0.75 2.0582 0.154 Inf 1.756 2.361
## same - different aligned incongruent top 0.75 1.1263 0.152 Inf 0.828 1.425
## same - different misaligned incongruent top 0.75 1.6718 0.154 Inf 1.371 1.973
## same - different aligned congruent bottom 0.75 1.6550 0.169 Inf 1.325 1.985
## same - different misaligned congruent bottom 0.75 1.4365 0.167 Inf 1.110 1.763
## same - different aligned incongruent bottom 0.75 0.1366 0.164 Inf -0.184 0.458
## same - different misaligned incongruent bottom 0.75 0.0666 0.164 Inf -0.254 0.388
##
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
# emmip(emm_E2_d, Congruency ~ Alignment | Cue + Probability, CIs = TRUE)
plot_E2_cf_d <- summary(emm_E2_d[1:16], infer = c(TRUE, FALSE), adjust = "sidak") %>%
as_tibble() %>%
ggplot(aes(y = estimate, 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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(Probability ~Cue, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_d) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", y = expression("Sensitivity"~italic("d'")), fill = "Congruency") + # set the names for main, x and y axises
geom_text(label = c("***", "", "", "", "*", "", "", "", "***", "", "", "", "", "", "", ""), color = sig_color, size = 6, nudge_y = 0.4, nudge_x = 0.5) + # add starts to the significant columns
NULL
# ggsave(filename = "E2_cf_d.pdf", plot_E2_cf_d, width = 8, height = 4.8)
plot_E2_cf_d
Composite face effects for top and bottom parts:
emm_E2_d_cf <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Probability"))
summary(emm_E2_d_cf[1:4], infer = TRUE)
## Alignment_pairwise Congruency_pairwise SameDifferent_pairwise Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned congruent - incongruent same - different top 0.25 0.678 0.170 Inf 0.3457 1.010 4.000 0.0001
## aligned - misaligned congruent - incongruent same - different bottom 0.25 0.290 0.118 Inf 0.0584 0.521 2.455 0.0141
## aligned - misaligned congruent - incongruent same - different top 0.75 0.963 0.118 Inf 0.7311 1.194 8.147 <.0001
## aligned - misaligned congruent - incongruent same - different bottom 0.75 0.149 0.170 Inf -0.1852 0.482 0.872 0.3830
##
## Confidence level used: 0.95
emm_E2_d_con <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Probability", "Alignment"))
summary(emm_E2_d_con[seq(1,7,2)], infer = TRUE)
## Congruency_pairwise SameDifferent_pairwise Cue Probability Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent same - different top 0.25 aligned 1.620 0.201 Inf 1.226 2.01 8.063 <.0001
## congruent - incongruent same - different bottom 0.25 aligned 0.998 0.182 Inf 0.641 1.35 5.483 <.0001
## congruent - incongruent same - different top 0.75 aligned 1.349 0.182 Inf 0.993 1.71 7.423 <.0001
## congruent - incongruent same - different bottom 0.75 aligned 1.518 0.202 Inf 1.123 1.91 7.525 <.0001
##
## Confidence level used: 0.95
# Sensitivity d'
emm_E2_d_fi <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Congruency", "Probability"), adjust = "sidak")
summary(emm_E2_d_fi[1:8], infer=TRUE)
## Alignment_pairwise SameDifferent_pairwise Cue Congruency Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned same - different top congruent 0.25 0.237 0.1211 Inf -0.0928 0.568 1.961 0.3360
## aligned - misaligned same - different top incongruent 0.25 -0.441 0.1116 Inf -0.7449 -0.136 -3.948 0.0006
## aligned - misaligned same - different bottom congruent 0.25 0.183 0.0824 Inf -0.0420 0.408 2.217 0.1940
## aligned - misaligned same - different bottom incongruent 0.25 -0.107 0.0748 Inf -0.3112 0.097 -1.431 0.7340
## aligned - misaligned same - different top congruent 0.75 0.417 0.0831 Inf 0.1908 0.644 5.024 <.0001
## aligned - misaligned same - different top incongruent 0.75 -0.545 0.0742 Inf -0.7478 -0.343 -7.350 <.0001
## aligned - misaligned same - different bottom congruent 0.75 0.219 0.1221 Inf -0.1143 0.551 1.790 0.4567
## aligned - misaligned same - different bottom incongruent 0.75 0.070 0.1115 Inf -0.2340 0.374 0.628 0.9976
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 8 estimates
## P value adjustment: sidak method for 8 tests
# emmip(emm_E2_d_fi[1:8], ~ Probability | Cue + Congruency, CIs = TRUE, adjust = "sidak")
plot_E2_cffi_d <- summary(emm_E2_d_fi[1:8], infer=TRUE) %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(Probability ~ Congruency, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_fi_d) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(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
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 = c(0.6, 0.5),
legend.box = "horizontal")
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)
# ggsave(filename = "E2_d.pdf", plot_E2_d, width = 10, height = 7)
plot_E2_d
Influence of Probability on facilitation and interference:
emm_E2_d_fi_Prob <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Congruency"), adjust = "none")
summary(emm_E2_d_fi_Prob[1:4], infer=TRUE)
## Alignment_pairwise SameDifferent_pairwise Probability_pairwise Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned same - different 0.25 - 0.75 top congruent -0.1799 0.142 Inf -0.458 0.0984 -1.267 0.2052
## aligned - misaligned same - different 0.25 - 0.75 top incongruent 0.1049 0.129 Inf -0.147 0.3569 0.816 0.4147
## aligned - misaligned same - different 0.25 - 0.75 bottom congruent -0.0357 0.142 Inf -0.314 0.2430 -0.251 0.8016
## aligned - misaligned same - different 0.25 - 0.75 bottom incongruent -0.1771 0.129 Inf -0.429 0.0754 -1.375 0.1692
##
## Confidence level used: 0.95
contrast(emm_E2_d_fi, method = list("faci-inte"=c(1, 1)), by = c("Cue", "Probability"))[1:4] %>%
summary(infer = TRUE)
## contrast Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top 0.25 -0.2032 0.160 Inf -0.5161 0.110 -1.272 0.2032
## faci-inte bottom 0.25 0.0757 0.104 Inf -0.1284 0.280 0.727 0.4672
## faci-inte top 0.75 -0.1281 0.104 Inf -0.3323 0.076 -1.230 0.2186
## faci-inte bottom 0.75 0.2885 0.160 Inf -0.0254 0.602 1.801 0.0716
##
## Confidence level used: 0.95
df_lmm_E2_rt <- df_lmm_E2 %>%
filter(isCorrect == 1)
# save(df_lmm_E2_rt, file = file.path("data", "df_lmm_E2_rt.RData"))
with log-transformation. #### The maximal model
# file_E2_rt_max <- file.path(folder_lmm, "E2_rt_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E2_rt_max)) {
# glmm_E2_rt_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment * Probability +
# (Cue * Congruency * Alignment * Probability | Participant),
# family = lognormal(),
# data = df_lmm_E2_rt,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_E2_rt_max, file = file_E2_rt_max)
# } else {
# load(file_E2_rt_max)
# }
#
# print(summary(glmm_E2_rt_max), corr = FALSE)
file_E2_rt_zcp <- file.path(folder_lmm, "E2_rt_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_E2_rt_zcp)) {
glmm_E2_rt_zcp <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + Con_Pro + Ali_Pro +
Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro +
Cue_Con_Ali_Pro || Participant),
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rt_zcp, file = file_E2_rt_zcp)
} else {
load(file_E2_rt_zcp)
}
print(summary(glmm_E2_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Con_Pro + Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 20092.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2443 -0.5901 -0.1322 0.4296 10.6198
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 4.570e-02 2.138e-01
## Participant.1 Cue_C 4.814e-03 6.938e-02
## Participant.2 Con_C 3.427e-04 1.851e-02
## Participant.3 Ali_C 5.044e-04 2.246e-02
## Participant.4 Cue_Con 6.945e-04 2.635e-02
## Participant.5 Cue_Ali 0.000e+00 0.000e+00
## Participant.6 Con_Ali 5.039e-04 2.245e-02
## Participant.7 Cue_Con_Ali 2.215e-04 1.488e-02
## Participant.8 Pro_C 4.729e-02 2.175e-01
## Participant.9 Cue_Pro 7.550e-02 2.748e-01
## Participant.10 Con_Pro 5.963e-10 2.442e-05
## Participant.11 Ali_Pro 0.000e+00 0.000e+00
## Participant.12 Cue_Con_Pro 4.505e-09 6.712e-05
## Participant.13 Cue_Ali_Pro 4.565e-03 6.756e-02
## Participant.14 Con_Ali_Pro 0.000e+00 0.000e+00
## Participant.15 Cue_Con_Ali_Pro 2.012e-07 4.485e-04
## Residual 1.110e-01 3.331e-01
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.690e+00 3.888e-02 3.443e+01 172.052 < 2e-16 ***
## Cuebottom -3.155e-03 1.519e-02 5.423e+01 -0.208 0.836273
## Congruencyincongruent 6.257e-02 1.055e-02 2.057e+02 5.928 1.28e-08 ***
## Alignmentmisaligned 4.145e-02 9.755e-03 1.622e+02 4.249 3.61e-05 ***
## Probability2-1 -1.247e-01 4.716e-02 5.844e+01 -2.645 0.010470 *
## Cuebottom:Congruencyincongruent 1.630e-02 1.434e-02 1.077e+02 1.136 0.258321
## Cuebottom:Alignmentmisaligned 5.224e-03 1.236e-02 1.623e+02 0.423 0.672997
## Congruencyincongruent:Alignmentmisaligned -4.881e-02 1.387e-02 1.121e+02 -3.520 0.000625 ***
## Cuebottom:Probability2-1 2.721e-01 5.190e-02 3.737e+01 5.244 6.46e-06 ***
## Congruencyincongruent:Probability2-1 -4.404e-02 1.904e-02 2.999e+04 -2.312 0.020776 *
## Alignmentmisaligned:Probability2-1 -3.556e-02 1.832e-02 2.877e+02 -1.941 0.053234 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -1.675e-03 1.906e-02 5.759e+01 -0.088 0.930264
## Cuebottom:Congruencyincongruent:Probability2-1 7.721e-02 2.697e-02 2.933e+04 2.863 0.004201 **
## Cuebottom:Alignmentmisaligned:Probability2-1 8.364e-02 2.734e-02 8.972e+01 3.059 0.002927 **
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 4.539e-02 2.643e-02 2.927e+04 1.718 0.085855 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.483e-02 3.773e-02 2.709e+04 -1.453 0.146240
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rt_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
## Standard deviation 0.8248 0.6528 0.6418 0.20828 0.20281 0.07911 0.06742 0.06739 0.05557 0.04468 0.001346 0.0002015 7.33e-05 0 0 0
## Proportion of Variance 0.4191 0.2625 0.2537 0.02673 0.02534 0.00386 0.00280 0.00280 0.00190 0.00123 0.000000 0.0000000 0.00e+00 0 0 0
## Cumulative Proportion 0.4191 0.6816 0.9354 0.96207 0.98741 0.99127 0.99407 0.99687 0.99877 1.00000 1.000000 1.0000000 1.00e+00 1 1 1
Cue_Ali
, Ali_Pro
, Con_Ali_Pro
,
Con_Pro
, Cue_Con_Pro
, and
Cue_Con_Ali_Pro
were removed from extended model
(glmm_E2_rt_zcp
) due to that the variance it explained was
smaller than 0.1%, making glmm_E2_rt_rdc
.
file_E2_rt_rdc <- file.path(folder_lmm, "E2_rt_lmm_rdc.RData")
# fit the rdc1 model
if (!file.exists(file_E2_rt_rdc)) {
glmm_E2_rt_rdc <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + Con_Ali + # Cue_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + # Ali_Pro + Con_Pro +
Cue_Ali_Pro # Con_Ali_Pro + Cue_Con_Pro +
|| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rt_rdc, file = file_E2_rt_rdc)
} else {
load(file_E2_rt_rdc)
}
print(summary(glmm_E2_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro || Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 20092.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2444 -0.5901 -0.1322 0.4295 10.6198
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0457251 0.21383
## Participant.1 Cue_C 0.0048160 0.06940
## Participant.2 Con_C 0.0003423 0.01850
## Participant.3 Ali_C 0.0005045 0.02246
## Participant.4 Cue_Con 0.0006969 0.02640
## Participant.5 Con_Ali 0.0005035 0.02244
## Participant.6 Cue_Con_Ali 0.0002217 0.01489
## Participant.7 Pro_C 0.0473011 0.21749
## Participant.8 Cue_Pro 0.0754976 0.27477
## Participant.9 Cue_Ali_Pro 0.0045724 0.06762
## Residual 0.1109745 0.33313
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.690e+00 3.889e-02 3.441e+01 172.015 < 2e-16 ***
## Cuebottom -3.155e-03 1.519e-02 5.420e+01 -0.208 0.836278
## Congruencyincongruent 6.257e-02 1.056e-02 2.057e+02 5.928 1.28e-08 ***
## Alignmentmisaligned 4.145e-02 9.755e-03 1.622e+02 4.249 3.61e-05 ***
## Probability2-1 -1.247e-01 4.716e-02 5.842e+01 -2.645 0.010478 *
## Cuebottom:Congruencyincongruent 1.630e-02 1.434e-02 1.077e+02 1.136 0.258371
## Cuebottom:Alignmentmisaligned 5.224e-03 1.236e-02 1.623e+02 0.423 0.673007
## Congruencyincongruent:Alignmentmisaligned -4.881e-02 1.387e-02 1.121e+02 -3.520 0.000624 ***
## Cuebottom:Probability2-1 2.721e-01 5.190e-02 3.737e+01 5.244 6.46e-06 ***
## Congruencyincongruent:Probability2-1 -4.404e-02 1.904e-02 3.018e+04 -2.312 0.020775 *
## Alignmentmisaligned:Probability2-1 -3.556e-02 1.832e-02 2.874e+02 -1.941 0.053255 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -1.675e-03 1.906e-02 5.760e+01 -0.088 0.930246
## Cuebottom:Congruencyincongruent:Probability2-1 7.721e-02 2.697e-02 3.008e+04 2.863 0.004201 **
## Cuebottom:Alignmentmisaligned:Probability2-1 8.364e-02 2.735e-02 8.966e+01 3.059 0.002932 **
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 4.539e-02 2.643e-02 2.998e+04 1.718 0.085863 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.483e-02 3.773e-02 2.956e+04 -1.453 0.146248
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E2_rt_etd <- file.path(folder_lmm, "E2_rt_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_E2_rt_etd)) {
glmm_E2_rt_etd <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + Con_Ali + # Cue_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + # Ali_Pro + Con_Pro +
Cue_Ali_Pro # Con_Ali_Pro + Cue_Con_Pro +
| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rt_etd, file = file_E2_rt_etd)
} else {
load(file_E2_rt_etd)
}
print(summary(glmm_E2_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro | Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 20010.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2586 -0.5908 -0.1304 0.4305 10.6496
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0464276 0.21547
## Cue_C 0.0049674 0.07048 -0.20
## Con_C 0.0004322 0.02079 0.33 -0.46
## Ali_C 0.0007474 0.02734 0.17 0.16 0.06
## Cue_Con 0.0010951 0.03309 0.01 0.38 -0.32 -0.26
## Con_Ali 0.0012791 0.03576 -0.09 0.02 -0.48 -0.08 0.44
## Cue_Con_Ali 0.0039599 0.06293 -0.63 0.07 -0.10 -0.55 -0.12 0.29
## Pro_C 0.0479580 0.21899 0.09 0.30 -0.72 0.07 0.42 0.21 -0.48
## Cue_Pro 0.0763459 0.27631 0.53 -0.24 0.20 -0.38 0.02 -0.58 -0.47 0.23
## Cue_Ali_Pro 0.0089737 0.09473 -0.15 0.30 -0.16 0.36 -0.35 0.29 0.25 0.06 -0.61
## Residual 0.1107688 0.33282
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.690e+00 4.013e-02 3.103e+01 166.699 < 2e-16 ***
## Cuebottom -2.038e-03 1.501e-02 4.127e+01 -0.136 0.89266
## Congruencyincongruent 6.184e-02 1.232e-02 5.877e+01 5.021 5.08e-06 ***
## Alignmentmisaligned 4.106e-02 9.936e-03 8.377e+01 4.132 8.48e-05 ***
## Probability2-1 -1.244e-01 4.429e-02 3.361e+01 -2.810 0.00821 **
## Cuebottom:Congruencyincongruent 1.510e-02 1.596e-02 6.841e+01 0.946 0.34754
## Cuebottom:Alignmentmisaligned 3.857e-03 1.348e-02 1.917e+02 0.286 0.77504
## Congruencyincongruent:Alignmentmisaligned -4.682e-02 1.499e-02 1.019e+02 -3.123 0.00233 **
## Cuebottom:Probability2-1 2.716e-01 5.702e-02 3.326e+01 4.764 3.63e-05 ***
## Congruencyincongruent:Probability2-1 -4.329e-02 1.904e-02 2.979e+04 -2.274 0.02300 *
## Alignmentmisaligned:Probability2-1 -3.545e-02 1.922e-02 2.027e+02 -1.844 0.06661 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -1.385e-04 2.186e-02 8.332e+01 -0.006 0.99496
## Cuebottom:Congruencyincongruent:Probability2-1 7.713e-02 2.695e-02 2.985e+04 2.862 0.00422 **
## Cuebottom:Alignmentmisaligned:Probability2-1 8.401e-02 2.974e-02 7.293e+01 2.825 0.00610 **
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 4.266e-02 2.640e-02 2.988e+04 1.616 0.10612
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.287e-02 3.767e-02 2.964e+04 -1.404 0.16046
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rt_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## Standard deviation 0.9715 0.6509 0.5085 0.21791 0.18936 0.14860 0.05757 0.01157 0.001596 1.485e-05
## Proportion of Variance 0.5440 0.2442 0.1490 0.02737 0.02067 0.01273 0.00191 0.00008 0.000000 0.000e+00
## Cumulative Proportion 0.5440 0.7882 0.9373 0.96462 0.98528 0.99801 0.99992 1.00000 1.000000 1.000e+00
Con_C
, Ali_C
, Cue_C
, and
Cue_Ali_Pro
were removed from extended model.
file_E2_rt_etd1 <- file.path(folder_lmm, "E2_rt_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E2_rt_etd1)) {
glmm_E2_rt_etd1 <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
( # Cue_C + Con_C + Ali_C +
Cue_Con + Con_Ali + # Cue_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro # Ali_Pro + Con_Pro +
# Con_Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro
| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rt_etd1, file = file_E2_rt_etd1)
} else {
load(file_E2_rt_etd1)
}
print(summary(glmm_E2_rt_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro | Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 20233.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.1945 -0.5956 -0.1291 0.4333 10.5434
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0460165 0.21451
## Cue_Con 0.0006146 0.02479 0.07
## Con_Ali 0.0007873 0.02806 -0.14 0.65
## Cue_Con_Ali 0.0023819 0.04880 -0.81 -0.09 0.08
## Pro_C 0.0444586 0.21085 0.15 0.51 0.29 -0.64
## Cue_Pro 0.0761836 0.27601 0.53 0.10 -0.64 -0.54 0.31
## Residual 0.1120021 0.33467
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.688e+00 3.923e-02 3.182e+01 170.466 < 2e-16 ***
## Cuebottom -1.585e-03 9.221e-03 2.488e+02 -0.172 0.863640
## Congruencyincongruent 6.336e-02 1.065e-02 1.165e+02 5.949 2.90e-08 ***
## Alignmentmisaligned 4.267e-02 9.245e-03 3.125e+02 4.615 5.74e-06 ***
## Probability2-1 -1.217e-01 3.961e-02 3.589e+01 -3.074 0.004026 **
## Cuebottom:Congruencyincongruent 1.544e-02 1.492e-02 1.070e+02 1.035 0.302881
## Cuebottom:Alignmentmisaligned 4.047e-03 1.307e-02 3.146e+02 0.310 0.756947
## Congruencyincongruent:Alignmentmisaligned -5.010e-02 1.467e-02 1.245e+02 -3.414 0.000865 ***
## Cuebottom:Probability2-1 2.693e-01 5.178e-02 3.643e+01 5.202 7.85e-06 ***
## Congruencyincongruent:Probability2-1 -4.602e-02 1.906e-02 3.022e+04 -2.415 0.015755 *
## Alignmentmisaligned:Probability2-1 -3.711e-02 1.738e-02 3.024e+04 -2.135 0.032752 *
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -1.388e-05 2.078e-02 1.263e+02 -0.001 0.999468
## Cuebottom:Congruencyincongruent:Probability2-1 8.156e-02 2.700e-02 3.026e+04 3.021 0.002523 **
## Cuebottom:Alignmentmisaligned:Probability2-1 8.534e-02 2.466e-02 3.024e+04 3.460 0.000540 ***
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 4.671e-02 2.650e-02 3.023e+04 1.763 0.077914 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.904e-02 3.781e-02 3.018e+04 -1.562 0.118375
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rt_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6]
## Standard deviation 0.9621 0.5960 0.4831 0.08617 6.331e-06 4.056e-06
## Proportion of Variance 0.6083 0.2334 0.1534 0.00488 0.000e+00 0.000e+00
## Cumulative Proportion 0.6083 0.8417 0.9951 1.00000 1.000e+00 1.000e+00
Cue_Con
, Con_Ali
, and
Cue_Con_Ali
were removed from extended model.
file_E2_rt_etd2 <- file.path(folder_lmm, "E2_rt_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_E2_rt_etd2)) {
glmm_E2_rt_etd2 <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
( # Cue_C + Con_C + Ali_C +
# Cue_Ali + Con_Ali + Cue_Con +
# Cue_Con_Ali +
Pro_C +
Cue_Pro # Ali_Pro + Con_Pro +
# Con_Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro
| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rt_etd2, file = file_E2_rt_etd2)
} else {
load(file_E2_rt_etd2)
}
print(summary(glmm_E2_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro | Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 20255.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.1850 -0.5961 -0.1295 0.4324 10.5556
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.04609 0.2147
## Pro_C 0.04458 0.2111 0.15
## Cue_Pro 0.07626 0.2761 0.53 0.31
## Residual 0.11212 0.3348
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.688e+00 3.844e-02 3.234e+01 173.996 < 2e-16 ***
## Cuebottom -1.724e-03 8.648e-03 3.027e+04 -0.199 0.842035
## Congruencyincongruent 6.324e-02 9.525e-03 3.028e+04 6.639 3.20e-11 ***
## Alignmentmisaligned 4.252e-02 8.694e-03 3.026e+04 4.891 1.01e-06 ***
## Probability2-1 -1.222e-01 3.967e-02 3.588e+01 -3.080 0.003958 **
## Cuebottom:Congruencyincongruent 1.640e-02 1.347e-02 3.027e+04 1.218 0.223357
## Cuebottom:Alignmentmisaligned 4.951e-03 1.234e-02 3.026e+04 0.401 0.688210
## Congruencyincongruent:Alignmentmisaligned -5.016e-02 1.325e-02 3.027e+04 -3.785 0.000154 ***
## Cuebottom:Probability2-1 2.705e-01 5.180e-02 3.644e+01 5.222 7.38e-06 ***
## Congruencyincongruent:Probability2-1 -4.541e-02 1.906e-02 3.028e+04 -2.382 0.017220 *
## Alignmentmisaligned:Probability2-1 -3.658e-02 1.739e-02 3.026e+04 -2.104 0.035388 *
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -2.584e-03 1.891e-02 3.026e+04 -0.137 0.891276
## Cuebottom:Congruencyincongruent:Probability2-1 7.937e-02 2.701e-02 3.028e+04 2.939 0.003300 **
## Cuebottom:Alignmentmisaligned:Probability2-1 8.363e-02 2.467e-02 3.026e+04 3.389 0.000702 ***
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 4.645e-02 2.651e-02 3.027e+04 1.752 0.079722 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.607e-02 3.782e-02 3.027e+04 -1.483 0.138190
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(glmm_E2_rt_etd2, glmm_E2_rt_rdc, refit = FALSE)
## Data: df_lmm_E2_rt
## Models:
## glmm_E2_rt_etd2: log(RT) ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro | Participant)
## glmm_E2_rt_rdc: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro || Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_E2_rt_etd2 23 20301 20493 -10128 20255
## glmm_E2_rt_rdc 27 20146 20371 -10046 20092 162.98 4 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (glmm_E2_rt_rdc
)
explained the data better than the extended model
(glmm_E2_rt_etd1
) and, therefore, the reduced model is used
as the optimal model.
glmm_E2_rt_opt <- glmm_E2_rt_rdc
print(summary(glmm_E2_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro || Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 20092.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2444 -0.5901 -0.1322 0.4295 10.6198
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0457251 0.21383
## Participant.1 Cue_C 0.0048160 0.06940
## Participant.2 Con_C 0.0003423 0.01850
## Participant.3 Ali_C 0.0005045 0.02246
## Participant.4 Cue_Con 0.0006969 0.02640
## Participant.5 Con_Ali 0.0005035 0.02244
## Participant.6 Cue_Con_Ali 0.0002217 0.01489
## Participant.7 Pro_C 0.0473011 0.21749
## Participant.8 Cue_Pro 0.0754976 0.27477
## Participant.9 Cue_Ali_Pro 0.0045724 0.06762
## Residual 0.1109745 0.33313
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.690e+00 3.889e-02 3.441e+01 172.015 < 2e-16 ***
## Cuebottom -3.155e-03 1.519e-02 5.420e+01 -0.208 0.836278
## Congruencyincongruent 6.257e-02 1.056e-02 2.057e+02 5.928 1.28e-08 ***
## Alignmentmisaligned 4.145e-02 9.755e-03 1.622e+02 4.249 3.61e-05 ***
## Probability2-1 -1.247e-01 4.716e-02 5.842e+01 -2.645 0.010478 *
## Cuebottom:Congruencyincongruent 1.630e-02 1.434e-02 1.077e+02 1.136 0.258371
## Cuebottom:Alignmentmisaligned 5.224e-03 1.236e-02 1.623e+02 0.423 0.673007
## Congruencyincongruent:Alignmentmisaligned -4.881e-02 1.387e-02 1.121e+02 -3.520 0.000624 ***
## Cuebottom:Probability2-1 2.721e-01 5.190e-02 3.737e+01 5.244 6.46e-06 ***
## Congruencyincongruent:Probability2-1 -4.404e-02 1.904e-02 3.018e+04 -2.312 0.020775 *
## Alignmentmisaligned:Probability2-1 -3.556e-02 1.832e-02 2.874e+02 -1.941 0.053255 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -1.675e-03 1.906e-02 5.760e+01 -0.088 0.930246
## Cuebottom:Congruencyincongruent:Probability2-1 7.721e-02 2.697e-02 3.008e+04 2.863 0.004201 **
## Cuebottom:Alignmentmisaligned:Probability2-1 8.364e-02 2.735e-02 8.966e+01 3.059 0.002932 **
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 4.539e-02 2.643e-02 2.998e+04 1.718 0.085863 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.483e-02 3.773e-02 2.956e+04 -1.453 0.146248
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E2_rt_emm <- file.path(folder_lmm, "E2_rt_emm.RData")
if (!file.exists(file_E2_rt_emm)) {
emm_E2_rt <- emmeans(glmm_E2_rt_opt, ~ Cue + Congruency + Alignment + Probability)
} else {
load(file_E2_rt_emm)
}
summary(emm_E2_rt, type = "response") # equivalent to regrid(emm_rt)
## Cue Congruency Alignment Probability response SE df asymp.LCL asymp.UCL
## top congruent aligned 0.25 856 39.3 Inf 782 936
## bottom congruent aligned 0.25 745 33.6 Inf 682 813
## top incongruent aligned 0.25 931 43.4 Inf 850 1020
## bottom incongruent aligned 0.25 793 35.8 Inf 725 866
## top congruent misaligned 0.25 908 41.7 Inf 830 994
## bottom congruent misaligned 0.25 762 34.3 Inf 697 832
## top incongruent misaligned 0.25 920 42.6 Inf 840 1007
## bottom incongruent misaligned 0.25 774 34.9 Inf 709 846
## top congruent aligned 0.75 756 34.0 Inf 692 825
## bottom congruent aligned 0.75 863 39.6 Inf 789 944
## top incongruent aligned 0.75 787 35.5 Inf 720 860
## bottom incongruent aligned 0.75 949 44.2 Inf 867 1040
## top congruent misaligned 0.75 774 34.9 Inf 708 845
## bottom congruent misaligned 0.75 926 42.6 Inf 846 1013
## top incongruent misaligned 0.75 785 35.4 Inf 718 857
## bottom incongruent misaligned 0.75 964 44.9 Inf 880 1056
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
# emmip(regrid(emm_E2_rt), Congruency ~ Alignment | Cue + Probability, CIs = TRUE)
plot_E2_cf_rt <- summary(emm_E2_rt, type = "response") %>%
as_tibble() %>%
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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(Probability ~Cue, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", 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
Composite face effects for top and bottom parts:
emm_E2_rt_cf <- contrast(regrid(emm_E2_rt), interaction = "pairwise", by = c("Cue", "Probability"), infer = TRUE)
emm_E2_rt_cf[1:4]
## Congruency_pairwise Alignment_pairwise Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top 0.25 -63.6 21.8 Inf -106.4 -20.823 -2.914 0.0036
## congruent - incongruent aligned - misaligned bottom 0.25 -35.2 10.2 Inf -55.1 -15.210 -3.453 0.0006
## congruent - incongruent aligned - misaligned top 0.75 -20.0 10.0 Inf -39.7 -0.332 -1.993 0.0463
## congruent - incongruent aligned - misaligned bottom 0.75 -48.4 22.7 Inf -92.9 -3.834 -2.129 0.0333
##
## Confidence level used: 0.95
emm_E2_rt_con <- contrast(regrid(emm_E2_rt), interaction = "pairwise", by = c("Cue", "Probability", "Alignment"))
summary(emm_E2_rt_con[c(1,2,5,6)], infer = TRUE)
## Congruency_pairwise Cue Probability Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top 0.25 aligned -75.5 16.18 Inf -107.2 -43.8 -4.670 <.0001
## congruent - incongruent bottom 0.25 aligned -47.9 7.93 Inf -63.4 -32.3 -6.032 <.0001
## congruent - incongruent top 0.75 aligned -31.3 7.71 Inf -46.4 -16.2 -4.056 <.0001
## congruent - incongruent bottom 0.75 aligned -86.4 16.50 Inf -118.8 -54.1 -5.239 <.0001
##
## Confidence level used: 0.95
emm_E2_rt_fi <- contrast(regrid(emm_E2_rt), "pairwise", by = c("Cue", "Congruency", "Probability"), infer=TRUE, adjust = "sidak")
emm_E2_rt_fi[1:8]
## contrast Cue Congruency Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent 0.25 -52.23 14.43 Inf -91.56 -12.89 -3.620 0.0023
## aligned - misaligned bottom congruent 0.25 -17.05 7.57 Inf -37.69 3.59 -2.252 0.1787
## aligned - misaligned top incongruent 0.25 11.36 17.29 Inf -35.77 58.50 0.657 0.9967
## aligned - misaligned bottom incongruent 0.25 18.12 8.33 Inf -4.58 40.83 2.177 0.2130
## aligned - misaligned top congruent 0.75 -18.10 7.62 Inf -38.87 2.67 -2.376 0.1318
## aligned - misaligned bottom congruent 0.75 -63.23 14.78 Inf -103.54 -22.92 -4.278 0.0002
## aligned - misaligned top incongruent 0.75 1.92 8.20 Inf -20.44 24.28 0.234 1.0000
## aligned - misaligned bottom incongruent 0.75 -14.84 18.37 Inf -64.93 35.24 -0.808 0.9870
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 8 estimates
## P value adjustment: sidak method for 8 tests
# emmip(emm_E2_rt_fi[1:8], ~ Probability | Cue + Congruency, CIs = TRUE, adjust = "sidak") +
# geom_hline(yintercept = 0, linetype = "dashed")
plot_E2_cffi_rt <- emm_E2_rt_fi[1:8] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(Probability ~ Congruency, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", 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
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 = c(0.6, 0.5),
legend.box = "horizontal")
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)
# ggsave(filename = "E2_rt.pdf", plot_E2_rt, width = 10, height = 7)
plot_E2_rt
Influence of Probability on facilitation and interference:
emm_E2_rt_fi_Prob <- contrast(regrid(emm_E2_rt), interaction="pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "none")
emm_E2_rt_fi_Prob[1:4]
## Alignment_pairwise Probability_pairwise Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned 0.25 - 0.75 top congruent -34.13 15.8 Inf -65.06 -3.19 -2.162 0.0306
## aligned - misaligned 0.25 - 0.75 bottom congruent 46.18 16.1 Inf 14.67 77.70 2.872 0.0041
## aligned - misaligned 0.25 - 0.75 top incongruent 9.45 18.7 Inf -27.19 46.08 0.505 0.6133
## aligned - misaligned 0.25 - 0.75 bottom incongruent 32.97 19.7 Inf -5.73 71.67 1.670 0.0950
##
## Confidence level used: 0.95
contrast(emm_E2_rt_fi, method = list("faci-inte"=c(1, 1)), by = c("Cue", "Probability"))[1:4] %>%
summary(infer = TRUE)
## contrast Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top 0.25 -40.86 23.2 Inf -86.3 4.58 -1.762 0.0780
## faci-inte bottom 0.25 1.08 12.2 Inf -22.9 25.04 0.088 0.9299
## faci-inte top 0.75 -16.18 12.2 Inf -40.2 7.79 -1.323 0.1859
## faci-inte bottom 0.75 -78.07 24.4 Inf -125.9 -30.27 -3.201 0.0014
##
## Confidence level used: 0.95
Results in this section were not included in the manuscript. The results were similar to E1.
# file_resp_max <- file.path(folder_lmm, "Resp_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_resp_max)) {
# glmm_resp_max <- glmer(
# Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
# (Cue * Congruency * Alignment * SameDifferent | Participant), # Con_Ali_Sam
# family = binomial(link = "probit"),
# data = df_lmm,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_resp_max, file = file_resp_max)
# } else {
# load(file_resp_max)
# }
#
# print(summary(glmm_resp_max), corr = FALSE)
file_resp_zcp <- file.path(folder_lmm, "Resp_lmm_zcp.RData")
# fit the zcp model
if (!file.exists(file_resp_zcp)) {
glmm_resp_zcp <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(Cue_C + Con_C + Ali_C + Sam_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam +
Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam || Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_zcp, file = file_resp_zcp)
} else {
load(file_resp_zcp)
}
print(summary(glmm_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam + Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 63102.7 63409.5 -31517.3 63034.7 61403
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.7530 -0.6145 0.2261 0.5866 4.5197
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 6.440e-02 2.538e-01
## Participant.1 Cue_C 1.251e-01 3.536e-01
## Participant.2 Con_C 5.088e-03 7.133e-02
## Participant.3 Ali_C 3.884e-02 1.971e-01
## Participant.4 Sam_C 2.193e-01 4.683e-01
## Participant.5 Cue_Con 5.078e-03 7.126e-02
## Participant.6 Cue_Ali 4.189e-02 2.047e-01
## Participant.7 Cue_Sam 7.770e-01 8.815e-01
## Participant.8 Con_Ali 0.000e+00 0.000e+00
## Participant.9 Con_Sam 3.261e-01 5.710e-01
## Participant.10 Ali_Sam 1.306e-14 1.143e-07
## Participant.11 Cue_Con_Ali 0.000e+00 0.000e+00
## Participant.12 Cue_Con_Sam 1.253e+00 1.120e+00
## Participant.13 Cue_Ali_Sam 1.401e-03 3.743e-02
## Participant.14 Con_Ali_Sam 1.067e-01 3.267e-01
## Participant.15 Cue_Con_Ali_Sam 5.275e-02 2.297e-01
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.133017 0.046191 2.880 0.003981 **
## Cue2-1 0.088095 0.046155 1.909 0.056305 .
## Congruency2-1 -0.143440 0.015205 -9.434 < 2e-16 ***
## Alignment2-1 0.056608 0.027580 2.052 0.040126 *
## SameDifferent2-1 -1.366284 0.059928 -22.799 < 2e-16 ***
## Probability0.5 0.042453 0.065205 0.651 0.515005
## Probability0.75 0.030363 0.016168 1.878 0.060389 .
## Cue2-1:Congruency2-1 -0.010243 0.025779 -0.397 0.691134
## Cue2-1:Alignment2-1 -0.103310 0.035394 -2.919 0.003514 **
## Congruency2-1:Alignment2-1 0.127143 0.023738 5.356 8.50e-08 ***
## Cue2-1:SameDifferent2-1 0.318684 0.113248 2.814 0.004892 **
## Congruency2-1:SameDifferent2-1 1.032331 0.075649 13.646 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.010627 0.023866 0.445 0.656103
## Cue2-1:Congruency2-1:Alignment2-1 -0.002245 0.047390 -0.047 0.962220
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.078199 0.148665 -0.526 0.598884
## Cue2-1:Alignment2-1:SameDifferent2-1 0.167988 0.047931 3.505 0.000457 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.573895 0.063344 -9.060 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.632166 0.099337 6.364 1.97e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
## Standard deviation 1.1196 0.8815 0.5710 0.46832 0.35363 0.32667 0.25378 0.22966 0.20467 0.19708 0.07133 0.07126 0.03743 1.143e-07 0 0
## Proportion of Variance 0.4154 0.2575 0.1081 0.07269 0.04145 0.03537 0.02135 0.01748 0.01388 0.01287 0.00169 0.00168 0.00046 0.000e+00 0 0
## Cumulative Proportion 0.4154 0.6730 0.7811 0.85376 0.89521 0.93058 0.95193 0.96941 0.98329 0.99617 0.99785 0.99954 1.00000 1.000e+00 1 1
Con_Ali
, Ali_Sam
, Cue_Con_Ali
,
and Cue_Ali_Sam
were removed from extended model
(glmm_resp_etd
) due to that the variances they explained
were smaller than 0.1%, making glmm_resp_rdc
.
file_resp_rdc <- file.path(folder_lmm, "Resp_lmm_rdc.RData")
# fit the zcp model
# three random effects were removed
if (!file.exists(file_resp_rdc)) {
glmm_resp_rdc <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(Cue_C + Con_C + Ali_C + Sam_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam +
Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam || Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_rdc, file = file_resp_rdc)
} else {
load(file_resp_rdc)
}
print(summary(glmm_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 63094.7 63365.4 -31517.3 63034.7 61407
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.7510 -0.6146 0.2259 0.5868 4.5215
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.064402 0.25378
## Participant.1 Cue_C 0.125050 0.35362
## Participant.2 Con_C 0.005088 0.07133
## Participant.3 Ali_C 0.038835 0.19707
## Participant.4 Sam_C 0.219322 0.46832
## Participant.5 Cue_Con 0.005079 0.07127
## Participant.6 Cue_Ali 0.041875 0.20463
## Participant.7 Cue_Sam 0.777015 0.88148
## Participant.8 Con_Sam 0.326078 0.57103
## Participant.9 Cue_Con_Sam 1.253376 1.11954
## Participant.10 Con_Ali_Sam 0.106723 0.32669
## Participant.11 Cue_Con_Ali_Sam 0.052783 0.22975
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.133020 0.046193 2.880 0.003981 **
## Cue2-1 0.088085 0.046163 1.908 0.056376 .
## Congruency2-1 -0.143434 0.015204 -9.434 < 2e-16 ***
## Alignment2-1 0.056618 0.027582 2.053 0.040104 *
## SameDifferent2-1 -1.366260 0.059919 -22.802 < 2e-16 ***
## Probability0.5 0.042443 0.065206 0.651 0.515106
## Probability0.75 0.030360 0.016168 1.878 0.060405 .
## Cue2-1:Congruency2-1 -0.010254 0.025777 -0.398 0.690775
## Cue2-1:Alignment2-1 -0.103374 0.035371 -2.923 0.003472 **
## Congruency2-1:Alignment2-1 0.127151 0.023736 5.357 8.47e-08 ***
## Cue2-1:SameDifferent2-1 0.318680 0.112984 2.821 0.004794 **
## Congruency2-1:SameDifferent2-1 1.032317 0.075768 13.625 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.010682 0.023847 0.448 0.654191
## Cue2-1:Congruency2-1:Alignment2-1 -0.002169 0.047379 -0.046 0.963483
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.078201 0.148731 -0.526 0.599036
## Cue2-1:Alignment2-1:SameDifferent2-1 0.167813 0.047598 3.526 0.000423 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.573905 0.063347 -9.060 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.632150 0.099361 6.362 1.99e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_resp_etd <- file.path(folder_lmm, "Resp_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_resp_etd)) {
glmm_resp_etd <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(Cue_C + Con_C + Ali_C + Sam_C +
Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam +
Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_etd, file = glmm_resp_etd)
} else {
load(file_resp_etd)
}
print(summary(glmm_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 63083.0 63949.5 -31445.5 62891.0 61341
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.7764 -0.6110 0.2195 0.5860 5.2220
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.06868 0.26206
## Cue_C 0.12513 0.35374 -0.12
## Con_C 0.00580 0.07616 -0.44 -0.09
## Ali_C 0.03871 0.19674 0.14 -0.02 -0.24
## Sam_C 0.22202 0.47119 -0.07 -0.16 0.59 -0.17
## Cue_Con 0.01401 0.11837 0.02 0.15 0.45 -0.36 0.38
## Cue_Ali 0.04120 0.20297 -0.40 -0.04 0.22 -0.16 0.23 0.06
## Cue_Sam 0.76967 0.87731 0.29 0.03 -0.32 0.17 0.01 -0.49 -0.29
## Con_Sam 0.33708 0.58059 -0.02 -0.22 -0.50 0.01 -0.18 0.02 0.07 0.03
## Cue_Con_Sam 1.24261 1.11473 0.04 -0.07 -0.21 0.09 -0.01 -0.61 -0.32 0.77 0.22
## Con_Ali_Sam 0.10948 0.33088 0.08 0.17 0.24 -0.07 0.27 -0.36 0.06 0.40 -0.46 0.44
## Cue_Con_Ali_Sam 0.19553 0.44219 0.15 -0.02 -0.38 0.02 -0.35 0.02 0.05 0.10 -0.07 -0.45 -0.39
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.190215 0.049826 3.818 0.000135 ***
## Cue2-1 0.086308 0.046234 1.867 0.061935 .
## Congruency2-1 -0.146568 0.015757 -9.302 < 2e-16 ***
## Alignment2-1 0.057107 0.027607 2.069 0.038586 *
## SameDifferent2-1 -1.367728 0.060308 -22.679 < 2e-16 ***
## Probability0.5 -0.068135 0.073251 -0.930 0.352287
## Probability0.75 0.030948 0.016186 1.912 0.055867 .
## Cue2-1:Congruency2-1 -0.008224 0.029046 -0.283 0.777083
## Cue2-1:Alignment2-1 -0.102079 0.035450 -2.880 0.003983 **
## Congruency2-1:Alignment2-1 0.130176 0.024030 5.417 6.06e-08 ***
## Cue2-1:SameDifferent2-1 0.313897 0.112803 2.783 0.005391 **
## Congruency2-1:SameDifferent2-1 1.030473 0.076980 13.386 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.013823 0.024049 0.575 0.565436
## Cue2-1:Congruency2-1:Alignment2-1 -0.008231 0.048046 -0.171 0.863980
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.049411 0.148288 -0.333 0.738973
## Cue2-1:Alignment2-1:SameDifferent2-1 0.171521 0.048081 3.567 0.000361 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.592064 0.064222 -9.219 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.664157 0.112066 5.926 3.10e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
## Standard deviation 1.3617 0.6534 0.6171 0.45717 0.33683 0.27047 0.22740 0.19526 0.11588 0.09401 0.01508 2.882e-05
## Proportion of Variance 0.5849 0.1347 0.1201 0.06593 0.03579 0.02308 0.01631 0.01203 0.00424 0.00279 0.00007 0.000e+00
## Cumulative Proportion 0.5849 0.7196 0.8398 0.90570 0.94149 0.96456 0.98088 0.99290 0.99714 0.99993 1.00000 1.000e+00
Con_C
, Cue_Con
, Ali_C
, and
Cue_Ali
was removed from extended model.
file_resp_etd1 <- file.path(folder_lmm, "Resp_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_resp_etd1)) {
glmm_resp_etd1 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(Cue_C + Sam_C + # Con_C + Ali_C +
Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali +
Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_etd1, file = glmm_resp_etd1)
} else {
load(file_resp_etd1)
}
print(summary(glmm_resp_etd1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 63245.1 63732.5 -31568.6 63137.1 61383
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.8485 -0.6094 0.2430 0.5779 4.6281
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.06446 0.2539
## Cue_C 0.12309 0.3508 -0.11
## Sam_C 0.21481 0.4635 -0.08 -0.16
## Cue_Sam 0.76338 0.8737 0.28 0.02 0.01
## Con_Sam 0.32412 0.5693 -0.04 -0.22 -0.16 0.03
## Cue_Con_Sam 1.21246 1.1011 0.06 -0.08 0.00 0.77 0.23
## Con_Ali_Sam 0.11567 0.3401 0.11 0.16 0.28 0.41 -0.44 0.45
## Cue_Con_Ali_Sam 0.18204 0.4267 0.13 0.03 -0.39 0.11 -0.05 -0.47 -0.43
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.157667 0.048780 3.232 0.001228 **
## Cue2-1 0.086991 0.045839 1.898 0.057728 .
## Congruency2-1 -0.138649 0.011955 -11.597 < 2e-16 ***
## Alignment2-1 0.040306 0.011744 3.432 0.000599 ***
## SameDifferent2-1 -1.353450 0.059365 -22.799 < 2e-16 ***
## Probability0.5 -0.011632 0.072389 -0.161 0.872343
## Probability0.75 0.030488 0.016134 1.890 0.058796 .
## Cue2-1:Congruency2-1 -0.007521 0.023914 -0.315 0.753140
## Cue2-1:Alignment2-1 -0.087931 0.023489 -3.744 0.000181 ***
## Congruency2-1:Alignment2-1 0.130470 0.023736 5.497 3.87e-08 ***
## Cue2-1:SameDifferent2-1 0.309046 0.112533 2.746 0.006028 **
## Congruency2-1:SameDifferent2-1 1.014579 0.075450 13.447 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.022333 0.023544 0.949 0.342848
## Cue2-1:Congruency2-1:Alignment2-1 -0.015297 0.047475 -0.322 0.747286
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.058703 0.146943 -0.399 0.689527
## Cue2-1:Alignment2-1:SameDifferent2-1 0.143644 0.047082 3.051 0.002281 **
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.592199 0.064522 -9.178 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.678179 0.110018 6.164 7.08e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 1.3463 0.6445 0.6092 0.44009 0.32770 0.24962 0.19412 2.881e-05
## Proportion of Variance 0.6042 0.1384 0.1237 0.06456 0.03579 0.02077 0.01256 0.000e+00
## Cumulative Proportion 0.6042 0.7426 0.8663 0.93087 0.96667 0.98744 1.00000 1.000e+00
Intercept
was removed from extended1 model.
file_resp_etd2 <- file.path(folder_lmm, "Resp_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_resp_etd2)) {
glmm_resp_etd2 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(0 + Cue_C + Sam_C + # Con_C + Ali_C +
Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali +
Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_etd2, file = glmm_resp_etd2)
} else {
load(file_resp_etd2)
}
print(summary(glmm_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (0 + Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 64871.6 65286.8 -32389.8 64779.6 61391
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.3445 -0.6291 0.2780 0.5980 4.0776
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_C 0.1154 0.3397
## Sam_C 0.2102 0.4584 -0.20
## Cue_Sam 0.7150 0.8456 0.08 0.02
## Con_Sam 0.3213 0.5668 -0.22 -0.19 0.03
## Cue_Con_Sam 1.1358 1.0657 -0.10 0.02 0.74 0.23
## Con_Ali_Sam 0.1080 0.3286 0.17 0.30 0.44 -0.47 0.45
## Cue_Con_Ali_Sam 0.1371 0.3703 0.08 -0.41 0.09 -0.05 -0.51 -0.44
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.123252 0.010709 11.509 < 2e-16 ***
## Cue2-1 0.099768 0.044345 2.250 0.024459 *
## Congruency2-1 -0.129109 0.011622 -11.109 < 2e-16 ***
## Alignment2-1 0.037931 0.011558 3.282 0.001031 **
## SameDifferent2-1 -1.314484 0.058587 -22.436 < 2e-16 ***
## Probability0.5 0.043315 0.014521 2.983 0.002855 **
## Probability0.75 0.028661 0.015913 1.801 0.071684 .
## Cue2-1:Congruency2-1 -0.013110 0.023309 -0.562 0.573820
## Cue2-1:Alignment2-1 -0.086384 0.023115 -3.737 0.000186 ***
## Congruency2-1:Alignment2-1 0.126081 0.023204 5.434 5.53e-08 ***
## Cue2-1:SameDifferent2-1 0.285404 0.108480 2.631 0.008515 **
## Congruency2-1:SameDifferent2-1 0.984935 0.074950 13.141 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.025026 0.023195 1.079 0.280613
## Cue2-1:Congruency2-1:Alignment2-1 -0.004488 0.046413 -0.097 0.922973
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.053188 0.141838 -0.375 0.707667
## Cue2-1:Alignment2-1:SameDifferent2-1 0.133972 0.046382 2.888 0.003872 **
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.573698 0.062888 -9.123 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.646349 0.105219 6.143 8.10e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd2))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## Standard deviation 1.2954 0.6398 0.5808 0.42799 0.31414 0.19015 8.192e-06
## Proportion of Variance 0.6118 0.1492 0.1230 0.06679 0.03598 0.01318 0.000e+00
## Cumulative Proportion 0.6118 0.7611 0.8841 0.95084 0.98682 1.00000 1.000e+00
Con_Ali_Sam
was removed from extended1 model.
file_resp_etd3 <- file.path(folder_lmm, "Resp_lmm_etd3.RData")
# fit the etd3 model
if (!file.exists(file_resp_etd3)) {
glmm_resp_etd3 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(0 + Cue_C + Sam_C + # Con_C + Ali_C +
Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_etd3, file = glmm_resp_etd3)
} else {
load(file_resp_etd3)
}
print(summary(glmm_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (0 + Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 64887.2 65239.2 -32404.6 64809.2 61398
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.0379 -0.6276 0.2795 0.5984 4.4562
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Cue_C 0.1153 0.3396
## Sam_C 0.2089 0.4571 -0.20
## Cue_Sam 0.7157 0.8460 0.08 0.02
## Con_Sam 0.3171 0.5631 -0.22 -0.18 0.03
## Cue_Con_Sam 1.1279 1.0620 -0.10 0.02 0.74 0.24
## Cue_Con_Ali_Sam 0.1336 0.3655 0.08 -0.41 0.10 -0.05 -0.51
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.123177 0.010705 11.507 < 2e-16 ***
## Cue2-1 0.099649 0.044331 2.248 0.024588 *
## Congruency2-1 -0.128751 0.011616 -11.084 < 2e-16 ***
## Alignment2-1 0.038946 0.011548 3.373 0.000745 ***
## SameDifferent2-1 -1.312469 0.058439 -22.459 < 2e-16 ***
## Probability0.5 0.043090 0.014511 2.969 0.002984 **
## Probability0.75 0.028336 0.015907 1.781 0.074848 .
## Cue2-1:Congruency2-1 -0.013659 0.023291 -0.586 0.557572
## Cue2-1:Alignment2-1 -0.087068 0.023090 -3.771 0.000163 ***
## Congruency2-1:Alignment2-1 0.124404 0.023176 5.368 7.98e-08 ***
## Cue2-1:SameDifferent2-1 0.284202 0.108399 2.622 0.008746 **
## Congruency2-1:SameDifferent2-1 0.981504 0.074559 13.164 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.017419 0.023101 0.754 0.450821
## Cue2-1:Congruency2-1:Alignment2-1 -0.002189 0.046186 -0.047 0.962202
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.049675 0.141367 -0.351 0.725299
## Cue2-1:Alignment2-1:SameDifferent2-1 0.136374 0.046292 2.946 0.003219 **
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.553813 0.046301 -11.961 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.652923 0.104533 6.246 4.21e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd3))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6]
## Standard deviation 1.2832 0.6208 0.5559 0.42463 0.31154 0
## Proportion of Variance 0.6289 0.1472 0.1180 0.06886 0.03707 0
## Cumulative Proportion 0.6289 0.7761 0.8941 0.96293 1.00000 1
Cue_C
was removed.
file_resp_etd4 <- file.path(folder_lmm, "Resp_lmm_etd4.RData")
# fit the etd4 model
if (!file.exists(file_resp_etd4)) {
glmm_resp_etd4 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(0 + Sam_C + # Con_C + Ali_C + Cue_C +
Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali +
Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
Cue_Con_Ali_Sam | Participant),
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_etd4, file = glmm_resp_etd4)
} else {
load(file_resp_etd4)
}
print(summary(glmm_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 65595.0 65892.8 -32764.5 65529.0 61404
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9069 -0.6337 0.2870 0.5997 3.5592
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Sam_C 0.2053 0.4531
## Cue_Sam 0.7240 0.8509 0.01
## Con_Sam 0.3154 0.5616 -0.19 0.02
## Cue_Con_Sam 1.1390 1.0672 0.03 0.70 0.26
## Cue_Con_Ali_Sam 0.1293 0.3595 -0.46 0.13 -0.06 -0.53
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.129522 0.010355 12.508 < 2e-16 ***
## Cue2-1 0.105943 0.012411 8.536 < 2e-16 ***
## Congruency2-1 -0.128304 0.011488 -11.168 < 2e-16 ***
## Alignment2-1 0.038831 0.011471 3.385 0.000711 ***
## SameDifferent2-1 -1.296669 0.057890 -22.399 < 2e-16 ***
## Probability0.5 0.037871 0.014127 2.681 0.007344 **
## Probability0.75 0.014138 0.015141 0.934 0.350402
## Cue2-1:Congruency2-1 -0.013638 0.022974 -0.594 0.552769
## Cue2-1:Alignment2-1 -0.086152 0.022946 -3.755 0.000174 ***
## Congruency2-1:Alignment2-1 0.124053 0.022943 5.407 6.41e-08 ***
## Cue2-1:SameDifferent2-1 0.280842 0.109001 2.577 0.009981 **
## Congruency2-1:SameDifferent2-1 0.971848 0.074277 13.084 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.017533 0.022956 0.764 0.445022
## Cue2-1:Congruency2-1:Alignment2-1 -0.002098 0.045909 -0.046 0.963548
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.047721 0.141789 -0.337 0.736445
## Cue2-1:Alignment2-1:SameDifferent2-1 0.134706 0.046006 2.928 0.003412 **
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.550741 0.046034 -11.964 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.639901 0.103436 6.186 6.15e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd4))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5]
## Standard deviation 1.2764 0.6366 0.5607 0.40497 1.158e-05
## Proportion of Variance 0.6484 0.1613 0.1251 0.06526 0.000e+00
## Cumulative Proportion 0.6484 0.8096 0.9347 1.00000 1.000e+00
Cue_Con_Ali_Sam
was removed.
file_resp_etd5 <- file.path(folder_lmm, "Resp_lmm_etd5.RData")
# fit the etd5 model
if (!file.exists(file_resp_etd5)) {
glmm_resp_etd5 <- glmer(
Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
(0 + Sam_C + # Con_C + Ali_C + Cue_C +
Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali +
Cue_Con_Sam # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam + +
| Participant), # Cue_Con_Ali_Sam
family = binomial(link = "probit"),
data = df_lmm,
control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_resp_etd5, file = glmm_resp_etd5)
} else {
load(file_resp_etd5)
}
print(summary(glmm_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam | Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 65596.2 65848.9 -32770.1 65540.2 61409
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.8313 -0.6303 0.2892 0.6016 3.5395
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant Sam_C 0.2049 0.4527
## Cue_Sam 0.7207 0.8489 0.01
## Con_Sam 0.3154 0.5616 -0.19 0.02
## Cue_Con_Sam 1.1323 1.0641 0.03 0.71 0.26
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.1294660 0.0103554 12.502 < 2e-16 ***
## Cue2-1 0.1061128 0.0124089 8.551 < 2e-16 ***
## Congruency2-1 -0.1282620 0.0114863 -11.166 < 2e-16 ***
## Alignment2-1 0.0390641 0.0114681 3.406 0.000658 ***
## SameDifferent2-1 -1.2958485 0.0579395 -22.366 < 2e-16 ***
## Probability0.5 0.0377466 0.0141252 2.672 0.007534 **
## Probability0.75 0.0142471 0.0151415 0.941 0.346742
## Cue2-1:Congruency2-1 -0.0134839 0.0229744 -0.587 0.557266
## Cue2-1:Alignment2-1 -0.0866271 0.0229394 -3.776 0.000159 ***
## Congruency2-1:Alignment2-1 0.1243850 0.0229390 5.422 5.88e-08 ***
## Cue2-1:SameDifferent2-1 0.2793811 0.1090565 2.562 0.010413 *
## Congruency2-1:SameDifferent2-1 0.9710948 0.0744207 13.049 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.0151448 0.0229397 0.660 0.509124
## Cue2-1:Congruency2-1:Alignment2-1 0.0004411 0.0458931 0.010 0.992331
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.0459603 0.1419862 -0.324 0.746168
## Cue2-1:Alignment2-1:SameDifferent2-1 0.1389068 0.0459013 3.026 0.002476 **
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.5438443 0.0458885 -11.851 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.6052064 0.0918957 6.586 4.52e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(glmm_resp_etd5, glmm_resp_rdc, refit = FALSE)
## Data: df_lmm
## Models:
## glmm_resp_etd5: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam | Participant)
## glmm_resp_rdc: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_resp_etd5 28 65596 65849 -32770 65540
## glmm_resp_rdc 30 63095 63365 -31517 63035 2505.5 2 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (glmm_resp_rdc
)
explained the data better than the extended model
(glmm_resp_etd5
) and, therefore, the reduced model is used
as the optimal model.
glmm_resp_opt <- glmm_resp_rdc
print(summary(glmm_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
## Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## AIC BIC logLik deviance df.resid
## 63094.7 63365.4 -31517.3 63034.7 61407
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -7.7510 -0.6146 0.2259 0.5868 4.5215
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.064402 0.25378
## Participant.1 Cue_C 0.125050 0.35362
## Participant.2 Con_C 0.005088 0.07133
## Participant.3 Ali_C 0.038835 0.19707
## Participant.4 Sam_C 0.219322 0.46832
## Participant.5 Cue_Con 0.005079 0.07127
## Participant.6 Cue_Ali 0.041875 0.20463
## Participant.7 Cue_Sam 0.777015 0.88148
## Participant.8 Con_Sam 0.326078 0.57103
## Participant.9 Cue_Con_Sam 1.253376 1.11954
## Participant.10 Con_Ali_Sam 0.106723 0.32669
## Participant.11 Cue_Con_Ali_Sam 0.052783 0.22975
## Number of obs: 61437, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.133020 0.046193 2.880 0.003981 **
## Cue2-1 0.088085 0.046163 1.908 0.056376 .
## Congruency2-1 -0.143434 0.015204 -9.434 < 2e-16 ***
## Alignment2-1 0.056618 0.027582 2.053 0.040104 *
## SameDifferent2-1 -1.366260 0.059919 -22.802 < 2e-16 ***
## Probability0.5 0.042443 0.065206 0.651 0.515106
## Probability0.75 0.030360 0.016168 1.878 0.060405 .
## Cue2-1:Congruency2-1 -0.010254 0.025777 -0.398 0.690775
## Cue2-1:Alignment2-1 -0.103374 0.035371 -2.923 0.003472 **
## Congruency2-1:Alignment2-1 0.127151 0.023736 5.357 8.47e-08 ***
## Cue2-1:SameDifferent2-1 0.318680 0.112984 2.821 0.004794 **
## Congruency2-1:SameDifferent2-1 1.032317 0.075768 13.625 < 2e-16 ***
## Alignment2-1:SameDifferent2-1 0.010682 0.023847 0.448 0.654191
## Cue2-1:Congruency2-1:Alignment2-1 -0.002169 0.047379 -0.046 0.963483
## Cue2-1:Congruency2-1:SameDifferent2-1 -0.078201 0.148731 -0.526 0.599036
## Cue2-1:Alignment2-1:SameDifferent2-1 0.167813 0.047598 3.526 0.000423 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1 -0.573905 0.063347 -9.060 < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1 0.632150 0.099361 6.362 1.99e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(emm_resp <- emmeans(glmm_resp_opt, ~ Alignment + Congruency + Cue + SameDifferent))
## Alignment Congruency Cue SameDifferent emmean SE df asymp.LCL asymp.UCL
## aligned congruent top same 1.284 0.0705 Inf 1.146 1.422
## misaligned congruent top same 1.142 0.0698 Inf 1.005 1.279
## aligned incongruent top same 0.323 0.0678 Inf 0.190 0.456
## misaligned incongruent top same 0.755 0.0686 Inf 0.620 0.889
## aligned congruent bottom same 1.212 0.0701 Inf 1.075 1.350
## misaligned congruent bottom same 1.042 0.0692 Inf 0.907 1.178
## aligned incongruent bottom same 0.440 0.0679 Inf 0.306 0.573
## misaligned incongruent bottom same 0.525 0.0680 Inf 0.391 0.658
## aligned congruent top different -0.963 0.0689 Inf -1.098 -0.828
## misaligned congruent top different -0.733 0.0683 Inf -0.867 -0.599
## aligned incongruent top different -0.408 0.0679 Inf -0.541 -0.275
## misaligned incongruent top different -0.494 0.0679 Inf -0.627 -0.361
## aligned congruent bottom different -0.603 0.0681 Inf -0.736 -0.470
## misaligned congruent bottom different -0.549 0.0680 Inf -0.683 -0.416
## aligned incongruent bottom different -0.254 0.0677 Inf -0.386 -0.121
## misaligned incongruent bottom different -0.203 0.0677 Inf -0.335 -0.070
##
## Results are averaged over the levels of: Probability
## Results are given on the probit (not the response) scale.
## Confidence level used: 0.95
emm_d <- contrast(emm_resp, method = "pairwise", simple = "SameDifferent")
summary(emm_d[1:8], infer = c(TRUE, FALSE), adjust = "none")
## contrast Alignment Congruency Cue estimate SE df asymp.LCL asymp.UCL
## same - different aligned congruent top 2.247 0.103 Inf 2.045 2.449
## same - different misaligned congruent top 1.875 0.102 Inf 1.675 2.076
## same - different aligned incongruent top 0.731 0.100 Inf 0.534 0.928
## same - different misaligned incongruent top 1.249 0.101 Inf 1.051 1.447
## same - different aligned congruent bottom 1.815 0.102 Inf 1.615 2.015
## same - different misaligned congruent bottom 1.592 0.102 Inf 1.393 1.791
## same - different aligned incongruent bottom 0.693 0.100 Inf 0.496 0.890
## same - different misaligned incongruent bottom 0.727 0.101 Inf 0.530 0.924
##
## Results are averaged over the levels of: Probability
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
# emmip(emm_d, Congruency ~ Alignment | Cue, CIs = TRUE)
plot_E12_cf_d <- summary(emm_d[1:8], infer = c(TRUE, FALSE), adjust = "sidak") %>%
as_tibble() %>%
ggplot(aes(y = estimate, 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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(. ~Cue, switch = "both") +
coord_cartesian(ylim = ylimit_cf_d) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", y = expression("Sensitivity"~italic("d'")), fill = "Congruency") + # set the names for main, x and y axises
geom_text(label = c("***", "", "", "", "**", "", "", ""), color = sig_color, size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
NULL
# ggsave(filename = "E12_cf_d.pdf", plot_E12_cf_d, width = 8, height = 4.8)
plot_E12_cf_d
Composite face effects for top and bottom parts:
emm_d_cf <- contrast(emm_resp, interaction = "pairwise", by = "Cue")
summary(emm_d_cf[1:2], infer = TRUE)
## Alignment_pairwise Congruency_pairwise SameDifferent_pairwise Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned congruent - incongruent same - different top 0.890 0.0814 Inf 0.730 1.049 10.936 <.0001
## aligned - misaligned congruent - incongruent same - different bottom 0.258 0.0796 Inf 0.102 0.414 3.238 0.0012
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
emm_d_con <- contrast(emm_resp, interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_d_con[c(1,3)], infer = TRUE)
## Congruency_pairwise SameDifferent_pairwise Cue Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent same - different top aligned 1.52 0.114 Inf 1.29 1.74 13.278 <.0001
## congruent - incongruent same - different bottom aligned 1.12 0.113 Inf 0.90 1.34 9.902 <.0001
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
# Sensitivity d'
emm_d_fi <- contrast(emm_resp, interaction = "pairwise", by = c("Cue", "Congruency"), adjust = "sidak")
summary(emm_d_fi[1:4], infer=TRUE)
## Alignment_pairwise SameDifferent_pairwise Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned same - different top congruent 0.3718 0.0561 Inf 0.2321 0.5114 6.631 <.0001
## aligned - misaligned same - different top incongruent -0.5182 0.0500 Inf -0.6429 -0.3936 -10.357 <.0001
## aligned - misaligned same - different bottom congruent 0.2235 0.0542 Inf 0.0884 0.3586 4.122 0.0002
## aligned - misaligned same - different bottom incongruent -0.0343 0.0493 Inf -0.1572 0.0886 -0.696 0.9305
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: sidak method for 4 tests
# showing the differences between aligned and misaligned (aligned-misaligned)
# emmip(emm_d_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak") +
# geom_hline(yintercept = 0, linetype = "dashed")
plot_E12_cffi_d <- summary(emm_d_fi[1:4], infer=TRUE) %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(. ~ Congruency, switch = "both") +
coord_cartesian(ylim = ylimit_cf_fi_d) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(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
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 = c(0.6, 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)
# ggsave(filename = "E12_d.pdf", plot_E12_d, width = 10, height = 4.5)
plot_E12_d
contrast(emm_d_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>%
summary(infer = TRUE)
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top -0.146 0.0684 Inf -0.280 -0.0125 -2.142 0.0322
## faci-inte bottom 0.189 0.0664 Inf 0.059 0.3193 2.849 0.0044
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
df_lmm_rt <- df_lmm %>%
filter(isCorrect == 1)
# save(df_lmm_rt, file = file.path("data", "df_lmm_rt.RData"))
with log-transformation. #### The maximal model
# file_rt_max <- file.path(folder_lmm, "rt_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_rt_max)) {
# glmm_rt_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment + Probability +
# (Cue * Congruency * Alignment | Participant),
# family = lognormal(),
# data = df_lmm_rt,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_rt_max, file = file_rt_max)
# } else {
# load(file_rt_max)
# }
#
# print(summary(glmm_rt_max), corr = FALSE)
file_rt_zcp <- file.path(folder_lmm, "rt_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_rt_zcp)) {
glmm_rt_zcp <- lmer(
log(RT) ~ Cue * Congruency * Alignment + Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_rt_zcp, file = file_rt_zcp)
} else {
load(file_rt_zcp)
}
print(summary(glmm_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 37568.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0118 -0.6012 -0.1452 0.4415 9.7535
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 5.531e-02 2.352e-01
## Participant.1 Cue_C 2.039e-02 1.428e-01
## Participant.2 Con_C 6.458e-04 2.541e-02
## Participant.3 Ali_C 7.453e-04 2.730e-02
## Participant.4 Cue_Con 7.533e-04 2.745e-02
## Participant.5 Cue_Ali 8.167e-05 9.037e-03
## Participant.6 Con_Ali 3.866e-11 6.217e-06
## Participant.7 Cue_Con_Ali 5.132e-03 7.164e-02
## Residual 1.334e-01 3.653e-01
## Number of obs: 44710, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.678e+00 4.171e-02 6.221e+01 160.114 < 2e-16 ***
## Cue2-1 3.909e-02 1.830e-02 6.350e+01 2.136 0.03651 *
## Congruency2-1 3.524e-02 4.819e-03 5.487e+01 7.314 1.17e-09 ***
## Alignment2-1 1.469e-02 4.964e-03 5.570e+01 2.959 0.00452 **
## Probability0.5 8.884e-02 5.897e-02 6.216e+01 1.507 0.13698
## Probability0.75 1.024e-02 5.087e-03 4.364e+04 2.013 0.04407 *
## Cue2-1:Congruency2-1 4.223e-03 7.913e-03 5.078e+01 0.534 0.59592
## Cue2-1:Alignment2-1 -2.254e-03 7.082e-03 3.155e+01 -0.318 0.75234
## Congruency2-1:Alignment2-1 -4.508e-02 6.976e-03 3.982e+04 -6.463 1.04e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.414e-02 1.681e-02 3.807e+01 -0.841 0.40551
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_rt_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 0.6438 0.3909 0.19612 0.07514 0.07474 0.06957 0.02474 1.702e-05
## Proportion of Variance 0.6660 0.2455 0.06179 0.00907 0.00897 0.00778 0.00098 0.000e+00
## Cumulative Proportion 0.6660 0.9114 0.97320 0.98227 0.99124 0.99902 1.00000 1.000e+00
Con_Ali
, and Cue_Ali
were removed from
extended model (glmm_rt_zcp
) due to that the variances they
explained were smaller than 0.1%, making glmm_rt_rdc
.
file_rt_rdc <- file.path(folder_lmm, "rt_lmm_rdc.RData")
# fit the zcp model
# three random effects were removed
if (!file.exists(file_rt_rdc)) {
glmm_rt_rdc <- lmer(
log(RT) ~ Cue * Congruency * Alignment + Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + # Con_Ali + Cue_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_rt_rdc, file = file_rt_rdc)
} else {
load(file_rt_rdc)
}
print(summary(glmm_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Con_Ali || Participant)
## Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 37568.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0114 -0.6010 -0.1454 0.4413 9.7530
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0553065 0.23517
## Participant.1 Cue_C 0.0203864 0.14278
## Participant.2 Con_C 0.0006454 0.02540
## Participant.3 Ali_C 0.0007437 0.02727
## Participant.4 Cue_Con 0.0007531 0.02744
## Participant.5 Cue_Con_Ali 0.0051144 0.07151
## Residual 0.1334233 0.36527
## Number of obs: 44710, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.678e+00 4.171e-02 6.221e+01 160.114 < 2e-16 ***
## Cue2-1 3.910e-02 1.830e-02 6.350e+01 2.136 0.03651 *
## Congruency2-1 3.524e-02 4.818e-03 5.488e+01 7.315 1.16e-09 ***
## Alignment2-1 1.468e-02 4.961e-03 5.586e+01 2.959 0.00452 **
## Probability0.5 8.884e-02 5.897e-02 6.216e+01 1.507 0.13700
## Probability0.75 1.024e-02 5.087e-03 4.369e+04 2.013 0.04411 *
## Cue2-1:Congruency2-1 4.227e-03 7.913e-03 5.079e+01 0.534 0.59555
## Cue2-1:Alignment2-1 -2.343e-03 6.978e-03 4.357e+04 -0.336 0.73703
## Congruency2-1:Alignment2-1 -4.510e-02 6.975e-03 4.236e+04 -6.465 1.02e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.414e-02 1.680e-02 3.814e+01 -0.841 0.40538
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_rt_etd <- file.path(folder_lmm, "rt_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_rt_etd)) {
glmm_rt_etd <- lmer(
log(RT) ~ Cue * Congruency * Alignment + Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + # Con_Ali + Cue_Ali +
Cue_Con_Ali | Participant),
data = df_lmm_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_rt_etd, file = glmm_rt_etd)
} else {
load(file_rt_etd)
}
print(summary(glmm_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Con_Ali | Participant)
## Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 37540.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0149 -0.6012 -0.1444 0.4431 9.7665
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0550740 0.23468
## Cue_C 0.0203309 0.14259 -0.07
## Con_C 0.0006861 0.02619 -0.14 0.45
## Ali_C 0.0008223 0.02868 -0.08 -0.12 0.31
## Cue_Con 0.0011893 0.03449 0.17 0.24 0.03 -0.72
## Cue_Con_Ali 0.0054717 0.07397 -0.72 0.11 -0.37 -0.10 -0.37
## Residual 0.1333885 0.36522
## Number of obs: 44710, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.672e+00 3.986e-02 6.803e+01 167.402 < 2e-16 ***
## Cue2-1 3.912e-02 1.828e-02 6.342e+01 2.140 0.03618 *
## Congruency2-1 3.621e-02 4.867e-03 5.542e+01 7.440 6.88e-10 ***
## Alignment2-1 1.471e-02 5.075e-03 5.567e+01 2.898 0.00537 **
## Probability0.5 1.002e-01 5.378e-02 6.300e+01 1.863 0.06707 .
## Probability0.75 1.010e-02 5.085e-03 4.336e+04 1.986 0.04707 *
## Cue2-1:Congruency2-1 4.786e-03 8.328e-03 5.356e+01 0.575 0.56789
## Cue2-1:Alignment2-1 -2.922e-03 6.971e-03 4.343e+04 -0.419 0.67507
## Congruency2-1:Alignment2-1 -4.461e-02 6.965e-03 4.312e+04 -6.404 1.53e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.339e-02 1.693e-02 5.914e+01 -0.791 0.43230
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.0169721 (tol = 0.002, component 1)
file_rt_etd1 <- file.path(folder_lmm, "rt_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_rt_etd1)) {
ss <- getME(glmm_rt_etd, c("theta","fixef"))
glmm_rt_etd1 <- update(
glmm_rt_etd, start=ss,
control=lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
} else {
load(file_rt_etd1)
}
print(summary(glmm_rt_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Con_Ali | Participant)
## Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 37540.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0149 -0.6012 -0.1445 0.4431 9.7665
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0550740 0.23468
## Cue_C 0.0203296 0.14258 -0.07
## Con_C 0.0006850 0.02617 -0.14 0.45
## Ali_C 0.0008217 0.02867 -0.08 -0.12 0.31
## Cue_Con 0.0011887 0.03448 0.17 0.24 0.03 -0.72
## Cue_Con_Ali 0.0054717 0.07397 -0.72 0.11 -0.37 -0.10 -0.37
## Residual 0.1333887 0.36522
## Number of obs: 44710, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.672e+00 3.986e-02 6.803e+01 167.400 < 2e-16 ***
## Cue2-1 3.912e-02 1.828e-02 6.343e+01 2.140 0.03617 *
## Congruency2-1 3.621e-02 4.865e-03 5.547e+01 7.442 6.78e-10 ***
## Alignment2-1 1.470e-02 5.074e-03 5.570e+01 2.898 0.00536 **
## Probability0.5 1.002e-01 5.378e-02 6.299e+01 1.863 0.06711 .
## Probability0.75 1.010e-02 5.085e-03 4.336e+04 1.986 0.04707 *
## Cue2-1:Congruency2-1 4.786e-03 8.327e-03 5.357e+01 0.575 0.56791
## Cue2-1:Alignment2-1 -2.922e-03 6.971e-03 4.343e+04 -0.419 0.67505
## Congruency2-1:Alignment2-1 -4.461e-02 6.965e-03 4.312e+04 -6.404 1.53e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.339e-02 1.693e-02 5.914e+01 -0.791 0.43222
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.0167706 (tol = 0.002, component 1)
summary(rePCA(glmm_rt_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6]
## Standard deviation 0.6608 0.3912 0.15145 0.11135 0.03757 0.0008193
## Proportion of Variance 0.6970 0.2443 0.03661 0.01979 0.00225 0.0000000
## Cumulative Proportion 0.6970 0.9414 0.97796 0.99775 1.00000 1.0000000
Con_C
and Ali_C
were removed from extended
model (glmm_resp_etd1
) due to that the variances they
explained were smaller than 1%, making glmm_resp_etd2
.
file_rt_etd2 <- file.path(folder_lmm, "rt_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_rt_etd2)) {
glmm_rt_etd2 <- lmer(
log(RT) ~ Cue * Congruency * Alignment + Probability +
(Cue_C + # Con_C + Ali_C +
Cue_Con + # Con_Ali + Cue_Ali +
Cue_Con_Ali | Participant),
data = df_lmm_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_rt_etd2, file = file_rt_etd2)
} else {
load(file_rt_etd2)
}
print(summary(glmm_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Cue_Con + Cue_Con_Ali | Participant)
## Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 37587.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9925 -0.6004 -0.1446 0.4413 9.7582
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0552105 0.23497
## Cue_C 0.0203947 0.14281 -0.07
## Cue_Con 0.0007303 0.02702 0.14 0.27
## Cue_Con_Ali 0.0048203 0.06943 -0.77 0.09 -0.49
## Residual 0.1337601 0.36573
## Number of obs: 44710, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.674e+00 4.004e-02 6.743e+01 166.698 < 2e-16 ***
## Cue2-1 3.916e-02 1.830e-02 6.344e+01 2.139 0.0363 *
## Congruency2-1 3.514e-02 3.508e-03 3.876e+04 10.017 < 2e-16 ***
## Alignment2-1 1.379e-02 3.483e-03 4.367e+04 3.961 7.48e-05 ***
## Probability0.5 9.634e-02 5.422e-02 6.218e+01 1.777 0.0805 .
## Probability0.75 1.030e-02 5.092e-03 4.368e+04 2.023 0.0431 *
## Cue2-1:Congruency2-1 4.982e-03 7.858e-03 4.983e+01 0.634 0.5290
## Cue2-1:Alignment2-1 -2.427e-03 6.965e-03 4.418e+04 -0.348 0.7275
## Congruency2-1:Alignment2-1 -4.614e-02 6.968e-03 4.154e+04 -6.622 3.58e-11 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.371e-02 1.663e-02 3.757e+01 -0.824 0.4149
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(glmm_rt_etd2, glmm_rt_rdc, refit = FALSE)
## Data: df_lmm_rt
## Models:
## glmm_rt_rdc: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Con_Ali || Participant)
## glmm_rt_etd2: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Cue_Con + Cue_Con_Ali | Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_rt_rdc 17 37602 37750 -18784 37568
## glmm_rt_etd2 21 37629 37812 -18794 37587 0 4 1
According to BIC, the reduced model (glmm_resp_rdc
)
explained the data better than the extended model
(glmm_resp_etd2
) and, therefore, the reduced model is used
as the optimal model.
glmm_rt_opt <- glmm_rt_rdc
print(summary(glmm_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Con_Ali || Participant)
## Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 37568.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0114 -0.6010 -0.1454 0.4413 9.7530
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0553065 0.23517
## Participant.1 Cue_C 0.0203864 0.14278
## Participant.2 Con_C 0.0006454 0.02540
## Participant.3 Ali_C 0.0007437 0.02727
## Participant.4 Cue_Con 0.0007531 0.02744
## Participant.5 Cue_Con_Ali 0.0051144 0.07151
## Residual 0.1334233 0.36527
## Number of obs: 44710, groups: Participant, 64
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.678e+00 4.171e-02 6.221e+01 160.114 < 2e-16 ***
## Cue2-1 3.910e-02 1.830e-02 6.350e+01 2.136 0.03651 *
## Congruency2-1 3.524e-02 4.818e-03 5.488e+01 7.315 1.16e-09 ***
## Alignment2-1 1.468e-02 4.961e-03 5.586e+01 2.959 0.00452 **
## Probability0.5 8.884e-02 5.897e-02 6.216e+01 1.507 0.13700
## Probability0.75 1.024e-02 5.087e-03 4.369e+04 2.013 0.04411 *
## Cue2-1:Congruency2-1 4.227e-03 7.913e-03 5.079e+01 0.534 0.59555
## Cue2-1:Alignment2-1 -2.343e-03 6.978e-03 4.357e+04 -0.336 0.73703
## Congruency2-1:Alignment2-1 -4.510e-02 6.975e-03 4.236e+04 -6.465 1.02e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.414e-02 1.680e-02 3.814e+01 -0.841 0.40538
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_rt_emm <- file.path(folder_lmm, "rt_emm.RData")
if (!file.exists(file_rt_emm)) {
emm_rt <- emmeans(glmm_rt_opt, ~ Cue + Congruency + Alignment)
} else {
load(file_rt_emm)
}
summary(emm_rt, type = "response") # equivalent to regrid(emm_rt)
## Cue Congruency Alignment response SE df asymp.LCL asymp.UCL
## top congruent aligned 778 25.5 Inf 730 830
## bottom congruent aligned 806 26.4 Inf 756 859
## top incongruent aligned 820 26.9 Inf 769 874
## bottom incongruent aligned 859 28.2 Inf 805 916
## top congruent misaligned 806 26.4 Inf 756 859
## bottom congruent misaligned 838 27.4 Inf 786 894
## top incongruent misaligned 817 26.8 Inf 767 872
## bottom incongruent misaligned 848 27.8 Inf 795 904
##
## Results are averaged over the levels of: Probability
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
# emmip(regrid(emm_rt), Congruency ~ Alignment | Cue, CIs = TRUE)
plot_E12_cf_rt <- summary(emm_rt, type = "response") %>%
as_tibble() %>%
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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(. ~Cue, switch = "both") +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", 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
Composite face effects for top and bottom parts:
emm_rt_cf <- contrast(regrid(emm_rt), interaction = "pairwise", by = "Cue", infer = TRUE)
emm_rt_cf[1:2]
## Congruency_pairwise Alignment_pairwise Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top -30.2 8.76 Inf -47.4 -13.0 -3.447 0.0006
## congruent - incongruent aligned - misaligned bottom -43.3 9.37 Inf -61.6 -24.9 -4.616 <.0001
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
# emmip(emm_rt_cf[1:2], ~ Cue , CIs = TRUE) +
# geom_hline(yintercept = 0, linetype = "dashed")
emm_rt_con <- contrast(regrid(emm_rt), interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_rt_con[c(1,2)], infer = TRUE)
## Congruency_pairwise Cue Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top aligned -41.7 6.75 Inf -54.9 -28.4 -6.168 <.0001
## congruent - incongruent bottom aligned -52.8 7.19 Inf -66.9 -38.7 -7.344 <.0001
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
emm_rt_fi <- contrast(regrid(emm_rt), "pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "sidak")
emm_rt_fi[1:4]
## contrast Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent -27.62 6.22 Inf -43.11 -12.1 -4.440 <.0001
## aligned - misaligned bottom congruent -32.54 6.59 Inf -48.96 -16.1 -4.935 <.0001
## aligned - misaligned top incongruent 2.59 6.85 Inf -14.48 19.7 0.378 0.9925
## aligned - misaligned bottom incongruent 10.73 7.32 Inf -7.49 28.9 1.466 0.4594
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: sidak method for 4 tests
# emmip(emm_rt_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak") +
# geom_hline(yintercept = 0, linetype = "dashed")
plot_E12_cffi_rt <- emm_rt_fi[1:4] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(. ~ Congruency, switch = "both") +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", 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
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 = c(0.6, 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 = 20)),
widths = c(1.5, 1),
nrow = 1)
# ggsave(filename = "E12_rt.pdf", plot_E12_rt, width = 10, height = 4.5)
plot_E12_rt
contrast(emm_rt_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>%
summary(infer = TRUE)
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top -25.0 9.72 Inf -44.1 -5.97 -2.574 0.0100
## faci-inte bottom -21.8 10.30 Inf -42.0 -1.62 -2.118 0.0342
##
## Results are averaged over the levels of: Probability
## Confidence level used: 0.95
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)
# ggsave(filename = "E1.pdf", plot_E1, width = 10, height = 9)
plot_E1
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)
# ggsave(filename = "E2.pdf", plot_E2, width = 10, height = 14)
plot_E2
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)
# ggsave(filename = "E12.pdf", plot_E12, width = 10, height = 9)
plot_E12
This analysis was included to reply to reviewers’ question on the
possibility of lognormal()
distorting the response time
results.
In a nutshell, 1) comparing to the models fitted without
lognormal()
, residuals in models fitted with
lognormal()
were more normally distributed. 2) the results
from models fitted without and with lognormal()
were
similar.
without log-transformation. #### The maximal model
# file_E1_rte_max <- file.path(folder_lmm, "E1_rte_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E1_rte_max)) {
# lmm_E1_rte_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment +
# (Cue * Congruency * Alignment | Participant),
# family = lognormal(),
# data = df_lmm_E1_rte,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(lmm_E1_rte_max, file = file_E1_rte_max)
# } else {
# load(file_E1_rte_max)
# }
#
# print(summary(lmm_E1_rte_max), corr = FALSE)
file_E1_rte_zcp <- file.path(folder_lmm, "E1_rte_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_E1_rte_zcp)) {
lmm_E1_rte_zcp <- lmer(
RT ~ Cue * Congruency * Alignment +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E1_rte_zcp, file = file_E1_rte_zcp)
} else {
load(file_E1_rte_zcp)
}
print(summary(lmm_E1_rte_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 229185.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.282 -0.336 -0.133 0.115 41.483
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 113556.2 336.98
## Participant.1 Cue_C 49441.5 222.35
## Participant.2 Con_C 126.1 11.23
## Participant.3 Ali_C 2562.5 50.62
## Participant.4 Cue_Con 1455.2 38.15
## Participant.5 Cue_Ali 10055.3 100.28
## Participant.6 Con_Ali 0.0 0.00
## Participant.7 Cue_Con_Ali 86488.6 294.09
## Residual 504376.3 710.19
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 933.77 65.23 42.97 14.314 <2e-16 ***
## Cuebottom 54.56 47.97 53.80 1.137 0.260
## Congruencyincongruent 40.85 27.43 113.76 1.489 0.139
## Alignmentmisaligned 14.92 28.49 90.63 0.524 0.602
## Cuebottom:Congruencyincongruent 34.27 43.46 55.92 0.789 0.434
## Cuebottom:Alignmentmisaligned 59.73 44.84 49.59 1.332 0.189
## Congruencyincongruent:Alignmentmisaligned -10.59 42.20 60.49 -0.251 0.803
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -63.92 70.84 30.27 -0.902 0.374
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E1_rte_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 0.4745 0.4141 0.3131 0.14120 0.07128 0.05371 0.01581 0
## Proportion of Variance 0.4306 0.3280 0.1875 0.03813 0.00972 0.00552 0.00048 0
## Cumulative Proportion 0.4306 0.7587 0.9462 0.98428 0.99400 0.99952 1.00000 1
Con_Ali
and Con_C
were removed from
extended model (lmm_E1_rte_zcp
) due to that the variance it
explained was smaller than 0.1%, making lmm_E1_rte_rdc
.
file_E1_rte_rdc <- file.path(folder_lmm, "E1_rte_lmm_rdc.RData")
# fit the rdc1 model
if (!file.exists(file_E1_rte_rdc)) {
lmm_E1_rte_rdc <- lmer(
RT ~ Cue * Congruency * Alignment +
(Cue_C + Ali_C + # Con_C +
Cue_Con + Cue_Ali + # Con_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E1_rte_rdc, file = file_E1_rte_rdc)
} else {
load(file_E1_rte_rdc)
}
print(summary(lmm_E1_rte_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 229185.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.280 -0.336 -0.133 0.115 41.485
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 113568 337.00
## Participant.1 Cue_C 49415 222.29
## Participant.2 Ali_C 2568 50.67
## Participant.3 Cue_Con 1416 37.63
## Participant.4 Cue_Ali 10050 100.25
## Participant.5 Cue_Con_Ali 86446 294.02
## Residual 504408 710.22
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 933.77 65.23 42.95 14.316 <2e-16 ***
## Cuebottom 54.55 47.95 53.85 1.138 0.260
## Congruencyincongruent 40.75 27.35 138.49 1.490 0.138
## Alignmentmisaligned 14.93 28.50 90.64 0.524 0.602
## Cuebottom:Congruencyincongruent 34.38 43.43 56.03 0.792 0.432
## Cuebottom:Alignmentmisaligned 59.72 44.84 49.59 1.332 0.189
## Congruencyincongruent:Alignmentmisaligned -10.59 42.20 60.50 -0.251 0.803
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -63.92 70.83 30.27 -0.902 0.374
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E1_rte_etd <- file.path(folder_lmm, "E1_rte_lmm_etd.RData")
# fit the etd1 model
if (!file.exists(file_E1_rte_etd)) {
lmm_E1_rte_etd <- lmer(
RT ~ Cue * Congruency * Alignment +
(Cue_C + Ali_C + # Con_C +
Cue_Con + Cue_Ali + # Con_Ali +
Cue_Con_Ali | Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E1_rte_etd, file = file_E1_rte_etd)
} else {
load(file_E1_rte_etd)
}
print(summary(lmm_E1_rte_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 229144.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.539 -0.336 -0.134 0.115 41.374
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 113480 336.87
## Cue_C 48950 221.25 0.01
## Ali_C 3753 61.27 -0.18 0.61
## Cue_Con 8578 92.62 0.08 -0.38 -0.96
## Cue_Ali 14993 122.45 0.46 0.29 0.71 -0.81
## Cue_Con_Ali 85427 292.28 -0.67 -0.31 0.19 -0.24 0.00
## Residual 503518 709.59
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 934.19 72.62 31.50 12.865 4.41e-14 ***
## Cuebottom 52.25 44.39 32.74 1.177 0.248
## Congruencyincongruent 43.19 29.17 79.83 1.481 0.143
## Alignmentmisaligned 13.84 27.71 54.66 0.499 0.619
## Cuebottom:Congruencyincongruent 31.77 47.98 36.86 0.662 0.512
## Cuebottom:Alignmentmisaligned 65.03 46.37 33.90 1.402 0.170
## Congruencyincongruent:Alignmentmisaligned -16.07 42.00 60.45 -0.383 0.703
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -60.94 70.52 30.32 -0.864 0.394
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 (none)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E1_rte_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6]
## Standard deviation 0.5819 0.3406 0.2775 0.1221 0.005737 1.913e-17
## Proportion of Variance 0.6195 0.2122 0.1409 0.0273 0.000060 0.000e+00
## Cumulative Proportion 0.6195 0.8317 0.9726 0.9999 1.000000 1.000e+00
Ali_C
, and Cue_Con
were removed from
extended model.
file_E1_rte_etd1 <- file.path(folder_lmm, "E1_rte_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E1_rte_etd1)) {
lmm_E1_rte_etd1 <- lmer(
RT ~ Cue * Congruency * Alignment +
(Cue_C + # Con_C + Ali_C +
Cue_Ali + # Con_Ali + Cue_Con +
Cue_Con_Ali | Participant),
data = df_lmm_E1_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E1_rte_etd1, file = file_E1_rte_etd1)
} else {
load(file_E1_rte_etd1)
}
print(summary(lmm_E1_rte_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 229169.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.262 -0.337 -0.136 0.117 41.484
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 113524 336.93
## Cue_C 49530 222.55 0.01
## Cue_Ali 9520 97.57 0.52 0.33
## Cue_Con_Ali 85117 291.75 -0.69 -0.27 0.10
## Residual 505119 710.72
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 934.35 69.81 32.33 13.384 9.85e-15 ***
## Cuebottom 52.79 42.01 36.49 1.257 0.217
## Congruencyincongruent 40.54 27.07 170.03 1.497 0.136
## Alignmentmisaligned 14.05 26.49 91.47 0.530 0.597
## Cuebottom:Congruencyincongruent 36.38 42.77 67.09 0.851 0.398
## Cuebottom:Alignmentmisaligned 62.61 43.51 41.66 1.439 0.158
## Congruencyincongruent:Alignmentmisaligned -10.91 42.04 62.05 -0.259 0.796
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -66.61 70.47 30.93 -0.945 0.352
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(lmm_E1_rte_etd1, lmm_E1_rte_rdc, refit = FALSE)
## Data: df_lmm_E1_rt
## Models:
## lmm_E1_rte_rdc: RT ~ Cue * Congruency * Alignment + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
## lmm_E1_rte_etd1: RT ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali | Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## lmm_E1_rte_rdc 15 229216 229329 -114593 229186
## lmm_E1_rte_etd1 19 229208 229352 -114585 229170 15.691 4 0.003463 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (lmm_E1_rte_rdc
)
explained the data better than the extended model
(lmm_E1_rte_etd1
) and, therefore, the reduced model is used
as the optimal model.
lmm_E1_rte_opt <- lmm_E1_rte_etd1
print(summary(lmm_E1_rte_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 229169.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.262 -0.337 -0.136 0.117 41.484
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 113524 336.93
## Cue_C 49530 222.55 0.01
## Cue_Ali 9520 97.57 0.52 0.33
## Cue_Con_Ali 85117 291.75 -0.69 -0.27 0.10
## Residual 505119 710.72
## Number of obs: 14339, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 934.35 69.81 32.33 13.384 9.85e-15 ***
## Cuebottom 52.79 42.01 36.49 1.257 0.217
## Congruencyincongruent 40.54 27.07 170.03 1.497 0.136
## Alignmentmisaligned 14.05 26.49 91.47 0.530 0.597
## Cuebottom:Congruencyincongruent 36.38 42.77 67.09 0.851 0.398
## Cuebottom:Alignmentmisaligned 62.61 43.51 41.66 1.439 0.158
## Congruencyincongruent:Alignmentmisaligned -10.91 42.04 62.05 -0.259 0.796
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -66.61 70.47 30.93 -0.945 0.352
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
resi_E1_lmm <- plot(lmm_E1_rte_opt, resid(., scaled=TRUE) ~ fitted(.), abline = 0,
ylim = c(-6, 47),
xlab = "Fitted values (RT)",
ylab = "Scaled residuals",
main= "LMM without log-transformation (Experiment 1)")
resi_E1_lmm
resi_E1_glmm <- plot(glmm_E1_rt_opt, resid(., scaled=TRUE) ~ fitted(.), abline = 0,
ylim = c(-6, 47),
xlab = "Fitted values (log(RT))",
ylab = "Scaled residuals",
main = "GLMM with log-transformation (Experiment 1)")
resi_E1_glmm
file_E1_rte_emm <- file.path(folder_lmm, "E1_rte_emm.RData")
if (!file.exists(file_E1_rte_emm)) {
emm_E1_rte <- emmeans(lmm_E1_rte_opt, ~ Cue + Congruency + Alignment)
} else {
load(file_E1_rte_emm)
}
# emmip(regrid(emm_E1_rte), Congruency ~ Alignment | Cue, CIs = TRUE)
summary(emm_E1_rte, type = "response") # equivalent to regrid(emm_rte)
## Cue Congruency Alignment emmean SE df asymp.LCL asymp.UCL
## top congruent aligned 934 69.8 Inf 798 1071
## bottom congruent aligned 987 57.9 Inf 874 1101
## top incongruent aligned 975 63.8 Inf 850 1100
## bottom incongruent aligned 1064 68.0 Inf 931 1197
## top congruent misaligned 948 59.6 Inf 832 1065
## bottom congruent misaligned 1064 72.1 Inf 923 1205
## top incongruent misaligned 978 67.3 Inf 846 1110
## bottom incongruent misaligned 1063 63.9 Inf 938 1188
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
plot_E1_cf_rte <- summary(emm_E1_rte) %>%
as_tibble() %>%
ggplot(aes(y = emmean, 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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(. ~Cue, switch = "both") +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", 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_rte.pdf", plot_E1_cf_rte, width = 8, height = 4.8)
plot_E1_cf_rte
Composite face effects for top and bottom parts:
emm_E1_rte_cf <- contrast(regrid(emm_E1_rte), interaction = "pairwise", by = "Cue", infer = TRUE)
emm_E1_rte_cf[1:2]
## Congruency_pairwise Alignment_pairwise Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top -10.9 42.0 Inf -93.3 71.49 -0.259 0.7953
## congruent - incongruent aligned - misaligned bottom -77.5 43.3 Inf -162.4 7.37 -1.790 0.0735
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
emm_E1_rte_con <- contrast(regrid(emm_E1_rte), interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_E1_rte_con[c(1,2)], infer = TRUE)
## Congruency_pairwise Cue Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top aligned -40.5 27.1 Inf -93.6 12.5 -1.497 0.1343
## congruent - incongruent bottom aligned -76.9 27.7 Inf -131.1 -22.7 -2.781 0.0054
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
emm_E1_rte_fi <- contrast(regrid(emm_E1_rte), "pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "sidak")
# emmip(emm_E1_rte_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak")
emm_E1_rte_fi[1:4]
## contrast Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent -14.055 26.5 Inf -80.0 51.94 -0.530 0.9733
## aligned - misaligned bottom congruent -76.670 27.4 Inf -145.0 -8.35 -2.795 0.0206
## aligned - misaligned top incongruent -3.147 29.7 Inf -77.1 70.78 -0.106 0.9999
## aligned - misaligned bottom incongruent 0.844 30.7 Inf -75.5 77.20 0.028 1.0000
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: sidak method for 4 tests
plot_E1_cffi_rte <- emm_E1_rte_fi[1:4] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(. ~ Congruency, switch = "both") +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) + # set the names for main, x and y axis
theme(legend.position = "none") +
NULL
# ggsave(filename = "E1_fi_rte.pdf", plot_E1_cffi_rte, width = 7, height = 4.55)
plot_E1_cffi_rte
plot_E1_cf_rte_ <- plot_E1_cf_rte +
guides(color = guide_legend(nrow = 1, title.position = "left"),
linetype = guide_legend(nrow = 1, title.position = "left")) +
theme(legend.position = c(0.6, 0.1),
legend.box = "horizontal",
legend.key.height = unit(0.01, "cm"))
plot_E1_rte <- ggarrange(plot_E1_cf_rte_, plot_E1_cffi_rte,
labels = c("a", "b"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1)
# ggsave(filename = "E1_rte.pdf", plot_E1_rte, width = 10, height = 4.5)
plot_E1_rte
contrast(emm_E1_rte_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>%
summary(infer = TRUE)
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top -17.2 37.4 Inf -90.5 56.084 -0.460 0.6455
## faci-inte bottom -75.8 38.8 Inf -151.9 0.286 -1.953 0.0509
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
without log-transformation. #### The maximal model
# file_E2_rte_max <- file.path(folder_lmm, "E2_rte_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E2_rte_max)) {
# lmm_E2_rte_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment * Probability +
# (Cue * Congruency * Alignment * Probability | Participant),
# family = lognormal(),
# data = df_lmm_E2_rt,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(lmm_E2_rte_max, file = file_E2_rte_max)
# } else {
# load(file_E2_rte_max)
# }
#
# print(summary(lmm_E2_rte_max), corr = FALSE)
file_E2_rte_zcp <- file.path(folder_lmm, "E2_rte_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_E2_rte_zcp)) {
lmm_E2_rte_zcp <- lmer(
RT ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + Con_Pro + Ali_Pro +
Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro +
Cue_Con_Ali_Pro || Participant),
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E2_rte_zcp, file = file_E2_rte_zcp)
} else {
load(file_E2_rte_zcp)
}
print(summary(lmm_E2_rte_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Con_Pro + Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 462514.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.748 -0.404 -0.147 0.152 55.058
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 4.952e+04 2.225e+02
## Participant.1 Cue_C 6.862e+03 8.284e+01
## Participant.2 Con_C 5.725e+02 2.393e+01
## Participant.3 Ali_C 4.691e+02 2.166e+01
## Participant.4 Cue_Con 7.609e-05 8.723e-03
## Participant.5 Cue_Ali 3.302e+02 1.817e+01
## Participant.6 Con_Ali 5.749e-01 7.582e-01
## Participant.7 Cue_Con_Ali 6.004e+02 2.450e+01
## Participant.8 Pro_C 5.307e+04 2.304e+02
## Participant.9 Cue_Pro 1.447e+05 3.804e+02
## Participant.10 Con_Pro 0.000e+00 0.000e+00
## Participant.11 Ali_Pro 0.000e+00 0.000e+00
## Participant.12 Cue_Con_Pro 4.094e-04 2.023e-02
## Participant.13 Cue_Ali_Pro 2.257e+04 1.502e+02
## Participant.14 Con_Ali_Pro 4.535e+03 6.735e+01
## Participant.15 Cue_Con_Ali_Pro 4.495e+03 6.705e+01
## Residual 2.376e+05 4.875e+02
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 891.826 41.100 36.272 21.699 < 2e-16 ***
## Cuebottom -6.536 19.431 62.526 -0.336 0.737713
## Congruencyincongruent 56.158 14.602 324.188 3.846 0.000145 ***
## Alignmentmisaligned 44.173 13.379 169.239 3.302 0.001172 **
## Probability2-1 -122.770 56.213 71.833 -2.184 0.032229 *
## Cuebottom:Congruencyincongruent 33.169 19.841 177.638 1.672 0.096330 .
## Cuebottom:Alignmentmisaligned 15.196 18.394 75.282 0.826 0.411330
## Congruencyincongruent:Alignmentmisaligned -42.324 19.458 159.669 -2.175 0.031089 *
## Cuebottom:Probability2-1 277.275 73.119 39.521 3.792 0.000500 ***
## Congruencyincongruent:Probability2-1 -52.529 28.653 390.711 -1.833 0.067517 .
## Alignmentmisaligned:Probability2-1 -39.205 29.382 151.414 -1.334 0.184101
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -29.031 27.934 43.805 -1.039 0.304385
## Cuebottom:Congruencyincongruent:Probability2-1 112.005 39.911 245.662 2.806 0.005412 **
## Cuebottom:Alignmentmisaligned:Probability2-1 102.707 45.130 66.444 2.276 0.026087 *
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 78.117 40.920 102.556 1.909 0.059058 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -120.537 56.516 62.012 -2.133 0.036909 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 (none)
## boundary (singular) fit: see help('isSingular')
summary(rePCA(lmm_E2_rte_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
## Standard deviation 0.7804 0.4726 0.4565 0.30816 0.16993 0.13815 0.13754 0.05027 0.04909 0.04443 0.03727 0.001555 4.151e-05 1.789e-05 0 0
## Proportion of Variance 0.5029 0.1844 0.1721 0.07842 0.02385 0.01576 0.01562 0.00209 0.00199 0.00163 0.00115 0.000000 0.000e+00 0.000e+00 0 0
## Cumulative Proportion 0.5029 0.6874 0.8595 0.93791 0.96176 0.97752 0.99314 0.99523 0.99722 0.99885 1.00000 1.000000 1.000e+00 1.000e+00 1 1
Cue_Con
, Con_Ali
, Cue_Con_Pro
,
Ali_Pro
, and Con_Pro
, were removed from
extended model (lmm_E2_rte_zcp
) due to that the variance it
explained was smaller than 0.1%, making lmm_E2_rte_rdc
.
file_E2_rte_rdc <- file.path(folder_lmm, "E2_rte_lmm_rdc.RData")
# fit the rdc1 model
if (!file.exists(file_E2_rte_rdc)) {
lmm_E2_rte_rdc <- lmer(
RT ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Ali + # Cue_Con + Con_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro + Con_Ali_Pro + # Cue_Con_Pro +
Cue_Con_Ali_Pro || Participant),
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E2_rte_rdc, file = file_E2_rte_rdc)
} else {
load(file_E2_rte_rdc)
}
print(summary(lmm_E2_rte_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 462514.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.748 -0.404 -0.147 0.152 55.058
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 49550.9 222.60
## Participant.1 Cue_C 6862.9 82.84
## Participant.2 Con_C 572.7 23.93
## Participant.3 Ali_C 469.6 21.67
## Participant.4 Cue_Ali 330.4 18.18
## Participant.5 Cue_Con_Ali 588.0 24.25
## Participant.6 Pro_C 53071.4 230.37
## Participant.7 Cue_Pro 144689.2 380.38
## Participant.8 Cue_Ali_Pro 22543.5 150.15
## Participant.9 Con_Ali_Pro 4540.3 67.38
## Participant.10 Cue_Con_Ali_Pro 4641.1 68.13
## Residual 237628.9 487.47
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 891.827 41.110 36.241 21.694 < 2e-16 ***
## Cuebottom -6.536 19.431 62.493 -0.336 0.737710
## Congruencyincongruent 56.156 14.602 325.282 3.846 0.000145 ***
## Alignmentmisaligned 44.172 13.378 169.462 3.302 0.001172 **
## Probability2-1 -122.770 56.211 71.844 -2.184 0.032221 *
## Cuebottom:Congruencyincongruent 33.169 19.838 176.282 1.672 0.096303 .
## Cuebottom:Alignmentmisaligned 15.196 18.391 74.926 0.826 0.411272
## Congruencyincongruent:Alignmentmisaligned -42.321 19.455 161.191 -2.175 0.031061 *
## Cuebottom:Probability2-1 277.275 73.113 39.538 3.792 0.000500 ***
## Congruencyincongruent:Probability2-1 -52.529 28.658 392.405 -1.833 0.067570 .
## Alignmentmisaligned:Probability2-1 -39.205 29.385 151.821 -1.334 0.184135
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -29.030 27.927 43.447 -1.040 0.304322
## Cuebottom:Congruencyincongruent:Probability2-1 112.006 39.926 249.077 2.805 0.005423 **
## Cuebottom:Alignmentmisaligned:Probability2-1 102.708 45.135 66.700 2.276 0.026089 *
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 78.117 40.936 103.082 1.908 0.059142 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -120.537 56.557 62.969 -2.131 0.036978 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00308474 (tol = 0.002, component 1)
file_E2_rte_etd <- file.path(folder_lmm, "E2_rte_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_E2_rte_etd)) {
lmm_E2_rte_etd <- lmer(
RT ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Ali + # Cue_Con + Con_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro + Con_Ali_Pro + # Cue_Con_Pro +
Cue_Con_Ali_Pro | Participant),
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E2_rte_etd, file = file_E2_rte_etd)
} else {
load(file_E2_rte_etd)
}
print(summary(lmm_E2_rte_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro | Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 462393.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.828 -0.405 -0.146 0.153 55.044
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 50234.3 224.13
## Cue_C 7239.6 85.09 -0.19
## Con_C 776.9 27.87 0.42 -0.70
## Ali_C 1148.7 33.89 0.15 0.56 -0.38
## Cue_Ali 2136.1 46.22 -0.32 0.64 -0.45 0.24
## Cue_Con_Ali 10001.0 100.01 -0.68 -0.04 -0.38 -0.10 0.24
## Pro_C 54767.0 234.02 0.27 0.50 -0.38 0.23 0.00 -0.69
## Cue_Pro 146209.2 382.37 0.68 -0.40 0.45 -0.55 -0.33 -0.52 0.22
## Cue_Ali_Pro 41138.6 202.83 -0.27 0.60 -0.31 0.60 0.72 0.06 0.06 -0.69
## Con_Ali_Pro 6657.6 81.59 -0.06 -0.22 -0.03 0.43 -0.27 0.39 -0.41 -0.37 -0.14
## Cue_Con_Ali_Pro 38623.6 196.53 -0.27 0.43 -0.53 0.06 0.73 0.56 -0.21 -0.09 0.15 0.07
## Residual 237054.7 486.88
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 891.792 41.942 31.665 21.263 < 2e-16 ***
## Cuebottom -6.013 18.102 45.881 -0.332 0.741271
## Congruencyincongruent 55.087 14.864 296.961 3.706 0.000251 ***
## Alignmentmisaligned 43.562 14.358 89.296 3.034 0.003161 **
## Probability2-1 -123.150 55.746 33.188 -2.209 0.034178 *
## Cuebottom:Congruencyincongruent 33.156 21.572 167.135 1.537 0.126183
## Cuebottom:Alignmentmisaligned 15.846 20.785 65.124 0.762 0.448573
## Congruencyincongruent:Alignmentmisaligned -40.564 21.232 156.536 -1.911 0.057897 .
## Cuebottom:Probability2-1 277.423 84.313 32.469 3.290 0.002415 **
## Congruencyincongruent:Probability2-1 -52.705 29.919 230.968 -1.762 0.079464 .
## Alignmentmisaligned:Probability2-1 -37.843 31.568 61.957 -1.199 0.235177
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -30.333 32.730 55.587 -0.927 0.358060
## Cuebottom:Congruencyincongruent:Probability2-1 112.420 43.094 224.952 2.609 0.009698 **
## Cuebottom:Alignmentmisaligned:Probability2-1 102.357 51.842 40.184 1.974 0.055234 .
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 78.408 44.373 70.412 1.767 0.081562 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -121.037 65.197 73.886 -1.856 0.067369 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 (none)
## Model failed to converge with max|grad| = 0.0850029 (tol = 0.002, component 1)
summary(rePCA(lmm_E2_rte_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
## Standard deviation 0.9269 0.5349 0.4197 0.35088 0.23739 0.08613 0.07367 0.01932 0.001903 5.587e-05 3.188e-05
## Proportion of Variance 0.5675 0.1890 0.1163 0.08131 0.03722 0.00490 0.00358 0.00025 0.000000 0.000e+00 0.000e+00
## Cumulative Proportion 0.5675 0.7564 0.8727 0.95405 0.99127 0.99617 0.99975 1.00000 1.000000 1.000e+00 1.000e+00
Con_C
, Ali_C
, Cue_C
,
Cue_Ali
, Cue_Con_Ali
and
Con_Ali_Pro
were removed from extended model.
file_E2_rte_etd1 <- file.path(folder_lmm, "E2_rte_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E2_rte_etd1)) {
lmm_E2_rte_etd1 <- lmer(
RT ~ Cue * Congruency * Alignment * Probability +
(# Cue_C + Con_C + Ali_C +
# Cue_Ali + # Cue_Con + Con_Ali +
# Cue_Con_Ali +
Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro + # Con_Ali_Pro + Cue_Con_Pro +
Cue_Con_Ali_Pro | Participant),
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E2_rte_etd1, file = file_E2_rte_etd1)
} else {
load(file_E2_rte_etd1)
}
print(summary(lmm_E2_rte_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro + Cue_Ali_Pro + Cue_Con_Ali_Pro | Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 462579.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.101 -0.410 -0.146 0.155 54.975
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 50248 224.16
## Pro_C 46212 214.97 0.35
## Cue_Pro 146707 383.02 0.69 0.36
## Cue_Ali_Pro 21679 147.24 -0.42 -0.15 -0.64
## Cue_Con_Ali_Pro 7000 83.66 -0.64 -0.73 -0.11 0.01
## Residual 239134 489.01
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 889.94 40.61 33.67 21.913 < 2e-16 ***
## Cuebottom -4.37 12.63 30240.29 -0.346 0.729405
## Congruencyincongruent 58.74 13.91 30234.97 4.222 2.43e-05 ***
## Alignmentmisaligned 44.37 12.70 30235.28 3.494 0.000477 ***
## Probability2-1 -119.05 48.27 36.42 -2.466 0.018482 *
## Cuebottom:Congruencyincongruent 30.81 19.67 30247.37 1.566 0.117274
## Cuebottom:Alignmentmisaligned 14.27 18.02 30240.97 0.792 0.428402
## Congruencyincongruent:Alignmentmisaligned -44.61 19.36 30234.77 -2.304 0.021204 *
## Cuebottom:Probability2-1 273.77 80.50 33.21 3.401 0.001765 **
## Congruencyincongruent:Probability2-1 -57.36 28.11 4475.83 -2.041 0.041332 *
## Alignmentmisaligned:Probability2-1 -40.51 28.76 132.58 -1.408 0.161402
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -28.36 27.62 30254.81 -1.027 0.304396
## Cuebottom:Congruencyincongruent:Probability2-1 117.62 40.16 1289.85 2.928 0.003467 **
## Cuebottom:Alignmentmisaligned:Probability2-1 104.08 45.04 49.91 2.311 0.025002 *
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 80.87 39.44 1201.97 2.050 0.040545 *
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -125.76 57.23 341.83 -2.197 0.028662 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00515642 (tol = 0.002, component 1)
summary(rePCA(lmm_E2_rte_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5]
## Standard deviation 0.8969 0.4277 0.31723 0.22111 0.002423
## Proportion of Variance 0.7076 0.1609 0.08853 0.04301 0.000010
## Cumulative Proportion 0.7076 0.8685 0.95699 0.99999 1.000000
Cue_Con_Ali_Pro
was removed from extended model.
file_E2_rte_etd2 <- file.path(folder_lmm, "E2_rte_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_E2_rte_etd2)) {
lmm_E2_rte_etd2 <- lmer(
RT ~ Cue * Congruency * Alignment * Probability +
(# Cue_C + Con_C + Ali_C +
# Cue_Ali + # Cue_Con + Con_Ali +
# Cue_Con_Ali +
Pro_C +
Cue_Pro + # Con_Pro + Ali_Pro +
Cue_Ali_Pro # +Con_Ali_Pro + Cue_Con_Pro +
| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2_rt,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(lmm_E2_rte_etd2, file = file_E2_rte_etd2)
} else {
load(file_E2_rte_etd2)
}
print(summary(lmm_E2_rte_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro + Cue_Ali_Pro | Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 462582.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.097 -0.410 -0.145 0.155 54.983
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 50259 224.2
## Pro_C 46274 215.1 0.35
## Cue_Pro 146624 382.9 0.68 0.36
## Cue_Ali_Pro 21615 147.0 -0.41 -0.14 -0.64
## Residual 239161 489.0
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 889.846 40.616 33.661 21.909 < 2e-16 ***
## Cuebottom -4.304 12.632 30243.358 -0.341 0.73334
## Congruencyincongruent 58.617 13.915 30256.381 4.212 2.53e-05 ***
## Alignmentmisaligned 44.489 12.699 30255.570 3.503 0.00046 ***
## Probability2-1 -118.939 47.393 37.558 -2.510 0.01652 *
## Cuebottom:Congruencyincongruent 30.861 19.669 30248.587 1.569 0.11666
## Cuebottom:Alignmentmisaligned 14.175 18.022 30252.502 0.787 0.43154
## Congruencyincongruent:Alignmentmisaligned -44.475 19.361 30260.748 -2.297 0.02161 *
## Cuebottom:Probability2-1 273.795 80.697 34.275 3.393 0.00176 **
## Congruencyincongruent:Probability2-1 -56.865 27.867 30262.095 -2.041 0.04130 *
## Alignmentmisaligned:Probability2-1 -40.668 28.538 240.765 -1.425 0.15545
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -28.129 27.619 30260.127 -1.018 0.30846
## Cuebottom:Congruencyincongruent:Probability2-1 116.664 39.483 30269.231 2.955 0.00313 **
## Cuebottom:Alignmentmisaligned:Probability2-1 103.892 44.461 88.928 2.337 0.02170 *
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 80.301 38.745 30254.394 2.073 0.03822 *
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -123.846 55.291 30215.866 -2.240 0.02511 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(lmm_E2_rte_etd2, lmm_E2_rte_rdc, refit = FALSE)
## Data: df_lmm_E2_rt
## Models:
## lmm_E2_rte_etd2: RT ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro + Cue_Ali_Pro | Participant)
## lmm_E2_rte_rdc: RT ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## lmm_E2_rte_etd2 27 462637 462861 -231291 462583
## lmm_E2_rte_rdc 28 462570 462803 -231257 462514 68.127 1 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (lmm_E2_rte_rdc
)
explained the data better than the extended model
(lmm_E2_rte_etd1
) and, therefore, the reduced model is used
as the optimal model.
lmm_E2_rte_opt <- lmm_E2_rte_rdc
print(summary(lmm_E2_rte_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: RT ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
## Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 462514.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.748 -0.404 -0.147 0.152 55.058
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 49550.9 222.60
## Participant.1 Cue_C 6862.9 82.84
## Participant.2 Con_C 572.7 23.93
## Participant.3 Ali_C 469.6 21.67
## Participant.4 Cue_Ali 330.4 18.18
## Participant.5 Cue_Con_Ali 588.0 24.25
## Participant.6 Pro_C 53071.4 230.37
## Participant.7 Cue_Pro 144689.2 380.38
## Participant.8 Cue_Ali_Pro 22543.5 150.15
## Participant.9 Con_Ali_Pro 4540.3 67.38
## Participant.10 Cue_Con_Ali_Pro 4641.1 68.13
## Residual 237628.9 487.47
## Number of obs: 30371, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 891.827 41.110 36.241 21.694 < 2e-16 ***
## Cuebottom -6.536 19.431 62.493 -0.336 0.737710
## Congruencyincongruent 56.156 14.602 325.282 3.846 0.000145 ***
## Alignmentmisaligned 44.172 13.378 169.462 3.302 0.001172 **
## Probability2-1 -122.770 56.211 71.844 -2.184 0.032221 *
## Cuebottom:Congruencyincongruent 33.169 19.838 176.282 1.672 0.096303 .
## Cuebottom:Alignmentmisaligned 15.196 18.391 74.926 0.826 0.411272
## Congruencyincongruent:Alignmentmisaligned -42.321 19.455 161.191 -2.175 0.031061 *
## Cuebottom:Probability2-1 277.275 73.113 39.538 3.792 0.000500 ***
## Congruencyincongruent:Probability2-1 -52.529 28.658 392.405 -1.833 0.067570 .
## Alignmentmisaligned:Probability2-1 -39.205 29.385 151.821 -1.334 0.184135
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -29.030 27.927 43.447 -1.040 0.304322
## Cuebottom:Congruencyincongruent:Probability2-1 112.006 39.926 249.077 2.805 0.005423 **
## Cuebottom:Alignmentmisaligned:Probability2-1 102.708 45.135 66.700 2.276 0.026089 *
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 78.117 40.936 103.082 1.908 0.059142 .
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -120.537 56.557 62.969 -2.131 0.036978 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00308474 (tol = 0.002, component 1)
resi_E2_lmm <- plot(lmm_E2_rte_opt, resid(., scaled=TRUE) ~ fitted(.), abline = 0,
ylim = c(-6, 47),
xlab = "Fitted values (RT)",
ylab = "Scaled residuals",
main= "LMM without log-transformation (Experiment 2)")
resi_E2_lmm
resi_E2_glmm <- plot(glmm_E2_rt_opt, resid(., scaled=TRUE) ~ fitted(.), abline = 0,
ylim = c(-6, 47),
xlab = "Fitted values (log(RT))",
ylab = "Scaled residuals",
main = "GLMM with log-transformation (Experiment 2)")
resi_E2_glmm
file_E2_rte_emm <- file.path(folder_lmm, "E2_rte_emm.RData")
if (!file.exists(file_E2_rte_emm)) {
emm_E2_rte <- emmeans(lmm_E2_rte_opt, ~ Cue + Congruency + Alignment + Probability)
} else {
load(file_E2_rte_emm)
}
summary(emm_E2_rte) # equivalent to regrid(emm_rte)
## Cue Congruency Alignment Probability emmean SE df asymp.LCL asymp.UCL
## top congruent aligned 0.25 953 50.7 Inf 854 1052
## bottom congruent aligned 0.25 808 49.0 Inf 712 904
## top incongruent aligned 0.25 1036 51.9 Inf 934 1137
## bottom incongruent aligned 0.25 868 49.1 Inf 771 964
## top congruent misaligned 0.25 1017 50.8 Inf 918 1116
## bottom congruent misaligned 0.25 836 49.0 Inf 740 932
## top incongruent misaligned 0.25 1018 51.4 Inf 917 1119
## bottom incongruent misaligned 0.25 845 49.1 Inf 749 941
## top congruent aligned 0.75 830 48.9 Inf 735 926
## bottom congruent aligned 0.75 963 50.7 Inf 863 1062
## top incongruent aligned 0.75 860 49.1 Inf 764 957
## bottom incongruent aligned 0.75 1082 51.8 Inf 980 1183
## top congruent misaligned 0.75 855 49.0 Inf 759 951
## bottom congruent misaligned 0.75 1054 50.8 Inf 954 1153
## top incongruent misaligned 0.75 882 49.0 Inf 786 978
## bottom incongruent misaligned 0.75 1080 51.9 Inf 978 1182
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
# emmip(regrid(emm_E2_rte), Congruency ~ Alignment | Cue + Probability, CIs = TRUE)
plot_E2_cf_rte <- summary(emm_E2_rte) %>%
as_tibble() %>%
ggplot(aes(y = emmean, 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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(Probability ~Cue, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", 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_rte.pdf", plot_E2_cf_rte, width = 8, height = 4.8)
plot_E2_cf_rte
Composite face effects for top and bottom parts:
emm_E2_rte_cf <- contrast(regrid(emm_E2_rte), interaction = "pairwise", by = c("Cue", "Probability"), infer = TRUE)
emm_E2_rte_cf[1:4]
## Congruency_pairwise Alignment_pairwise Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top 0.25 -81.38 35.0 Inf -150.0 -12.7 -2.323 0.0202
## congruent - incongruent aligned - misaligned bottom 0.25 -50.14 19.4 Inf -88.3 -12.0 -2.578 0.0099
## congruent - incongruent aligned - misaligned top 0.75 -3.26 19.2 Inf -40.8 34.3 -0.170 0.8649
## congruent - incongruent aligned - misaligned bottom 0.75 -92.56 35.7 Inf -162.5 -22.6 -2.593 0.0095
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
emm_E2_rte_con <- contrast(regrid(emm_E2_rte), interaction = "pairwise", by = c("Cue", "Probability", "Alignment"))
summary(emm_E2_rte_con[c(1,2,5,6)], infer = TRUE)
## Congruency_pairwise Cue Probability Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top 0.25 aligned -82.4 25.4 Inf -132.2 -32.65 -3.246 0.0012
## congruent - incongruent bottom 0.25 aligned -59.6 14.0 Inf -87.0 -32.13 -4.253 <.0001
## congruent - incongruent top 0.75 aligned -29.9 13.9 Inf -57.1 -2.72 -2.156 0.0311
## congruent - incongruent bottom 0.75 aligned -119.1 25.4 Inf -168.8 -69.34 -4.693 <.0001
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
emm_E2_rte_fi <- contrast(regrid(emm_E2_rte), "pairwise", by = c("Cue", "Congruency", "Probability"), infer=TRUE, adjust = "sidak")
emm_E2_rte_fi[1:8]
## contrast Cue Congruency Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent 0.25 -63.77 23.8 Inf -128.8 1.23 -2.675 0.0582
## aligned - misaligned bottom congruent 0.25 -27.62 15.0 Inf -68.6 13.33 -1.839 0.4203
## aligned - misaligned top incongruent 0.25 17.60 27.5 Inf -57.4 92.62 0.640 0.9973
## aligned - misaligned bottom incongruent 0.25 22.52 15.8 Inf -20.7 65.75 1.421 0.7408
## aligned - misaligned top congruent 0.75 -24.57 14.9 Inf -65.2 16.01 -1.651 0.5647
## aligned - misaligned bottom congruent 0.75 -91.12 24.0 Inf -156.4 -25.80 -3.804 0.0011
## aligned - misaligned top incongruent 0.75 -21.31 15.6 Inf -64.0 21.34 -1.363 0.7813
## aligned - misaligned bottom incongruent 0.75 1.44 28.3 Inf -75.7 78.55 0.051 1.0000
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 8 estimates
## P value adjustment: sidak method for 8 tests
# emmip(emm_E2_rte_fi[1:8], ~ Probability | Cue + Congruency, CIs = TRUE, adjust = "sidak") +
# geom_hline(yintercept = 0, linetype = "dashed")
plot_E2_cffi_rte <- emm_E2_rte_fi[1:8] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(Probability ~ Congruency, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) + # set the names for main, x and y axis
theme(legend.position = "none") +
NULL
# ggsave(filename = "E2_fi_rte.pdf", plot_E2_cffi_rte, width = 7, height = 4.55)
plot_E2_cffi_rte
plot_E2_cf_rte_ <- plot_E2_cf_rte +
guides(color = guide_legend(nrow = 1, title.position = "left"),
linetype = guide_legend(nrow = 1, title.position = "left")) +
theme(legend.position = c(0.6, 0.5),
legend.box = "horizontal")
plot_E2_rte <- ggarrange(plot_E2_cf_rte_, plot_E2_cffi_rte,
labels = c("a", "b"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1)
# ggsave(filename = "E2_rte.pdf", plot_E2_rte, width = 10, height = 7)
plot_E2_rte
contrast(emm_E2_rte_fi, method = list("faci-inte"=c(1, 1)), by = c("Cue", "Probability"))[1:4] %>%
summary(infer = TRUE)
## contrast Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top 0.25 -46.17 37.7 Inf -120.1 27.757 -1.224 0.2209
## faci-inte bottom 0.25 -5.09 24.0 Inf -52.1 41.913 -0.212 0.8318
## faci-inte top 0.75 -45.88 23.8 Inf -92.4 0.686 -1.931 0.0535
## faci-inte bottom 0.75 -89.68 38.4 Inf -164.9 -14.466 -2.337 0.0194
##
## Degrees-of-freedom method: inherited from asymptotic when re-gridding
## Confidence level used: 0.95
ggarrange(resi_E1_lmm, resi_E1_glmm,
resi_E2_lmm, resi_E2_glmm)
ggsave("residuals_vs_fitted.png", width = 12, height = 8.4)
First, participants did not demonstrate floor effect overall in both experiments.
contr_E1_resp_fe <- contrast(
emmeans(glmm_E1_resp_opt, ~ Cue + SameDifferent),
method = "pairwise", simple = "SameDifferent")
summary(contr_E1_resp_fe[2], infer = c(TRUE, TRUE))
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## same - different bottom 0.991 0.115 Inf 0.765 1.22 8.587 <.0001
##
## Results are averaged over the levels of: Congruency, Alignment
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
contr_E2_resp_fe <- contrast(
emmeans(glmm_E2_resp_opt, ~ Probability + Cue + SameDifferent)
, method = "pairwise", simple = "SameDifferent")
summary(contr_E2_resp_fe[c(3,4)], infer = c(TRUE, TRUE), adjust="none")
## contrast Probability Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## same - different 0.25 bottom 1.702 0.122 Inf 1.463 1.94 13.978 <.0001
## same - different 0.75 bottom 0.824 0.126 Inf 0.578 1.07 6.563 <.0001
##
## Results are averaged over the levels of: Congruency, Alignment
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
The performance was even better for bottom than top in some conditions.
contrast(
emmeans(glmm_E2_resp_opt, ~ Probability + Cue + SameDifferent),
interaction = "pairwise", simple = c("SameDifferent", "Cue"))
## Probability = 0.25:
## Cue_pairwise SameDifferent_pairwise estimate SE df z.ratio p.value
## top - bottom same - different -0.772 0.181 Inf -4.269 <.0001
##
## Probability = 0.75:
## Cue_pairwise SameDifferent_pairwise estimate SE df z.ratio p.value
## top - bottom same - different 1.009 0.181 Inf 5.585 <.0001
##
## Results are averaged over the levels of: Congruency, Alignment
There were no floor effects in most conditions, but we still did not observe the interference.
summary(emm_E1_d[c(7,8)], infer = c(TRUE, TRUE), adjust = "none")
## contrast Alignment Congruency Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## same - different aligned incongruent bottom 0.516 0.145 Inf 0.233 0.800 3.570 0.0004
## same - different misaligned incongruent bottom 0.490 0.145 Inf 0.207 0.774 3.388 0.0007
##
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
summary(emm_E2_d[c(7,8,15,16)], infer = c(TRUE, TRUE), adjust = "none")
## contrast Alignment Congruency Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## same - different aligned incongruent bottom 0.25 1.2221 0.153 Inf 0.922 1.522 7.988 <.0001
## same - different misaligned incongruent bottom 0.25 1.3292 0.153 Inf 1.029 1.629 8.676 <.0001
## same - different aligned incongruent bottom 0.75 0.1366 0.164 Inf -0.184 0.458 0.834 0.4041
## same - different misaligned incongruent bottom 0.75 0.0666 0.164 Inf -0.254 0.388 0.407 0.6843
##
## Note: contrasts are still on the probit scale
## Confidence level used: 0.95
df_lmm_E2 %>%
group_by(Experiment, Participant, CuedHalf, Congruency, Alignment) %>%
summarize(N = n(),
N_corr = sum(isCorrect),
.groups = "drop")
## # A tibble: 512 × 7
## Experiment Participant CuedHalf Congruency Alignment N N_corr
## <chr> <fct> <chr> <fct> <fct> <int> <dbl>
## 1 CF_Complete_75BottomCue 201 B congruent aligned 120 111
## 2 CF_Complete_75BottomCue 201 B congruent misaligned 120 102
## 3 CF_Complete_75BottomCue 201 B incongruent aligned 120 90
## 4 CF_Complete_75BottomCue 201 B incongruent misaligned 120 93
## 5 CF_Complete_75BottomCue 201 T congruent aligned 40 33
## 6 CF_Complete_75BottomCue 201 T congruent misaligned 40 35
## 7 CF_Complete_75BottomCue 201 T incongruent aligned 40 31
## 8 CF_Complete_75BottomCue 201 T incongruent misaligned 40 30
## 9 CF_Complete_75BottomCue 202 B congruent aligned 120 116
## 10 CF_Complete_75BottomCue 202 B congruent misaligned 120 112
## # … with 502 more rows
with log-transformation. #### The maximal model
# file_E1_rtall_max <- file.path(folder_lmm, "E1_rtall_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E1_rtall_max)) {
# glmm_E1_rtall_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment +
# (Cue * Congruency * Alignment | Participant),
# family = lognormal(),
# data = df_lmm_E1,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_E1_rtall_max, file = file_E1_rtall_max)
# } else {
# load(file_E1_rtall_max)
# }
#
# print(summary(glmm_E1_rtall_max), corr = FALSE)
file_E1_rtall_zcp <- file.path(folder_lmm, "E1_rtall_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_E1_rtall_zcp)) {
glmm_E1_rtall_zcp <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali || Participant),
data = df_lmm_E1,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rtall_zcp, file = file_E1_rtall_zcp)
} else {
load(file_E1_rtall_zcp)
}
print(summary(glmm_E1_rtall_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 22527.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3311 -0.5763 -0.1282 0.4409 10.2547
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0805103 0.28374
## Participant.1 Cue_C 0.0198051 0.14073
## Participant.2 Con_C 0.0006468 0.02543
## Participant.3 Ali_C 0.0013945 0.03734
## Participant.4 Cue_Con 0.0013896 0.03728
## Participant.5 Cue_Ali 0.0022539 0.04748
## Participant.6 Con_Ali 0.0007299 0.02702
## Participant.7 Cue_Con_Ali 0.0123211 0.11100
## Residual 0.1724635 0.41529
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.711e+00 5.262e-02 3.713e+01 127.544 < 2e-16 ***
## Cuebottom 9.198e-02 2.839e-02 4.644e+01 3.239 0.002216 **
## Congruencyincongruent 4.897e-02 1.399e-02 1.213e+02 3.501 0.000649 ***
## Alignmentmisaligned 3.429e-02 1.502e-02 1.171e+02 2.282 0.024272 *
## Cuebottom:Congruencyincongruent -1.358e-02 2.023e-02 6.096e+01 -0.671 0.504553
## Cuebottom:Alignmentmisaligned 6.856e-05 2.089e-02 6.176e+01 0.003 0.997391
## Congruencyincongruent:Alignmentmisaligned -2.895e-02 1.971e-02 5.987e+01 -1.468 0.147238
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 1.675e-02 3.040e-02 3.100e+01 0.551 0.585466
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E1_rtall_etd <- file.path(folder_lmm, "E1_rtall_lmm_etd.RData")
# fit the etd1 model
if (!file.exists(file_E1_rtall_etd)) {
glmm_E1_rtall_etd <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali | Participant),
data = df_lmm_E1,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rtall_etd, file = file_E1_rtall_etd)
} else {
load(file_E1_rtall_etd)
}
print(summary(glmm_E1_rtall_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 22479.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4016 -0.5776 -0.1267 0.4422 10.2613
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0805465 0.28381
## Cue_C 0.0198102 0.14075 -0.01
## Con_C 0.0009628 0.03103 -0.73 -0.08
## Ali_C 0.0015088 0.03884 -0.22 -0.21 0.71
## Cue_Con 0.0019925 0.04464 0.26 -0.40 -0.11 -0.27
## Cue_Ali 0.0025226 0.05023 -0.10 -0.09 0.54 0.50 -0.26
## Con_Ali 0.0021657 0.04654 0.14 0.38 -0.36 -0.44 -0.55 0.34
## Cue_Con_Ali 0.0144537 0.12022 -0.69 0.07 0.47 -0.10 -0.33 0.51 0.51
## Residual 0.1721857 0.41495
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.711e+00 5.752e-02 3.099e+01 116.664 < 2e-16 ***
## Cuebottom 9.198e-02 3.026e-02 3.122e+01 3.040 0.00476 **
## Congruencyincongruent 4.897e-02 1.572e-02 4.146e+01 3.116 0.00333 **
## Alignmentmisaligned 3.430e-02 1.411e-02 4.784e+01 2.430 0.01891 *
## Cuebottom:Congruencyincongruent -1.359e-02 2.234e-02 3.552e+01 -0.608 0.54696
## Cuebottom:Alignmentmisaligned 6.311e-05 1.909e-02 5.586e+01 0.003 0.99737
## Congruencyincongruent:Alignmentmisaligned -2.895e-02 1.899e-02 6.271e+01 -1.524 0.13245
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 1.676e-02 3.146e-02 3.626e+01 0.533 0.59757
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## Model failed to converge with max|grad| = 0.0202263 (tol = 0.002, component 1)
summary(rePCA(glmm_E1_rtall_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## Standard deviation 0.7187 0.3475 0.23380 0.13589 0.09770 0.001254 0.0002954 0.0001187
## Proportion of Variance 0.7174 0.1677 0.07593 0.02565 0.01326 0.000000 0.0000000 0.0000000
## Cumulative Proportion 0.7174 0.8852 0.96109 0.98674 1.00000 1.000000 1.0000000 1.0000000
Con_C
, Ali_C
, and Cue_Con
were
removed from extended model.
file_E1_rtall_etd1 <- file.path(folder_lmm, "E1_rtall_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E1_rtall_etd1)) {
glmm_E1_rtall_etd1 <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + # Con_C + Ali_C +
Cue_Ali + Con_Ali + # Cue_Con +
Cue_Con_Ali | Participant),
data = df_lmm_E1,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rtall_etd1, file = file_E1_rtall_etd1)
} else {
load(file_E1_rtall_etd1)
}
print(summary(glmm_E1_rtall_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Con_Ali + Cue_Con_Ali | Participant)
## Data: df_lmm_E1
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 22530.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3979 -0.5813 -0.1265 0.4468 10.1973
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.080510 0.28374
## Cue_C 0.019802 0.14072 -0.01
## Cue_Ali 0.002262 0.04756 -0.10 -0.10
## Con_Ali 0.001680 0.04098 0.15 0.43 0.59
## Cue_Con_Ali 0.014390 0.11996 -0.69 0.07 0.52 0.55
## Residual 0.172954 0.41588
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.711e+00 5.428e-02 3.154e+01 123.639 < 2e-16 ***
## Cuebottom 9.197e-02 2.857e-02 3.380e+01 3.219 0.002840 **
## Congruencyincongruent 4.896e-02 1.246e-02 2.311e+02 3.930 0.000112 ***
## Alignmentmisaligned 3.428e-02 1.296e-02 7.706e+01 2.646 0.009882 **
## Cuebottom:Congruencyincongruent -1.357e-02 1.956e-02 8.427e+01 -0.694 0.489805
## Cuebottom:Alignmentmisaligned 7.862e-05 1.900e-02 3.425e+01 0.004 0.996723
## Congruencyincongruent:Alignmentmisaligned -2.897e-02 1.872e-02 7.415e+01 -1.547 0.126077
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 1.677e-02 3.147e-02 3.529e+01 0.533 0.597354
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_rtall_etd1))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5]
## Standard deviation 0.7140 0.3424 0.22896 0.08101 1.26e-05
## Proportion of Variance 0.7431 0.1709 0.07642 0.00957 0.00e+00
## Cumulative Proportion 0.7431 0.9140 0.99043 1.00000 1.00e+00
file_E1_rtall_etd2 <- file.path(folder_lmm, "E1_rtall_lmm_etd2.RData")
# fit the etd2 model
if (!file.exists(file_E1_rtall_etd2)) {
glmm_E1_rtall_etd2 <- lmer(
log(RT) ~ Cue * Congruency * Alignment +
(Cue_C + # Con_C + Ali_C +
# Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali | Participant),
data = df_lmm_E1,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E1_rtall_etd2, file = file_E1_rtall_etd2)
} else {
load(file_E1_rtall_etd2)
}
print(summary(glmm_E1_rtall_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Con_Ali | Participant)
## Data: df_lmm_E1
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 22542.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3824 -0.5796 -0.1262 0.4486 10.1585
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.08051 0.2837
## Cue_C 0.01980 0.1407 -0.01
## Cue_Con_Ali 0.01225 0.1107 -0.75 0.08
## Residual 0.17323 0.4162
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.711e+00 5.433e-02 3.191e+01 123.530 < 2e-16 ***
## Cuebottom 9.197e-02 2.823e-02 3.702e+01 3.258 0.002406 **
## Congruencyincongruent 4.896e-02 1.262e-02 2.346e+02 3.879 0.000136 ***
## Alignmentmisaligned 3.428e-02 1.262e-02 2.346e+02 2.716 0.007096 **
## Cuebottom:Congruencyincongruent -1.357e-02 1.914e-02 7.791e+01 -0.709 0.480507
## Cuebottom:Alignmentmisaligned 7.968e-05 1.914e-02 7.791e+01 0.004 0.996689
## Congruencyincongruent:Alignmentmisaligned -2.896e-02 1.914e-02 7.794e+01 -1.513 0.134370
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 1.677e-02 3.040e-02 3.100e+01 0.552 0.585212
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(glmm_E1_rtall_etd2, glmm_E1_rtall_zcp, refit = FALSE)
## Data: df_lmm_E1
## Models:
## glmm_E1_rtall_etd2: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Con_Ali | Participant)
## glmm_E1_rtall_zcp: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_E1_rtall_etd2 15 22573 22692 -11271 22543
## glmm_E1_rtall_zcp 17 22562 22697 -11264 22528 14.745 2 0.0006283 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to BIC, the reduced model (glmm_E1_rtall_zcp
)
explained the data better than the extended model
(glmm_E1_rtall_etd2
) and, therefore, the reduced model is
used as the optimal model.
glmm_E1_rtall_opt <- glmm_E1_rtall_zcp
print(summary(glmm_E1_rtall_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
## Data: df_lmm_E1
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 22527.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3311 -0.5763 -0.1282 0.4409 10.2547
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0805103 0.28374
## Participant.1 Cue_C 0.0198051 0.14073
## Participant.2 Con_C 0.0006468 0.02543
## Participant.3 Ali_C 0.0013945 0.03734
## Participant.4 Cue_Con 0.0013896 0.03728
## Participant.5 Cue_Ali 0.0022539 0.04748
## Participant.6 Con_Ali 0.0007299 0.02702
## Participant.7 Cue_Con_Ali 0.0123211 0.11100
## Residual 0.1724635 0.41529
## Number of obs: 20477, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.711e+00 5.262e-02 3.713e+01 127.544 < 2e-16 ***
## Cuebottom 9.198e-02 2.839e-02 4.644e+01 3.239 0.002216 **
## Congruencyincongruent 4.897e-02 1.399e-02 1.213e+02 3.501 0.000649 ***
## Alignmentmisaligned 3.429e-02 1.502e-02 1.171e+02 2.282 0.024272 *
## Cuebottom:Congruencyincongruent -1.358e-02 2.023e-02 6.096e+01 -0.671 0.504553
## Cuebottom:Alignmentmisaligned 6.856e-05 2.089e-02 6.176e+01 0.003 0.997391
## Congruencyincongruent:Alignmentmisaligned -2.895e-02 1.971e-02 5.987e+01 -1.468 0.147238
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 1.675e-02 3.040e-02 3.100e+01 0.551 0.585466
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E1_rtall_emm <- file.path(folder_lmm, "E1_rtall_emm.RData")
if (!file.exists(file_E1_rtall_emm)) {
emm_E1_rtall <- emmeans(glmm_E1_rtall_opt, ~ Cue + Congruency + Alignment)
} else {
load(file_E1_rtall_emm)
}
# emmip(regrid(emm_E1_rtall), Congruency ~ Alignment | Cue, CIs = TRUE)
summary(emm_E1_rtall, type = "response") # equivalent to regrid(emm_rtall)
## Cue Congruency Alignment response SE df asymp.LCL asymp.UCL
## top congruent aligned 821 43.2 Inf 741 911
## bottom congruent aligned 901 47.4 Inf 812 998
## top incongruent aligned 863 45.4 Inf 778 956
## bottom incongruent aligned 933 49.1 Inf 842 1034
## top congruent misaligned 850 44.7 Inf 767 942
## bottom congruent misaligned 932 49.0 Inf 841 1033
## top incongruent misaligned 867 45.6 Inf 782 961
## bottom incongruent misaligned 954 50.2 Inf 860 1058
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
plot_E1_cf_rtall <- summary(emm_E1_rtall, type = "response") %>%
as_tibble() %>%
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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(. ~Cue, switch = "both") +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", y = "Response times (ms) [all trials]", 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_rtall.pdf", plot_E1_cf_rtall, width = 8, height = 4.8)
plot_E1_cf_rtall
Composite face effects for top and bottom parts:
emm_E1_rtall_cf <- contrast(regrid(emm_E1_rtall), interaction = "pairwise", by = "Cue", infer = TRUE)
emm_E1_rtall_cf[1:2]
## Congruency_pairwise Alignment_pairwise Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top -24.0 16.8 Inf -57.0 8.92 -1.429 0.1529
## congruent - incongruent aligned - misaligned bottom -10.6 18.3 Inf -46.5 25.38 -0.576 0.5645
##
## Confidence level used: 0.95
emm_E1_rtall_con <- contrast(regrid(emm_E1_rtall), interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_E1_rtall_con[c(1,2)], infer = TRUE)
## Congruency_pairwise Cue Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top aligned -41.2 12.0 Inf -64.7 -17.76 -3.444 0.0006
## congruent - incongruent bottom aligned -32.4 12.9 Inf -57.8 -7.09 -2.508 0.0121
##
## Confidence level used: 0.95
emm_E1_rtall_fi <- contrast(regrid(emm_E1_rtall), "pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "sidak")
# emmip(emm_E1_rtall_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak")
emm_E1_rtall_fi[1:4]
## contrast Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent -28.66 12.6 Inf -60.2 2.84 -2.266 0.0905
## aligned - misaligned bottom congruent -31.48 13.9 Inf -66.0 3.05 -2.271 0.0895
## aligned - misaligned top incongruent -4.62 13.0 Inf -37.0 27.75 -0.356 0.9940
## aligned - misaligned bottom incongruent -20.91 14.2 Inf -56.3 14.50 -1.471 0.4562
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: sidak method for 4 tests
plot_E1_cffi_rtall <- emm_E1_rtall_fi[1:4] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(. ~ Congruency, switch = "both") +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) + # set the names for main, x and y axis
theme(legend.position = "none") +
NULL
# ggsave(filename = "E1_fi_rtall.pdf", plot_E1_cffi_rtall, width = 7, height = 4.55)
plot_E1_cffi_rtall
plot_E1_cf_rtall_ <- plot_E1_cf_rtall +
guides(color = guide_legend(nrow = 1, title.position = "left"),
linetype = guide_legend(nrow = 1, title.position = "left")) +
theme(legend.position = c(0.6, 0.1),
legend.box = "horizontal",
legend.key.height = unit(0.01, "cm"))
plot_E1_rtall <- ggarrange(plot_E1_cf_rtall_, plot_E1_cffi_rtall,
labels = c("a", "b"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1)
# ggsave(filename = "E1_rtall.pdf", plot_E1_rtall, width = 10, height = 4.5)
plot_E1_rtall
contrast(emm_E1_rtall_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>%
summary(infer = TRUE)
## contrast Cue estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top -33.3 19.4 Inf -71.2 4.68 -1.719 0.0857
## faci-inte bottom -52.4 21.3 Inf -94.1 -10.72 -2.464 0.0137
##
## Confidence level used: 0.95
with log-transformation. #### The maximal model
# file_E2_rtall_max <- file.path(folder_lmm, "E2_rtall_lmm_max.RData")
#
# # fit the max model
# if (!file.exists(file_E2_rtall_max)) {
# glmm_E2_rtall_max <- glmer(
# log(RT) ~ Cue * Congruency * Alignment * Probability +
# (Cue * Congruency * Alignment * Probability | Participant),
# family = lognormal(),
# data = df_lmm_E2,
# control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
# optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
# )
#
# save(glmm_E2_rtall_max, file = file_E2_rtall_max)
# } else {
# load(file_E2_rtall_max)
# }
#
# print(summary(glmm_E2_rtall_max), corr = FALSE)
file_E2_rtall_zcp <- file.path(folder_lmm, "E2_rtall_lmm_zcp.RData")
# fit the zcp1 model
if (!file.exists(file_E2_rtall_zcp)) {
glmm_E2_rtall_zcp <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Con_C + Ali_C +
Cue_Con + Cue_Ali + Con_Ali +
Cue_Con_Ali +
Pro_C +
Cue_Pro + Con_Pro + Ali_Pro +
Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro +
Cue_Con_Ali_Pro || Participant),
data = df_lmm_E2,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rtall_zcp, file = file_E2_rtall_zcp)
} else {
load(file_E2_rtall_zcp)
}
print(summary(glmm_E2_rtall_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro + Con_Pro + Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
## Data: df_lmm_E2
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 32192.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9652 -0.5897 -0.1249 0.4513 9.9066
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 4.860e-02 2.205e-01
## Participant.1 Cue_C 4.131e-03 6.428e-02
## Participant.2 Con_C 1.676e-04 1.295e-02
## Participant.3 Ali_C 6.986e-04 2.643e-02
## Participant.4 Cue_Con 2.470e-04 1.572e-02
## Participant.5 Cue_Ali 7.107e-04 2.666e-02
## Participant.6 Con_Ali 1.864e-05 4.318e-03
## Participant.7 Cue_Con_Ali 2.433e-10 1.560e-05
## Participant.8 Pro_C 5.271e-02 2.296e-01
## Participant.9 Cue_Pro 7.049e-02 2.655e-01
## Participant.10 Con_Pro 2.143e-04 1.464e-02
## Participant.11 Ali_Pro 1.045e-09 3.233e-05
## Participant.12 Cue_Con_Pro 2.267e-03 4.761e-02
## Participant.13 Cue_Ali_Pro 3.482e-03 5.901e-02
## Participant.14 Con_Ali_Pro 5.093e-03 7.137e-02
## Participant.15 Cue_Con_Ali_Pro 2.603e-10 1.614e-05
## Residual 1.262e-01 3.553e-01
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.715e+00 3.991e-02 3.388e+01 168.265 < 2e-16 ***
## Cuebottom 1.331e-04 1.422e-02 5.831e+01 0.009 0.992569
## Congruencyincongruent 4.763e-02 8.547e-03 2.134e+02 5.573 7.49e-08 ***
## Alignmentmisaligned 3.829e-02 9.657e-03 1.562e+02 3.965 0.000111 ***
## Probability2-1 -1.406e-01 4.850e-02 5.552e+01 -2.900 0.005337 **
## Cuebottom:Congruencyincongruent 5.506e-04 1.180e-02 1.379e+02 0.047 0.962845
## Cuebottom:Alignmentmisaligned 1.056e-03 1.240e-02 1.430e+02 0.085 0.932252
## Congruencyincongruent:Alignmentmisaligned -3.436e-02 1.149e-02 2.167e+02 -2.990 0.003109 **
## Cuebottom:Probability2-1 3.086e-01 5.011e-02 3.788e+01 6.159 3.49e-07 ***
## Congruencyincongruent:Probability2-1 -2.133e-03 1.809e-02 1.915e+02 -0.118 0.906231
## Alignmentmisaligned:Probability2-1 -2.530e-02 1.816e-02 2.201e+02 -1.393 0.165030
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 2.048e-03 1.622e-02 4.057e+04 0.126 0.899485
## Cuebottom:Congruencyincongruent:Probability2-1 -1.014e-02 2.443e-02 1.340e+02 -0.415 0.678866
## Cuebottom:Alignmentmisaligned:Probability2-1 4.987e-02 2.519e-02 1.057e+02 1.980 0.050341 .
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 1.413e-02 2.617e-02 1.145e+02 0.540 0.590273
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -1.473e-02 3.243e-02 4.057e+04 -0.454 0.649703
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rtall_zcp))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
## Standard deviation 0.7474 0.6462 0.6206 0.20089 0.18093 0.16610 0.13403 0.07504 0.0744 0.04424 0.04121 0.03644 0.01215 9.102e-05 4.542e-05 4.391e-05
## Proportion of Variance 0.3733 0.2791 0.2574 0.02697 0.02188 0.01844 0.01201 0.00376 0.0037 0.00131 0.00114 0.00089 0.00010 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion 0.3733 0.6524 0.9098 0.93678 0.95866 0.97710 0.98911 0.99287 0.9966 0.99788 0.99901 0.99990 1.00000 1.000e+00 1.000e+00 1.000e+00
Con_C
, Con_Ali
, Cue_Con_Ali
,
Ali_Pro
, and Cue_Con_Ali_Pro
were removed from
extended model (glmm_E2_rtall_zcp
) due to that the variance
it explained was smaller than 0.1%, making
glmm_E2_rtall_rdc
.
file_E2_rtall_rdc <- file.path(folder_lmm, "E2_rtall_lmm_rdc.RData")
# fit the rdc1 model
if (!file.exists(file_E2_rtall_rdc)) {
glmm_E2_rtall_rdc <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Ali_C + # Con_C +
Cue_Con + Cue_Ali + # Con_Ali +
# Cue_Con_Ali +
Pro_C +
Cue_Pro + Con_Pro + # Ali_Pro +
Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro # +
|| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rtall_rdc, file = file_E2_rtall_rdc)
} else {
load(file_E2_rtall_rdc)
}
print(summary(glmm_E2_rtall_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Pro_C + Cue_Pro + Con_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro || Participant)
## Data: df_lmm_E2
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 32194.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9633 -0.5900 -0.1246 0.4514 9.9214
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0485983 0.22045
## Participant.1 Cue_C 0.0041313 0.06428
## Participant.2 Ali_C 0.0006985 0.02643
## Participant.3 Cue_Con 0.0002468 0.01571
## Participant.4 Cue_Ali 0.0007103 0.02665
## Participant.5 Pro_C 0.0527070 0.22958
## Participant.6 Cue_Pro 0.0704934 0.26551
## Participant.7 Con_Pro 0.0002140 0.01463
## Participant.8 Cue_Con_Pro 0.0029160 0.05400
## Participant.9 Cue_Ali_Pro 0.0034794 0.05899
## Participant.10 Con_Ali_Pro 0.0050913 0.07135
## Residual 0.1262365 0.35530
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.715e+00 3.989e-02 3.382e+01 168.339 < 2e-16 ***
## Cuebottom 1.331e-04 1.422e-02 5.831e+01 0.009 0.992569
## Congruencyincongruent 4.763e-02 8.227e-03 5.177e+02 5.790 1.22e-08 ***
## Alignmentmisaligned 3.829e-02 9.650e-03 1.711e+02 3.968 0.000106 ***
## Probability2-1 -1.406e-01 4.851e-02 5.558e+01 -2.899 0.005348 **
## Cuebottom:Congruencyincongruent 5.506e-04 1.180e-02 1.379e+02 0.047 0.962849
## Cuebottom:Alignmentmisaligned 1.056e-03 1.240e-02 1.431e+02 0.085 0.932257
## Congruencyincongruent:Alignmentmisaligned -3.436e-02 1.147e-02 4.062e+04 -2.997 0.002732 **
## Cuebottom:Probability2-1 3.086e-01 5.016e-02 3.803e+01 6.152 3.51e-07 ***
## Congruencyincongruent:Probability2-1 -2.133e-03 1.823e-02 1.969e+02 -0.117 0.906948
## Alignmentmisaligned:Probability2-1 -2.530e-02 1.816e-02 2.201e+02 -1.393 0.165051
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 2.048e-03 1.622e-02 4.062e+04 0.126 0.899498
## Cuebottom:Congruencyincongruent:Probability2-1 -1.014e-02 2.484e-02 1.418e+02 -0.408 0.683890
## Cuebottom:Alignmentmisaligned:Probability2-1 4.987e-02 2.519e-02 1.058e+02 1.980 0.050351 .
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 1.413e-02 2.617e-02 1.145e+02 0.540 0.590292
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -1.473e-02 3.243e-02 4.062e+04 -0.454 0.649744
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E2_rtall_etd <- file.path(folder_lmm, "E2_rtall_lmm_etd.RData")
# fit the etd model
if (!file.exists(file_E2_rtall_etd)) {
glmm_E2_rtall_etd <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(Cue_C + Ali_C + # Con_C +
Cue_Con + Cue_Ali + # Con_Ali +
# Cue_Con_Ali +
Pro_C +
Cue_Pro + Con_Pro + # Ali_Pro +
Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro # +
| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rtall_etd, file = file_E2_rtall_etd)
} else {
load(file_E2_rtall_etd)
}
print(summary(glmm_E2_rtall_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Pro_C + Cue_Pro + Con_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro | Participant)
## Data: df_lmm_E2
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 32109.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9963 -0.5922 -0.1250 0.4503 10.0205
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.0488421 0.22100
## Cue_C 0.0041764 0.06463 -0.25
## Ali_C 0.0008446 0.02906 0.19 0.18
## Cue_Con 0.0006464 0.02543 -0.33 0.02 -0.16
## Cue_Ali 0.0011495 0.03390 -0.30 0.23 0.02 0.97
## Pro_C 0.0531768 0.23060 0.11 0.26 0.10 -0.09 -0.02
## Cue_Pro 0.0708353 0.26615 0.49 -0.24 -0.42 -0.40 -0.48 0.22
## Con_Pro 0.0004630 0.02152 0.17 -0.68 0.31 -0.50 -0.58 -0.32 -0.02
## Cue_Con_Pro 0.0037156 0.06096 -0.74 0.34 0.20 0.15 0.20 0.36 -0.66 -0.09
## Cue_Ali_Pro 0.0059003 0.07681 0.10 0.60 0.37 -0.09 0.08 0.13 -0.42 -0.12 0.24
## Con_Ali_Pro 0.0064642 0.08040 0.04 -0.45 -0.27 0.77 0.65 -0.17 -0.16 -0.22 -0.16 -0.47
## Residual 0.1260916 0.35509
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.715e+00 4.021e-02 3.148e+01 167.009 < 2e-16 ***
## Cuebottom 1.331e-04 1.436e-02 3.888e+01 0.009 0.992657
## Congruencyincongruent 4.763e-02 8.410e-03 7.088e+02 5.664 2.15e-08 ***
## Alignmentmisaligned 3.829e-02 1.002e-02 8.966e+01 3.822 0.000244 ***
## Probability2-1 -1.406e-01 4.731e-02 3.218e+01 -2.973 0.005552 **
## Cuebottom:Congruencyincongruent 5.506e-04 1.231e-02 2.056e+02 0.045 0.964371
## Cuebottom:Alignmentmisaligned 1.056e-03 1.293e-02 1.476e+02 0.082 0.935053
## Congruencyincongruent:Alignmentmisaligned -3.436e-02 1.146e-02 4.072e+04 -2.998 0.002716 **
## Cuebottom:Probability2-1 3.086e-01 5.632e-02 3.267e+01 5.479 4.62e-06 ***
## Congruencyincongruent:Probability2-1 -2.133e-03 1.896e-02 8.102e+01 -0.112 0.910709
## Alignmentmisaligned:Probability2-1 -2.530e-02 1.772e-02 1.853e+02 -1.428 0.154967
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 2.048e-03 1.621e-02 4.072e+04 0.126 0.899440
## Cuebottom:Congruencyincongruent:Probability2-1 -1.014e-02 2.533e-02 2.067e+02 -0.400 0.689445
## Cuebottom:Alignmentmisaligned:Probability2-1 4.987e-02 2.664e-02 9.363e+01 1.872 0.064331 .
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 1.413e-02 2.697e-02 1.185e+02 0.524 0.601258
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -1.473e-02 3.242e-02 4.072e+04 -0.454 0.649557
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rtall_etd))
## $Participant
## Importance of components:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
## Standard deviation 0.8830 0.6401 0.4940 0.28559 0.16823 0.09568 0.06021 0.0009448 0.0002613 0.0001026 3.713e-18
## Proportion of Variance 0.5011 0.2633 0.1568 0.05241 0.01819 0.00588 0.00233 0.0000000 0.0000000 0.0000000 0.000e+00
## Cumulative Proportion 0.5011 0.7644 0.9212 0.97360 0.99179 0.99767 1.00000 1.0000000 1.0000000 1.0000000 1.000e+00
file_E2_rtall_etd1 <- file.path(folder_lmm, "E2_rtall_lmm_etd1.RData")
# fit the etd1 model
if (!file.exists(file_E2_rtall_etd1)) {
glmm_E2_rtall_etd1 <- lmer(
log(RT) ~ Cue * Congruency * Alignment * Probability +
(# Con_C + Ali_C + Cue_C +
# Con_Ali + Cue_Con + Cue_Ali +
# Cue_Con_Ali +
Pro_C +
Cue_Pro + # Ali_Pro + Con_Pro +
Cue_Ali_Pro + Con_Ali_Pro # + Cue_Con_Pro +
| Participant), # Cue_Con_Ali_Pro
data = df_lmm_E2,
control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)
# save(glmm_E2_rtall_etd1, file = file_E2_rtall_etd1)
} else {
load(file_E2_rtall_etd1)
}
print(summary(glmm_E2_rtall_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro + Cue_Ali_Pro + Con_Ali_Pro | Participant)
## Data: df_lmm_E2
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 32382.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9695 -0.5955 -0.1225 0.4543 9.8350
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## Participant (Intercept) 0.048802 0.22091
## Pro_C 0.050278 0.22423 0.15
## Cue_Pro 0.070782 0.26605 0.49 0.27
## Cue_Ali_Pro 0.005374 0.07331 -0.04 -0.02 -0.11
## Con_Ali_Pro 0.005040 0.07100 0.04 -0.12 -0.18 -0.47
## Residual 0.127248 0.35672
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.715e+00 3.947e-02 3.219e+01 170.111 < 2e-16 ***
## Cuebottom 1.331e-04 8.141e-03 4.079e+04 0.016 0.98696
## Congruencyincongruent 4.763e-02 8.141e-03 4.079e+04 5.851 4.92e-09 ***
## Alignmentmisaligned 3.829e-02 8.141e-03 4.079e+04 4.704 2.56e-06 ***
## Probability2-1 -1.406e-01 4.221e-02 3.393e+01 -3.332 0.00209 **
## Cuebottom:Congruencyincongruent 5.506e-04 1.151e-02 4.079e+04 0.048 0.96186
## Cuebottom:Alignmentmisaligned 1.056e-03 1.151e-02 4.079e+04 0.092 0.92694
## Congruencyincongruent:Alignmentmisaligned -3.436e-02 1.151e-02 4.079e+04 -2.985 0.00284 **
## Cuebottom:Probability2-1 3.086e-01 5.084e-02 3.491e+01 6.070 6.31e-07 ***
## Congruencyincongruent:Probability2-1 -2.133e-03 1.745e-02 3.605e+02 -0.122 0.90276
## Alignmentmisaligned:Probability2-1 -2.530e-02 1.756e-02 1.448e+02 -1.441 0.15168
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 2.048e-03 1.628e-02 4.079e+04 0.126 0.89990
## Cuebottom:Congruencyincongruent:Probability2-1 -1.014e-02 2.303e-02 4.079e+04 -0.440 0.65982
## Cuebottom:Alignmentmisaligned:Probability2-1 4.987e-02 2.642e-02 1.123e+02 1.888 0.06167 .
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 1.413e-02 2.622e-02 1.154e+02 0.539 0.59099
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -1.473e-02 3.256e-02 4.079e+04 -0.452 0.65105
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# compare the extended and reduced model
anova(glmm_E2_rtall_etd1, glmm_E2_rtall_rdc, refit = FALSE)
## Data: df_lmm_E2
## Models:
## glmm_E2_rtall_rdc: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Pro_C + Cue_Pro + Con_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro || Participant)
## glmm_E2_rtall_etd1: log(RT) ~ Cue * Congruency * Alignment * Probability + (Pro_C + Cue_Pro + Cue_Ali_Pro + Con_Ali_Pro | Participant)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_E2_rtall_rdc 28 32251 32492 -16097 32195
## glmm_E2_rtall_etd1 32 32446 32722 -16191 32382 0 4 1
According to BIC, the reduced model (glmm_E2_rtall_rdc
)
explained the data better than the extended model
(glmm_E2_rtall_etd1
) and, therefore, the reduced model is
used as the optimal model.
glmm_E2_rtall_opt <- glmm_E2_rtall_rdc
print(summary(glmm_E2_rtall_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + Ali_C + Cue_Con + Cue_Ali + Pro_C + Cue_Pro + Con_Pro + Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro || Participant)
## Data: df_lmm_E2
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
##
## REML criterion at convergence: 32194.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.9633 -0.5900 -0.1246 0.4514 9.9214
##
## Random effects:
## Groups Name Variance Std.Dev.
## Participant (Intercept) 0.0485983 0.22045
## Participant.1 Cue_C 0.0041313 0.06428
## Participant.2 Ali_C 0.0006985 0.02643
## Participant.3 Cue_Con 0.0002468 0.01571
## Participant.4 Cue_Ali 0.0007103 0.02665
## Participant.5 Pro_C 0.0527070 0.22958
## Participant.6 Cue_Pro 0.0704934 0.26551
## Participant.7 Con_Pro 0.0002140 0.01463
## Participant.8 Cue_Con_Pro 0.0029160 0.05400
## Participant.9 Cue_Ali_Pro 0.0034794 0.05899
## Participant.10 Con_Ali_Pro 0.0050913 0.07135
## Residual 0.1262365 0.35530
## Number of obs: 40960, groups: Participant, 32
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.715e+00 3.989e-02 3.382e+01 168.339 < 2e-16 ***
## Cuebottom 1.331e-04 1.422e-02 5.831e+01 0.009 0.992569
## Congruencyincongruent 4.763e-02 8.227e-03 5.177e+02 5.790 1.22e-08 ***
## Alignmentmisaligned 3.829e-02 9.650e-03 1.711e+02 3.968 0.000106 ***
## Probability2-1 -1.406e-01 4.851e-02 5.558e+01 -2.899 0.005348 **
## Cuebottom:Congruencyincongruent 5.506e-04 1.180e-02 1.379e+02 0.047 0.962849
## Cuebottom:Alignmentmisaligned 1.056e-03 1.240e-02 1.431e+02 0.085 0.932257
## Congruencyincongruent:Alignmentmisaligned -3.436e-02 1.147e-02 4.062e+04 -2.997 0.002732 **
## Cuebottom:Probability2-1 3.086e-01 5.016e-02 3.803e+01 6.152 3.51e-07 ***
## Congruencyincongruent:Probability2-1 -2.133e-03 1.823e-02 1.969e+02 -0.117 0.906948
## Alignmentmisaligned:Probability2-1 -2.530e-02 1.816e-02 2.201e+02 -1.393 0.165051
## Cuebottom:Congruencyincongruent:Alignmentmisaligned 2.048e-03 1.622e-02 4.062e+04 0.126 0.899498
## Cuebottom:Congruencyincongruent:Probability2-1 -1.014e-02 2.484e-02 1.418e+02 -0.408 0.683890
## Cuebottom:Alignmentmisaligned:Probability2-1 4.987e-02 2.519e-02 1.058e+02 1.980 0.050351 .
## Congruencyincongruent:Alignmentmisaligned:Probability2-1 1.413e-02 2.617e-02 1.145e+02 0.540 0.590292
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -1.473e-02 3.243e-02 4.062e+04 -0.454 0.649744
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
file_E2_rtall_emm <- file.path(folder_lmm, "E2_rtall_emm.RData")
if (!file.exists(file_E2_rtall_emm)) {
emm_E2_rtall <- emmeans(glmm_E2_rtall_opt, ~ Cue + Congruency + Alignment + Probability)
} else {
load(file_E2_rtall_emm)
}
summary(emm_E2_rtall, type = "response") # equivalent to regrid(emm_rtall)
## Cue Congruency Alignment Probability response SE df asymp.LCL asymp.UCL
## top congruent aligned 0.25 885 41.6 Inf 807 970
## bottom congruent aligned 0.25 758 35.1 Inf 693 830
## top incongruent aligned 0.25 929 43.7 Inf 847 1019
## bottom incongruent aligned 0.25 801 37.1 Inf 731 877
## top congruent misaligned 0.25 931 43.8 Inf 849 1021
## bottom congruent misaligned 0.25 779 36.1 Inf 712 853
## top incongruent misaligned 0.25 938 44.1 Inf 855 1028
## bottom incongruent misaligned 0.25 797 36.9 Inf 728 872
## top congruent aligned 0.75 769 35.6 Inf 702 842
## bottom congruent aligned 0.75 897 42.2 Inf 818 984
## top incongruent aligned 0.75 805 37.3 Inf 735 882
## bottom incongruent aligned 0.75 936 44.0 Inf 853 1026
## top congruent misaligned 0.75 789 36.5 Inf 720 864
## bottom congruent misaligned 0.75 945 44.4 Inf 861 1036
## top incongruent misaligned 0.75 804 37.2 Inf 734 880
## bottom incongruent misaligned 0.75 954 44.8 Inf 870 1046
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
# emmip(regrid(emm_E2_rtall), Congruency ~ Alignment | Cue + Probability, CIs = TRUE)
plot_E2_cf_rtall <- summary(emm_E2_rtall, type = "response") %>%
as_tibble() %>%
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),
size = 0.8) +
scale_linetype_manual(values=c("solid", "dashed"))+
scale_color_manual(values=con_color) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6, position = position_dodge(width = 0.1),
show.legend = F) +
facet_grid(Probability ~Cue, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Target half", y = "Response times (ms) [all trials]", 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_rtall.pdf", plot_E2_cf_rtall, width = 8, height = 4.8)
plot_E2_cf_rtall
Composite face effects for top and bottom parts:
emm_E2_rtall_cf <- contrast(regrid(emm_E2_rtall), interaction = "pairwise", by = c("Cue", "Probability"), infer = TRUE)
emm_E2_rtall_cf[1:4]
## Congruency_pairwise Alignment_pairwise Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent aligned - misaligned top 0.25 -37.4 19.3 Inf -75.1 0.401 -1.939 0.0525
## congruent - incongruent aligned - misaligned bottom 0.25 -24.8 10.3 Inf -45.0 -4.527 -2.399 0.0165
## congruent - incongruent aligned - misaligned top 0.75 -21.3 10.4 Inf -41.7 -0.895 -2.046 0.0408
## congruent - incongruent aligned - misaligned bottom 0.75 -29.6 19.5 Inf -67.8 8.629 -1.517 0.1292
##
## Confidence level used: 0.95
emm_E2_rtall_con <- contrast(regrid(emm_E2_rtall), interaction = "pairwise", by = c("Cue", "Probability", "Alignment"))
summary(emm_E2_rtall_con[c(1,2,5,6)], infer = TRUE)
## Congruency_pairwise Cue Probability Alignment estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## congruent - incongruent top 0.25 aligned -44.2 13.50 Inf -70.6 -17.7 -3.271 0.0011
## congruent - incongruent bottom 0.25 aligned -42.3 7.45 Inf -56.9 -27.7 -5.685 <.0001
## congruent - incongruent top 0.75 aligned -36.6 7.45 Inf -51.2 -22.0 -4.919 <.0001
## congruent - incongruent bottom 0.75 aligned -38.5 13.60 Inf -65.2 -11.9 -2.833 0.0046
##
## Confidence level used: 0.95
emm_E2_rtall_fi <- contrast(regrid(emm_E2_rtall), "pairwise", by = c("Cue", "Congruency", "Probability"), infer=TRUE, adjust = "sidak")
emm_E2_rtall_fi[1:8]
## contrast Cue Congruency Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned top congruent 0.25 -46.24 14.27 Inf -85.1 -7.33 -3.241 0.0095
## aligned - misaligned bottom congruent 0.25 -20.80 8.11 Inf -42.9 1.33 -2.564 0.0799
## aligned - misaligned top incongruent 0.25 -8.88 14.51 Inf -48.4 30.68 -0.612 0.9980
## aligned - misaligned bottom incongruent 0.25 3.96 8.37 Inf -18.9 26.79 0.472 0.9997
## aligned - misaligned top congruent 0.75 -19.96 8.21 Inf -42.4 2.43 -2.431 0.1144
## aligned - misaligned bottom congruent 0.75 -47.53 14.47 Inf -87.0 -8.06 -3.284 0.0082
## aligned - misaligned top incongruent 0.75 1.33 8.43 Inf -21.7 24.33 0.158 1.0000
## aligned - misaligned bottom incongruent 0.75 -17.96 14.70 Inf -58.0 22.12 -1.222 0.8652
##
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 8 estimates
## P value adjustment: sidak method for 8 tests
# emmip(emm_E2_rtall_fi[1:8], ~ Probability | Cue + Congruency, CIs = TRUE, adjust = "sidak") +
# geom_hline(yintercept = 0, linetype = "dashed")
plot_E2_cffi_rtall <- emm_E2_rtall_fi[1:8] %>%
as_tibble() %>%
ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
geom_point(size = 2) +
geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0,
alpha = .6) +
geom_hline(yintercept = 0, linetype = "dashed") +
scale_color_manual(values=con_color) +
facet_grid(Probability ~ Congruency, switch = "x",
labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
coord_cartesian(ylim = ylimit_cf_fi_rt) + # set the limit for y axis c(0, 1100)
labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) + # set the names for main, x and y axis
theme(legend.position = "none") +
NULL
# ggsave(filename = "E2_fi_rtall.pdf", plot_E2_cffi_rtall, width = 7, height = 4.55)
plot_E2_cffi_rtall
plot_E2_cf_rtall_ <- plot_E2_cf_rtall +
guides(color = guide_legend(nrow = 1, title.position = "left"),
linetype = guide_legend(nrow = 1, title.position = "left")) +
theme(legend.position = c(0.6, 0.5),
legend.box = "horizontal")
plot_E2_rtall <- ggarrange(plot_E2_cf_rtall_, plot_E2_cffi_rtall,
labels = c("a", "b"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1)
# ggsave(filename = "E2_rtall.pdf", plot_E2_rtall, width = 10, height = 7)
plot_E2_rtall
Influence of Probability on facilitation and interference:
emm_E2_rtall_fi_Prob <- contrast(regrid(emm_E2_rtall), interaction="pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "none")
emm_E2_rtall_fi_Prob[1:4]
## Alignment_pairwise Probability_pairwise Cue Congruency estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## aligned - misaligned 0.25 - 0.75 top congruent -26.3 15.9 Inf -57.52 4.97 -1.648 0.0993
## aligned - misaligned 0.25 - 0.75 bottom congruent 26.7 16.1 Inf -4.77 58.23 1.663 0.0963
## aligned - misaligned 0.25 - 0.75 top incongruent -10.2 16.3 Inf -42.15 21.73 -0.627 0.5309
## aligned - misaligned 0.25 - 0.75 bottom incongruent 21.9 16.4 Inf -10.30 54.14 1.334 0.1824
##
## Confidence level used: 0.95
contrast(emm_E2_rtall_fi, method = list("faci-inte"=c(1, 1)), by = c("Cue", "Probability"))[1:4] %>%
summary(infer = TRUE)
## contrast Cue Probability estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## faci-inte top 0.25 -55.1 21.4 Inf -97.0 -13.23 -2.579 0.0099
## faci-inte bottom 0.25 -16.8 12.9 Inf -42.1 8.36 -1.310 0.1902
## faci-inte top 0.75 -18.6 13.0 Inf -44.1 6.83 -1.434 0.1516
## faci-inte bottom 0.75 -65.5 21.7 Inf -108.0 -22.95 -3.017 0.0026
##
## Confidence level used: 0.95
plot_E1_rtall <- ggarrange(plot_E1_cf_rtall_, plot_E1_cffi_rtall,
labels = c("C", "D"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1, ncol = 2)
# ggsave(filename = "E1_rtall.png", plot_E1_rtall, width = 10, height = 5)
plot_E1_rtall
plot_E1_rt_ <- ggarrange(plot_E1_cf_rt_, plot_E1_cffi_rt,
labels = c("C", "D"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1, ncol = 2)
# ggsave(filename = "E1_rt_.png", plot_E1_rt_, width = 10, height = 5)
plot_E1_rt_
plot_E2_rtall <- ggarrange(plot_E2_cf_rtall_, plot_E2_cffi_rtall,
labels = c("C", "D"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1, ncol = 2)
# ggsave(filename = "E2_rtall.png", plot_E2_rtall, width = 10, height = 8)
plot_E2_rtall
plot_E2_rt_ <- ggarrange(plot_E2_cf_rt_, plot_E2_cffi_rt,
labels = c("C", "D"),
font.label = (list(size = 18)),
widths = c(1.5, 1),
nrow = 1, ncol = 2)
# ggsave(filename = "E2_rt_.png", plot_E2_rt_, width = 10, height = 8)
plot_E2_rt_
sessionInfo()
## R version 4.1.3 (2022-03-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur/Monterey 10.16
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggpubr_0.6.0 emmeans_1.8.4-1 optimx_2022-4.30 lmerTest_3.1-3 lme4_1.1-31 Matrix_1.4-1 readxl_1.4.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.0 purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 tibble_3.1.8 ggplot2_3.4.1 tidyverse_1.3.2
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-162 fs_1.6.1 lubridate_1.9.2 insight_0.19.0 httr_1.4.4 numDeriv_2016.8-1.1 tools_4.1.3 backports_1.4.1 bslib_0.4.2 utf8_1.2.3 R6_2.5.1 DBI_1.1.3 colorspace_2.1-0 withr_2.5.0 tidyselect_1.2.0 compiler_4.1.3 textshaping_0.3.6 cli_3.6.0 rvest_1.0.3 xml2_1.3.3 labeling_0.4.2 bayestestR_0.13.0 sass_0.4.5 scales_1.2.1 mvtnorm_1.1-3 systemfonts_1.0.4 digest_0.6.31 minqa_1.2.5 rmarkdown_2.20 tinylabels_0.2.3 pkgconfig_2.0.3 htmltools_0.5.4 highr_0.10 dbplyr_2.3.0 fastmap_1.1.0 rlang_1.0.6 rstudioapi_0.14 farver_2.1.1 jquerylib_0.1.4 generics_0.1.3 jsonlite_1.8.4 car_3.1-1 googlesheets4_1.0.1 magrittr_2.0.3 parameters_0.20.2 Rcpp_1.0.10 munsell_0.5.0 fansi_1.0.4 abind_1.4-5 lifecycle_1.0.3 stringi_1.7.12 yaml_2.3.7 carData_3.0-5 MASS_7.3-58.2 grid_4.1.3 crayon_1.5.2 lattice_0.20-45 cowplot_1.1.1 haven_2.5.1 splines_4.1.3 hms_1.1.2 knitr_1.42 pillar_1.8.1 uuid_1.1-0 boot_1.3-28.1 estimability_1.4.1 ggsignif_0.6.4 effectsize_0.8.3 reprex_2.0.2 glue_1.6.2 evaluate_0.20 modelr_0.1.10 vctrs_0.5.2 nloptr_2.0.3
## [75] tzdb_0.3.0 cellranger_1.1.0 gtable_0.3.1 papaja_0.1.1 datawizard_0.6.5 assertthat_0.2.1 cachem_1.0.6 xfun_0.37 xtable_1.8-4 broom_1.0.3 coda_0.19-4 rstatix_0.7.2 ragg_1.2.5 googledrive_2.0.0 gargle_1.3.0 timechange_0.2.0 ellipsis_0.3.2 xaringanExtra_0.7.0