Facial palsy reveals the sensorimotor contribution to facial-emotion recognition.
The 2 matches
- [1] § Results › Severity–Performance Coupling in Congenital Palsy (H2a). ↔ Study 2/Script/Study2_Confirmatory_Analyses_and_Plot.R, lines 789–848 · score 0.54 · Model projections, cross validation, facial motor, correlated, matched, predicted
- [2] § Materials and Methods ↔ Study 2/Script/Study2_Confirmatory_Analyses_and_Plot.R, lines 683–746 · score 0.50 · SFGS scores, ADFES accuracy, JeFEE, correlations, CI, bootstrap
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 915 lines · 32 KB · no license · 2 matches
- ## HEADER ----
- # Experiment: CARIPARO
- # Programmer: QUETTIER THOMAS
- # Created: 04/06/2023
- # Updated: 24/07/2025
- # Description:
- # This script performs data analysis for the CARIPARO experiment,
- # specifically for the Accuracy and Intensity measures of the
- # Online student experiment.
- ## Clean up ----
- rm(list = ls()) # Remove all objects
- ## Load libraries ----
- library(tidyverse)
- library(afex)
- library(effectsize)
- library(BayesFactor)
- library(emmeans)
- library(dplyr)
- library(performance)
- library(brms)
- library(bayestestR)
- library(tidyverse)
- library(cowplot)
- library(ggplot2)
- library(ggrain)
- library(mediation)
- library(broom)
- library(boot)
- ## Define preprocessing function ----
- preprocessed_data <- function(file_path, value_col, ...) {
- read_csv(file_path) %>%
- group_by(...) %>%
- summarise(across(all_of(value_col), ~ mean(.x, na.rm = TRUE)), .groups = "drop") %>%
- mutate(label = paste0(subject,video_set),
- video_set = factor(video_set, levels = c("ADFES", "JeFEE")))
- }
- figure<-function(data, type){
- colors <- c("ADFES" = "#657d9a", "JeFEE" = "#b37269")
- colorgroup <- c(Moebius = "#F0E442", Control = "#C07DA5")
- # stat summary
- if(type == "acc"){
- df <- data %>% dplyr::select(-label) %>%
- 'colnames<-'(c("subject" , "group" ,"video_set", "mean"))%>%
- mutate(mean = mean*100,
- match = paste0(parse_number(subject),video_set))
- ytitle <- "Mean Accuracy (%)"
- } else if(type == "int"){
- df <- data %>% dplyr::select(-label) %>%
- 'colnames<-'(c("subject", "group" , "video_set", "mean"))%>%
- mutate(match = paste0(parse_number(subject),video_set))
- ytitle <- "Mean Intensity (px)"
- }
- descritive <- df %>%
- group_by(video_set, group) %>%
- summarise(sd = sd(mean),
- se = sd(mean)/sqrt(n()),
- mean = mean(mean),
- .groups = "drop")%>%
- mutate(x_pos = case_when(
- group == "Moebius" & video_set == "ADFES" ~ 2 - 0.1,
- group == "Moebius" & video_set == "JeFEE" ~ 2 - 0.1,
- group == "Control" & video_set == "ADFES" ~ 1 + 0.1,
- group == "Control" & video_set == "JeFEE" ~ 1 + 0.1
- ))
- p <- ggplot(df %>% filter(group %in% c("Moebius", "Control")),
- aes(x = group, y = mean, fill = video_set)) +
- geom_rain(alpha = 0.5, rain.side = 'f2x2', id.long.var = "match", cov = "group") +
- geom_point(data = descritive,
- aes(x = x_pos, y = mean, fill = video_set),
- size = 3, shape = 23, color = "black") +
- geom_errorbar(data = descritive,
- aes(x = x_pos, ymin = mean - se, ymax = mean + se),
- width = 0, color = "black", linewidth = 0.5, inherit.aes = FALSE) +
- scale_fill_manual(values = colors) +
- scale_color_manual(values = colorgroup) +
- labs(x = NULL, y = ytitle, fill = "Expression Type") +
- theme_minimal(base_size = 14) +
- theme(legend.position = "none") +
- theme(text=element_text(size=10, family="Helvetica"),
- panel.background = element_blank(),
- axis.line = element_line(colour = "black"),
- strip.text.x = element_text(size = 6.6),
- strip.text.y = element_text(size = 6.6),
- panel.grid.major = element_blank(), # Rimuove le griglie principali
- panel.grid.minor = element_blank() )
- return(p)
- }
- # Function to extract results from mediation analysis
- extract_med <- function(model, mediator_name, outcome_name) {
- summ <- summary(model)
- tibble(
- mediator = mediator_name,
- outcome = outcome_name,
- acme = summ$d0,
- acme_ci_low = summ$d0.ci[1],
- acme_ci_high = summ$d0.ci[2],
- acme_p = summ$d0.p,
- ade = summ$z0,
- ade_ci_low = summ$z0.ci[1],
- ade_ci_high = summ$z0.ci[2],
- ade_p = summ$z0.p,
- total_effect = summ$tau.coef,
- total_ci_low = summ$tau.ci[1],
- total_ci_high = summ$tau.ci[2],
- total_p = summ$tau.p
- )
- }
- # Generic function to bootstrap Pearson r
- cor_fun <- function(data, indices, x, y) {
- d <- data[indices, ]
- return(cor(d[[x]], d[[y]], method = "pearson"))
- }
- # Helper function to append test results
- add_result <- function(var, outcome, test, bf, eff = NA) {
- tibble::tibble(
- variable = var,
- outcome = outcome,
- stat_type = test$method,
- stat_value = unname(test$estimate),
- p_value = test$p.value,
- bf01 = bf,
- effect_size = eff
- )
- }
- # Pearson r with BCa 95 % CI (10 000 resamples)
- bcacor <- function(d, i, var){
- d <- d[i, ]
- cor(d$Sunnybrook, d[[var]], method = "pearson")
- }
- get_bca <- function(var){
- bt <- boot(dat, bcacor, R = 10000, var = var)
- ci <- boot.ci(bt, type = "bca")$bca[4:5]
- tibble(
- Variable = var,
- r = cor(dat$Sunnybrook, dat[[var]]),
- CI_low = ci[1],
- CI_high = ci[2],
- p = cor.test(dat$Sunnybrook, dat[[var]])$p.value
- )
- }
- # Leave-one-out cross-validated R² with percentile CI
- calc_loo <- function(y){
- n <- nrow(dat)
- yh <- numeric(n)
- for(i in seq_len(n)){
- fit <- lm(reformulate("Sunnybrook", y), data = dat[-i, ])
- yh[i] <- predict(fit, newdata = dat[i, ])
- }
- r2 <- 1 - sum((dat[[y]] - yh)^2) / sum((dat[[y]] - mean(dat[[y]]))^2)
- bt <- boot(dat, function(d, ind){
- d <- d[ind, ]
- n <- nrow(d); yh <- numeric(n)
- for(i in seq_len(n)){
- fit <- lm(reformulate("Sunnybrook", y), data = d[-i, ])
- yh[i] <- predict(fit, newdata = d[i, ])
- }
- 1 - sum((d[[y]] - yh)^2) / sum((d[[y]] - mean(d[[y]]))^2)
- }, R = 10000)
- ci <- boot.ci(bt, type = "perc")$percent[4:5]
- tibble(Variable = y, R2_CV = r2, CI_low = ci[1], CI_high = ci[2])
- }
- get_pred <- function(y){
- fit <- lm(reformulate("Sunnybrook", y), data = dat)
- predict(fit, newdata = grid, interval = "prediction", level = 0.95) %>%
- as_tibble() %>%
- mutate(Sunnybrook = grid$Sunnybrook, Variable = y)
- }
- ## Accuracy Analysis ----
- ### 0. Data preparation ----
- df_acc <- preprocessed_data("data/Study2_Mean_forEmotion_Accuracy.csv", "accuracy", subject, group, video_set, emotion)
- df_int <- preprocessed_data("data/Study2_Mean_forEmotion_intensity", "intensity", subject, group, video_set)
- df_acc$total <- 8 # Number of trials per observation
- ### 1. Descriptive statistics for accuracy ----
- df_subject_mean <- df_acc %>%
- group_by(subject, group, video_set) %>%
- summarise(accuracy = mean(accuracy, na.rm = TRUE), .groups = "drop")
- descriptive_accuracy <- df_subject_mean %>%
- group_by(video_set, group) %>%
- summarise(
- mean_acc = mean(accuracy) * 100,
- sd_acc = sd(accuracy) * 100,
- se_acc = sd(accuracy) / sqrt(n()) * 100,
- min_acc = min(accuracy) * 100,
- max_acc = max(accuracy) * 100,
- .groups = "drop"
- )
- print(descriptive_accuracy)
- # Compute % difference between ADFES and JeFEE
- diff_percent <- descriptive_accuracy %>%
- dplyr::select(video_set, group, mean_acc) %>%
- pivot_wider(names_from = video_set, values_from = mean_acc) %>%
- mutate(percent_diff = (ADFES - JeFEE) / ADFES * 100)
- ### 2. Fit GLMM on accuracy (binomial with weights) ----
- mod_glmer <- glmer(
- accuracy ~ video_set * group + (1 | subject),
- family = binomial(),
- weights = total,
- data = df_acc
- )
- summary(mod_glmer)
- ### 3. Estimated marginal means (response scale) ----
- emm_acc <- emmeans(mod_glmer, pairwise ~ video_set, type = "response")
- ### 4. Effect size from odds ratio ----
- odds_ratio <- summary(emm_acc$contrasts) %>% pull(odds.ratio)
- cohens_d <- oddsratio_to_d(odds_ratio)
- print(cohens_d)
- ### 5. R² from frequentist model ----
- r2(mod_glmer)
- ### 6. Welch's correction (variance == False -> apply correction) ----
- # data preparation
- ### 0. Data preparation
- df_welch <- preprocessed_data("Study2_Mean_forEmotion_Accuracy.csv", "accuracy", subject, video_set, group)
- # Subset data first
- adfes_data <- df_welch %>% filter(video_set == "ADFES")
- jefee_data <- df_welch %>% filter(video_set == "JeFEE")
- # Run Welch t-tests
- ADFES_ph <- t.test(accuracy ~ group, data = adfes_data, var.equal = FALSE)
- JeFEE_ph <- t.test(accuracy ~ group, data = jefee_data, var.equal = FALSE)
- # Compute Cohen's d from raw data
- ADFES_d <- cohens_d(accuracy ~ group, data = adfes_data)
- JeFEE_d <- cohens_d(accuracy ~ group, data = jefee_data)
- ### Bayesian Analysis (Accuracy) ----
- #### 1. Add success counts ----
- df_acc <- df_acc %>%
- mutate(successes = round(accuracy * total))
- #### 2. Fit full Bayesian model ----
- mod_full <- brm(
- successes | trials(total) ~ video_set * group + (1 | subject),
- family = binomial(),
- data = df_acc,
- prior = set_prior("normal(0, 5)", class = "b"),
- chains = 4, cores = 4, iter = 4000, seed = 123,
- save_pars = save_pars(all = TRUE)
- )
- #### 3. Fit null Bayesian model ----
- mod_null <- brm(
- successes | trials(total) ~ 1 + (1 | subject),
- family = binomial(),
- data = df_acc,
- prior = set_prior("normal(0, 5)", class = "Intercept"),
- chains = 4, cores = 4, iter = 4000, seed = 123,
- save_pars = save_pars(all = TRUE)
- )
- #### 4. Compute Bayes Factor ----
- BF <- bayesfactor_models(mod_full, mod_null)
- BF10 <- exp(abs(BF$log_BF[BF$Model == "1 + (1 | subject)"]))
- ## Intensity Analysis ----
- ### 1. Descriptive statistics for intensity ----
- descriptive_intensity <- df_int %>%
- group_by(video_set, group) %>%
- summarise(
- mean_int = mean(intensity, na.rm = TRUE),
- sd_int = sd(intensity, na.rm = TRUE),
- se_int = sd(intensity, na.rm = TRUE) / sqrt(n()),
- .groups = "drop"
- )
- print(descriptive_intensity)
- ### 2. Frequentist ANOVA ----
- anova_int <- aov_ez(id = "subject", dv = "intensity", within = "video_set", between = "group",data = df_int)
- summary(anova_int)
- ### 3. Effect size: η² ----
- eta2 <- eta_squared(anova_int, partial = TRUE)
- print(eta2)
- ### 4. Cohen’s d for repeated measures ----
- df_wide <- df_int %>%
- select(-label) %>%
- pivot_wider(names_from = video_set, values_from = intensity) %>%
- drop_na() %>%
- column_to_rownames("subject")
- d_rm <- cohens_d(df_wide$ADFES, df_wide$JeFEE, paired = TRUE, within = TRUE)
- print(d_rm)
- ### 5. Bayesian ANOVA ----
- df_int$subject <- as.factor(df_int$subject)
- df_int$video_set <- as.factor(df_int$video_set)
- df_int$group <- as.factor(df_int$group)
- bf_intensity <- anovaBF(
- intensity ~ video_set * group * subject,
- data = df_int ,
- whichRandom = "subject",
- iterations = 10000
- )
- BF <-extractBF(bf_intensity)
- ### 6. Welch's correction (variance == False -> apply correction)----
- # Subset data first
- adfes_data <- df_int %>% filter(video_set == "ADFES")
- jefee_data <- df_int %>% filter(video_set == "JeFEE")
- # Run Welch t-tests
- ADFES_ph <- t.test(intensity ~ group, data = adfes_data, var.equal = FALSE)
- JeFEE_ph <- t.test(intensity ~ group, data = jefee_data, var.equal = FALSE)
- # Compute Cohen's d from raw data
- ADFES_d <- cohens_d(intensity ~ group, data = adfes_data)
- JeFEE_d <- cohens_d(intensity ~ group, data = jefee_data)
- ### 7. Plot Figure 2S ----
- # Plots fig. 2S supp
- df_acc <- preprocessed_data("Study2_Mean_forEmotion_Accuracy.csv", "accuracy", subject, group, video_set)
- df_int <- preprocessed_data("Study2_Mean_forEmotion_intensity.csv", "intensity", subject, group, video_set)
- p1 <- figure(df_acc,"acc") # plot accuracy
- p2 <- figure(df_int,"int") # plot intensity
- p3 <- plot_grid(p1, p2, nrow = 1,labels = "AUTO") #combine plots
- # Export
- ggsave("figures/Fig_2S_finale.png", # export for draft
- plot = p3,
- device = "png",
- dpi = 300,
- width = 18,
- height = 12,
- units = "cm")
- ggsave("figures/Fig_2S.tiff", # export for journal
- plot = p3,
- device = "tiff",
- dpi = 1200,
- width = 18,
- height = 12,
- units = "cm")
- ## Normative sample comparison ----
- ### 1. Normative values ----
- df_acc_n <- read_csv("Study2_Mean_forEmotion_Accuracy.csv")%>%
- group_by(subject,video_set) %>%
- summarise( accuracy = mean(acc, na.rm = TRUE)) %>%
- mutate(video_set = as.factor(video_set),
- label = paste0(subject,video_set))
- df_int_n <- read_csv("Study2_Mean_forEmotion_intensity.csv")%>%
- group_by(subject,video_set) %>%
- summarise(intensity = mean(intensity, na.rm = TRUE)) %>%
- mutate(video_set = as.factor(video_set),
- label = paste0(subject,video_set)) %>%
- ungroup() %>%
- dplyr::select(-c(subject,video_set))
- df_norm <- left_join(df_acc_n, df_int_n, by = "label") %>%
- dplyr::select(-label) %>%
- group_by(video_set) %>%
- summarise(norm_acc = mean(accuracy),
- norm_int = mean(intensity),
- sd_acc = sd(accuracy),
- sd_int = sd(intensity))
- norm_ADFES <- df_norm$norm_acc[df_norm$video_set == "ADFES"]
- norm_JeFEE <- df_norm$norm_acc[df_norm$video_set == "JeFEE"]
- norm_ADFES_int <- df_norm$norm_int[df_norm$video_set == "ADFES"]
- norm_JeFEE_int <- df_norm$norm_int[df_norm$video_set == "JeFEE"]
- ### 2. Subset your data ----
- df_acc <- preprocessed_data("Study2_Mean_forEmotion_Accuracy.csv", "accuracy", subject, group, video_set)
- df_int <- preprocessed_data("Study2_Mean_forEmotion_intensity.csv", "intensity", subject, group, video_set)%>%
- select(intensity, label)
- df <- left_join(df_acc, df_int, by = "label") %>%
- select(-label)
- controls <- df %>% filter(group == "Control")
- moebius <- df %>% filter(group == "Moebius")
- ### 3. Compute per-subject means for each video_set ----
- control_means <- controls %>%
- group_by(subject, video_set) %>%
- summarise(acc = mean(accuracy),
- int = mean(intensity),
- .groups = "drop")
- moebius_means <- moebius %>%
- group_by(subject, video_set) %>%
- summarise(acc = mean(accuracy),
- int = mean(intensity),
- .groups = "drop")
- # --- Split by ADFES / JeFEE ---
- control_adfes <- control_means %>% filter(video_set == "ADFES") %>% pull(acc)
- control_jefee <- control_means %>% filter(video_set == "JeFEE") %>% pull(acc)
- moebius_adfes <- moebius_means %>% filter(video_set == "ADFES") %>% pull(acc)
- moebius_jefee <- moebius_means %>% filter(video_set == "JeFEE") %>% pull(acc)
- control_adfes_int <- control_means %>% filter(video_set == "ADFES") %>% pull(int)
- control_jefee_int <- control_means %>% filter(video_set == "JeFEE") %>% pull(int)
- moebius_adfes_int <- moebius_means %>% filter(video_set == "ADFES") %>% pull(int)
- moebius_jefee_int <- moebius_means %>% filter(video_set == "JeFEE") %>% pull(int)
- ### 4. Welch one-sample t-tests vs normative means X---
- # ADFES ACCURACY
- t_ctrl_adfes <- t.test(control_adfes, mu = norm_ADFES)
- d_ctrl_adfes <- cohens_d(control_adfes, mu = norm_ADFES)
- bf_ctrl_adfes <- ttestBF(x = control_adfes, mu = norm_ADFES)
- t_moeb_adfes <- t.test(moebius_adfes, mu = norm_ADFES)
- d_moeb_adfes <- cohens_d(moebius_adfes, mu = norm_ADFES)
- bf_moeb_adfes <- ttestBF(x = moebius_adfes, mu = norm_ADFES)
- # JeFEE ACCURACY
- t_ctrl_jefee <- t.test(control_jefee, mu = norm_JeFEE)
- d_ctrl_jefee <- cohens_d(control_jefee, mu = norm_JeFEE)
- bf_ctrl_jefee <- ttestBF(x = control_jefee, mu = norm_JeFEE)
- t_moeb_jefee <- t.test(moebius_jefee, mu = norm_JeFEE)
- d_moeb_jefee <- cohens_d(moebius_jefee, mu = norm_JeFEE)
- bf_moeb_jefee <- ttestBF(x = moebius_jefee, mu = norm_JeFEE)
- # ADFES INTENSITY
- t_ctrl_adfes_int <- t.test(control_adfes_int, mu = norm_ADFES_int)
- d_ctrl_adfes_int <- cohens_d(control_adfes_int, mu = norm_ADFES_int)
- bf_ctrl_adfes_int <- ttestBF(x = control_adfes_int, mu = norm_ADFES_int)
- t_moeb_adfes_int <- t.test(moebius_adfes_int, mu = norm_ADFES_int)
- d_moeb_adfes_int <- cohens_d(moebius_adfes_int, mu = norm_ADFES_int)
- bf_moeb_adfes_int <- ttestBF(x = moebius_adfes_int, mu = norm_ADFES_int)
- # JeFEE INTENSITY
- t_ctrl_jefee_int <- t.test(control_jefee_int, mu = norm_JeFEE_int)
- d_ctrl_jefee_int <- cohens_d(control_jefee_int, mu = norm_JeFEE_int)
- bf_ctrl_jefee_int <- ttestBF(x = control_jefee_int, mu = norm_JeFEE_int)
- t_moeb_jefee_int <- t.test(moebius_jefee_int, mu = norm_JeFEE_int)
- d_moeb_jefee_int <- cohens_d(moebius_jefee_int, mu = norm_JeFEE_int)
- bf_moeb_jefee_int <- ttestBF(x = moebius_jefee_int, mu = norm_JeFEE_int)
- ## Mediation Analysis ----
- ### 1. Data preparation----
- data <- read_csv("data/Study2_Complete_Dataset.csv") %>%
- filter(group == "moebius") %>%
- dplyr::select(subject, AQ_score, TAS_score, Sunnybrook, acc_ADFES, acc_JeFEE)
- ### 2. Total effect models ----
- model_adfes <- lm(acc_ADFES ~ Sunnybrook, data = data)
- model_jefee <- lm(acc_JeFEE ~ Sunnybrook, data = data)
- ### 3. Mediator Models -----
- model_tas <- lm(TAS_score ~ Sunnybrook, data = data)
- model_aq <- lm(AQ_score ~ Sunnybrook, data = data)
- ### 4. Mediation Models -----
- #### AQ mediation for ADFES ----
- med_model_aq_adfes <- lm(AQ_score ~ Sunnybrook, data = data)
- out_model_aq_adfes <- lm(acc_ADFES ~ Sunnybrook + AQ_score, data = data)
- mediation_aq_adfes <- mediate(med_model_aq_adfes, out_model_aq_adfes,
- treat = "Sunnybrook", mediator = "AQ_score",
- boot = TRUE, sims = 1000)
- #### AQ mediation for JeFEE ----
- med_model_aq_jefee <- lm(AQ_score ~ Sunnybrook, data = data)
- out_model_aq_jefee <- lm(acc_JeFEE ~ Sunnybrook + AQ_score, data = data)
- mediation_aq_jefee <- mediate(med_model_aq_jefee, out_model_aq_jefee,
- treat = "Sunnybrook", mediator = "AQ_score",
- boot = TRUE, sims = 1000)
- #### TAS mediation for ADFES ----
- med_model_tas_adfes <- lm(TAS_score ~ Sunnybrook, data = data)
- out_model_tas_adfes <- lm(acc_ADFES ~ Sunnybrook + TAS_score, data = data)
- mediation_tas_adfes <- mediate(med_model_tas_adfes, out_model_tas_adfes,
- treat = "Sunnybrook", mediator = "TAS_score",
- boot = TRUE, sims = 1000)
- #### TAS mediation for JeFEE ----
- med_model_tas_jefee <- lm(TAS_score ~ Sunnybrook, data = data)
- out_model_tas_jefee <- lm(acc_JeFEE ~ Sunnybrook + TAS_score, data = data)
- mediation_tas_jefee <- mediate(med_model_tas_jefee, out_model_tas_jefee,
- treat = "Sunnybrook", mediator = "TAS_score",
- boot = TRUE, sims = 1000)
- ### 5. Extract summary stats ----
- results <- bind_rows(
- extract_med(mediation_tas_adfes, "TAS", "ADFES"),
- extract_med(mediation_tas_jefee, "TAS", "JeFEE"),
- extract_med(mediation_aq_adfes, "AQ", "ADFES"),
- extract_med(mediation_aq_jefee, "AQ", "JeFEE")
- )
- ### 6. FDR correction
- results <- as.data.frame(results) %>%
- dplyr::select(
- mediator, outcome,
- total_effect, total_ci_low, total_ci_high, total_p, total_q,
- acme, acme_ci_low, acme_ci_high, acme_p, acme_q
- ) %>%
- print()
- # Extract tidy regression summaries
- tas_sum <- tidy(model_tas, conf.int = TRUE)
- aq_sum <- tidy(model_aq, conf.int = TRUE)
- # Extract only Sunnybrook rows
- tas_sunny <- filter(tas_sum, term == "Sunnybrook")
- aq_sunny <- filter(aq_sum, term == "Sunnybrook")
- # Combine and compute FDR-corrected q-values
- mediator_pred <- bind_rows(tas_sunny, aq_sunny) %>%
- mutate(mediator = c("TAS", "AQ"),
- q = p.adjust(p.value, method = "fdr"))
- print(mediator_pred)
- # Demography ----
- data <- read_csv("data/Study2_Complete_Dataset.csv") %>%
- filter(group == "moebius")
- ### 1. Inizialyse results matrix ----
- results <- tibble::tibble(
- variable = character(),
- outcome = character(),
- stat_type = character(),
- stat_value = numeric(),
- p_value = numeric(),
- bf01 = numeric(),
- effect_size = numeric()
- )
- ### 2. Palsy laterality (monolateral vs bilateral) ----
- for (outcome in c("acc_ADFES", "acc_JeFEE")) {
- x <- data[[outcome]][data$lateralisation == "monolateral"]
- y <- data[[outcome]][data$lateralisation == "bilateral"]
- t_res <- t.test(x, y)
- d <- cohens_d(x, y)$Cohens_d
- bf <- 1 / extractBF(ttestBF(x = x, y = y))$bf
- results <- dplyr::bind_rows(results, add_result("palsy_laterality", outcome, t_res, bf, d))
- }
- ### 3. Age (continuous predictor) ----
- for (outcome in c("acc_ADFES", "acc_JeFEE")) {
- cor_res <- cor.test(data[[outcome]], data$age, method = "pearson")
- bf <- 1 / extractBF(correlationBF(data[[outcome]], data$age))$bf
- results <- dplyr::bind_rows(results, add_result("age", outcome, cor_res, bf))
- }
- ### 4. Education (years) ----
- for (outcome in c("acc_ADFES", "acc_JeFEE")) {
- cor_res <- cor.test(data[[outcome]], data$y_ed, method = "pearson")
- bf <- 1 / extractBF(correlationBF(data[[outcome]], data$y_ed))$bf
- results <- dplyr::bind_rows(results, add_result("education", outcome, cor_res, bf))
- }
- ### 5. Gender (m vs f) ----
- for (outcome in c("acc_ADFES", "acc_JeFEE")) {
- x <- data[[outcome]][data$gender == "m"]
- y <- data[[outcome]][data$gender == "f"]
- t_res <- t.test(x, y)
- d <- cohens_d(x, y)$Cohens_d
- bf <- 1 / extractBF(ttestBF(x = x, y = y))$bf
- results <- dplyr::bind_rows(results, add_result("gender", outcome, t_res, bf, d))
- }
- ### 6. FDR correction ----
- results <- results %>%
- dplyr::mutate(q_value = p.adjust(p_value, method = "fdr"))
- # Correlation and Figure 2 ----
- ### 1. Data preparation ----
- moebius_data <- read_csv("data/Study2_Complete_Dataset.csv")%>%
- filter(group == "moebius") %>%
- mutate(acc_ADFES = acc_ADFES*100,
- acc_JeFEE = acc_JeFEE*100)
- ### 2. ADFES correlation ----
- cor_test_adfes <- cor.test(moebius_data$Sunnybrook, moebius_data$acc_ADFES, method = "pearson")
- print(cor_test_adfes)
- bf_test_adfes <- correlationBF(x = moebius_data$Sunnybrook, y = moebius_data$acc_ADFES)
- posterior_samples <- posterior(bf_test_adfes, iterations = 10000)
- p_r_greater_0 <- mean(posterior_samples[, "rho"] > 0)
- sprintf("P(r > 0) = %.3f", p_r_greater_0)
- ### 3. JeFEE correlation ----
- cor_test_jefee <- cor.test(moebius_data$Sunnybrook, moebius_data$acc_JeFEE, method = "pearson")
- print(cor_test_jefee)
- bf_test_jefee <- correlationBF(x = moebius_data$Sunnybrook, y = moebius_data$acc_JeFEE)
- posterior_samples <- posterior(bf_test_jefee, iterations = 10000)
- p_r_greater_0 <- mean(posterior_samples[, "rho"] > 0)
- sprintf("P(r > 0) = %.3f", p_r_greater_0)
- ### 4. Extract raw p-values ----
- p_values <- c(cor_test_adfes$p.value, cor_test_jefee$p.value)
- # Apply BH correction to get q-values
- q_values <- p.adjust(p_values, method = "BH")
- ### 5. Bootstrap ----
- set.seed(123) # for reproducibility
- # Bootstrap ADFES
- boot_adfes <- boot(data = moebius_data, statistic = cor_fun, R = 10000, x = "Sunnybrook", y = "acc_ADFES")
- ci_adfes <- boot.ci(boot_adfes, type = "perc")$percent[4:5]
- # Bootstrap JeFEE
- boot_jefee <- boot(data = moebius_data, statistic = cor_fun, R = 10000, x = "Sunnybrook", y = "acc_JeFEE")
- ci_jefee <- boot.ci(boot_jefee, type = "perc")$percent[4:5]
- # Prepare data frame
- df_boot <- data.frame(
- r = c(boot_adfes$t, boot_jefee$t),
- test = rep(c("ADFES", "JeFEE"), each = length(boot_adfes$t))
- )
- # Define colors
- color_map <- c("ADFES" = "#3271AD", "JeFEE" = "#C56637") # blue and violet
- # update data from R script
- r_JeFEE <- round(cor_test_jefee$estimate,2)
- r_ADFES <- round(cor_test_adfes$estimate,2)
- CI_JeFEE <- c(0.28, 0.81)
- CI_ADFES <- c(0.39, 0.8)
- ### 6. Plots Figure 2 ----
- p1 <- ggplot(moebius_data, aes(x = Sunnybrook, y = acc_ADFES)) +
- geom_point(color = "#3271AD") +
- geom_smooth(method = "lm", color = "#3271AD", fill = "#3271AD", alpha = 0.3) +
- labs(title = " ", x = "SFGS Score", y = "ADFES Accuracy (x)") +
- theme_minimal() +
- coord_cartesian(ylim = c(0, 100))+
- theme_minimal(base_size = 14) +
- theme(legend.position = "none",
- text = element_text(size = 10,
- family = "Helvetica"), # use Helvetica, size 16 for all text
- panel.background = element_blank(), # clean white background
- axis.line = element_line(colour = "black"), # black axis lines
- strip.text.x = element_text(size = 6.6), # facet labels (x): size 20
- strip.text.y = element_text(size = 6.6),
- panel.grid.major = element_blank(), # Rimuove le griglie principali
- panel.grid.minor = element_blank())
- p2 <- ggplot(moebius_data, aes(x = Sunnybrook, y = acc_JeFEE)) +
- geom_point(color = "#C56637") +
- geom_smooth(method = "lm", color = "#C56637", fill = "#C56637", alpha = 0.3) +
- labs(title = "", x = "SFGS Score", y = "JeFEE Accuracy (%)") +
- theme_minimal() +
- coord_cartesian(ylim = c(0, 100))+
- theme_minimal(base_size = 14) +
- theme(legend.position = "none",
- text = element_text(size = 10,
- family = "Helvetica"), # use Helvetica, size 16 for all text
- panel.background = element_blank(), # clean white background
- axis.line = element_line(colour = "black"), # black axis lines
- strip.text.x = element_text(size = 6.6), # facet labels (x): size 20
- strip.text.y = element_text(size = 6.6),
- panel.grid.major = element_blank(), # Rimuove le griglie principali
- panel.grid.minor = element_blank())
- p3 <- ggplot(df_boot, aes(x = r, fill = test)) +
- geom_density(alpha = 0.4) +
- geom_vline(xintercept = r_ADFES, color = "#3271AD", linetype = "solid", linewidth = 1) +
- geom_vline(xintercept = CI_ADFES, color = "#3271AD", linetype = "dashed", linewidth = 0.8) +
- geom_vline(xintercept = r_JeFEE, color = "#C56637", linetype = "solid", linewidth = 1) +
- geom_vline(xintercept = CI_JeFEE, color = "#C56637", linetype = "dashed", linewidth = 0.8) +
- scale_fill_manual(values = color_map) +
- labs(
- title = "",
- x = "Bootstrapped Correlation Coefficient (r)",
- y = "Density",
- fill = "Test"
- ) +
- theme_minimal() +
- theme(plot.title = element_text(hjust = 0.5))+
- theme_minimal(base_size = 14) +
- theme(legend.position = "none",
- text = element_text(size = 10,
- family = "Helvetica"), # use Helvetica, size 16 for all text
- panel.background = element_blank(), # clean white background
- axis.line = element_line(colour = "black"), # black axis lines
- strip.text.x = element_text(size = 6.6), # facet labels (x): size 20
- strip.text.y = element_text(size = 6.6),
- panel.grid.major = element_blank(), # Rimuove le griglie principali
- panel.grid.minor = element_blank()) +
- annotate("text", x = 0, y = 3,
- label = paste0("ADFES statistics:\nMean r = ",r_ADFES,"\n 95% CI: [",CI_ADFES[1],", 0.80]\nP(r > 0) = 0.987"), color = "#3271AD", size = 3) +
- annotate("text", x = 0, y = 1.2,
- label = paste0("JeFEE statistics:\nMean r = ",r_JeFEE,"\n 95% CI: [",CI_JeFEE[1],", 0.81]\nP(r > 0) = 0.972"), color = "#C56637", size = 3)
- # Plots
- row1 <- cowplot::plot_grid(p1, p2, labels = c("A", "B"))
- # Then: combine row1 with p3
- p4 <- cowplot::plot_grid(row1, p3, nrow = 2, labels = c("", "C"))
- # Export
- ggsave("figures/Fig_2_finale.png", # export for draft
- plot = p4,
- device = "png",
- dpi = 300,
- width = 18,
- height = 14,
- units = "cm")
- ggsave("figures/Fig_2.tiff", # export for journal
- plot = p4,
- device = "tiff",
- dpi = 1200,
- width = 18,
- height = 14,
- units = "cm")
- ### 7. R2_cv LOO ----
- # 1 Load data and keep Moebius participants
- dat <- moebius_data %>%
- dplyr::select(Sunnybrook,
- acc_ADFES,
- acc_JeFEE) %>%
- drop_na()
- set.seed(1)
- # 2 Pearson r with BCa 95 % CI (10 000 resamples)
- corr_tbl <- bind_rows(
- get_bca("acc_JeFEE"),
- get_bca("acc_ADFES")
- ) %>% mutate(q = p.adjust(p, method = "BH"))
- print(corr_tbl)
- # 3 Leave-one-out cross-validated R² with percentile CI
- loo_tbl <- bind_rows(
- calc_loo("acc_JeFEE"),
- calc_loo("acc_ADFES")
- )
- print(loo_tbl)
- # 4 Model projections
- grid <- tibble(Sunnybrook = c(20, 80))
- pred_tbl <- bind_rows(
- get_pred("acc_JeFEE"),
- get_pred("acc_ADFES")
- )
- print(pred_tbl)
- # OFMT correlation ----
- ### 1. Data preparation ----
- df_tot <- read_csv("data/Study2_Complete_Dataset.csv") %>%
- dplyr::select(subject, group, Sunnybrook,ofmt ) %>%
- mutate(match = parse_number(subject))
- df <- df_tot %>%
- filter(group == "moebius")
- ### 2. Correlation ----
- cor_test_Sunny <- cor.test(df$Sunnybrook, df$ofmt, method = "pearson")
- print(cor_test_Sunny)
- bf_test_Sunny <- correlationBF(x = df$Sunnybrook, y = df$ofmt, paired = TRUE)
- ### 3. Group difference ----
- anova <- aov_ez(id = "subject", dv = "ofmt", between = "group",data = df_tot)
- summary(anova)
- ### 4. Plot Figure 3 ----
- # Panel A: Scatterplot (no correlation)
- pA <- ggplot(df, aes(x = Sunnybrook, y = ofmt)) +
- geom_point(fill = "#F0E442", color = "gray" , shape = 21 ) +
- geom_smooth(method = "lm", se = TRUE, color = "#D1C436", fill = "#FAF6C2", alpha = 0.3) +
- labs(
- x = "Sunnybrook Score (Facial Motor Function)",
- y = "OFMT Accuracy (%)"
- ) +
- theme_minimal() +
- theme(plot.title = element_text(hjust = 0.5))+
- theme_minimal(base_size = 14) +
- theme(legend.position = "none",
- text = element_text(size = 10,
- family = "Helvetica"), # use Helvetica, size 16 for all text
- panel.background = element_blank(), # clean white background
- axis.line = element_line(colour = "black"), # black axis lines
- strip.text.x = element_text(size = 6.6), # facet labels (x): size 20
- strip.text.y = element_text(size = 6.6),
- panel.grid.major = element_blank(), # Rimuove le griglie principali
- panel.grid.minor = element_blank())
- # Colori per le condizioni
- colors <- c("moebius" = "#F0E442", "control" = "purple")
- descritive <- df_tot %>%
- filter(group %in% c("moebius", "control")) %>%
- group_by( group) %>%
- summarise(mean_acc = mean(ofmt, na.rm = TRUE),
- sd_acc = sd(ofmt, na.rm = TRUE),
- se = sd_acc / sqrt(n()),
- .groups = "drop") %>%
- mutate(x_pos = case_when(
- group == "moebius" ~ 2 - 0.1,
- group == "control" ~ 1 + 0.1,
- ))
- # Panel B: Group boxplot
- pB <- ggplot(df_tot,
- aes(x = group, y = ofmt, fill = group)) +
- geom_rain(alpha = 0.5, rain.side = 'f1x1', id.long.var = "match") +
- geom_point(data = descritive,
- aes(x = x_pos, y = mean_acc),
- color = "black",
- size = 2.5, shape = 18, inherit.aes = FALSE) +
- geom_errorbar(data = descritive,
- aes(x = x_pos, ymin = mean_acc - se, ymax = mean_acc + se),
- width = 0, color = "black", linewidth = 0.5, inherit.aes = FALSE) +
- scale_fill_manual(values = colors) +
- labs(
- x = "",
- y = "OFMT Accuracy (%)"
- ) + theme_minimal(base_size = 14) +
- theme(legend.position = "none",
- text = element_text(size = 10,
- family = "Helvetica"), # use Helvetica, size 16 for all text
- panel.background = element_blank(), # clean white background
- axis.line = element_line(colour = "black"), # black axis lines
- strip.text.x = element_text(size = 6.6), # facet labels (x): size 20
- strip.text.y = element_text(size = 6.6),
- panel.grid.major = element_blank(), # Rimuove le griglie principali
- panel.grid.minor = element_blank())+
- geom_text(data = descritive, aes(x = group, y = 0.62,
- label = paste0("M = ", round(mean_acc, 3),
- "\nSD = ", round(sd_acc, 3),"\n")),
- color = "black", size = 2.5)
- # Combine both panels
- figure3 <- cowplot::plot_grid(pA, pB, labels = "AUTO", nrow = 1)
- ggsave("figures/Fig_3_finale.png", # export for draft
- plot = figure3,
- device = "png",
- dpi = 300,
- width = 18,
- height = 9,
- units = "cm")
- ggsave("figures/Fig_3.tiff", # export for draft
- plot = figure3,
- device = "tiff",
- dpi = 1200,
- width = 18,
- height = 9,
- units = "cm")
- ## END ----
Study2_Confirmatory_Analyses_and_Plot.R, no license · at the source
Overview
- Department of Developmental Psychology and Socialisation, University of Padova, Padova 35131, Italy
- Padova Neuroscience Center, Department of Developmental Psychology and Socialisation, University of Padova, Padova 35129, Italy
- Department of Medicine and Surgery, University of Parma, Parma 43126, Italy
- Independent Physiotherapist, Padova 35143, Italy
- Social Neuroscience and Comparative Development, Social Neuroscience and Comparative Development, Institut des Sciences Cognitives Marc Jeannerod, CNRS/Université Claude Bernard Lyon 1, Bron Cedex 69675, France
Abstract
Although recognizing emotions from facial expressions appears effortless, the field is divided between vision-based accounts, which posit matching to learned visual templates, and embodied accounts, which posit recruitment of facial motor circuits. We propose an ambiguity-gated, developmentally calibrated architecture in which the recognition system draws on sensorimotor information primarily when visual evidence is insufficient, with early motor experience proposed to shape the threshold and gain of this contribution. We tested this model across three studies (N = 185) integrating dynamic prototypical and nonprototypical expressions, congenital (Moebius syndrome) and acquired facial palsy, and standardized severity grading (Sunnybrook Facial Grading System; SFGS). Neurotypical adults (N = 117) confirmed a robust prototypicality-dependen
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
OSF 3yux4
Availability: 1 check, the latest on 26 September 2026: the link answers (HTTP 200)
- 26 September 2026: the link answers (HTTP 200)
4 files
- Study 1/
Script/ , R, 269 linesStudy1_Confirmatory_Anal yses_and_Plot.R - Study 2/
Script/ , R, 915 lines, 2 matchesStudy2_Confirmatory_Anal yses_and_Plot.R - Study 2/
Script/ , R, 49 linesStudy2_ConnettivityPlot. R - Study 2/
Script/ , R, 48 linesStudy2_connectivity_stat s.R
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 4 scripts, each with its path and the digest of its content;
- 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data, Materials, and Software Availability
Behavioral datasets, EEG data, R analysis scripts, and experimental protocols have been deposited in the Open Science Framework (OSF) (43) [Facial palsy reveals the sensorimotor contribution to facial-emotion recognition].
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 5 keywords, 10 MeSH terms, 1 funder, 32 references.
Cite
This paper
Sessa, P., Schiano Lomoriello, A., Quettier, T., Maffei, A., Costa, S., Nichele, M., & Ferrari, P. F. (2026). Facial palsy reveals the sensorimotor contribution to facial-emotion recognition. Proceedings of the National Academy of Sciences of the United States of America, 123(37), e2608511123. https://
BibTeX
@article{sessa2026facial
author = {Sessa, Paola and Schiano Lomoriello, Arianna and Quettier, Thomas and Maffei, Antonio and Costa, Sara and Nichele, Marta and Ferrari, Pier Francesco},
title = {{Facial palsy reveals the sensorimotor contribution to facial-emotion recognition}},
journal = {Proceedings of the National Academy of Sciences of the United States of America},
year = {2026},
month = sep,
volume = {123},
number = {37},
pages = {e2608511123},
publisher = {National Academy of Sciences},
issn = {0027-8424},
doi = {10.1073/
url = {https://
pmid = {42726659},
pmcid = {PMC13578938}
}
RIS
TY - JOUR
AU - Sessa, Paola
AU - Schiano Lomoriello, Arianna
AU - Quettier, Thomas
AU - Maffei, Antonio
AU - Costa, Sara
AU - Nichele, Marta
AU - Ferrari, Pier Francesco
TI - Facial palsy reveals the sensorimotor contribution to facial-emotion recognition
T2 - Proceedings of the National Academy of Sciences of the United States of America
J2 - Proc Natl Acad Sci U S A
PY - 2026
DA - 2026/
VL - 123
IS - 37
SP - e2608511123
SN - 0027-8424
PB - National Academy of Sciences
DO - 10.1073/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1073/
"type": "article-journal",
"title": "Facial palsy reveals the sensorimotor contribution to facial-emotion recognition",
"container-title": "Proceedings of the National Academy of Sciences of the United States of America",
"author": [
{
"family": "Sessa",
"given": "Paola"
},
{
"family": "Schiano Lomoriello",
"given": "Arianna"
},
{
"family": "Quettier",
"given": "Thomas"
},
{
"family": "Maffei",
"given": "Antonio"
},
{
"family": "Costa",
"given": "Sara"
},
{
"family": "Nichele",
"given": "Marta"
},
{
"family": "Ferrari",
"given": "Pier Francesco"
}
],
"container-title-short":
"volume": "123",
"issue": "37",
"page": "e2608511123",
"DOI": "10.1073/
"PMID": "42726659",
"PMCID": "PMC13578938",
"ISSN": "0027-8424",
"publisher": "National Academy of Sciences",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
9,
11
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1162/imag.a.1258 [code]
- Non-specific increase in alpha power during a neurofeedback session targeting its downregulation.Journal: Imaging neuroscience (Cambridge, Mass.)In common: BayesFactor, afex, brms, 5 other tools, EEG
- [2] doi:10.1038/s41467-026-73865-9 [code]
- Histamine shapes the neurocomputational dynamics of human learning.Journal: Nature communicationsIn common: BayesFactor, brms, easystats, 5 other tools
- [3] doi:10.1093/nc/niag029 [code]
- A data-driven approach to identifying and evaluating connectivity-based neural correlates of conscious visual perception.Journal: Neuroscience of consciousnessIn common: BayesFactor, afex, easystats, 5 other tools
- [4] doi:10.1162/opmi.a.358 [code]
- Tracking Visual Statistical Learning with Steady-State Visual Evoked Potentials: Effects of Exemplar and Category Information.Journal: Open mind : discoveries in cognitive scienceIn common: BayesFactor, afex, brms, 4 other tools, EEG
- [5] doi:10.1038/s41467-026-74565-0 [code]
- The functional neurobiology of dispositions towards negative emotions.Journal: Nature communicationsIn common: BayesFactor, afex, brms, 4 other tools
- [6] doi:10.1371/journal.pone.0355165 [code]
- Pupillary dynamics during hands-off L2 driving and transitions of control under high cognitive load.Journal: PloS oneIn common: BayesFactor, brms, easystats, 4 other tools
- [7] doi:10.1016/j.isci.2026.116747 [code]
- Age and loneliness relate to reduced trust learning and alterations in amygdala function.Journal: iScienceIn common: brms, easystats, broom, 4 other tools
- [8] doi:10.1038/s41597-026-07350-9 [code]
- An open multi-center MEG-EEG dataset for studying conscious visual perception.Journal: Scientific dataIn common: BayesFactor, afex, easystats, 3 other tools, EEG
- [9] doi:10.1038/s42003-026-10229-5 [code]
- The neurocomputational mechanisms underlying the impact of social comparison on effort investment.Journal: Communications biologyIn common: afex, brms, easystats, 3 other tools, EEG
- [10] doi:10.1523/eneuro.0076-26.2026 [code]
- Exogenously Driven Neural Reactivation of Spatially Matching Visual Working-Memory Contents.Journal: eNeuroIn common: BayesFactor, brms, emmeans, 3 other tools, EEG
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 4 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:f70ff2ee0607a4ee…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
