The neurocomputational mechanisms underlying the impact of social comparison on effort investment.
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 Markdown · 1,925 lines · 71 KB · no license
- ---
- title: "Exp1 and Exp2"
- author: "JiaRui"
- date: "2026-2-11"
- output: html_document
- ---
- ```{r setup, include=FALSE}
- library(Rmisc)
- library(tidyverse)
- library(bruceR)
- library(ggpubr)
- library(afex)
- library(emmeans)
- library(sjPlot)
- library(readxl)
- library(dplyr)
- library(tidyr)
- library(xlsx)
- library(ggplot2)
- library(ggtext)
- library(psych)
- library(effects)
- library(brms)
- library(parameters)
- library(simr)
- gg.rr <-theme(axis.line = element_line(colour = "black"),text = element_text(family='Arial',size=11),
- axis.title.y = element_markdown(margin = margin(t = 20, r = 5, b = 20, l = 0)),
- axis.title.x = element_markdown(),
- panel.grid.major = element_blank(),
- panel.grid.minor = element_blank(),
- panel.border = element_blank(),
- panel.background = element_blank(),
- strip.background = element_blank(),
- plot.title = element_markdown(hjust = 0.5,size=12))
- gg.side <-theme(axis.line = element_line(colour = "black"),text =element_text(family='serif',size=16),
- axis.title.y = element_markdown(margin = margin(t = 0, r = 8, b = 0, l = 0)), ##up right down left
- axis.title.x = element_markdown(margin = margin(t = 8, r = 0, b = 0, l = 0)),axis.text = element_text(colour = "black"),
- panel.grid.major = element_blank(),
- panel.grid.minor = element_blank(),
- panel.border = element_blank(),
- panel.background = element_blank(),
- strip.background = element_blank(),
- plot.title = element_markdown(hjust = 0.5,size=12))
- ```
- # Exp1 and Exp2 behavior analysis
- ```{r import exp1 and exp2 efficacy data}
- ###Set working directory###
- set.wd("")
- ###exp1###
- exp1_interval = read_csv("/beha/exp1_interval.csv")
- exp1_interval_learn = read_csv("/beha/exp1_interval_learnHB.csv")
- exp1_check = read_excel("/beha/exp1_check.xlsx")
- exp1_interval_learn = exp1_interval_learn %>%
- group_by(SubID) %>%
- mutate(Cong_prev = lag(meanCongruency, 1)) %>%
- dplyr::mutate(un_PE_prev = lag(unsigned_PE_efficacy, 1)) %>%
- dplyr::mutate(PE_prev = lag(signed_PE_efficacy, 1)) %>%
- dplyr::mutate(zCRPS = scale(CRPS)) %>%
- dplyr::mutate(zmeanRT = scale(meanRT)) %>%
- dplyr::mutate(zmbased_efficacy_prev = scale(mbased_efficacy_prev)) %>%
- dplyr::mutate(zun_PE_prev = scale(un_PE_prev)) %>%
- dplyr::mutate(zPE_prev = scale(PE_prev))
- exp1_interval_learn$duration = as.numeric(exp1_interval_learn$duration)
- exp1_interval$gender = as.factor(exp1_interval$gender)
- exp1_interval_learn$gender = as.factor(exp1_interval_learn$gender)
- exp1_interval_learn$FeedCode = as.factor(exp1_interval_learn$FeedCode)
- exp1_interval_learn$FeedPrev = as.factor(exp1_interval_learn$FeedPrev)
- exp1_interval_learn$mbased_efficacy = as.numeric(exp1_interval_learn$mbased_efficacy)
- exp1_interval_learn$mbased_efficacy_prev = as.numeric(exp1_interval_learn$mbased_efficacy_prev)
- exp1_interval_learn$unsigned_PE_efficacy = as.numeric(exp1_interval_learn$unsigned_PE_efficacy)
- exp1_interval_learn$un_PE_prev = as.numeric(exp1_interval_learn$un_PE_prev)
- exp1_interval_learn$signed_PE_efficacy = as.numeric(exp1_interval_learn$signed_PE_efficacy)
- exp1_interval_learn$PE_prev = as.numeric(exp1_interval_learn$PE_prev)
- exp1_interval$FeedPrev = as.factor(exp1_interval$FeedPrev)
- ###exp2###
- exp2_interval = read_csv("/beha/exp2_interval.csv")
- exp2_interval_learn = read_csv("/beha/exp2_interval_learnHB.csv")
- exp2_check = read_excel("/beha/exp2_check.xlsx")
- exp2_interval_learn = exp2_interval_learn %>%
- group_by(SubID) %>%
- mutate(Cong_prev = lag(meanCongruency, 1)) %>%
- mutate(un_PE_prev = lag(unsigned_PE_efficacy, 1)) %>%
- mutate(PE_prev = lag(signed_PE_efficacy, 1))
- exp2_interval_learn$duration = as.numeric(exp2_interval_learn$duration)
- exp2_interval$gender = as.factor(exp2_interval$gender)
- exp2_interval_learn$gender = as.factor(exp2_interval_learn$gender)
- exp2_interval_learn$FeedCode = as.factor(exp2_interval_learn$FeedCode)
- exp2_interval_learn$FeedPrev = as.factor(exp2_interval_learn$FeedPrev)
- exp2_interval_learn$mbased_efficacy = as.numeric(exp2_interval_learn$mbased_efficacy)
- exp2_interval_learn$mbased_efficacy_prev = as.numeric(exp2_interval_learn$mbased_efficacy_prev)
- exp1_interval_learn$unsigned_PE_efficacy = as.numeric(exp1_interval_learn$unsigned_PE_efficacy)
- exp2_interval_learn$un_PE_prev = as.numeric(exp2_interval_learn$un_PE_prev)
- exp1_interval_learn$signed_PE_efficacy = as.numeric(exp1_interval_learn$signed_PE_efficacy)
- exp2_interval_learn$PE_prev = as.numeric(exp2_interval_learn$PE_prev)
- exp2_interval$FeedPrev = as.factor(exp2_interval$FeedPrev)
- ```
- ### Exp1 and Exp2 post rating
- ```{r exp1 and exp2 post rating des}
- exp1_check_emotion_sub = exp1_check %>%
- dplyr::summarise(emotion_downward = mean(emotion1),
- emotion_upward = mean(emotion2),
- emotion_lateral = mean(emotion3))
- exp1_check_emotion_sub
- exp2_check_emotion_sub = exp2_check %>%
- dplyr::summarise(emotion_downward = mean(emotion1),
- emotion_upward = mean(emotion2),
- emotion_lateral = mean(emotion3))
- exp2_check_emotion_sub
- ```
- ```{r exp1 check post emotion}
- exp1_check_emotion = exp1_check %>%
- pivot_longer(cols = starts_with("emotion"),
- names_to = "cond",
- values_to = "emotion") %>%
- mutate(cond = factor(cond,
- levels = c("emotion1","emotion2","emotion3"),
- labels = c("emotion_downward","emotion_upward","emotion_lateral")))
- exp1_check_emotion_avo = aov_ez(id = "SubID", dv = "emotion",
- within = "cond", data = exp1_check_emotion)
- exp1_check_emotion_avo
- exp1_check_emotion_post = pairs(emmeans(exp1_check_emotion_avo, ~ cond),
- adjust = "bonferroni")
- exp1_check_emotion_post
- ```
- ```{r exp2 check post emotion}
- exp2_check_emotion = exp2_check %>%
- pivot_longer(cols = starts_with("emotion"),
- names_to = "cond",
- values_to = "emotion") %>%
- mutate(cond = factor(cond,
- levels = c("emotion1","emotion2","emotion3"),
- labels = c("emotion_downward","emotion_upward","emotion_lateral")))
- exp2_check_emotion_avo = aov_ez(id = "SubID", dv = "emotion",
- within = "cond", data = exp2_check_emotion)
- exp2_check_emotion_avo
- exp2_check_emotion_post = pairs(emmeans(exp2_check_emotion_avo, ~ cond),
- adjust = "bonferroni")
- exp2_check_emotion_post
- ```
- ### Exp1 descriptive statistics
- ```{r exp1 rate_score and model_based efficacy descriptive}
- exp1_interval_efficacy = exp1_interval_learn %>%
- group_by(SubID) %>%
- mutate(FeedCode = factor(FeedCode, levels = c("1", "2"),
- labels=c("Downward","Upward")))
- contrasts(exp1_interval_efficacy$gender) = contr.sum
- contrasts(exp1_interval_efficacy$FeedCode) = contr.sum
- ###exp1 rate_score###
- exp1_rate_feedback = exp1_interval_learn %>%
- dplyr::group_by(SubID) %>%
- fill(rate_score, .direction = "up")%>%
- drop_na(rate_score)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(rate_score_mean = round(mean(rate_score),3),
- rate_score_sd = round(sd(rate_score),3),
- rate_score_se=rate_score_sd/sqrt(32))
- exp1_rate_feedback
- ###exp1 model_based efficacy###
- exp1_efficacy_feedback = exp1_interval_learn %>%
- dplyr::group_by(SubID) %>%
- fill(mbased_efficacy, .direction = "up")%>%
- drop_na(mbased_efficacy)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(mbased_efficacy_mean = round(mean(mbased_efficacy),3),
- mbased_efficacy_sd = round(sd(mbased_efficacy),3),
- mbased_efficacy_se=mbased_efficacy_sd/sqrt(32))
- exp1_efficacy_feedback
- ```
- ```{r exp1 behavior descriptive}
- ###exp1 CRPS ###
- exp1_interval_CRPS = exp1_interval %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
- CRPS < mean(CRPS) + 3 * sd(CRPS))
- exp1_CRPS_feedback = exp1_interval_CRPS %>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(CRPS_mean = round(mean(CRPS),3),
- CRPS_sd = round(sd(CRPS),3),
- CRPS_se=CRPS_sd/sqrt(32))
- exp1_CRPS_feedback
- ###exp1 RT ###
- exp1_interval_RT = exp1_interval %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
- meanRT < mean(meanRT) + 3 * sd(meanRT))
- exp1_RT_feedback = exp1_interval_RT %>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(RT_mean = round(mean(meanRT)),
- RT_sd = round(sd(meanRT)),
- RT_se=RT_sd/sqrt(32))
- exp1_RT_feedback
- ###exp1 ACC ###
- exp1_ACC_feedback = exp1_interval %>%
- drop_na(FeedPrev) %>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(ACC_mean = round(mean(ACC),3),
- ACC_sd = round(sd(ACC),3),
- ACC_se=ACC_sd/sqrt(32))
- exp1_ACC_feedback
- ###exp1 feedback count###
- exp1_feedback_sub = exp1_interval %>%
- group_by(SubID,FeedCode) %>%
- dplyr::summarise(counts = n()) %>%
- ungroup()
- exp1_feedback_count = exp1_feedback_sub %>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(feed_mean = round(mean(counts),3),
- feed_sd = round(sd(counts),3),
- feed_se=feed_sd/sqrt(32))
- exp1_feedback_count
- ```
- ### Exp1 efficacy analysis
- ```{r exp1 rate_score and feedback}
- exp1_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
- (1+FeedCode|SubID),
- exp1_interval_efficacy, REML=FALSE)
- exp1_rate.feedback_anova = anova(exp1_rate.feedback_lmm)
- exp1_rate.feedback_anova
- summary(exp1_rate.feedback_lmm)
- exp1_rate.feedback_std_ci = model_parameters(
- exp1_rate.feedback_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_rate.feedback_std_ci
- ```
- ```{r exp1 rate_score and feedback plot}
- exp1_sub_rate_feedback = exp1_interval_efficacy %>%
- dplyr::group_by(SubID) %>%
- fill(rate_score, .direction = "up")%>%
- drop_na(rate_score)%>%
- dplyr::group_by(SubID, FeedCode) %>%
- dplyr::summarise(rate_score_mean = round(mean(rate_score),3),
- rate_score_sd = round(sd(rate_score),3),
- rate_score_se=rate_score_sd/sqrt(32))
- exp1_rate.feedback_plot = ggbarplot(exp1_sub_rate_feedback, x = "FeedCode",
- y = "rate_score_mean",
- alpha = 0.6, ylab= "Rate",
- xlab = "Social Comparison",
- color = "black",fill = "FeedCode",
- add = c("mean_se", "jitter"),
- add.params = list(color = "FeedCode"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4))+
- scale_y_continuous(breaks = seq(0, 100, by = 20), expand = c(0, 0)) +
- coord_cartesian(ylim = c(0, 105))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp1_rate.feedback_plot = ggpar(exp1_rate.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp1_rate.feedback_plot
- ```
- ```{r exp1 rate_score and efficacy}
- exp1_efficacy.rate_lmm = lmerTest::lmer(rate_score ~ age+gender+ mbased_efficacy+
- (1+mbased_efficacy|SubID),
- exp1_interval_efficacy, REML=FALSE)
- exp1_efficacy.rate_anova = anova(exp1_efficacy.rate_lmm)
- exp1_efficacy.rate_anova
- summary(exp1_efficacy.rate_lmm)
- exp1_efficacy.rate_std_ci = model_parameters(
- exp1_efficacy.rate_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_efficacy.rate_std_ci
- ```
- ```{r exp1 rate_score and efficacy plot}
- eff_df0 <- Effect(c("mbased_efficacy"), exp1_efficacy.rate_lmm,
- xlevels = list(mbased_efficacy = seq(min(exp1_interval_efficacy$mbased_efficacy, na.rm = TRUE),
- max(exp1_interval_efficacy$mbased_efficacy, na.rm = TRUE),
- by = 0.1)))
- exp1.rate.efficacy = as.data.frame(eff_df0)
- head(exp1.rate.efficacy)
- len1 = length(exp1_interval_efficacy$mbased_efficacy)
- exp1.plot.rate.efficacy <- ggplot(exp1.rate.efficacy,
- aes(x = mbased_efficacy, y = fit)) +
- geom_line(color = "#F8766D", linewidth = 1, linetype = 1) +
- geom_ribbon(aes(ymin = fit - se, ymax = fit + se),
- fill = "#F8766D", alpha = 0.1) +
- gg.side +
- scale_x_continuous(limits = c(0, 1))
- exp1.plot.rate.efficacy
- ```
- ```{r exp1 rate_score and efficacy plot}
- exp1_sub_rate_efficacy = exp1_interval_learn %>%
- group_by(RoundID) %>%
- dplyr::summarise(
- efficacy_mean = round(mean(mbased_efficacy, na.rm = TRUE), 3),
- efficacy_sd = round(sd(mbased_efficacy, na.rm = TRUE), 3),
- efficacy_se = efficacy_sd / sqrt(32),
- Rate_mean = round(mean(EfficacyProbeRespLin, na.rm = TRUE),3),
- Rate_sd = round(sd(EfficacyProbeRespLin, na.rm = TRUE), 3),
- Rate_se = Rate_sd / sqrt(32))%>%
- drop_na(Rate_mean)
- exp1_rate.efficacy_plot = ggplot(data = exp1_sub_rate_efficacy, aes(x = RoundID)) +
- # Plot the "rate" line and confidence interval
- geom_line(aes(y = Rate_mean, color = "rate"), size = 1) +
- geom_ribbon(aes(ymin =Rate_mean - Rate_se,
- ymax = Rate_mean + Rate_se, fill = "rate"),
- alpha = 0.2) +
- # Plot the "CRPS" line and confidence interval
- geom_line(aes(y = efficacy_mean, color = "efficacy"), size = 1) +
- geom_ribbon(aes(ymin = efficacy_mean - efficacy_se,
- ymax = efficacy_mean + efficacy_se, fill = "efficacy"),
- alpha = 0.2) +
- # Labels and scales
- labs(x = "RoundID", y = "Value", color = "Legend", fill = "Legend") +
- scale_x_continuous(breaks = seq(0, max(exp1_sub_rate_efficacy$RoundID), by = 24)) +
- scale_color_manual(values = c("rate" = "#808080", "efficacy" = "#749857")) + # Specify colors
- scale_fill_manual(values = c("rate" = "#A9A9A9", "efficacy" = "#749857")) + # Specify fill colors
- ylim(0.25, 0.75) +
- theme_minimal() +
- theme(legend.position = "top")+gg.side # Place the legend at the top
- exp1_rate.efficacy_plot
- ```
- ```{r exp1 efficacy and social comparison}
- exp1_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~age+ gender+FeedCode+
- (1+FeedCode|SubID),exp1_interval_efficacy, REML=FALSE)
- exp1_efficacy.feedback_anova = anova(exp1_efficacy.feedback_lmm)
- exp1_efficacy.feedback_anova
- summary(exp1_efficacy.feedback_lmm)
- exp1_efficacy.feedback_std_ci = model_parameters(
- exp1_efficacy.feedback_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_efficacy.feedback_std_ci
- ```
- ```{r exp1 efficacy and social comparison plot}
- exp1_sub_efficacy_feedback = exp1_interval_efficacy %>%
- dplyr::filter(FeedCode == "Downward"|FeedCode == "Upward") %>%
- dplyr::group_by(SubID, FeedCode) %>%
- dplyr::summarise(mbased_efficacy_mean = round(mean(mbased_efficacy),3),
- mbased_efficacy_sd =round(sd(mbased_efficacy),3),
- mbased_efficacy_se=mbased_efficacy_sd/sqrt(32))
- exp1_efficacy.feedback_plot= ggbarplot(exp1_sub_efficacy_feedback, x = "FeedCode",
- y = "mbased_efficacy_mean",
- alpha = 0.6,ylab= "Efficacy",
- xlab = "Social Comparison",
- color = "black",fill = "FeedCode",
- add = c("mean_se", "jitter"),
- add.params = list(color = "FeedCode"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right',
- position = position_dodge(width =0.4))+
- scale_y_continuous(breaks = seq(0, 1, by = 0.2), expand = c(0, 0)) +
- coord_cartesian(ylim = c(0, 1.05))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp1_efficacy.feedback_plot = ggpar(exp1_efficacy.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp1_efficacy.feedback_plot
- ```
- ## Exp1 behavior analysis
- ### Exp1 CRPS analysis
- ```{r exp1 CRPS and social comparison}
- exp1_feedback.CRPS = exp1_interval_CRPS %>%
- dplyr::filter(FeedPrev == "1"|FeedPrev == "2") %>%
- dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
- levels = c("Downward","Upward")))
- contrasts(exp1_feedback.CRPS$FeedPrev) = contr.sum
- contrasts(exp1_feedback.CRPS$gender) = contr.sum
- exp1_feedback.CRPS_lmm = lmerTest::lmer(CRPS ~ age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID),exp1_feedback.CRPS, REML=FALSE)
- exp1_feedback.CRPS_anova = anova(exp1_feedback.CRPS_lmm)
- exp1_feedback.CRPS_anova
- summary(exp1_feedback.CRPS_lmm)
- exp1_feedback.CRPS_std_ci = model_parameters(
- exp1_feedback.CRPS_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_feedback.CRPS_std_ci
- ```
- ```{r exp1 CRPS and social comparison plot}
- exp1_sub_CRPS_feedback = exp1_feedback.CRPS %>%
- dplyr::group_by(SubID,FeedPrev) %>%
- dplyr::summarise(CRPS_mean = round(mean(CRPS),3),
- CRPS_sd = round(sd(CRPS),3),
- CRPS_se=CRPS_sd/sqrt(32))
- exp1_CRPS.feedback_plot = ggbarplot(exp1_sub_CRPS_feedback, x = "FeedPrev",
- y = "CRPS_mean", alpha = 0.6,
- ylab= "CRPS", xlab = "Social Comparison",
- color = "black",fill = "FeedPrev",
- add = c("mean_se", "jitter"),
- add.params = list(color = "FeedPrev"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4)) +
- scale_y_continuous(breaks = seq(0, 1.25, by = 0.2), expand = c(0, 0)) +
- coord_cartesian(ylim = c(0, 1.25))+
- annotate("text",x=1.35,y=0.97,label="",size = 6) +
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp1_CRPS.feedback_plot = ggpar(exp1_CRPS.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp1_CRPS.feedback_plot
- ```
- ```{r exp1 CRPS and efficacy}
- ###exp1 CRPS and efficacy LMM### un_PE_prev PE_prev
- exp1_efficacy.CRPS = exp1_interval_learn %>%
- group_by(SubID,FeedPrev) %>%
- filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
- CRPS < mean(CRPS) + 3 * sd(CRPS))
- contrasts(exp1_efficacy.CRPS$gender) = contr.sum
- exp1_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- exp1_efficacy.CRPS, REML=FALSE)
- exp1_efficacy.CRPS_anova = anova(exp1_efficacy.CRPS_lmm)
- summary(exp1_efficacy.CRPS_lmm)
- exp1_efficacy.CRPS_anova
- exp1_efficacy.CRPS_std_ci = model_parameters(
- exp1_efficacy.CRPS_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_efficacy.CRPS_std_ci
- ```
- ```{r CRPS and efficacy plot}
- eff_df1 = Effect(c("mbased_efficacy_prev"), exp1_efficacy.CRPS_lmm,
- xlevels = list(mbased_efficacy_prev = seq(min(exp1_efficacy.CRPS$mbased_efficacy_prev, na.rm = TRUE),
- max(exp1_efficacy.CRPS$mbased_efficacy_prev, na.rm = TRUE),
- by = 0.1)))
- exp1.CRPS.efficacy = as.data.frame(eff_df1)
- head(exp1.CRPS.efficacy)
- len1 = length(exp1.CRPS.efficacy$mbased_efficacy_prev)
- exp1.plot.CRPS.efficacy = ggplot(exp1.CRPS.efficacy,
- aes(x = mbased_efficacy_prev, y = fit)) +
- geom_line(color = "#F8766D", linewidth = 1, linetype = 1) +
- geom_ribbon(aes(ymin = fit - se, ymax = fit + se),
- fill = "#F8766D", alpha = 0.1) +
- gg.side +
- scale_x_continuous(limits = c(0, 1)) +
- scale_y_continuous(
- limits = c(0.92, 1.01),
- breaks = seq(0, 2, by = 0.02) # y轴每0.2一个刻度
- )
- exp1.plot.CRPS.efficacy
- ```
- ### Exp1 RT analysis
- ```{r exp1 RT and social comparison}
- ###exp1 RT LMM###
- exp1_feedback.RT = exp1_interval_RT %>%
- filter(FeedPrev == "1"|FeedPrev == "2") %>%
- dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
- levels = c("Downward","Upward")))
- contrasts(exp1_feedback.RT$FeedPrev)<-contr.sum
- contrasts(exp1_feedback.RT$gender)<-contr.sum
- exp1_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID),exp1_feedback.RT, REML=FALSE)
- exp1_feedback.RT_anova = anova(exp1_feedback.RT_lmm)
- exp1_feedback.RT_anova
- summary(exp1_feedback.RT_lmm)
- exp1_feedback.RT_std_ci = model_parameters(
- exp1_feedback.RT_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_feedback.RT_std_ci
- ```
- ```{r exp1 RT and social comparison plot}
- exp1_sub_RT_feedback = exp1_interval_RT %>%
- filter(FeedPrev == "1"|FeedPrev == "2") %>%
- mutate(FeedPrev = factor(recode(FeedPrev, "1" = "Downward", "2" = "Upward"),
- levels = c("Downward", "Upward"))) %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- dplyr::summarise(RT_mean = round(mean(meanRT),3),
- RT_sd = round(sd(meanRT),3),
- RT_se=RT_sd/sqrt(32))
- exp1_RT.feedback_plot= ggbarplot(exp1_sub_RT_feedback, x = "FeedPrev",
- y = "RT_mean", alpha = 0.6,
- ylab= "Reaction time (ms)",
- xlab = "Social Comparison",
- color = "black",fill = "FeedPrev",
- add = c("mean_se", "jitter"),
- add.params = list(color = "FeedPrev"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4)) +
- scale_y_continuous(breaks = c(0, seq(0, 1150, by = 200)), expand = c(0, 0))+
- coord_cartesian(ylim = c(0, 1150)) +
- annotate("text",x=1.35,y=710,label="",size = 6) +
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp1_RT.feedback_plot = ggpar(exp1_RT.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp1_RT.feedback_plot
- ```
- ```{r exp1 RT and efficacy}
- ###exp1 CRPS and efficacy LMM### un_PE_prev PE_prev
- exp1_efficacy.RT = exp1_interval_learn %>%
- dplyr::group_by(SubID,FeedPrev) %>%
- filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
- meanRT < mean(meanRT) + 3 * sd(meanRT))
- contrasts(exp1_efficacy.RT$gender) = contr.sum
- exp1_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- data = exp1_efficacy.RT, REML=FALSE)
- exp1_efficacy.RT_anova = anova(exp1_efficacy.RT_lmm)
- exp1_efficacy.RT_anova
- summary(exp1_efficacy.RT_lmm)
- exp1_efficacy.RT_std_ci = model_parameters(
- exp1_efficacy.RT_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp1_efficacy.RT_std_ci
- ```
- ```{r exp1 RT and efficacy plot}
- eff_df2 = Effect(c("mbased_efficacy_prev"),exp1_efficacy.RT_lmm,
- xlevels = list(mbased_efficacy_prev = seq(min(exp1_efficacy.RT$mbased_efficacy_prev, na.rm = TRUE),
- max(exp1_efficacy.RT$mbased_efficacy_prev, na.rm = TRUE),
- by = 0.1)))
- exp1.RT.efficacy = as.data.frame(eff_df2)
- head(exp1.RT.efficacy)
- len2<-length(exp1.RT.efficacy$mbased_efficacy_prev)
- exp1.plot.RT.efficacy <- ggplot()+
- geom_line(data=exp1.RT.efficacy,
- aes(x=mbased_efficacy_prev, y=fit),
- color="#F8766D",size=1,linetype=1)+
- geom_ribbon(data=exp1.RT.efficacy,
- aes(x=mbased_efficacy_prev, max = fit + se, min = fit- se),
- fill = "#F8766D",
- alpha=0.1,
- inherit.aes = FALSE)+ylim(c(600, 740))+ scale_x_continuous(limits = c(0, 1)) +gg.side
- exp1.plot.RT.efficacy
- ```
- ###Exp1 LMM power
- ```{r exp1 efficacy and behavior power}
- ###rate & feedack###
- exp1_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
- (1+FeedCode|SubID),
- exp1_interval_efficacy, REML=FALSE)
- exp1_rate.feedback_anova = anova(exp1_rate.feedback_lmm)
- exp1_rate.feedback_anova
- summary(exp1_rate.feedback_lmm)
- model_rate_fb_exp1=powerSim(exp1_rate.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- ###efficacy & rate###
- exp1_efficacy.rate_lmm = lmerTest::lmer(rate_score ~ age+gender+ mbased_efficacy+
- (1+mbased_efficacy|SubID),
- exp1_interval_efficacy, REML=FALSE)
- exp1_efficacy.rate_anova = anova(exp1_efficacy.rate_lmm)
- exp1_efficacy.rate_anova
- summary(exp1_efficacy.rate_lmm)
- model_rate_eff_exp1=powerSim(exp1_efficacy.rate_lmm,fixed("mbased_efficacy", "t"),nsim=1000)
- ###efficacy & feedback###
- exp1_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~ age+gender+FeedCode+
- (1+FeedCode|SubID),exp1_interval_efficacy, REML=FALSE)
- exp1_efficacy.feedback_anova = anova(exp1_efficacy.feedback_lmm)
- exp1_efficacy.feedback_anova
- summary(exp1_efficacy.feedback_lmm)
- model_eff_fb_exp1=powerSim(exp1_efficacy.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- # ###CRPS & feedback###
- exp1_feedback.CRPS_lmm = lmerTest::lmer(CRPS ~ age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID),exp1_feedback.CRPS, REML=FALSE)
- exp1_feedback.CRPS_anova = anova(exp1_feedback.CRPS_lmm)
- exp1_feedback.CRPS_anova
- summary(exp1_feedback.CRPS_lmm)
- model_CRPS_fb_exp1=powerSim(exp1_feedback.CRPS_lmm,fixed("FeedPrev", "f"),nsim=1000)
- ###CRPS & efficacy###
- exp1_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- exp1_efficacy.CRPS, REML=FALSE)
- exp1_efficacy.CRPS_anova = anova(exp1_efficacy.CRPS_lmm)
- exp1_efficacy.CRPS_anova
- summary(exp1_efficacy.CRPS_lmm)
- model_CRPS_eff_exp1=powerSim(exp1_efficacy.CRPS_lmm,
- fixed("mbased_efficacy_prev", "t"),nsim=1000)
- # ###RT & feedback###
- exp1_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID),
- exp1_feedback.RT, REML=FALSE)
- exp1_feedback.RT_anova = anova(exp1_feedback.RT_lmm)
- exp1_feedback.RT_anova
- summary(exp1_feedback.RT_lmm)
- model_RT_fb_exp1=powerSim(exp1_feedback.RT_lmm,fixed("FeedPrev", "f"),nsim=1000)
- ###RT & efficacy###
- exp1_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- data = exp1_efficacy.RT, REML=FALSE)
- exp1_efficacy.RT_anova = anova(exp1_efficacy.RT_lmm)
- exp1_efficacy.RT_anova
- summary(exp1_efficacy.RT_lmm)
- model_RT_eff_exp1=powerSim(exp1_efficacy.RT_lmm,
- fixed("mbased_efficacy_prev", "t"),nsim=1000)
- ```
- ## Exp2 model analysis
- ### Exp2 descriptive statistics
- ```{r exp2 rate_score and social comparison descriptive}
- exp2_interval_efficacy = exp2_interval_learn %>%
- group_by(SubID) %>%
- mutate(FeedCode = factor(FeedCode, levels = c("1", "2"),
- labels=c("Downward","Upward")))
- contrasts(exp2_interval_efficacy$FeedCode) = contr.sum
- contrasts(exp2_interval_efficacy$gender) = contr.sum
- ###exp2 rate_score###
- exp2_rate_feedback = exp2_interval_learn %>%
- dplyr::group_by(SubID) %>%
- fill(rate_score, .direction = "up")%>%
- drop_na(rate_score)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(rate_score_mean = round(mean(rate_score),3),
- rate_score_sd = round(sd(rate_score),3),
- rate_score_se=rate_score_sd/sqrt(34))
- exp2_rate_feedback
- ###exp2 model_based efficacy###
- exp2_efficacy_feedback = exp2_interval_learn %>%
- dplyr::group_by(SubID) %>%
- fill(mbased_efficacy, .direction = "up")%>%
- drop_na(mbased_efficacy)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(mbased_efficacy_mean = round(mean(mbased_efficacy),3),
- mbased_efficacy_sd = round(sd(mbased_efficacy),3),
- mbased_efficacy_se=mbased_efficacy_sd/sqrt(34))
- exp2_efficacy_feedback
- ```
- ```{r exp2 CRPS and RT descriptive}
- ###exp2 CRPS ###
- exp2_interval_CRPS = exp2_interval_learn %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
- CRPS < mean(CRPS) + 3 * sd(CRPS))
- exp2_sub_CRPS_feedback = exp2_interval %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
- CRPS < mean(CRPS) + 3 * sd(CRPS)) %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- dplyr::summarise(CRPS = round(mean(CRPS),3))
- exp2_CRPS_feedback = exp2_sub_CRPS_feedback %>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(CRPS_mean = round(mean(CRPS),3),
- CRPS_sd = round(sd(CRPS),3),
- CRPS_se=CRPS_sd/sqrt(34))
- exp2_CRPS_feedback
- ###exp2 RT ###
- exp2_interval_RT = exp2_interval_learn %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
- meanRT < mean(meanRT) + 3 * sd(meanRT))
- exp2_sub_RT_feedback=exp2_interval_learn %>%
- dplyr::group_by(SubID, FeedPrev) %>%
- filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
- meanRT < mean(meanRT) + 3 * sd(meanRT))%>%
- dplyr::group_by(SubID, FeedPrev) %>%
- dplyr::summarise(RT = round(mean(meanRT)))
- exp2_RT_feedback = exp2_sub_RT_feedback %>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(RT_mean = round(mean(RT)),
- RT_sd = round(sd(RT)),
- RT_se=RT_sd/sqrt(34))
- exp2_RT_feedback
- ###exp2 ACC ###
- exp2_ACC_feedback = exp2_interval %>%
- drop_na(FeedPrev) %>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(ACC_mean = round(mean(ACC),3),
- ACC_sd = round(sd(ACC),3),
- ACC_se=ACC_sd/sqrt(32))
- exp2_ACC_feedback
- ###exp2 feedback count###
- exp2_feedback_sub = exp2_interval %>%
- group_by(SubID,FeedCode) %>%
- dplyr::summarise(counts = n()) %>%
- ungroup()
- exp2_feedback_count = exp2_feedback_sub %>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(feed_mean = round(mean(counts),3),
- feed_sd = round(sd(counts),3),
- feed_se=feed_sd/sqrt(32))
- exp2_feedback_count
- ```
- ###Exp2 efficacy analysis
- ```{r exp2 rate_score and social comparison}
- exp2_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
- (1+FeedCode|SubID),
- data = exp2_interval_efficacy, REML=FALSE)
- exp2_rate.feedback_anova = anova(exp2_rate.feedback_lmm)
- exp2_rate.feedback_anova
- summary(exp2_rate.feedback_lmm)
- exp2_rate.feedback_std_ci = model_parameters(
- exp2_rate.feedback_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_rate.feedback_std_ci
- ```
- ```{r exp2 rate_score and efficacy}
- exp2_efficacy.rate_lmm= lmerTest::lmer(rate_score ~age+gender+mbased_efficacy+
- (1+mbased_efficacy|SubID),
- data = exp2_interval_learn, REML=FALSE)
- exp2_efficacy.rate_anova = anova(exp2_efficacy.rate_lmm)
- exp2_efficacy.rate_anova
- summary(exp2_efficacy.rate_lmm)
- exp2_efficacy.rate_std_ci = model_parameters(
- exp2_efficacy.rate_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_efficacy.rate_std_ci
- ```
- ```{r rate_score and efficacy plot}
- exp2_sub_rate_efficacy = exp2_interval_efficacy %>%
- group_by(RoundID) %>%
- dplyr::summarise(
- efficacy_mean = round(mean(mbased_efficacy, na.rm = TRUE), 3),
- efficacy_sd = round(sd(mbased_efficacy, na.rm = TRUE), 3),
- efficacy_se = efficacy_sd / sqrt(32),
- Rate_mean = round(mean(EfficacyProbeRespLin, na.rm = TRUE),3),
- Rate_sd = round(sd(EfficacyProbeRespLin, na.rm = TRUE), 3),
- Rate_se = Rate_sd / sqrt(34))%>%
- drop_na(Rate_mean)
- exp2_rate.efficacy_plot = ggplot(data = exp2_sub_rate_efficacy, aes(x = RoundID)) +
- # Plot the "rate" line and confidence interval
- geom_line(aes(y = Rate_mean, color = "rate"), size = 1) +
- geom_ribbon(aes(ymin =Rate_mean - Rate_se,
- ymax = Rate_mean + Rate_se, fill = "rate"),
- alpha = 0.2) +
- # Plot the "CRPS" line and confidence interval
- geom_line(aes(y = efficacy_mean, color = "efficacy"), size = 1) +
- geom_ribbon(aes(ymin = efficacy_mean - efficacy_se,
- ymax = efficacy_mean + efficacy_se, fill = "efficacy"),
- alpha = 0.2) +
- # Labels and scales
- labs(x = "RoundID", y = "Value", color = "Legend", fill = "Legend") +
- scale_x_continuous(breaks = seq(0, max(exp2_sub_rate_efficacy$RoundID), by = 24)) +
- scale_color_manual(values = c("rate" = "#808080", "efficacy" = "#749857")) + # Specify colors
- scale_fill_manual(values = c("rate" = "#A9A9A9", "efficacy" = "#749857")) + # Specify fill colors
- ylim(0.25, 0.75) +
- theme_minimal() +
- theme(legend.position = "top")+gg.side # Place the legend at the top
- exp2_rate.efficacy_plot
- ```
- ```{r exp2 efficacy and social comparison}
- exp2_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~ age+gender+FeedCode+
- (1+FeedCode|SubID),
- data = exp2_interval_efficacy, REML=FALSE)
- exp2_efficacy.feedback_anova = anova(exp2_efficacy.feedback_lmm)
- exp2_efficacy.feedback_anova
- summary(exp2_efficacy.feedback_lmm)
- exp2_efficacy.feedback_std_ci = model_parameters(
- exp2_efficacy.feedback_lmm,
- standardize = "refit",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_efficacy.feedback_std_ci
- ```
- ##Exp2 behavior analysis
- ### Exp2 CRPS analysis
- ```{r exp2 CRPS and social comparison}
- exp2_feedback.CRPS = exp2_interval_CRPS %>%
- group_by(SubID) %>%
- dplyr::filter(FeedPrev == "1"|FeedPrev == "2") %>%
- dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
- levels = c("Downward","Upward")))
- contrasts(exp2_feedback.CRPS$FeedPrev) = contr.sum
- contrasts(exp2_feedback.CRPS$gender) = contr.sum
- exp2_feedback.CRPS_lmm = lmerTest::lmer(CRPS~age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID), exp2_feedback.CRPS, REML=FALSE)
- exp2_feedback.CRPS_anova = anova(exp2_feedback.CRPS_lmm)
- exp2_feedback.CRPS_anova
- summary(exp2_feedback.CRPS_lmm)
- exp2_feedback.CRPS_std_ci = model_parameters(
- exp2_feedback.CRPS_lmm,
- standardize = "refit",
- ci_method = "profile",
- ci = 0.95,
- digits = 3)
- exp2_feedback.CRPS_std_ci
- ```
- ```{r exp2 CRPS and efficacy}
- exp2_efficacy.CRPS = exp2_interval_learn %>%
- group_by(SubID) %>%
- dplyr::group_by(SubID,FeedPrev) %>%
- filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
- CRPS < mean(CRPS) + 3 * sd(CRPS))
- contrasts(exp2_efficacy.CRPS$gender)<-contr.sum
- exp2_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- data=exp2_efficacy.CRPS, REML=FALSE)
- summary(exp2_efficacy.CRPS_lmm)
- exp2_efficacy.CRPS_anova = anova(exp2_efficacy.CRPS_lmm)
- exp2_efficacy.CRPS_anova
- exp2_efficacy.CRPS_std_ci = model_parameters(
- exp2_efficacy.CRPS_lmm,
- standardize = "refit",
- ci_method = "profile",
- ci = 0.95,
- digits = 3)
- exp2_efficacy.CRPS_std_ci
- ```
- ### Exp2 RT analysis
- ```{r exp2 RT and social comparison}
- exp2_feedback.RT = exp2_interval_RT %>%
- group_by(SubID) %>%
- filter(FeedPrev == "1"|FeedPrev == "2") %>%
- dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
- levels = c("Downward","Upward")))
- contrasts(exp2_feedback.RT$FeedPrev) = contr.sum
- contrasts(exp2_feedback.RT$gender) = contr.sum
- exp2_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID), exp2_feedback.RT, REML=FALSE)
- exp2_feedback.RT_anova = anova(exp2_feedback.RT_lmm)
- exp2_feedback.RT_anova
- summary(exp2_feedback.RT_lmm)
- exp2_feedback.RT_std_ci = model_parameters(
- exp2_feedback.RT_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_feedback.RT_std_ci
- ```
- ```{r exp2 RT and efficacy}
- exp2_efficacy.RT = exp2_interval_learn %>%
- group_by(SubID) %>%
- dplyr::group_by(SubID,FeedPrev) %>%
- filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
- meanRT < mean(meanRT) + 3 * sd(meanRT))
- contrasts(exp2_efficacy.RT$gender) = contr.sum
- exp2_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- data=exp2_efficacy.RT, REML=FALSE)
- exp2_efficacy.RT_anova = anova(exp2_efficacy.RT_lmm)
- exp2_efficacy.RT_anova
- summary(exp2_efficacy.RT_lmm)
- exp2_efficacy.RT_std_ci = model_parameters(
- exp2_efficacy.RT_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_efficacy.RT_std_ci
- ```
- ###Exp1 LMM power
- ```{r exp2 efficacy and behavior power}
- ###rate & feedack###
- exp2_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
- (1+FeedCode|SubID),
- exp2_interval_efficacy, REML=FALSE)
- exp2_rate.feedback_anova = anova(exp2_rate.feedback_lmm)
- exp2_rate.feedback_anova
- summary(exp2_rate.feedback_lmm)
- model_rate_fb_exp2=powerSim(exp2_rate.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- ###efficacy & rate###
- exp2_efficacy.rate_lmm = lmerTest::lmer(rate_score ~ age+gender+ mbased_efficacy+
- (1+mbased_efficacy|SubID),
- exp2_interval_efficacy, REML=FALSE)
- exp2_efficacy.rate_anova = anova(exp2_efficacy.rate_lmm)
- exp2_efficacy.rate_anova
- summary(exp2_efficacy.rate_lmm)
- model_rate_eff_exp2=powerSim(exp2_efficacy.rate_lmm,fixed("mbased_efficacy", "t"),nsim=1000)
- ###efficacy & feedback###
- exp2_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~ age+gender+FeedCode+
- (1+FeedCode|SubID),exp2_interval_efficacy, REML=FALSE)
- exp2_efficacy.feedback_anova = anova(exp2_efficacy.feedback_lmm)
- exp2_efficacy.feedback_anova
- summary(exp2_efficacy.feedback_lmm)
- model_eff_fb_exp2=powerSim(exp2_efficacy.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- # ###CRPS & feedback###
- exp2_feedback.CRPS_lmm = lmerTest::lmer(CRPS ~ age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID),exp2_feedback.CRPS, REML=FALSE)
- exp2_feedback.CRPS_anova = anova(exp2_feedback.CRPS_lmm)
- exp2_feedback.CRPS_anova
- summary(exp2_feedback.CRPS_lmm)
- model_CRPS_fb_exp2=powerSim(exp2_feedback.CRPS_lmm,fixed("FeedPrev", "f"),nsim=1000)
- ###CRPS & efficacy###
- exp2_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- exp2_efficacy.CRPS, REML=FALSE)
- exp2_efficacy.CRPS_anova = anova(exp2_efficacy.CRPS_lmm)
- exp2_efficacy.CRPS_anova
- summary(exp2_efficacy.CRPS_lmm)
- model_CRPS_eff_exp2=powerSim(exp2_efficacy.CRPS_lmm,
- fixed("mbased_efficacy_prev", "t"),nsim=1000)
- # ###RT & feedback###
- exp2_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
- (1+FeedPrev+meanCongruency|SubID),
- exp2_feedback.RT, REML=FALSE)
- exp2_feedback.RT_anova = anova(exp2_feedback.RT_lmm)
- exp2_feedback.RT_anova
- summary(exp2_feedback.RT_lmm)
- model_RT_fb_exp2=powerSim(exp2_feedback.RT_lmm,fixed("FeedPrev", "f"),nsim=1000)
- ###RT & efficacy###
- exp2_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
- (1+mbased_efficacy_prev+meanCongruency|SubID),
- data = exp2_efficacy.RT, REML=FALSE)
- exp2_efficacy.RT_anova = anova(exp2_efficacy.RT_lmm)
- exp2_efficacy.RT_anova
- summary(exp2_efficacy.RT_lmm)
- model_RT_eff_exp2=powerSim(exp2_efficacy.RT_lmm,
- fixed("mbased_efficacy_prev", "t"),nsim=1000)
- ```
- # Exp2 ERP analysis
- ```{r import exp2 ERPS data}
- ###ERP data##
- cue_ERP = read.csv(".../ERP/Cue_alltrial.csv", header = T) %>%
- dplyr::select(SubID,RoundID,CNV)
- feed_ERP = read.csv(".../ERP/Feed_alltrial.csv", header = T) %>%
- dplyr::select(SubID,RoundID,RewP,P3,LPP)
- ###ERSP data##
- cue_tfa_beta=read_excel(".../Data/ERP/TFAcue_db.xlsx") %>%
- dplyr::select(SubID,RoundID,cuebeta)
- ###combine data###
- exp2_feedERPS_combined = merge(exp2_interval_learn, feed_ERP,by =c("SubID","RoundID"), all = TRUE) %>%
- arrange(SubID,RoundID)
- exp2_cue_ERSP = merge(cue_ERP,cue_tfa_beta,by =c("SubID","RoundID"), all = TRUE)
- exp2_cueERSP_combined = merge(exp2_interval_learn, exp2_cue_ERSP,by =c("SubID","RoundID"), all = TRUE)%>%
- arrange(SubID,RoundID)
- ```
- ```{r import exp2 ERPS data}
- exp2_feedERPS_combined$age= as.numeric(exp2_feedERPS_combined$age)
- exp2_feedERPS_combined$gender= as.factor(exp2_feedERPS_combined$gender)
- exp2_feedERPS_combined$RewP= as.numeric(exp2_feedERPS_combined$RewP)
- exp2_feedERPS_combined$P3= as.numeric(exp2_feedERPS_combined$P3)
- exp2_feedERPS_combined$LPP= as.numeric(exp2_feedERPS_combined$LPP)
- exp2_cueERSP_combined$age= as.numeric(exp2_cueERSP_combined$age)
- exp2_cueERSP_combined$mbased_efficacy_prev = as.numeric(exp2_cueERSP_combined$mbased_efficacy_prev)
- exp2_cueERSP_combined$gender= as.factor(exp2_cueERSP_combined$gender)
- exp2_cueERSP_combined$CNV= as.numeric(exp2_cueERSP_combined$CNV)
- exp2_cueERSP_combined$cuebeta= as.numeric(exp2_cueERSP_combined$cuebeta)
- exp2_interval_feedERPS = exp2_feedERPS_combined %>%
- filter(FeedCode == "1"|FeedCode== "2") %>%
- mutate(FeedCode = factor(FeedCode, levels = c("1", "2"),
- labels=c("Downward","Upward")))
- contrasts(exp2_interval_feedERPS$FeedCode) = contr.sum
- contrasts(exp2_interval_feedERPS$gender) = contr.sum
- exp2_interval_cueERPS = exp2_cueERSP_combined %>%
- filter(FeedPrev == "1"|FeedPrev== "2") %>%
- mutate(FeedPrev = factor(FeedPrev, levels = c("1", "2"),
- labels=c("Downward","Upward")))
- contrasts(exp2_interval_cueERPS$FeedPrev) = contr.sum
- contrasts(exp2_interval_cueERPS$gender) = contr.sum
- contrasts(exp2_cueERSP_combined$FeedPrev) = contr.sum
- contrasts(exp2_cueERSP_combined$gender) = contr.sum
- ```
- ### Exp2 Feedback phase analysis
- ```{r RewP and social comparison lmm}
- exp2_RewP.feedback_lmm = lmerTest::lmer(RewP~age+gender+FeedCode+
- (1+FeedCode|SubID),exp2_interval_feedERPS, REML=FALSE)
- exp2_RewP.feedback_anova = anova(exp2_RewP.feedback_lmm)
- exp2_RewP.feedback_anova
- summary(exp2_RewP.feedback_lmm )
- exp2_RewP.feedback_std_ci = model_parameters(
- exp2_RewP.feedback_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_RewP.feedback_std_ci
- ```
- ```{r RewP and social comparison des}
- exp2_RewP_feedback = exp2_interval_feedERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(RewP)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(RewP_mean = round(mean(RewP),3),
- RewP_sd = round(sd(RewP),3),
- RewP_se=RewP_sd/sqrt(34))
- exp2_RewP_feedback
- ```
- ```{r RewP and social comparison plot}
- exp2_sub_RewP_feedback = exp2_interval_ERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(RewP)%>%
- dplyr::group_by(SubID, FeedCode) %>%
- dplyr::summarise(RewP_mean = round(mean(RewP),3),
- RewP_sd = round(sd(RewP),3),
- RewP_se=RewP_sd/sqrt(34))
- exp2_RewP.feedback_plot= ggbarplot(exp2_sub_RewP_feedback, x = "FeedCode",
- y = "RewP_mean",
- alpha = 0.6, ylab= "RewP",
- xlab = "Social Comparison",
- color = "black",fill = "FeedCode",
- add = c("mean_se","jitter"),
- add.params = list(color = "FeedCode"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4)) +
- scale_y_continuous(breaks = seq(0, 25, by = 5), expand = c(0, 0)) +
- coord_cartesian(ylim = c(0, 28))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp2_RewP.feedback_plot = ggpar(exp2_RewP.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp2_RewP.feedback_plot
- ```
- ```{r P3 and social comparison lmm}
- exp2_P3.feedback_lmm = lmerTest::lmer(P3~age+gender+FeedCode+
- (1+FeedCode|SubID),exp2_interval_feedERPS, REML=FALSE)
- exp2_P3.efficacy.fd_anova = anova(exp2_P3.feedback_lmm)
- exp2_P3.efficacy.fd_anova
- summary(exp2_P3.feedback_lmm)
- exp2_P3.feedback_std_ci = model_parameters(
- exp2_P3.feedback_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_P3.feedback_std_ci
- ```
- ```{r P3 and social comparison des}
- exp2_P3_feedback = exp2_interval_ERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(P3)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(P3_mean = round(mean(P3),3),
- P3_sd = round(sd(P3),3),
- P3_se=P3_sd/sqrt(34))
- exp2_P3_feedback
- ```
- ```{r P3 and social comparison plot}
- exp2_sub_P3_feedback = exp2_interval_ERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(P3)%>%
- dplyr::group_by(SubID, FeedCode) %>%
- dplyr::summarise(P3_mean = round(mean(P3),3),
- P3_sd = round(sd(P3),3),
- P3_se=P3_sd/sqrt(34))
- exp2_P3.feedback_plot= ggbarplot(exp2_sub_P3_feedback, x = "FeedCode",
- y = "P3_mean",
- alpha = 0.6, ylab= "P3",
- xlab = "Social Comparison",
- color = "black",fill = "FeedCode",
- add = c("mean_se","jitter"),
- add.params = list(color = "FeedCode"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4)) +
- scale_y_continuous(breaks = seq(0, 25, by = 5), expand = c(0, 0)) +
- coord_cartesian(ylim = c(0, 27))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp2_P3.feedback_plot = ggpar(exp2_P3.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp2_P3.feedback_plot
- ```
- ```{r LPP and social comparison lmm}
- exp2_LPP.feedback_lmm = lmerTest::lmer(LPP~age+gender+FeedCode+
- (1+FeedCode|SubID),
- exp2_interval_feedERPS, REML=FALSE)
- exp2_LPP.feedback_anova = anova(exp2_LPP.feedback_lmm)
- exp2_LPP.feedback_anova
- summary(exp2_LPP.feedback_lmm)
- exp2_LPP.feedback_std_ci = model_parameters(
- exp2_LPP.feedback_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_LPP.feedback_std_ci
- ```
- ```{r LPP and social comparison des}
- exp2_LPP_feedback = exp2_interval_feedERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(LPP)%>%
- dplyr::group_by(FeedCode) %>%
- dplyr::summarise(LPP_mean = round(mean(LPP),3),
- LPP_sd = round(sd(LPP),3),
- LPP_se=LPP_sd/sqrt(34))
- exp2_LPP_feedback
- ```
- ```{r LPP and social comparison plot}
- exp2_sub_LPP_feedback = exp2_interval_ERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(LPP)%>%
- dplyr::group_by(SubID, FeedCode) %>%
- dplyr::summarise(LPP_mean = round(mean(LPP),3),
- LPP_sd = round(sd(LPP),3),
- LPP_se=LPP_sd/sqrt(34))
- exp2_LPP.feedback_plot= ggbarplot(exp2_sub_LPP_feedback, x = "FeedCode",
- y = "LPP_mean",
- alpha = 0.6, ylab= "LPP",
- xlab = "Social Comparison",
- color = "black",fill = "FeedCode",
- add = c("mean_se","jitter"),
- add.params = list(color = "FeedCode"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4)) +
- scale_y_continuous(breaks = seq(-4, 10, by = 2), expand = c(0, 0)) +
- coord_cartesian(ylim = c(-5, 11))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp2_LPP.feedback_plot = ggpar(exp2_LPP.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp2_LPP.feedback_plot
- ```
- ```{r feedback power}
- exp2_RewP.feedback_lmm = lmerTest::lmer(RewP~age+gender+FeedCode+
- (1+FeedCode|SubID),exp2_interval_feedERPS, REML=FALSE)
- summary(exp2_RewP.feedback_lmm )
- modelRewP=powerSim(exp2_RewP.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- exp2_P3.feedback_lmm = lmerTest::lmer(P3~age+gender+FeedCode+
- (1+FeedCode|SubID),exp2_interval_ERPS, REML=FALSE)
- summary(exp2_P3.feedback_lmm)
- modelP3=powerSim(exp2_P3.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- exp2_LPP.feedback_lmm = lmerTest::lmer(LPP~age+gender+FeedCode+
- (1+FeedCode|SubID),
- exp2_interval_ERPS, REML=FALSE)
- summary(exp2_LPP.feedback_lmm)
- modelLPP=powerSim(exp2_LPP.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
- ```
- ##Exp2 Cue pahse analysis
- ```{r CNV and social comparison}
- exp2_CNV.feedback_lmm = lmerTest::lmer(CNV~age+gender+FeedPrev+
- (1+FeedPrev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- exp2_CNV.feedback_anova = anova(exp2_CNV.feedback_lmm)
- exp2_CNV.feedback_anova
- summary(exp2_CNV.feedback_lmm)
- exp2_CNV.feedback_std_ci = model_parameters(
- exp2_CNV.feedback_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_CNV.feedback_std_ci
- ```
- ```{r CNV and social comparison des}
- exp2_CNV_feedback = exp2_interval_cueERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(CNV)%>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(CNV_mean = round(mean(CNV),3),
- CNV_sd = round(sd(CNV),3),
- CNV_se = CNV_sd/sqrt(34))
- exp2_CNV_feedback
- ```
- ```{r CNV and social comparison plot}
- exp2_sub_CNV_feedback = exp2_interval_cueERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(CNV)%>%
- dplyr::group_by(SubID, FeedPrev) %>%
- dplyr::summarise(CNV_mean = round(mean(CNV),3),
- CNV_sd = round(sd(CNV),3),
- CNV_se = CNV_sd/sqrt(34))
- exp2_CNV.feedback_plot= ggbarplot(exp2_sub_CNV_feedback, x = "FeedPrev",
- y = "CNV_mean", alpha = 0.6,
- ylab= "CNV", xlab = "Social Comparison",
- color = "black",fill = "FeedPrev",
- add = c("mean_se","jitter"),
- add.params = list(color = "FeedPrev"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4))+
- scale_y_continuous(breaks = seq(-8, 8, by = 2), expand = c(0, 0)) +
- coord_cartesian(ylim = c(-7.5, 7.5))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp2_CNV.feedback_plot = ggpar(exp2_CNV.feedback_plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp2_CNV.feedback_plot
- ```
- ```{r CNV and efficacy}
- exp2_CNV.efficacy_lmm = lmerTest::lmer(CNV~gender+mbased_efficacy_prev+
- (1+mbased_efficacy_prev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- exp2_CNV.efficacy_anova = anova(exp2_CNV.efficacy_lmm)
- exp2_CNV.efficacy_anova
- summary(exp2_CNV.efficacy_lmm)
- exp2_CNV.efficacy_std_ci = model_parameters(
- exp2_CNV.efficacy_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_CNV.efficacy_std_ci
- ```
- ```{r CNV and efficacy plot}
- eff_df3 <- Effect(c("mbased_efficacy_prev"), exp2_CNV.efficacy_lmm,
- xlevels = list(mbased_efficacy_prev = seq(min(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE),
- max(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE), 0.1)))
- exp2.CNV.efficacy <- as.data.frame(eff_df3)
- head(exp2.CNV.efficacy)
- len3 <- length(exp2.CNV.efficacy$mbased_efficacy_prev)
- exp2.plot.CNV.efficacy <-
- ggplot() +
- geom_line(data = exp2.CNV.efficacy,
- aes(x = mbased_efficacy_prev, y = fit, color = "S"),
- color = "#F8766D", size = 1, linetype = 1) +
- geom_ribbon(data = exp2.CNV.efficacy,
- aes(x = mbased_efficacy_prev, ymax = fit + se, ymin = fit - se),
- fill = "#F8766D", alpha = 0.1, inherit.aes = FALSE) +
- gg.side +
- scale_y_continuous(breaks = scales::breaks_width(1))
- xmax <- max(exp2.CNV.efficacy$mbased_efficacy_prev, na.rm = TRUE)
- exp2.plot.CNV.efficacy <- exp2.plot.CNV.efficacy +
- coord_cartesian(xlim = c(0, xmax))
- exp2.plot.CNV.efficacy
- ```
- ```{r CNV and effort}
- exp2_CNV.CRPS_lmm = lmerTest::lmer(CRPS~age+gender+mbased_efficacy_prev+CNV+
- (1+mbased_efficacy_prev+CNV|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- exp2_CNV.CRPS_anova = anova(exp2_CNV.CRPS_lmm)
- exp2_CNV.CRPS_anova
- summary(exp2_CNV.CRPS_lmm)
- exp2_CNV.CRPS_std_ci = model_parameters(
- exp2_CNV.CRPS_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_CNV.CRPS_std_ci
- ```
- ```{r Cuebeta and social comparison}
- exp2_Cuebeta.fd_lmm = lmerTest::lmer(cuebeta~age+gender+FeedPrev+(1+FeedPrev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- exp2_Cuebeta.fd_anova = anova(exp2_Cuebeta.fd_lmm)
- exp2_Cuebeta.fd_anova
- summary(exp2_Cuebeta.fd_lmm)
- exp2_Cuebeta.fd_std_ci = model_parameters(
- exp2_Cuebeta.fd_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_Cuebeta.fd_std_ci
- ```
- ```{r Cuebeta and social comparison des}
- exp2_Cuebeta_feedback = exp2_interval_cueERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(cuebeta)%>%
- dplyr::group_by(FeedPrev) %>%
- dplyr::summarise(cuebeta_mean = round(mean(cuebeta),3),
- cuebeta_sd = round(sd(cuebeta),3),
- cuebeta_se=cuebeta_sd/sqrt(34))
- exp2_Cuebeta_feedback
- ```
- ```{r Cuebeta and social comparison plot}
- exp2_sub_cue_feedback = exp2_interval_cueERPS %>%
- dplyr::group_by(SubID) %>%
- drop_na(cuebeta)%>%
- dplyr::group_by(SubID,FeedPrev) %>%
- dplyr::summarise(cuebeta_mean = round(mean(cuebeta),3),
- cuebeta_sd = round(sd(cuebeta),3),
- cuebeta_se=cuebeta_sd/sqrt(34))
- exp2_cuebeta.feedback.plot = ggbarplot(exp2_sub_cue_feedback, x = "FeedPrev",
- y = "cuebeta_mean", alpha = 0.6,
- ylab= "cuebeta", xlab = "Social Comparison",
- color = "black",fill = "FeedPrev",
- add = c("mean_se","jitter"),
- add.params = list(color = "FeedPrev"),
- palette =c("#1b7c3d","#2b6a99"),width = 0.4,
- legend = 'right', position = position_dodge(width =0.4)) +
- scale_y_continuous(
- breaks = seq(-1.5, 1.5, by = 0.5),
- labels = scales::number_format(accuracy = 0.1)
- ) +
- coord_cartesian(ylim = c(-1.5, 1.5))+
- theme(axis.text = element_text(size = 16, family = "serif"),
- axis.title = element_text(size = 20, family = "serif"))
- exp2_cuebeta.feedback.plot = ggpar(exp2_cuebeta.feedback.plot, legend = 'right') +
- theme(legend.text = element_text(size = 12, family = "serif"),
- legend.title = element_text(size = 14, family = "serif", face = "bold"))
- exp2_cuebeta.feedback.plot
- ```
- ```{r Cuebeta and efficacy}
- exp2_Cuebeta.efficacy_lmm = lmerTest::lmer(cuebeta~age+gender+mbased_efficacy_prev+
- (1+mbased_efficacy_prev|SubID),exp2_interval_cueERPS, REML=FALSE)
- exp2_Cuebeta.efficacy_anova = anova(exp2_Cuebeta.efficacy_lmm)
- exp2_Cuebeta.efficacy_anova
- summary(exp2_Cuebeta.efficacy_lmm)
- exp2_Cuebeta.efficacy_std_ci = model_parameters(
- exp2_Cuebeta.efficacy_lmm,
- standardize = "refit",
- df_method = "satterthwaite",
- ci_method = "wald",
- ci = 0.95,
- effects = "all",
- iterations = 1000,
- summary = getOption("parameters_mixed_summary", FALSE),
- digits = 3)
- exp2_Cuebeta.efficacy_std_ci
- ```
- ```{r Cuebeta and efficacy plot}
- eff_df4 <- Effect(c("mbased_efficacy_prev"), exp2_Cuebeta.efficacy_lmm,
- xlevels = list(mbased_efficacy_prev = seq(min(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE),
- max(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE), 0.1)))
- exp2.Cuebeta.efficacy <- as.data.frame(eff_df4)
- head(exp2.Cuebeta.efficacy)
- len4<-length(exp2_interval_cueERPS$mbased_efficacy_prev)
- exp2.plot.Cuebeta.efficacy <- ggplot()+
- geom_line(data=exp2.Cuebeta.efficacy, aes(x=mbased_efficacy_prev, y=fit,color="S"),color="#F8766D",size=1,linetype=1)+
- geom_ribbon(data=exp2.Cuebeta.efficacy, aes(x=mbased_efficacy_prev, max = fit + se, min = fit- se),
- fill = "#F8766D",alpha=0.1, inherit.aes = FALSE)+gg.side
- xmax <- max(exp2.Cuebeta.efficacy$mbased_efficacy_prev, na.rm = TRUE)
- exp2.plot.Cuebeta.efficacy <- exp2.plot.Cuebeta.efficacy +
- coord_cartesian(xlim = c(0, xmax))
- exp2.plot.Cuebeta.efficacy
- ```
- ```{r cue power}
- exp2_CNV.feedback_lmm = lmerTest::lmer(CNV~age+gender+FeedPrev+
- (1+FeedPrev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- summary(exp2_CNV.feedback_lmm)
- modelCNV=powerSim(exp2_CNV.feedback_lmm,fixed("FeedPrev", "f"),nsim=1000)
- exp2_CNV.efficacy_lmm = lmerTest::lmer(CNV~age+gender+mbased_efficacy_prev+
- (1+mbased_efficacy_prev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- summary(exp2_CNV.efficacy_lmm)
- model_eff_CNV=powerSim(exp2_CNV.efficacy_lmm,fixed("mbased_efficacy_prev", "f"),nsim=1000)
- exp2_Cuebeta.fd_lmm = lmerTest::lmer(cuebeta~age+gender+FeedPrev+(1+FeedPrev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- summary(exp2_Cuebeta.fd_lmm)
- modelCuebeta=powerSim(exp2_Cuebeta.fd_lmm,fixed("FeedPrev", "f"),nsim=1000)
- exp2_Cuebeta.efficacy_lmm = lmerTest::lmer(cuebeta~age+gender+mbased_efficacy_prev+
- (1+mbased_efficacy_prev|SubID),
- exp2_interval_cueERPS, REML=FALSE)
- summary(exp2_Cuebeta.efficacy_lmm)
- model_eff_Cuebeta=powerSim(exp2_Cuebeta.efficacy_lmm,fixed("mbased_efficacy_prev", "f"),nsim=1000)
- ```
- # Exp1 and Exp2 hddm
- ## Exp1 hddm analysis
- ```{r exp1 social comaprison hddm,echo = FALSE}
- ###model1 social comparison feedback ###
- exp1_feedback.hddm = read.csv('.../HDDM/exp1_feedback_cong_traces7000.csv')
- exp1_feedback.traces = exp1_feedback.hddm %>%
- dplyr::select(v_Intercept,v_Feed.T.up.,
- a_Intercept,a_Feed.T.up.)%>%
- dplyr::rename(v_upward = v_Intercept,
- v_diff = v_Feed.T.up.,
- a_upward = a_Intercept,
- a_diff = a_Feed.T.up.)%>%
- mutate(v_downward = v_diff+ v_upward,
- a_downward = a_diff + a_upward)
- # Add the posterior probabilities
- exp1_feedback_hypotheses = list(
- t1 = hypothesis(exp1_feedback.traces, "v_downward > v_upward"),
- t2 = hypothesis(exp1_feedback.traces, "a_downward < a_upward"))
- exp1_feedback.hddm.results = data.frame(
- test = c("v_downward > v_upward",
- "a_downward < a_upward"),
- Post.Prob = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$Post.Prob),
- estimate = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$Estimate),
- ci.lower = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$CI.Lower),
- ci.upper = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$CI.Upper),
- est.error = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$Est.Error))
- exp1_feedback.hddm.results
- ```
- ```{r exp1 social comaprison hddm plot}
- exp1_feedback.plot = bind_rows(
- exp1_feedback.traces %>%
- mutate(diff = v_diff,
- Category = 'v')%>%
- dplyr::select(diff,Category),
- exp1_feedback.traces %>%
- mutate(diff = a_diff,
- Category = 'a')%>%
- dplyr::select(diff,Category),
- )
- exp1_feedback.hddm=ggplot(exp1_feedback.plot, aes(x = diff, fill = Category)) +
- geom_density(alpha = 0.4, aes(color = Category)) +
- scale_fill_manual(values = c('#24A669', '#BF6B82')) +
- scale_color_manual(values = c('#24A669', '#BF6B82'))+
- labs(x = 'Social', y = 'Density')+gg.side
- exp1_feedback.hddm
- ```
- ```{r exp1 efficacy hddm,echo = FALSE}
- ###model2 efficacy ###
- exp1_efficacy.hddm = read.csv(".../HDDM/exp1_efficacy_traces.csv")
- exp1_efficacy.traces<-exp1_efficacy.hddm %>%
- dplyr::select(v_Intercept,
- v_mbased_efficacy_prev,
- a_Intercept,
- a_mbased_efficacy_prev)
- # Add the posterior probabilities
- exp1_efficacy_hypotheses = list(
- t1 = hypothesis(exp1_efficacy.traces, "v_Intercept < 0"),
- t2 = hypothesis(exp1_efficacy.traces, "v_mbased_efficacy_prev > 0"),
- t3 = hypothesis(exp1_efficacy.traces, "a_Intercept > 0"),
- t4 = hypothesis(exp1_efficacy.traces, "a_mbased_efficacy_prev < 0"))
- exp1_efficacy.hddm.results = data.frame(
- test = c("v_Intercept < 0",
- "v_mbased_efficacy_prev > 0",
- "a_Intercept > 0",
- "a_mbased_efficacy_prev < 0"),
- Post.Prob = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$Post.Prob),
- estimate = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$Estimate),
- ci.lower = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$CI.Lower),
- ci.upper = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$CI.Upper),
- est.error = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$Est.Error))
- exp1_efficacy.hddm.results
- ```
- ```{r exp1 efficacy hddm plot}
- exp1_efficacy.plot = bind_rows(
- exp1_efficacy.traces %>%
- dplyr::mutate(Intercept = v_Intercept,
- mbased_efficacy = v_mbased_efficacy_prev,
- Category = 'v')%>%
- dplyr::select(Intercept,mbased_efficacy,Category),
- exp1_efficacy.traces %>%
- dplyr::mutate(Intercept = a_Intercept,
- mbased_efficacy = a_mbased_efficacy_prev,
- Category = 'a')%>%
- dplyr::select(Intercept,mbased_efficacy,Category),
- )
- exp1_efficacy.hddm=ggplot(exp1_efficacy.plot, aes(x = mbased_efficacy, fill = Category)) +
- geom_density(alpha = 0.4, aes(color = Category)) +
- scale_fill_manual(values = c('#24A669', '#BF6B82')) +
- scale_color_manual(values = c('#24A669', '#BF6B82')) +
- labs(x = 'Efficacy', y = 'Density')+gg.side
- exp1_efficacy.hddm
- ```
- ## Exp2 hddm analysis
- ```{r exp2 social comparison hddm}
- ###model1 social comparison feedback ###
- exp2_feedback.hddm = read.csv(".../HDDM/exp2_feedback_cong_traces7000.csv")
- exp2_feedback.traces = exp2_feedback.hddm %>%
- dplyr::select(v_Intercept,v_Feed.T.down.,
- a_Intercept,a_Feed.T.down.)%>%
- dplyr::rename(v_diff = v_Feed.T.down.,
- v_downward = v_Intercept,
- a_diff = a_Feed.T.down.,
- a_downward = a_Intercept)%>%
- mutate(v_upward = v_downward + v_diff,
- a_upward = a_downward + a_diff)
- # Add the posterior probabilities
- exp2_feedback_hypotheses = list(
- t1 = hypothesis(exp2_feedback.traces, "v_downward > v_upward"),
- t2 = hypothesis(exp2_feedback.traces, "a_downward < a_upward"))
- exp2_feedback.hddm.results = data.frame(
- test = c("v_downward > v_upward",
- "a_downward < a_upward"),
- Post.Prob = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$Post.Prob),
- estimate = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$Estimate),
- ci.lower = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$CI.Lower),
- ci.upper = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$CI.Upper),
- est.error = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$Est.Error))
- exp2_feedback.hddm.results
- ```
- ```{r exp2 efficacy hddm}
- ###model1 efficacy ###
- exp2_efficacy.hddm = read.csv(".../HDDM/exp2_efficacy_traces.csv")
- exp2_efficacy.traces = exp2_efficacy.hddm %>%
- dplyr::select(v_Intercept,
- v_mbased_efficacy_prev,
- a_Intercept,
- a_mbased_efficacy_prev)
- # Add the posterior probabilities
- exp2_efficacy_hypotheses = list(
- t1 = hypothesis(exp2_efficacy.traces, "v_Intercept < 0"),
- t2 = hypothesis(exp2_efficacy.traces, "v_mbased_efficacy_prev > 0"),
- t3 = hypothesis(exp2_efficacy.traces, "a_Intercept > 0"),
- t4 = hypothesis(exp2_efficacy.traces, "a_mbased_efficacy_prev < 0"))
- exp2_efficacy.hddm.results = data.frame(
- test = c("v_Intercept < 0",
- "v_mbased_efficacy_prev > 0",
- "a_Intercept > 0",
- "a_mbased_efficacy_prev < 0"),
- Post.Prob = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$Post.Prob),
- estimate = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$Estimate),
- ci.lower = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$CI.Lower),
- ci.upper = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$CI.Upper),
- est.error = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$Est.Error))
- exp2_efficacy.hddm.results
- ```
- ```{r LOOIC plot}
- df1 <- tribble(
- ~Model, ~dLOOIC,
- "Intercept", 552.194,
- "1LR", 287.183,
- "2LR", 0
- ) %>%
- mutate(Model = factor(Model, levels = c("2LR","1LR","Intercept")))
- p1 <- ggplot(df1, aes(x = Model, y = dLOOIC)) +
- geom_col(width = 0.7) +
- geom_text(aes(label = sprintf("%.1f", dLOOIC)),
- vjust = -0.3, size = 3) +
- labs(x = NULL, y = "ΔLOOIC (best model = 0; lower is better)") +
- theme_classic() +
- coord_cartesian(ylim = c(0, max(df1$dLOOIC) * 1.15))+gg.side
- p1
- ```
analysis_HB_scripts.Rmd, no license · at the source
Overview
- School of Psychology, Capital Normal University,Beijing, China
- Beijing Key Laboratory of Learning and Cognition, Capital Normal University,Beijing, China
- Faculty of Education, Henan Normal University,Xinxiang, China
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above.
OSF vpr9e
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
- 28 September 2026: the link answers (HTTP 200)
1 file
- Social_comparison_and_ef
fort/ , R, 1,925 linesanalysis_HB_scripts.Rmd
Code availability statement
The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: OSF vpr9e
Read it in the paper: doi.org/10.1038/s42003-026-10229-5.
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;
- 1 script, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability statement
The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- no repository, dataset or request procedure was recognized in it
Read it in the paper: doi.org/10.1038/s42003-026-10229-5.
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, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 2 keywords, 9 MeSH terms, 2 funders, 71 references.
Cite
This paper
Dong, J., Rong, Y., Ma, S., Xu, Y., & Wei, P. (2026). The neurocomputational mechanisms underlying the impact of social comparison on effort investment. Communications biology, 9(1), 984. https://
BibTeX
@article{dong2026neuroco
author = {Dong, Jiarui and Rong, Yachao and Ma, Shengjie and Xu, Yang and Wei, Ping},
title = {{The neurocomputational mechanisms underlying the impact of social comparison on effort investment}},
journal = {Communications biology},
year = {2026},
month = may,
volume = {9},
number = {1},
pages = {984},
publisher = {Nature Publishing Group},
issn = {2399-3642},
doi = {10.1038/
url = {https://
pmid = {42106486},
pmcid = {PMC13381887}
}
RIS
TY - JOUR
AU - Dong, Jiarui
AU - Rong, Yachao
AU - Ma, Shengjie
AU - Xu, Yang
AU - Wei, Ping
TI - The neurocomputational mechanisms underlying the impact of social comparison on effort investment
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 984
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "The neurocomputational mechanisms underlying the impact of social comparison on effort investment",
"container-title": "Communications biology",
"author": [
{
"family": "Dong",
"given": "Jiarui"
},
{
"family": "Rong",
"given": "Yachao"
},
{
"family": "Ma",
"given": "Shengjie"
},
{
"family": "Xu",
"given": "Yang"
},
{
"family": "Wei",
"given": "Ping"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "984",
"DOI": "10.1038/
"PMID": "42106486",
"PMCID": "PMC13381887",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
9
]
]
}
}
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.1371/journal.pbio.3003979 [code]
- Impaired midfrontal‑motor theta phase synchronization characterizes maladaptive motivational behavior in people with obsessive‑compulsive disorder.Journal: PLoS biologyIn common: afex, psych, emmeans, 3 other tools, EEG, 2 references
- [2] doi:10.1073/pnas.2603114123 [code]
- The human hippocampus can pattern separate memories by meaning.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: afex, psych, easystats, 5 other tools
- [3] doi:10.1016/j.neuroimage.2026.122115 [code]
- Midfrontal theta power relates to response speeding following frustrative nonreward.Journal: NeuroImageIn common: psych, easystats, emmeans, 4 other tools, EEG, 1 reference
- [4] doi:10.7554/elife.103566 [code]
- Effort produces after-effects costly for others but valued for self.Journal: eLifeIn common: psych, emmeans, lmerTest, 3 other tools, EEG, 2 references
- [5] doi:10.1073/pnas.2606871123 [code]
- Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: psych, easystats, emmeans, 4 other tools, 1 reference
- [6] doi:10.1038/s41398-026-04341-7 [code]
- Aberrant insula activity to negative and reduced learning from positive feedback underlie maladaptive self-beliefs in depression.Journal: Translational psychiatryIn common: psych, tidyverse, 5 references
- [7] doi:10.1371/journal.pone.0353990 [code]
- Positive mood enhances accessibility of unrelated concepts in the first language but not in the foreign language.Journal: PloS oneIn common: afex, psych, emmeans, 4 other tools, EEG
- [8] doi:10.1038/s41598-026-58046-4 [code]
- Dissecting the interplay of model-based control, impulsivity and compulsivity on self-control in daily life.Journal: Scientific reportsIn common: psych, easystats, emmeans, 2 other tools, EEG, 2 references
- [9] doi:10.1126/sciadv.aec9291 [code]
- Computational mechanisms of perception in autism revealed using games inspired by rodent operant tasks.Journal: Science advancesIn common: afex, psych, easystats, 4 other tools
- [10] doi:10.1093/cercor/bhag113 [code]
- Long-term reliability and stability of parameterized resting state EEG: evidence from a five-year follow-up.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: psych, easystats, emmeans, 4 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, 1 script, and 0 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:e770d939a1e223f6…
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.
