Code
cat('\014') # clean terminalCode
rm(list = ls()) # clean workspace
library(tidyverse)
library(afex)
library(emmeans)
library(GGally)
library(easystats)Recordings with EMOTIV EPOC Flex Gel, 32 channels
cat('\014') # clean terminalrm(list = ls()) # clean workspace
library(tidyverse)
library(afex)
library(emmeans)
library(GGally)
library(easystats)emm_options(pbkrtest.limit = 5000)
my_dodge <- .3
my_jitter <- .2
theme_set(theme_minimal())
a_posteriori_aov_ez <- function(aov_ez_object, sig_level = .05) {
factors <- as.list(rownames(aov_ez_object$anova_table))
for (j in 1:length(factors)) {
if (grepl(':', factors[[j]])) {
factors[[j]] <- unlist(strsplit(factors[[j]], ':'))
}
}
p_values <- aov_ez_object$anova_table$`Pr(>F)`
for (i in 1:length(p_values)) {
if (p_values[i] <= sig_level) {
cat(rep('_', 60), '\n', sep = '')
print(emmeans(aov_ez_object, factors[[i]], contr = 'pairwise'))
}
}
}
a_posteriori_lmer <- function(lmer_obj, sig_level = .05) {
anova_lmer <- anova(lmer_obj)
factors <- as.list(row.names(anova_lmer))
for (j in 1:length(factors)) {
if (grepl(':', factors[[j]])) {
factors[[j]] <- unlist(strsplit(factors[[j]], ':'))
}
}
p_values <- anova_lmer$`Pr(>F)`
for (i in 1:length(p_values)) {
if (p_values[i] <= sig_level) {
cat(rep('_', 60), '\n', sep = '')
print(emmeans(lmer_obj, factors[[i]], contr = 'pairwise'))
}
}
}
a_posteriori_glmer <- function(glmer_obj, sig_level = .05) {
anova_glmer <- car::Anova(glmer_obj)
factors <- as.list(row.names(anova_glmer))
for (j in 1:length(factors)) {
if (grepl(':', factors[[j]])) {
factors[[j]] <- unlist(strsplit(factors[[j]], ':'))
}
}
p_values <- anova_glmer$`Pr(>Chisq)`
print(anova_glmer)
for (i in 1:length(p_values)) {
if (p_values[i] <= sig_level) {
cat(rep('_', 60), '\n', sep = '')
print(emmeans(glmer_obj, factors[[i]], contr = 'pairwise'))
}
}
}
xclude <- c(15, 22, 24, 36, 44)csv_answers <- list.files(path = '../csv', full.names = TRUE)
answers_df <- vroom::vroom(csv_answers, col_types = c(Sex = 'c'), show_col_types = FALSE) |>
filter(Block > 0) |>
mutate(Block = factor(Block)) |>
filter(!is.na(Question)) |>
mutate(file_info = str_extract(Subject, '.+?(?=_202)')) |>
mutate(Sex = if_else(Sex == 'f', 'female', 'male')) |>
separate(file_info, c('Version', 'ID', 'Group', 'City'), sep = '_', remove = FALSE) |>
mutate(Version = tolower(Version),
Group = tolower(Group),
Group = str_replace(Group, 'suv', 'vul'),
Group = if_else(Group == 'vul', 'vulnerable', 'control'),
Group = fct_relevel(Group, 'vulnerable'),
num_id = parse_number(ID),
Question = recode(Question, 'unpleasantness' = 'displeasing', 'pain' = 'painful'),
Stimulus = case_match(Valence, 'EASE' ~ 'no_pain', 'PAIN' ~ 'pain'),
City = case_match(City, 's' ~ 'stgo', 'v' ~ 'viña')) |>
mutate_if(is.character, as.factor) |>
relocate(Subject, .after = last_col()) |>
filter(!(num_id %in% xclude))
write.csv(answers_df, 'data/painEmpathy_2023_answers_clean_2_versions.csv', row.names = FALSE)
erp_averages <- list.files(path = './data/ave_volt_2_versions', full.names = TRUE)
painEmpathy_data <- vroom::vroom(erp_averages, show_col_types = FALSE) |>
separate(ERPset, c('Version', 'ID', 'Group', 'City'), sep = '_', remove = FALSE) |>
rename(Component = mlabel,
Amplitude = value,
Stimulus = binlabel,
Electrode = chlabel) |>
mutate(Group = if_else(Group == 'vul', 'vulnerable', 'control'),
Group = fct_relevel(Group, 'vulnerable'),
City = case_match(City, 's' ~ 'stgo', 'v' ~ 'viña'),
worklat = gsub('.0', '', worklat, fixed = TRUE),
num_id = parse_number(ID),
chindex = factor(chindex),
bini = factor(bini)) |>
left_join(unique(answers_df[c('num_id', 'Sex')]), by = 'num_id') |>
mutate(Component = factor(Component, levels = c('N1', 'N2', 'P1', 'P3', 'LPP', 'P3a', 'P3b')),
Electrode = factor(Electrode, levels = c('FC1', 'Fz', 'FC2',
'CP1', 'Cz', 'CP2',
'O1' , 'Oz', 'O2')),
Lateral = case_match(Electrode,
c('FC1', 'CP1', 'O1') ~ 'left',
c('Fz' , 'Cz' , 'Oz') ~ 'center',
c('FC2', 'CP2', 'O2') ~ 'right')) |>
mutate_if(is.character, as.factor) |>
filter(!(num_id %in% xclude))
write.csv(painEmpathy_data, file.path('data/painEmpathy_2024_erp_clean_2_versions.csv'), row.names = FALSE)
connectivity_file <- 'data/median_connectivity_2_versions.csv'
label_a <- 'occipital'
label_b <- 'parietal'
connectivity_data <- read_csv(connectivity_file, show_col_types = FALSE) |>
separate(ERPset, c('ID', 'Group', 'City'), sep = '_', remove = FALSE) |>
mutate(Group = if_else(Group == 'vul', 'vulnerable', 'control'),
Group = fct_relevel(Group, 'vulnerable'),
Version = str_sub(image, -2, -1),
Stimulus = str_sub(image, 1, -4),
Stimulus = fct_relevel(Stimulus, 'pain'),
City = case_match(City, 's' ~ 'stgo', 'v' ~ 'viña'),log_median_connectivity = log(median_connectivity),
num_id = parse_number(ID),
region_b = fct_relevel(region_b, paste0(label_b, '_ipsi'))
) |>
left_join(unique(answers_df[c('num_id', 'Sex')]), by = 'num_id') |>
mutate_if(is.character, as.factor) |>
filter(!(num_id %in% xclude))
write_csv(connectivity_data, 'data/painEmpathy_2024_connectivity_clean_2_versions.csv')
n1_data <- subset(painEmpathy_data, Component == 'N1',)
n2_data <- subset(painEmpathy_data, Component == 'N2',)
p1_data <- subset(painEmpathy_data, Component == 'P1',)
p3_data <- subset(painEmpathy_data, Component == 'P3',)
lpp_data <- subset(painEmpathy_data, Component == 'LPP',)
p3a_data <- subset(painEmpathy_data, Component == 'P3a',)
p3b_data <- subset(painEmpathy_data, Component == 'P3b',)
component_data_wide_stimulus <- painEmpathy_data[c('num_id', 'Version', 'Stimulus', 'Lateral', 'Component', 'Amplitude')] |>
mutate(Stimulus = fct_relevel(Stimulus, 'pain')) |>
pivot_wider(names_from = Component, values_from = Amplitude)addmargins(xtabs(~ Sex + Group, data = unique(answers_df[c('num_id', 'Sex', 'Group')]))) Group
Sex vulnerable control Sum
female 25 25 50
male 25 25 50
Sum 50 50 100
cat(rep('_', 60), '\n', sep = '')____________________________________________________________
addmargins(xtabs(~ Version + Sex + Group + City, data = unique(answers_df[c('Version', 'num_id', 'Sex', 'Group', 'City')])), margin = 2), , Group = vulnerable, City = stgo
Sex
Version female male Sum
pev1 24 24 48
pev2 25 24 49
, , Group = control, City = stgo
Sex
Version female male Sum
pev1 18 20 38
pev2 18 20 38
, , Group = vulnerable, City = viña
Sex
Version female male Sum
pev1 0 1 1
pev2 0 1 1
, , Group = control, City = viña
Sex
Version female male Sum
pev1 7 5 12
pev2 7 5 12
summary(answers_df) Sex Block trialN Image Valence
female:4915 1:4969 Min. : 1.00 54.1.jpg: 48 EASE:4875
male :4926 2:4872 1st Qu.:16.00 9.1.jpg : 48 PAIN:4966
Median :32.00 hp-1 : 48
Mean :31.49 2.2.jpg : 47
3rd Qu.:47.00 43.2.jpg: 47
Max. :64.00 hnp-10 : 47
(Other) :9556
Answer Question rT Session
Min. : 1.00 displeasing:4927 Min. : 2 Min. :1
1st Qu.:17.00 painful :4914 1st Qu.: 3115 1st Qu.:1
Median :49.00 Median : 3995 Median :1
Mean :44.86 Mean : 4455 Mean :1
3rd Qu.:72.00 3rd Qu.: 5143 3rd Qu.:1
Max. :97.00 Max. :68437 Max. :1
file_info Version ID Group
pev1_s133_ctl_s: 66 pev1:4728 s113 : 119 vulnerable:4854
pev1_s113_ctl_s: 62 pev2:5113 s133 : 119 control :4987
pev2_s006_vul_s: 61 s127 : 117
pev2_s040_vul_s: 61 s147 : 112
pev2_s126_ctl_s: 61 s035 : 111
pev2_s134_ctl_s: 61 s037 : 111
(Other) :9469 (Other):9152
City num_id Stimulus
stgo:8569 Min. : 1.00 no_pain:4875
viña:1272 1st Qu.: 29.00 pain :4966
Median :100.00
Mean : 77.41
3rd Qu.:126.00
Max. :150.00
Subject
pev1_s133_ctl_s_2025-01-20_18-45-53: 66
pev1_s113_ctl_s_2024-12-23_14-53-17: 62
pev2_s006_vul_s_2024-10-25_18-31-33: 61
pev2_s040_vul_s_2024-11-29_14-50-53: 61
pev2_s126_ctl_s_2025-01-17_21-06-11: 61
pev2_s134_ctl_s_2025-01-22_15-26-40: 61
(Other) :9469
pain_rating_lmer <- lmer(Answer ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|Image), subset(answers_df, Question == 'painful'))
afex_plot(
pain_rating_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .15),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 4)
)
pain_rating_lmer@calllmer(formula = Answer ~ Group * Sex * Stimulus * Version + (Stimulus *
Version | num_id) + (1 | Image), data = subset(answers_df,
Question == "painful"))
anova(pain_rating_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 1460 1460 1 95.900 5.0103 0.027510 *
Sex 48 48 1 95.824 0.1638 0.686621
Stimulus 140210 140210 1 123.514 481.1280 < 2.2e-16 ***
Version 134 134 1 208.986 0.4594 0.498657
Group:Sex 1 1 1 95.852 0.0036 0.952127
Group:Stimulus 3257 3257 1 95.708 11.1754 0.001184 **
Sex:Stimulus 75 75 1 95.654 0.2569 0.613432
Group:Version 609 609 1 95.099 2.0912 0.151441
Sex:Version 175 175 1 94.777 0.5996 0.440649
Stimulus:Version 273 273 1 212.299 0.9383 0.333816
Group:Sex:Stimulus 63 63 1 95.676 0.2156 0.643491
Group:Sex:Version 0 0 1 94.865 0.0002 0.987873
Group:Stimulus:Version 175 175 1 96.067 0.6000 0.440496
Sex:Stimulus:Version 4 4 1 95.722 0.0154 0.901395
Group:Sex:Stimulus:Version 17 17 1 95.819 0.0597 0.807516
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(pain_rating_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.04 | [0.00, 0.14] | small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 0.79 | [0.73, 0.84] | large
Version | 0.00 | [0.00, 0.00] | very small
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.09 | [0.01, 0.22] | medium
Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Version | 0.01 | [0.00, 0.09] | small
Sex:Version | 0.00 | [0.00, 0.00] | very small
Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Sex:Version | 0.00 | [0.00, 0.00] | very small
Group:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
- Interpretation rule: field2013
a_posteriori_lmer(pain_rating_lmer)____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Group emmean SE df lower.CL upper.CL
vulnerable 49.4 1.26 116 46.9 51.9
control 45.6 1.26 114 43.1 48.1
Results are averaged over the levels of: Sex, Stimulus, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
vulnerable - control 3.81 1.7 96 2.238 0.0275
Results are averaged over the levels of: Sex, Stimulus, Version
Degrees-of-freedom method: kenward-roger
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus emmean SE df lower.CL upper.CL
no_pain 24.2 1.59 121 21.0 27.3
pain 70.9 1.21 142 68.5 73.3
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain - pain -46.7 2.13 124 -21.933 <.0001
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Group Stimulus emmean SE df lower.CL upper.CL
vulnerable no_pain 29.4 2.19 108 25.1 33.7
control no_pain 18.9 2.19 108 14.6 23.3
vulnerable pain 69.5 1.63 121 66.3 72.7
control pain 72.3 1.62 118 69.1 75.5
Results are averaged over the levels of: Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
vulnerable no_pain - control no_pain 10.47 3.00 95.9 3.488 0.0040
vulnerable no_pain - vulnerable pain -40.09 2.92 110.5 -13.725 <.0001
vulnerable no_pain - control pain -42.93 2.73 198.3 -15.753 <.0001
control no_pain - vulnerable pain -50.55 2.73 199.8 -18.518 <.0001
control no_pain - control pain -53.40 2.91 109.5 -18.332 <.0001
vulnerable pain - control pain -2.85 2.17 96.0 -1.310 0.5588
Results are averaged over the levels of: Sex, Version
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
unpleasantness_rating_lmer <- lmer(Answer ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|Image), subset(answers_df, Question == 'displeasing'))
afex_plot(
unpleasantness_rating_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .15),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 4)
)
unpleasantness_rating_lmer@calllmer(formula = Answer ~ Group * Sex * Stimulus * Version + (Stimulus *
Version | num_id) + (1 | Image), data = subset(answers_df,
Question == "displeasing"))
options(width = 90)
anova(unpleasantness_rating_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 11 11 1 95.959 0.0368 0.848186
Sex 318 318 1 95.958 1.0840 0.300410
Stimulus 91665 91665 1 127.402 312.6115 < 2.2e-16 ***
Version 74 74 1 203.593 0.2512 0.616802
Group:Sex 3 3 1 95.964 0.0110 0.916709
Group:Stimulus 1758 1758 1 96.059 5.9941 0.016168 *
Sex:Stimulus 531 531 1 96.057 1.8096 0.181729
Group:Version 3 3 1 96.612 0.0097 0.921895
Sex:Version 39 39 1 96.653 0.1315 0.717684
Stimulus:Version 2904 2904 1 214.070 9.9029 0.001885 **
Group:Sex:Stimulus 140 140 1 96.071 0.4786 0.490704
Group:Sex:Version 233 233 1 96.748 0.7941 0.375059
Group:Stimulus:Version 1606 1606 1 95.776 5.4765 0.021349 *
Sex:Stimulus:Version 79 79 1 95.842 0.2678 0.605971
Group:Sex:Stimulus:Version 314 314 1 95.940 1.0693 0.303692
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(unpleasantness_rating_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.00 | [0.00, 0.00] | very small
Sex | 8.57e-04 | [0.00, 0.04] | very small
Stimulus | 0.71 | [0.63, 0.77] | large
Version | 0.00 | [0.00, 0.00] | very small
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.05 | [0.00, 0.15] | small
Sex:Stimulus | 8.19e-03 | [0.00, 0.08] | very small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 0.00 | [0.00, 0.00] | very small
Stimulus:Version | 0.04 | [0.00, 0.10] | small
Group:Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Sex:Version | 0.00 | [0.00, 0.00] | very small
Group:Stimulus:Version | 0.04 | [0.00, 0.15] | small
Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus:Version | 7.08e-04 | [0.00, 0.04] | very small
- Interpretation rule: field2013
# a_posteriori_lmer(unpleasantness_rating_lmer)
emmeans(unpleasantness_rating_lmer, pairwise ~ Stimulus)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus emmean SE df lower.CL upper.CL
no_pain 24.5 1.60 118 21.3 27.6
pain 58.8 1.92 111 55.0 62.6
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain - pain -34.3 1.94 127 -17.679 <.0001
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
emmeans(unpleasantness_rating_lmer, pairwise ~ Group*Stimulus)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Group Stimulus emmean SE df lower.CL upper.CL
vulnerable no_pain 26.9 2.20 107 22.6 31.3
control no_pain 22.0 2.20 107 17.6 26.3
vulnerable pain 56.8 2.67 103 51.5 62.1
control pain 60.7 2.67 103 55.4 66.0
Results are averaged over the levels of: Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
vulnerable no_pain - control no_pain 4.95 3.02 96.0 1.638 0.3625
vulnerable no_pain - vulnerable pain -29.91 2.65 111.9 -11.301 <.0001
vulnerable no_pain - control pain -33.76 3.46 170.5 -9.756 <.0001
control no_pain - vulnerable pain -34.86 3.46 170.5 -10.075 <.0001
control no_pain - control pain -38.72 2.65 111.7 -14.637 <.0001
vulnerable pain - control pain -3.85 3.71 95.9 -1.039 0.7270
Results are averaged over the levels of: Sex, Version
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
emmeans(unpleasantness_rating_lmer, pairwise ~ Stimulus*Version)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus Version emmean SE df lower.CL upper.CL
no_pain pev1 26.4 1.90 130 22.6 30.1
pain pev1 57.4 2.14 122 53.2 61.7
no_pain pev2 22.6 1.64 141 19.3 25.8
pain pev2 60.1 1.97 125 56.2 64.0
Results are averaged over the levels of: Group, Sex
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain pev1 - pain pev1 -31.1 2.21 149 -14.080 <.0001
no_pain pev1 - no_pain pev2 3.8 1.54 204 2.468 0.0681
no_pain pev1 - pain pev2 -33.8 2.16 150 -15.645 <.0001
pain pev1 - no_pain pev2 34.9 2.29 143 15.191 <.0001
pain pev1 - pain pev2 -2.7 1.47 208 -1.839 0.2582
no_pain pev2 - pain pev2 -37.6 2.19 147 -17.147 <.0001
Results are averaged over the levels of: Group, Sex
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
emmeans(unpleasantness_rating_lmer, pairwise ~ Stimulus*Version|Group)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Group = vulnerable:
Stimulus Version emmean SE df lower.CL upper.CL
no_pain pev1 27.9 2.59 114 22.8 33.1
pain pev1 56.3 2.94 109 50.5 62.1
no_pain pev2 25.9 2.20 118 21.6 30.3
pain pev2 57.4 2.69 110 52.0 62.7
Group = control:
Stimulus Version emmean SE df lower.CL upper.CL
no_pain pev1 24.8 2.58 112 19.7 29.9
pain pev1 58.5 2.94 109 52.7 64.4
no_pain pev2 19.2 2.20 120 14.8 23.5
pain pev2 62.9 2.69 111 57.5 68.2
Results are averaged over the levels of: Sex
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
Group = vulnerable:
contrast estimate SE df t.ratio p.value
no_pain pev1 - pain pev1 -28.37 2.94 124 -9.633 <.0001
no_pain pev1 - no_pain pev2 2.01 1.92 166 1.047 0.7218
no_pain pev1 - pain pev2 -29.44 2.88 125 -10.240 <.0001
pain pev1 - no_pain pev2 30.38 3.08 120 9.870 <.0001
pain pev1 - pain pev2 -1.07 1.80 173 -0.595 0.9334
no_pain pev2 - pain pev2 -31.45 2.92 122 -10.760 <.0001
Group = control:
contrast estimate SE df t.ratio p.value
no_pain pev1 - pain pev1 -33.76 2.93 123 -11.514 <.0001
no_pain pev1 - no_pain pev2 5.58 1.91 166 2.924 0.0204
no_pain pev1 - pain pev2 -38.09 2.87 124 -13.279 <.0001
pain pev1 - no_pain pev2 39.34 3.08 120 12.792 <.0001
pain pev1 - pain pev2 -4.33 1.80 177 -2.405 0.0798
no_pain pev2 - pain pev2 -43.67 2.93 123 -14.907 <.0001
Results are averaged over the levels of: Sex
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
EDF files were pre-processed in Matlab using the EEGLAB 2023.1 toolbox (Delorme and Makeig 2004), the ERPLAB 10.0 toolbox (Lopez-Calderon and Luck 2014), and automated with in-house scripts. EEG data was high-pass filtered at 0.1 Hz with a 12 dB/oct roll-off. A working time window was selected from 2 seconds before the first Stimulus to 2 seconds after the last one. Defective channels were identified by eye inspection and omitted from the preprocessing steps. Artifacts originating from eye blinks or movements, heart beats, muscle contraction, channel noise, or electrical interference were identified and removed by means of independent Component analysis (ICA) and using the ICLabel 1.4 classifier (Pion-Tonachini, Kreutz-Delgado, and Makeig 2019), Components with an score between 0.8 and 1 in the aforementioned artifactual categories were removed. At this point defective channels were spherically interpolated. Data was re-referenced to infinity with the REST 1.2 toolbox (Dong et al. 2017), low-pass filtered at 35 Hz with a 12 dB/oct roll-off, cut in [-200ms 1000ms] epochs around stimuli, and baseline-corrected relative to the mean voltage in the pre-Stimulus time.
options(width = 90)
ggplot(
painEmpathy_data,
aes(x = Amplitude, fill = Component, color = Component)) +
geom_histogram(alpha = .4) +
facet_wrap(~Component, ncol = 1) +
theme(strip.text.x = element_blank())
addmargins(xtabs(~ Sex + Group, data = unique(painEmpathy_data[c('num_id', 'Sex', 'Group')]))) Group
Sex vulnerable control Sum
female 25 25 50
male 24 25 49
Sum 49 50 99
cat(rep('_', 60), '\n', sep = '')____________________________________________________________
addmargins(xtabs(~ Version + Sex + Group + City, data = unique(painEmpathy_data[c('Version', 'num_id', 'Sex', 'Group', 'City')])), margin = 2), , Group = vulnerable, City = stgo
Sex
Version female male Sum
pev1 25 24 49
pev2 25 24 49
, , Group = control, City = stgo
Sex
Version female male Sum
pev1 18 20 38
pev2 18 20 38
, , Group = vulnerable, City = viña
Sex
Version female male Sum
pev1 0 0 0
pev2 0 0 0
, , Group = control, City = viña
Sex
Version female male Sum
pev1 7 5 12
pev2 7 5 12
summary(painEmpathy_data) worklat Component Amplitude chindex Electrode bini
[105 135]:1188 N1 :1188 Min. :-10.0282 16 :1584 O1 :1584 1:4158
[125 145]:1188 N2 :1188 1st Qu.: -0.6611 18 :1584 Oz :1584 2:4158
[240 300]:1188 P1 :1188 Median : 1.3603 19 :1584 O2 :1584
[260 300]:1188 P3 :1188 Mean : 1.4862 2 : 792 FC1 : 792
[260 360]:1188 LPP:1188 3rd Qu.: 3.5628 6 : 792 Fz : 792
[340 390]:1188 P3a:1188 Max. : 13.1818 29 : 792 FC2 : 792
[550 750]:1188 P3b:1188 (Other):1188 (Other):1188
Stimulus ERPset Version ID Group
no_pain:4158 pev1_s001_vul_s: 42 pev1:4158 s001 : 84 vulnerable:4116
pain :4158 pev1_s002_vul_s: 42 pev2:4158 s002 : 84 control :4200
pev1_s003_vul_s: 42 s003 : 84
pev1_s004_vul_s: 42 s004 : 84
pev1_s005_vul_s: 42 s005 : 84
pev1_s006_vul_s: 42 s006 : 84
(Other) :8064 (Other):7812
City num_id Sex Lateral
stgo:7308 Min. : 1.00 female:4200 center:2772
viña:1008 1st Qu.: 28.00 male :4116 left :2772
Median :100.00 right :2772
Mean : 76.87
3rd Qu.:126.00
Max. :150.00
ggpairs(
subset(component_data_wide_stimulus, Version == 'pev1'),
aes(colour = Stimulus, alpha = .5, linewidth = NA),
columns = c('N1', 'N2', 'P1', 'P3a', 'P3b', 'LPP'),
lower = list(continuous = wrap('points', alpha = .4)),
progress = FALSE)
ggpairs(
subset(component_data_wide_stimulus, Version == 'pev2'),
aes(colour = Stimulus, alpha = .5, linewidth = NA),
columns = c('N1', 'N2', 'P1', 'P3a', 'P3b', 'LPP'),
lower = list(continuous = wrap('points', alpha = .4)),
progress = FALSE)Electrodes FC1, Fz, FC2
painEmpathy_n1_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), n1_data)
afex_plot(
painEmpathy_n1_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_n1_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = n1_data)
options(width = 110)
anova(painEmpathy_n1_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 0.08657 0.08657 1 95.001 0.2359 0.62832
Sex 0.08791 0.08791 1 95.001 0.2395 0.62568
Stimulus 0.19062 0.19062 1 95.002 0.5194 0.47288
Version 0.88427 0.88427 1 95.001 2.4093 0.12394
Group:Sex 0.98096 0.98096 1 95.001 2.6727 0.10539
Group:Stimulus 0.01562 0.01562 1 95.002 0.0426 0.83698
Sex:Stimulus 1.03792 1.03792 1 95.002 2.8279 0.09592 .
Group:Version 0.04972 0.04972 1 95.001 0.1355 0.71366
Sex:Version 0.59097 0.59097 1 95.001 1.6101 0.20757
Stimulus:Version 0.08302 0.08302 1 94.998 0.2262 0.63545
Group:Sex:Stimulus 0.27603 0.27603 1 95.002 0.7521 0.38801
Group:Sex:Version 0.09271 0.09271 1 95.001 0.2526 0.61641
Group:Stimulus:Version 0.41691 0.41691 1 94.998 1.1359 0.28922
Sex:Stimulus:Version 0.05401 0.05401 1 94.998 0.1472 0.70212
Group:Sex:Stimulus:Version 0.17813 0.17813 1 94.998 0.4853 0.48772
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_n1_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.00 | [0.00, 0.00] | very small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 0.00 | [0.00, 0.00] | very small
Version | 0.01 | [0.00, 0.09] | small
Group:Sex | 0.02 | [0.00, 0.10] | small
Group:Stimulus | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus | 0.02 | [0.00, 0.10] | small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 6.25e-03 | [0.00, 0.07] | very small
Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Sex:Version | 0.00 | [0.00, 0.00] | very small
Group:Stimulus:Version | 1.40e-03 | [0.00, 0.05] | very small
Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
- Interpretation rule: field2013
a_posteriori_lmer(painEmpathy_n1_lmer)Electrodes FC1, Fz, FC2
painEmpathy_n2_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), n2_data)
afex_plot(
painEmpathy_n2_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_n2_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = n2_data)
options(width = 110)
anova(painEmpathy_n2_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 2.0533 2.0533 1 95.003 4.8260 0.03047 *
Sex 0.0068 0.0068 1 95.003 0.0161 0.89940
Stimulus 0.7973 0.7973 1 94.999 1.8739 0.17426
Version 11.5887 11.5887 1 94.996 27.2370 1.055e-06 ***
Group:Sex 0.0953 0.0953 1 95.003 0.2241 0.63703
Group:Stimulus 0.2286 0.2286 1 94.999 0.5372 0.46539
Sex:Stimulus 0.2220 0.2220 1 94.999 0.5217 0.47188
Group:Version 0.0621 0.0621 1 94.996 0.1460 0.70321
Sex:Version 0.3617 0.3617 1 94.996 0.8501 0.35885
Stimulus:Version 0.0002 0.0002 1 94.997 0.0004 0.98425
Group:Sex:Stimulus 0.6826 0.6826 1 94.999 1.6042 0.20840
Group:Sex:Version 1.4306 1.4306 1 94.996 3.3623 0.06984 .
Group:Stimulus:Version 0.0327 0.0327 1 94.997 0.0770 0.78206
Sex:Stimulus:Version 0.0766 0.0766 1 94.997 0.1800 0.67235
Group:Sex:Stimulus:Version 0.0496 0.0496 1 94.997 0.1165 0.73360
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_n2_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.04 | [0.00, 0.14] | small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 8.93e-03 | [0.00, 0.08] | very small
Version | 0.21 | [0.08, 0.35] | large
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 0.00 | [0.00, 0.00] | very small
Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus | 6.19e-03 | [0.00, 0.07] | very small
Group:Sex:Version | 0.02 | [0.00, 0.11] | small
Group:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
- Interpretation rule: field2013
a_posteriori_lmer(painEmpathy_n2_lmer)____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Group emmean SE df lower.CL upper.CL
vulnerable -2.17 0.268 95 -2.71 -1.64
control -3.00 0.265 95 -3.53 -2.48
Results are averaged over the levels of: Sex, Stimulus, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
vulnerable - control 0.829 0.377 95 2.197 0.0305
Results are averaged over the levels of: Sex, Stimulus, Version
Degrees-of-freedom method: kenward-roger
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version emmean SE df lower.CL upper.CL
pev1 -2.88 0.201 95 -3.28 -2.48
pev2 -2.29 0.192 95 -2.68 -1.91
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
pev1 - pev2 -0.587 0.112 95 -5.219 <.0001
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
# emmeans(painEmpathy_n2_lmer, pairwise ~ Version)
# emmeans(painEmpathy_n2_lmer, pairwise ~ Sex*Version|Group)Electrodes O1, Oz, O2
painEmpathy_p1_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), p1_data)
afex_plot(
painEmpathy_p1_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_p1_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = p1_data)
options(width = 90)
anova(painEmpathy_p1_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 0.00047 0.00047 1 95.097 0.0017 0.96688
Sex 0.12550 0.12550 1 95.097 0.4586 0.49991
Stimulus 0.00779 0.00779 1 95.064 0.0285 0.86634
Version 0.00074 0.00074 1 94.980 0.0027 0.95850
Group:Sex 0.59126 0.59126 1 95.097 2.1606 0.14489
Group:Stimulus 0.40014 0.40014 1 95.064 1.4622 0.22958
Sex:Stimulus 0.00398 0.00398 1 95.064 0.0145 0.90430
Group:Version 0.02342 0.02342 1 94.980 0.0856 0.77051
Sex:Version 0.20622 0.20622 1 94.980 0.7536 0.38753
Stimulus:Version 1.38244 1.38244 1 95.032 5.0517 0.02691 *
Group:Sex:Stimulus 0.12310 0.12310 1 95.064 0.4498 0.50404
Group:Sex:Version 0.34472 0.34472 1 94.980 1.2597 0.26454
Group:Stimulus:Version 0.05397 0.05397 1 95.032 0.1972 0.65798
Sex:Stimulus:Version 0.71520 0.71520 1 95.032 2.6135 0.10927
Group:Sex:Stimulus:Version 0.03587 0.03587 1 95.032 0.1311 0.71812
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_p1_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.00 | [0.00, 0.00] | very small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 0.00 | [0.00, 0.00] | very small
Version | 0.00 | [0.00, 0.00] | very small
Group:Sex | 0.01 | [0.00, 0.09] | small
Group:Stimulus | 4.74e-03 | [0.00, 0.07] | very small
Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 0.00 | [0.00, 0.00] | very small
Stimulus:Version | 0.04 | [0.00, 0.14] | small
Group:Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Sex:Version | 2.67e-03 | [0.00, 0.06] | very small
Group:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus:Version | 0.02 | [0.00, 0.10] | small
Group:Sex:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
- Interpretation rule: field2013
a_posteriori_lmer(painEmpathy_p1_lmer)____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus Version emmean SE df lower.CL upper.CL
no_pain pev1 0.823 0.223 95 0.380 1.27
pain pev1 1.043 0.226 95 0.595 1.49
no_pain pev2 1.023 0.199 95 0.628 1.42
pain pev2 0.833 0.221 95 0.395 1.27
Results are averaged over the levels of: Group, Sex
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain pev1 - pain pev1 -0.22013 0.137 95 -1.604 0.3815
no_pain pev1 - no_pain pev2 -0.19967 0.134 95 -1.494 0.4449
no_pain pev1 - pain pev2 -0.00951 0.134 95 -0.071 0.9999
pain pev1 - no_pain pev2 0.02046 0.141 95 0.145 0.9989
pain pev1 - pain pev2 0.21063 0.144 95 1.458 0.4666
no_pain pev2 - pain pev2 0.19016 0.117 95 1.632 0.3660
Results are averaged over the levels of: Group, Sex
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
# emmeans(painEmpathy_p1_lmer, pairwise ~ Stimulus*Version)
# emmeans(painEmpathy_p1_lmer, pairwise ~ Sex*Version|Stimulus)Electrodes O1, Oz, O2
painEmpathy_p3_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), p3_data)
afex_plot(
painEmpathy_p3_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_p3_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = p3_data)
options(width = 110)
anova(painEmpathy_p3_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 0.2791 0.2791 1 95.002 0.9899 0.32230
Sex 0.1777 0.1777 1 95.002 0.6302 0.42926
Stimulus 7.5870 7.5870 1 94.999 26.9097 1.204e-06 ***
Version 6.0524 6.0524 1 95.005 21.4668 1.144e-05 ***
Group:Sex 0.0013 0.0013 1 95.002 0.0047 0.94529
Group:Stimulus 0.0165 0.0165 1 94.999 0.0586 0.80931
Sex:Stimulus 0.3900 0.3900 1 94.999 1.3831 0.24252
Group:Version 0.3936 0.3936 1 95.005 1.3960 0.24035
Sex:Version 0.4629 0.4629 1 95.005 1.6418 0.20320
Stimulus:Version 0.0096 0.0096 1 95.000 0.0339 0.85433
Group:Sex:Stimulus 0.3579 0.3579 1 94.999 1.2694 0.26272
Group:Sex:Version 0.4932 0.4932 1 95.005 1.7493 0.18914
Group:Stimulus:Version 0.1072 0.1072 1 95.000 0.3802 0.53899
Sex:Stimulus:Version 0.7561 0.7561 1 95.000 2.6816 0.10482
Group:Sex:Stimulus:Version 1.4294 1.4294 1 95.000 5.0698 0.02665 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_p3_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.00 | [0.00, 0.00] | very small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 0.21 | [0.08, 0.35] | large
Version | 0.17 | [0.06, 0.31] | large
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus | 3.93e-03 | [0.00, 0.06] | very small
Group:Version | 4.07e-03 | [0.00, 0.07] | very small
Sex:Version | 6.57e-03 | [0.00, 0.07] | very small
Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Group:Sex:Stimulus | 2.77e-03 | [0.00, 0.06] | very small
Group:Sex:Version | 7.67e-03 | [0.00, 0.08] | very small
Group:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus:Version | 0.02 | [0.00, 0.10] | small
Group:Sex:Stimulus:Version | 0.04 | [0.00, 0.14] | small
- Interpretation rule: field2013
# a_posteriori_lmer(painEmpathy_p3_lmer)
emmeans(painEmpathy_p3_lmer, pairwise ~ Stimulus)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus emmean SE df lower.CL upper.CL
no_pain 4.18 0.241 95 3.70 4.66
pain 3.73 0.233 95 3.27 4.19
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain - pain 0.45 0.0868 95 5.187 <.0001
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
emmeans(painEmpathy_p3_lmer, pairwise ~ Version)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version emmean SE df lower.CL upper.CL
pev1 4.22 0.254 95 3.71 4.72
pev2 3.70 0.224 95 3.25 4.14
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
pev1 - pev2 0.52 0.112 95 4.633 <.0001
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
emmeans(painEmpathy_p3_lmer, pairwise ~ Group*Sex*Stimulus|Version)$emmeans
Version = pev1:
Group Sex Stimulus emmean SE df lower.CL upper.CL
vulnerable female no_pain 4.21 0.532 95 3.15 5.26
control female no_pain 4.41 0.532 95 3.35 5.46
vulnerable male no_pain 4.26 0.543 95 3.18 5.34
control male no_pain 4.86 0.532 95 3.81 5.92
vulnerable female pain 3.79 0.509 95 2.78 4.80
control female pain 4.02 0.509 95 3.01 5.03
vulnerable male pain 3.95 0.520 95 2.92 4.98
control male pain 4.24 0.509 95 3.23 5.25
Version = pev2:
Group Sex Stimulus emmean SE df lower.CL upper.CL
vulnerable female no_pain 3.28 0.467 95 2.35 4.21
control female no_pain 4.30 0.467 95 3.38 5.23
vulnerable male no_pain 4.02 0.477 95 3.07 4.96
control male no_pain 4.12 0.467 95 3.19 5.05
vulnerable female pain 2.83 0.450 95 1.94 3.72
control female pain 3.35 0.450 95 2.46 4.25
vulnerable male pain 3.48 0.459 95 2.57 4.39
control male pain 4.20 0.450 95 3.31 5.09
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
Version = pev1:
contrast estimate SE df t.ratio p.value
vulnerable female no_pain - control female no_pain -0.2004 0.752 95 -0.266 1.0000
vulnerable female no_pain - vulnerable male no_pain -0.0551 0.760 95 -0.072 1.0000
vulnerable female no_pain - control male no_pain -0.6570 0.752 95 -0.873 0.9877
vulnerable female no_pain - vulnerable female pain 0.4183 0.247 95 1.692 0.6921
vulnerable female no_pain - control female pain 0.1911 0.736 106 0.260 1.0000
vulnerable female no_pain - vulnerable male pain 0.2554 0.744 106 0.343 1.0000
vulnerable female no_pain - control male pain -0.0364 0.736 106 -0.049 1.0000
control female no_pain - vulnerable male no_pain 0.1453 0.760 95 0.191 1.0000
control female no_pain - control male no_pain -0.4566 0.752 95 -0.607 0.9987
control female no_pain - vulnerable female pain 0.6187 0.736 106 0.840 0.9903
control female no_pain - control female pain 0.3915 0.247 95 1.584 0.7586
control female no_pain - vulnerable male pain 0.4558 0.744 106 0.613 0.9986
control female no_pain - control male pain 0.1640 0.736 106 0.223 1.0000
vulnerable male no_pain - control male no_pain -0.6019 0.760 95 -0.792 0.9932
vulnerable male no_pain - vulnerable female pain 0.4734 0.744 106 0.636 0.9983
vulnerable male no_pain - control female pain 0.2462 0.744 106 0.331 1.0000
vulnerable male no_pain - vulnerable male pain 0.3105 0.252 95 1.231 0.9207
vulnerable male no_pain - control male pain 0.0187 0.744 106 0.025 1.0000
control male no_pain - vulnerable female pain 1.0754 0.736 106 1.461 0.8263
control male no_pain - control female pain 0.8482 0.736 106 1.152 0.9434
control male no_pain - vulnerable male pain 0.9124 0.744 106 1.227 0.9221
control male no_pain - control male pain 0.6206 0.247 95 2.511 0.2037
vulnerable female pain - control female pain -0.2272 0.720 95 -0.316 1.0000
vulnerable female pain - vulnerable male pain -0.1629 0.727 95 -0.224 1.0000
vulnerable female pain - control male pain -0.4547 0.720 95 -0.632 0.9983
control female pain - vulnerable male pain 0.0643 0.727 95 0.088 1.0000
control female pain - control male pain -0.2275 0.720 95 -0.316 1.0000
vulnerable male pain - control male pain -0.2918 0.727 95 -0.401 0.9999
Version = pev2:
contrast estimate SE df t.ratio p.value
vulnerable female no_pain - control female no_pain -1.0272 0.661 95 -1.554 0.7760
vulnerable female no_pain - vulnerable male no_pain -0.7393 0.668 95 -1.107 0.9539
vulnerable female no_pain - control male no_pain -0.8459 0.661 95 -1.279 0.9042
vulnerable female no_pain - vulnerable female pain 0.4485 0.224 95 2.001 0.4869
vulnerable female no_pain - control female pain -0.0769 0.649 107 -0.119 1.0000
vulnerable female no_pain - vulnerable male pain -0.2001 0.655 107 -0.305 1.0000
vulnerable female no_pain - control male pain -0.9239 0.649 107 -1.424 0.8443
control female no_pain - vulnerable male no_pain 0.2879 0.668 95 0.431 0.9999
control female no_pain - control male no_pain 0.1814 0.661 95 0.274 1.0000
control female no_pain - vulnerable female pain 1.4757 0.649 107 2.274 0.3174
control female no_pain - control female pain 0.9503 0.224 95 4.240 0.0013
control female no_pain - vulnerable male pain 0.8271 0.655 107 1.262 0.9106
control female no_pain - control male pain 0.1034 0.649 107 0.159 1.0000
vulnerable male no_pain - control male no_pain -0.1066 0.668 95 -0.160 1.0000
vulnerable male no_pain - vulnerable female pain 1.1878 0.656 107 1.811 0.6140
vulnerable male no_pain - control female pain 0.6624 0.656 107 1.010 0.9720
vulnerable male no_pain - vulnerable male pain 0.5392 0.229 95 2.357 0.2748
vulnerable male no_pain - control male pain -0.1846 0.656 107 -0.281 1.0000
control male no_pain - vulnerable female pain 1.2944 0.649 107 1.995 0.4902
control male no_pain - control female pain 0.7690 0.649 107 1.185 0.9345
control male no_pain - vulnerable male pain 0.6458 0.655 107 0.985 0.9756
control male no_pain - control male pain -0.0780 0.224 95 -0.348 1.0000
vulnerable female pain - control female pain -0.5254 0.636 95 -0.826 0.9912
vulnerable female pain - vulnerable male pain -0.6486 0.643 95 -1.009 0.9721
vulnerable female pain - control male pain -1.3724 0.636 95 -2.157 0.3872
control female pain - vulnerable male pain -0.1232 0.643 95 -0.192 1.0000
control female pain - control male pain -0.8470 0.636 95 -1.331 0.8847
vulnerable male pain - control male pain -0.7238 0.643 95 -1.126 0.9495
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 8 estimates
Electrodes CP1, Cz, CP2
painEmpathy_lpp_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), lpp_data)
afex_plot(
painEmpathy_lpp_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_lpp_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = lpp_data)
options(width = 90)
anova(painEmpathy_lpp_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 0.581 0.581 1 95.000 2.1879 0.1424088
Sex 0.830 0.830 1 95.000 3.1282 0.0801579 .
Stimulus 37.442 37.442 1 95.000 141.1129 < 2.2e-16 ***
Version 0.002 0.002 1 95.001 0.0093 0.9232289
Group:Sex 0.003 0.003 1 95.000 0.0096 0.9223556
Group:Stimulus 0.019 0.019 1 95.000 0.0710 0.7904633
Sex:Stimulus 0.593 0.593 1 95.000 2.2338 0.1383393
Group:Version 0.193 0.193 1 95.001 0.7266 0.3961328
Sex:Version 0.144 0.144 1 95.001 0.5416 0.4635867
Stimulus:Version 3.512 3.512 1 94.998 13.2373 0.0004461 ***
Group:Sex:Stimulus 0.863 0.863 1 95.000 3.2518 0.0745130 .
Group:Sex:Version 0.090 0.090 1 95.001 0.3396 0.5614401
Group:Stimulus:Version 0.023 0.023 1 94.998 0.0877 0.7677938
Sex:Stimulus:Version 0.384 0.384 1 94.998 1.4473 0.2319589
Group:Sex:Stimulus:Version 0.323 0.323 1 94.998 1.2181 0.2725162
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_lpp_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.01 | [0.00, 0.09] | small
Sex | 0.02 | [0.00, 0.11] | small
Stimulus | 0.59 | [0.47, 0.68] | large
Version | 0.00 | [0.00, 0.00] | very small
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus | 0.01 | [0.00, 0.09] | small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 0.00 | [0.00, 0.00] | very small
Stimulus:Version | 0.11 | [0.02, 0.24] | medium
Group:Sex:Stimulus | 0.02 | [0.00, 0.11] | small
Group:Sex:Version | 0.00 | [0.00, 0.00] | very small
Group:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus:Version | 4.59e-03 | [0.00, 0.07] | very small
Group:Sex:Stimulus:Version | 2.24e-03 | [0.00, 0.06] | very small
- Interpretation rule: field2013
a_posteriori_lmer(painEmpathy_lpp_lmer)____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus emmean SE df lower.CL upper.CL
no_pain 1.15 0.0926 95 0.97 1.34
pain 1.88 0.0941 95 1.69 2.07
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain - pain -0.726 0.0611 95 -11.879 <.0001
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus Version emmean SE df lower.CL upper.CL
no_pain pev1 1.28 0.1160 95 1.045 1.51
pain pev1 1.75 0.1130 95 1.525 1.97
no_pain pev2 1.03 0.0937 95 0.845 1.22
pain pev2 2.01 0.1060 95 1.800 2.22
Results are averaged over the levels of: Group, Sex
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain pev1 - pain pev1 -0.473 0.0897 95 -5.277 <.0001
no_pain pev1 - no_pain pev2 0.245 0.1020 95 2.408 0.0825
no_pain pev1 - pain pev2 -0.734 0.1010 95 -7.296 <.0001
pain pev1 - no_pain pev2 0.718 0.1040 95 6.933 <.0001
pain pev1 - pain pev2 -0.261 0.1130 95 -2.315 0.1018
no_pain pev2 - pain pev2 -0.979 0.0954 95 -10.266 <.0001
Results are averaged over the levels of: Group, Sex
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
# emmeans(painEmpathy_lpp_lmer, pairwise ~ Stimulus)
# emmeans(painEmpathy_lpp_lmer, pairwise ~ Stimulus*Version)
# emmeans(painEmpathy_lpp_lmer, pairwise ~ Group*Stimulus|Sex)Electrodes O1, Oz, O2
painEmpathy_p3a_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), p3a_data)
afex_plot(
painEmpathy_p3a_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_p3a_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = p3a_data)
options(width = 110)
anova(painEmpathy_p3a_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 1.0909 1.0909 1 95.007 3.4365 0.06687 .
Sex 0.0577 0.0577 1 95.007 0.1816 0.67094
Stimulus 5.6567 5.6567 1 95.000 17.8194 5.559e-05 ***
Version 7.2696 7.2696 1 94.999 22.9005 6.248e-06 ***
Group:Sex 0.1985 0.1985 1 95.007 0.6254 0.43101
Group:Stimulus 0.0421 0.0421 1 95.000 0.1326 0.71659
Sex:Stimulus 0.1619 0.1619 1 95.000 0.5099 0.47693
Group:Version 0.3130 0.3130 1 94.999 0.9860 0.32323
Sex:Version 0.3385 0.3385 1 94.999 1.0662 0.30443
Stimulus:Version 0.6659 0.6659 1 95.002 2.0976 0.15082
Group:Sex:Stimulus 0.7699 0.7699 1 95.000 2.4254 0.12271
Group:Sex:Version 0.0097 0.0097 1 94.999 0.0304 0.86186
Group:Stimulus:Version 0.0016 0.0016 1 95.002 0.0050 0.94357
Sex:Stimulus:Version 0.8617 0.8617 1 95.002 2.7144 0.10275
Group:Sex:Stimulus:Version 1.5872 1.5872 1 95.002 4.9999 0.02769 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_p3a_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.02 | [0.00, 0.11] | small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 0.15 | [0.04, 0.28] | large
Version | 0.18 | [0.06, 0.32] | large
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 6.82e-04 | [0.00, 0.04] | very small
Stimulus:Version | 0.01 | [0.00, 0.09] | small
Group:Sex:Stimulus | 0.01 | [0.00, 0.09] | small
Group:Sex:Version | 0.00 | [0.00, 0.00] | very small
Group:Stimulus:Version | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus:Version | 0.02 | [0.00, 0.10] | small
Group:Sex:Stimulus:Version | 0.04 | [0.00, 0.14] | small
- Interpretation rule: field2013
# a_posteriori_lmer(painEmpathy_p3a_lmer)
emmeans(painEmpathy_p3a_lmer, pairwise ~ Stimulus)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus emmean SE df lower.CL upper.CL
no_pain 4.29 0.289 95 3.72 4.87
pain 3.93 0.283 95 3.36 4.49
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain - pain 0.369 0.0875 95 4.221 0.0001
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
emmeans(painEmpathy_p3a_lmer, pairwise ~ Version)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version emmean SE df lower.CL upper.CL
pev1 4.41 0.310 95 3.80 5.03
pev2 3.81 0.268 95 3.27 4.34
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
pev1 - pev2 0.608 0.127 95 4.785 <.0001
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
emmeans(painEmpathy_p3a_lmer, pairwise ~ Group*Sex*Stimulus|Version)$emmeans
Version = pev1:
Group Sex Stimulus emmean SE df lower.CL upper.CL
vulnerable female no_pain 3.81 0.633 95 2.56 5.07
control female no_pain 5.09 0.633 95 3.83 6.35
vulnerable male no_pain 4.37 0.646 95 3.09 5.66
control male no_pain 4.89 0.633 95 3.63 6.14
vulnerable female pain 3.56 0.624 95 2.32 4.80
control female pain 4.97 0.624 95 3.73 6.21
vulnerable male pain 4.07 0.637 95 2.80 5.33
control male pain 4.55 0.624 95 3.31 5.79
Version = pev2:
Group Sex Stimulus emmean SE df lower.CL upper.CL
vulnerable female no_pain 3.00 0.555 95 1.90 4.10
control female no_pain 4.92 0.555 95 3.82 6.02
vulnerable male no_pain 3.96 0.566 95 2.84 5.08
control male no_pain 4.31 0.555 95 3.21 5.41
vulnerable female pain 2.60 0.533 95 1.54 3.66
control female pain 3.96 0.533 95 2.91 5.02
vulnerable male pain 3.32 0.544 95 2.24 4.40
control male pain 4.37 0.533 95 3.32 5.43
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
Version = pev1:
contrast estimate SE df t.ratio p.value
vulnerable female no_pain - control female no_pain -1.27813 0.896 95 -1.427 0.8425
vulnerable female no_pain - vulnerable male no_pain -0.56123 0.905 95 -0.620 0.9985
vulnerable female no_pain - control male no_pain -1.07294 0.896 95 -1.198 0.9307
vulnerable female no_pain - vulnerable female pain 0.25349 0.250 95 1.014 0.9712
vulnerable female no_pain - control female pain -1.15991 0.889 103 -1.304 0.8953
vulnerable female no_pain - vulnerable male pain -0.25369 0.899 103 -0.282 1.0000
vulnerable female no_pain - control male pain -0.73501 0.889 103 -0.826 0.9912
control female no_pain - vulnerable male no_pain 0.71690 0.905 95 0.792 0.9932
control female no_pain - control male no_pain 0.20519 0.896 95 0.229 1.0000
control female no_pain - vulnerable female pain 1.53162 0.889 103 1.722 0.6730
control female no_pain - control female pain 0.11822 0.250 95 0.473 0.9997
control female no_pain - vulnerable male pain 1.02444 0.899 103 1.140 0.9462
control female no_pain - control male pain 0.54312 0.889 103 0.611 0.9987
vulnerable male no_pain - control male no_pain -0.51172 0.905 95 -0.565 0.9992
vulnerable male no_pain - vulnerable female pain 0.81472 0.899 103 0.906 0.9848
vulnerable male no_pain - control female pain -0.59868 0.899 103 -0.666 0.9977
vulnerable male no_pain - vulnerable male pain 0.30754 0.255 95 1.206 0.9283
vulnerable male no_pain - control male pain -0.17378 0.899 103 -0.193 1.0000
control male no_pain - vulnerable female pain 1.32644 0.889 103 1.491 0.8103
control male no_pain - control female pain -0.08697 0.889 103 -0.098 1.0000
control male no_pain - vulnerable male pain 0.81926 0.899 103 0.912 0.9843
control male no_pain - control male pain 0.33793 0.250 95 1.352 0.8760
vulnerable female pain - control female pain -1.41340 0.883 95 -1.601 0.7488
vulnerable female pain - vulnerable male pain -0.50718 0.892 95 -0.568 0.9992
vulnerable female pain - control male pain -0.98851 0.883 95 -1.119 0.9510
control female pain - vulnerable male pain 0.90622 0.892 95 1.016 0.9710
control female pain - control male pain 0.42490 0.883 95 0.481 0.9997
vulnerable male pain - control male pain -0.48133 0.892 95 -0.539 0.9994
Version = pev2:
contrast estimate SE df t.ratio p.value
vulnerable female no_pain - control female no_pain -1.91892 0.784 95 -2.447 0.2316
vulnerable female no_pain - vulnerable male no_pain -0.96150 0.792 95 -1.213 0.9260
vulnerable female no_pain - control male no_pain -1.31455 0.784 95 -1.676 0.7024
vulnerable female no_pain - vulnerable female pain 0.40142 0.219 95 1.829 0.6023
vulnerable female no_pain - control female pain -0.96454 0.769 103 -1.254 0.9133
vulnerable female no_pain - vulnerable male pain -0.31895 0.777 103 -0.411 0.9999
vulnerable female no_pain - control male pain -1.37495 0.769 103 -1.787 0.6299
control female no_pain - vulnerable male no_pain 0.95742 0.792 95 1.208 0.9276
control female no_pain - control male no_pain 0.60437 0.784 95 0.771 0.9942
control female no_pain - vulnerable female pain 2.32034 0.769 103 3.016 0.0616
control female no_pain - control female pain 0.95437 0.219 95 4.348 0.0009
control female no_pain - vulnerable male pain 1.59997 0.777 103 2.059 0.4480
control female no_pain - control male pain 0.54397 0.769 103 0.707 0.9966
vulnerable male no_pain - control male no_pain -0.35305 0.792 95 -0.446 0.9998
vulnerable male no_pain - vulnerable female pain 1.36292 0.778 103 1.753 0.6528
vulnerable male no_pain - control female pain -0.00305 0.778 103 -0.004 1.0000
vulnerable male no_pain - vulnerable male pain 0.64255 0.224 95 2.868 0.0909
vulnerable male no_pain - control male pain -0.41345 0.778 103 -0.532 0.9995
control male no_pain - vulnerable female pain 1.71597 0.769 103 2.231 0.3425
control male no_pain - control female pain 0.35000 0.769 103 0.455 0.9998
control male no_pain - vulnerable male pain 0.99560 0.777 103 1.282 0.9037
control male no_pain - control male pain -0.06040 0.219 95 -0.275 1.0000
vulnerable female pain - control female pain -1.36597 0.754 95 -1.812 0.6137
vulnerable female pain - vulnerable male pain -0.72037 0.762 95 -0.946 0.9806
vulnerable female pain - control male pain -1.77638 0.754 95 -2.356 0.2752
control female pain - vulnerable male pain 0.64559 0.762 95 0.848 0.9897
control female pain - control male pain -0.41041 0.754 95 -0.544 0.9994
vulnerable male pain - control male pain -1.05600 0.762 95 -1.386 0.8613
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 8 estimates
Electrodes O1, Oz, O2
painEmpathy_p3b_lmer <- lmer(Amplitude ~ Group*Sex*Stimulus*Version + (Stimulus*Version|num_id) + (1|num_id:Electrode), p3b_data)
afex_plot(
painEmpathy_p3b_lmer,
x = 'Stimulus',
trace = 'Group',
panel = ~Version*Sex,
id = 'num_id',
error_arg = list(width = .25),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
jitter.height = 0,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),
point_arg = list(size = 3)
)
painEmpathy_p3b_lmer@calllmer(formula = Amplitude ~ Group * Sex * Stimulus * Version +
(Stimulus * Version | num_id) + (1 | num_id:Electrode), data = p3b_data)
options(width = 110)
anova(painEmpathy_p3b_lmer)Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Group 0.0305 0.0305 1 94.993 0.0988 0.7539819
Sex 0.0447 0.0447 1 94.993 0.1446 0.7045722
Stimulus 4.0484 4.0484 1 94.995 13.1059 0.0004745 ***
Version 8.8002 8.8002 1 95.002 28.4886 6.4e-07 ***
Group:Sex 0.0829 0.0829 1 94.993 0.2684 0.6056112
Group:Stimulus 0.0540 0.0540 1 94.995 0.1747 0.6768895
Sex:Stimulus 0.0637 0.0637 1 94.995 0.2061 0.6508763
Group:Version 0.3070 0.3070 1 95.002 0.9939 0.3213126
Sex:Version 0.1916 0.1916 1 95.002 0.6202 0.4329198
Stimulus:Version 0.8756 0.8756 1 94.993 2.8347 0.0955316 .
Group:Sex:Stimulus 0.0163 0.0163 1 94.995 0.0527 0.8188687
Group:Sex:Version 0.0333 0.0333 1 95.002 0.1078 0.7434180
Group:Stimulus:Version 0.4249 0.4249 1 94.993 1.3755 0.2438093
Sex:Stimulus:Version 1.1500 1.1500 1 94.993 3.7228 0.0566589 .
Group:Sex:Stimulus:Version 0.7942 0.7942 1 94.993 2.5710 0.1121581
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interpret(omega_squared(painEmpathy_p3b_lmer, alternative = 'two.sided'), rules = 'field2013')# Effect Size for ANOVA (Type III)
Parameter | Omega2 (partial) | 95% CI | Interpretation
-----------------------------------------------------------------------------
Group | 0.00 | [0.00, 0.00] | very small
Sex | 0.00 | [0.00, 0.00] | very small
Stimulus | 0.11 | [0.02, 0.24] | medium
Version | 0.22 | [0.09, 0.36] | large
Group:Sex | 0.00 | [0.00, 0.00] | very small
Group:Stimulus | 0.00 | [0.00, 0.00] | very small
Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Version | 0.00 | [0.00, 0.00] | very small
Sex:Version | 0.00 | [0.00, 0.00] | very small
Stimulus:Version | 0.02 | [0.00, 0.10] | small
Group:Sex:Stimulus | 0.00 | [0.00, 0.00] | very small
Group:Sex:Version | 0.00 | [0.00, 0.00] | very small
Group:Stimulus:Version | 3.86e-03 | [0.00, 0.06] | very small
Sex:Stimulus:Version | 0.03 | [0.00, 0.12] | small
Group:Sex:Stimulus:Version | 0.02 | [0.00, 0.10] | small
- Interpretation rule: field2013
# a_posteriori_lmer(painEmpathy_p3b_lmer)
emmeans(painEmpathy_p3b_lmer, pairwise ~ Stimulus)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Stimulus emmean SE df lower.CL upper.CL
no_pain 3.82 0.200 95 3.43 4.22
pain 3.47 0.193 95 3.09 3.85
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
no_pain - pain 0.353 0.0976 95 3.620 0.0005
Results are averaged over the levels of: Group, Sex, Version
Degrees-of-freedom method: kenward-roger
emmeans(painEmpathy_p3b_lmer, pairwise ~ Version)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version emmean SE df lower.CL upper.CL
pev1 3.95 0.216 95 3.52 4.38
pev2 3.34 0.179 95 2.99 3.70
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
pev1 - pev2 0.603 0.113 95 5.337 <.0001
Results are averaged over the levels of: Group, Sex, Stimulus
Degrees-of-freedom method: kenward-roger
emmeans(painEmpathy_p3b_lmer, pairwise ~ Sex*Stimulus|Version)NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version = pev1:
Sex Stimulus emmean SE df lower.CL upper.CL
female no_pain 4.11 0.331 95 3.45 4.76
male no_pain 4.28 0.334 95 3.62 4.95
female pain 3.73 0.304 95 3.13 4.33
male pain 3.66 0.307 95 3.05 4.27
Version = pev2:
Sex Stimulus emmean SE df lower.CL upper.CL
female no_pain 3.44 0.266 95 2.91 3.96
male no_pain 3.46 0.268 95 2.93 3.99
female pain 3.02 0.269 95 2.48 3.55
male pain 3.46 0.272 95 2.92 4.00
Results are averaged over the levels of: Group
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
Version = pev1:
contrast estimate SE df t.ratio p.value
female no_pain - male no_pain -0.17833 0.471 95 -0.379 0.9814
female no_pain - female pain 0.37650 0.185 95 2.037 0.1820
female no_pain - male pain 0.44342 0.452 112 0.982 0.7600
male no_pain - female pain 0.55482 0.452 112 1.228 0.6108
male no_pain - male pain 0.62174 0.187 95 3.329 0.0067
female pain - male pain 0.06692 0.432 95 0.155 0.9987
Version = pev2:
contrast estimate SE df t.ratio p.value
female no_pain - male no_pain -0.02225 0.378 95 -0.059 0.9999
female no_pain - female pain 0.41903 0.182 95 2.300 0.1053
female no_pain - male pain -0.02576 0.380 119 -0.068 0.9999
male no_pain - female pain 0.44128 0.380 120 1.161 0.6528
male no_pain - male pain -0.00351 0.184 95 -0.019 1.0000
female pain - male pain -0.44479 0.383 95 -1.162 0.6522
Results are averaged over the levels of: Group
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
n_ctl <- sum(unique(painEmpathy_data$num_id) >= 100)
n_vul <- sum(unique(painEmpathy_data$num_id) < 100)
n_fmut <- min(n_ctl, n_vul)Using 49 cases by group as FMUT only works with groups of equal size.
Fields and Kuperberg (2020)
max_dist value of 50 corresponds to an approximate distance of 5.24 cm (assuming a 56 cm great circle circumference head and that your electrode coordinates are based on an idealized spherical head with radius of 85.000000). Min/Max distances between all pairs of channels (in chanlocs units): 26.560450/169.891840 Median (semi-IQR) distance between all pairs of channels (in chanlocs units): 119.172654 (30.583399) Mean (SD) # of neighbors per channel: 2.6 (1.2) Median (semi-IQR) # of neighbors per channel: 2.0 (1.0) Min/max # of neighbors per channel: 0 to 4
painEmpathy_fmut_2_versions: 1 significant StimulusXVersion cluster(s) out of 47 cluster 1 F-masss: 1173 cluster 1 p-value: 0.0026 2 significant Stimulus cluster(s) out of 35 cluster 1 F-masss: 848 cluster 1 p-value: 0.0259 cluster 2 F-masss: 19905 cluster 2 p-value: 0.0001 6 significant Version cluster(s) out of 50 cluster 1 F-masss: 642 cluster 1 p-value: 0.0445 cluster 2 F-masss: 1526 cluster 2 p-value: 0.0025 cluster 3 F-masss: 2119 cluster 3 p-value: 0.0005 cluster 4 F-masss: 1246 cluster 4 p-value: 0.0070 cluster 5 F-masss: 885 cluster 5 p-value: 0.0207 cluster 6 F-masss: 1017 cluster 6 p-value: 0.0137
Using all cases
Groppe, Urbach, and Kutas (2011)
max_dist value of 50 corresponds to an approximate distance of 5.24 cm (assuming a 56 cm great circle circumference head and that your electrode coordinates are based on an idealized spherical head with radius of 85.000000). Min/Max distances between all pairs of channels (in chanlocs units): 26.560450/169.891840 Median (semi-IQR) distance between all pairs of channels (in chanlocs units): 119.172654 (30.583399) Mean (SD) # of neighbors per channel: 2.6 (1.2) Median (semi-IQR) # of neighbors per channel: 2.0 (1.0) Min/max # of neighbors per channel: 0 to 4
pev1_painEmpathy_ctl: 2 significant positive cluster(s) out of 13 cluster 1 t-masss: 375 cluster 1 p-value: 0.0034 cluster 2 t-masss: 338 cluster 2 p-value: 0.0056 0 significant negative cluster(s) out of 23 pev1_painEmpathy_vul: 2 significant positive cluster(s) out of 18 cluster 1 t-masss: 308 cluster 1 p-value: 0.0188 cluster 2 t-masss: 448 cluster 2 p-value: 0.0058 0 significant negative cluster(s) out of 14
pev2_painEmpathy_ctl: 1 significant positive cluster(s) out of 17 cluster 1 t-masss: 2096 cluster 1 p-value: 0.0000 1 significant negative cluster(s) out of 28 cluster 1 t-masss: -217 cluster 1 p-value: 0.0352 pev2_painEmpathy_vul: 1 significant positive cluster(s) out of 9 cluster 1 t-masss: 2369 cluster 1 p-value: 0.0000 0 significant negative cluster(s) out of 14
Same processing as ERPs.
Using 13 central electrodes shared between BioSemi ActiveTwo and Emotiv Epoc Flex devices:
Done in the ADAM 1.14 toolbox (Fahrenfort 2020) with FieldTrip 20211209 (Oostenveld et al. 2011).
Multivariate Interaction Measure, MIM (ROIconnect, Pellegrini et al. 2023), beta band (13-30 Hz) 1 sec post-stimulus.
options(width = 80)
summary(connectivity_data) ERPset ID Group City image
s001_vul_s: 16 s001 : 16 vulnerable:784 stgo:1392 no_pain_v1:396
s002_vul_s: 16 s002 : 16 control :800 viña: 192 no_pain_v2:396
s003_vul_s: 16 s003 : 16 pain_v1 :396
s004_vul_s: 16 s004 : 16 pain_v2 :396
s005_vul_s: 16 s005 : 16
s006_vul_s: 16 s006 : 16
(Other) :1488 (Other):1488
region_a region_b median_connectivity Version
left_occipital :792 parietal_ipsi :792 Min. :0.03959 v1:792
right_occipital:792 parietal_contra:792 1st Qu.:0.06816 v2:792
Median :0.07771
Mean :0.07981
3rd Qu.:0.08882
Max. :0.18607
Stimulus log_median_connectivity num_id Sex
pain :792 Min. :-3.229 Min. : 1.00 female:800
no_pain:792 1st Qu.:-2.686 1st Qu.: 28.00 male :784
Median :-2.555 Median :100.00
Mean :-2.550 Mean : 76.87
3rd Qu.:-2.421 3rd Qu.:126.00
Max. :-1.682 Max. :150.00
connectivity_data_wide_version <- connectivity_data[c('ERPset', 'Version', 'region_a', 'region_b', 'Stimulus', 'log_median_connectivity')] |>
pivot_wider(names_from = Version, values_from = log_median_connectivity)
connectivity_data_wide_region_a <- connectivity_data[c('ERPset', 'Version', 'region_a', 'region_b', 'Stimulus', 'log_median_connectivity')] |>
pivot_wider(names_from = region_a, values_from = log_median_connectivity)
connectivity_data_wide_region_b <- connectivity_data[c('ERPset', 'Version', 'region_a', 'region_b', 'Stimulus', 'log_median_connectivity')] |>
pivot_wider(names_from = region_b, values_from = log_median_connectivity)
connectivity_data_wide_stimulus <- connectivity_data[c('ERPset', 'Version', 'region_a', 'region_b', 'Stimulus', 'log_median_connectivity')] |>
pivot_wider(names_from = Stimulus, values_from = log_median_connectivity)
versions <- c('v1', 'v2')
region_a_parts <- c(paste0('left_', label_a), paste0('right_', label_a))
region_b_parts <- c(paste0(label_b, '_ipsi'), paste0(label_b, '_contra'))
stims <- c('pain', 'no_pain')
ggpairs(connectivity_data_wide_version,
aes(colour = Stimulus, alpha = .5, linewidth = NA),
columns = versions,
lower = list(continuous = wrap('points', alpha = .4)),
progress = FALSE
)
ggpairs(connectivity_data_wide_region_a,
aes(colour = Stimulus, alpha = .5, linewidth = NA),
columns = region_a_parts,
lower = list(continuous = wrap('points', alpha = .4)),
progress = FALSE
)
ggpairs(connectivity_data_wide_region_b,
aes(colour = Stimulus, alpha = .5, linewidth = NA),
columns = region_b_parts,
lower = list(continuous = wrap('points', alpha = .4)),
progress = FALSE
)
ggpairs(connectivity_data_wide_stimulus,
aes(colour = region_b, alpha = .5, linewidth = NA),
columns = stims,
lower = list(continuous = wrap('points', alpha = .4)),
progress = FALSE
)connectivity_glmer <- glmer(median_connectivity ~ Group*Sex*Stimulus*Version*region_b + (Stimulus*Version*region_b|num_id), family = Gamma(log), connectivity_data)
afex_plot(connectivity_glmer,
x = 'region_b',
trace = 'Stimulus',
panel = ~Version*Group,
id = 'num_id',
error_arg = list(width = .3, lwd = .75),
dodge = my_dodge,
data_arg = list(
position =
position_jitterdodge(
jitter.width = my_jitter,
dodge.width = my_dodge ## needs to be same as dodge
)),
mapping = c('color'),, data_alpha = .3,
point_arg = list(size = 3)
)
connectivity_glmer@callglmer(formula = median_connectivity ~ Group * Sex * Stimulus *
Version * region_b + (Stimulus * Version * region_b | num_id),
data = connectivity_data, family = Gamma(log))
options(width = 150)
anova(connectivity_glmer)Analysis of Variance Table
npar Sum Sq Mean Sq F value
Group 1 0.15090 0.15090 11.5040
Sex 1 0.08482 0.08482 6.4669
Stimulus 1 0.00095 0.00095 0.0727
Version 1 0.35376 0.35376 26.9698
region_b 1 1.18836 1.18836 90.5983
Group:Sex 1 0.00815 0.00815 0.6216
Group:Stimulus 1 0.00027 0.00027 0.0206
Sex:Stimulus 1 0.00461 0.00461 0.3516
Group:Version 1 0.01346 0.01346 1.0260
Sex:Version 1 0.00006 0.00006 0.0048
Stimulus:Version 1 0.00000 0.00000 0.0000
Group:region_b 1 0.00780 0.00780 0.5945
Sex:region_b 1 0.00138 0.00138 0.1055
Stimulus:region_b 1 0.00139 0.00139 0.1061
Version:region_b 1 0.07697 0.07697 5.8678
Group:Sex:Stimulus 1 0.00003 0.00003 0.0025
Group:Sex:Version 1 0.00864 0.00864 0.6585
Group:Stimulus:Version 1 0.00019 0.00019 0.0141
Sex:Stimulus:Version 1 0.02214 0.02214 1.6877
Group:Sex:region_b 1 0.00000 0.00000 0.0001
Group:Stimulus:region_b 1 0.00058 0.00058 0.0443
Sex:Stimulus:region_b 1 0.00029 0.00029 0.0217
Group:Version:region_b 1 0.00051 0.00051 0.0392
Sex:Version:region_b 1 0.00355 0.00355 0.2705
Stimulus:Version:region_b 1 0.00150 0.00150 0.1146
Group:Sex:Stimulus:Version 1 0.00005 0.00005 0.0040
Group:Sex:Stimulus:region_b 1 0.00113 0.00113 0.0861
Group:Sex:Version:region_b 1 0.00542 0.00542 0.4133
Group:Stimulus:Version:region_b 1 0.00000 0.00000 0.0001
Sex:Stimulus:Version:region_b 1 0.00135 0.00135 0.1030
Group:Sex:Stimulus:Version:region_b 1 0.00388 0.00388 0.2960
a_posteriori_glmer(connectivity_glmer)Analysis of Deviance Table (Type II Wald chisquare tests)
Response: median_connectivity
Chisq Df Pr(>Chisq)
Group 2.8526 1 0.091229 .
Sex 1.3538 1 0.244622
Stimulus 0.1793 1 0.671980
Version 19.4406 1 1.038e-05 ***
region_b 111.0950 1 < 2.2e-16 ***
Group:Sex 0.1090 1 0.741341
Group:Stimulus 0.0136 1 0.907090
Sex:Stimulus 0.1856 1 0.666623
Group:Version 0.3783 1 0.538523
Sex:Version 0.0041 1 0.948980
Stimulus:Version 0.0120 1 0.912825
Group:region_b 0.6590 1 0.416914
Sex:region_b 0.0610 1 0.804896
Stimulus:region_b 0.1346 1 0.713701
Version:region_b 8.2583 1 0.004057 **
Group:Sex:Stimulus 0.0152 1 0.901990
Group:Sex:Version 0.1322 1 0.716172
Group:Stimulus:Version 0.0042 1 0.948303
Sex:Stimulus:Version 0.7323 1 0.392144
Group:Sex:region_b 0.0051 1 0.943131
Group:Stimulus:region_b 0.0655 1 0.798041
Sex:Stimulus:region_b 0.0298 1 0.863055
Group:Version:region_b 0.0584 1 0.809072
Sex:Version:region_b 0.3839 1 0.535513
Stimulus:Version:region_b 0.1717 1 0.678568
Group:Sex:Stimulus:Version 0.0001 1 0.993662
Group:Sex:Stimulus:region_b 0.1212 1 0.727761
Group:Sex:Version:region_b 0.5877 1 0.443297
Group:Stimulus:Version:region_b 0.0003 1 0.985220
Sex:Stimulus:Version:region_b 0.1547 1 0.694125
Group:Sex:Stimulus:Version:region_b 0.4446 1 0.504919
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version emmean SE df asymp.LCL asymp.UCL
v1 -2.51 0.0196 Inf -2.55 -2.48
v2 -2.59 0.0230 Inf -2.64 -2.55
Results are averaged over the levels of: Group, Sex, Stimulus, region_b
Results are given on the log (not the response) scale.
Confidence level used: 0.95
$contrasts
contrast estimate SE df z.ratio p.value
v1 - v2 0.077 0.0211 Inf 3.654 0.0003
Results are averaged over the levels of: Group, Sex, Stimulus, region_b
Results are given on the log (not the response) scale.
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
region_b emmean SE df asymp.LCL asymp.UCL
parietal_ipsi -2.58 0.0193 Inf -2.62 -2.54
parietal_contra -2.52 0.0184 Inf -2.56 -2.49
Results are averaged over the levels of: Group, Sex, Stimulus, Version
Results are given on the log (not the response) scale.
Confidence level used: 0.95
$contrasts
contrast estimate SE df z.ratio p.value
parietal_ipsi - parietal_contra -0.0592 0.0059 Inf -10.034 <.0001
Results are averaged over the levels of: Group, Sex, Stimulus, Version
Results are given on the log (not the response) scale.
____________________________________________________________
NOTE: Results may be misleading due to involvement in interactions
$emmeans
Version region_b emmean SE df asymp.LCL asymp.UCL
v1 parietal_ipsi -2.55 0.0199 Inf -2.59 -2.51
v2 parietal_ipsi -2.61 0.0245 Inf -2.66 -2.57
v1 parietal_contra -2.48 0.0200 Inf -2.52 -2.44
v2 parietal_contra -2.57 0.0221 Inf -2.61 -2.52
Results are averaged over the levels of: Group, Sex, Stimulus
Results are given on the log (not the response) scale.
Confidence level used: 0.95
$contrasts
contrast estimate SE df z.ratio p.value
v1 parietal_ipsi - v2 parietal_ipsi 0.0628 0.02260 Inf 2.780 0.0279
v1 parietal_ipsi - v1 parietal_contra -0.0734 0.00712 Inf -10.309 <.0001
v1 parietal_ipsi - v2 parietal_contra 0.0177 0.01980 Inf 0.895 0.8074
v2 parietal_ipsi - v1 parietal_contra -0.1362 0.02380 Inf -5.730 <.0001
v2 parietal_ipsi - v2 parietal_contra -0.0451 0.00822 Inf -5.487 <.0001
v1 parietal_contra - v2 parietal_contra 0.0911 0.02060 Inf 4.419 0.0001
Results are averaged over the levels of: Group, Sex, Stimulus
Results are given on the log (not the response) scale.
P value adjustment: tukey method for comparing a family of 4 estimates