OSCR

The neurocomputational mechanisms underlying the impact of social comparison on effort investment.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

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

  1. ---
  2. title: "Exp1 and Exp2"
  3. author: "JiaRui"
  4. date: "2026-2-11"
  5. output: html_document
  6. ---
  7. ```{r setup, include=FALSE}
  8. library(Rmisc)
  9. library(tidyverse)
  10. library(bruceR)
  11. library(ggpubr)
  12. library(afex)
  13. library(emmeans)
  14. library(sjPlot)
  15. library(readxl)
  16. library(dplyr)
  17. library(tidyr)
  18. library(xlsx)
  19. library(ggplot2)
  20. library(ggtext)
  21. library(psych)
  22. library(effects)
  23. library(brms)
  24. library(parameters)
  25. library(simr)
  26. gg.rr <-theme(axis.line = element_line(colour = "black"),text = element_text(family='Arial',size=11),
  27. axis.title.y = element_markdown(margin = margin(t = 20, r = 5, b = 20, l = 0)),
  28. axis.title.x = element_markdown(),
  29. panel.grid.major = element_blank(),
  30. panel.grid.minor = element_blank(),
  31. panel.border = element_blank(),
  32. panel.background = element_blank(),
  33. strip.background = element_blank(),
  34. plot.title = element_markdown(hjust = 0.5,size=12))
  35. gg.side <-theme(axis.line = element_line(colour = "black"),text =element_text(family='serif',size=16),
  36. axis.title.y = element_markdown(margin = margin(t = 0, r = 8, b = 0, l = 0)), ##up right down left
  37. axis.title.x = element_markdown(margin = margin(t = 8, r = 0, b = 0, l = 0)),axis.text = element_text(colour = "black"),
  38. panel.grid.major = element_blank(),
  39. panel.grid.minor = element_blank(),
  40. panel.border = element_blank(),
  41. panel.background = element_blank(),
  42. strip.background = element_blank(),
  43. plot.title = element_markdown(hjust = 0.5,size=12))
  44. ```
  45. # Exp1 and Exp2 behavior analysis
  46. ```{r import exp1 and exp2 efficacy data}
  47. ###Set working directory###
  48. set.wd("")
  49. ###exp1###
  50. exp1_interval = read_csv("/beha/exp1_interval.csv")
  51. exp1_interval_learn = read_csv("/beha/exp1_interval_learnHB.csv")
  52. exp1_check = read_excel("/beha/exp1_check.xlsx")
  53. exp1_interval_learn = exp1_interval_learn %>%
  54. group_by(SubID) %>%
  55. mutate(Cong_prev = lag(meanCongruency, 1)) %>%
  56. dplyr::mutate(un_PE_prev = lag(unsigned_PE_efficacy, 1)) %>%
  57. dplyr::mutate(PE_prev = lag(signed_PE_efficacy, 1)) %>%
  58. dplyr::mutate(zCRPS = scale(CRPS)) %>%
  59. dplyr::mutate(zmeanRT = scale(meanRT)) %>%
  60. dplyr::mutate(zmbased_efficacy_prev = scale(mbased_efficacy_prev)) %>%
  61. dplyr::mutate(zun_PE_prev = scale(un_PE_prev)) %>%
  62. dplyr::mutate(zPE_prev = scale(PE_prev))
  63. exp1_interval_learn$duration = as.numeric(exp1_interval_learn$duration)
  64. exp1_interval$gender = as.factor(exp1_interval$gender)
  65. exp1_interval_learn$gender = as.factor(exp1_interval_learn$gender)
  66. exp1_interval_learn$FeedCode = as.factor(exp1_interval_learn$FeedCode)
  67. exp1_interval_learn$FeedPrev = as.factor(exp1_interval_learn$FeedPrev)
  68. exp1_interval_learn$mbased_efficacy = as.numeric(exp1_interval_learn$mbased_efficacy)
  69. exp1_interval_learn$mbased_efficacy_prev = as.numeric(exp1_interval_learn$mbased_efficacy_prev)
  70. exp1_interval_learn$unsigned_PE_efficacy = as.numeric(exp1_interval_learn$unsigned_PE_efficacy)
  71. exp1_interval_learn$un_PE_prev = as.numeric(exp1_interval_learn$un_PE_prev)
  72. exp1_interval_learn$signed_PE_efficacy = as.numeric(exp1_interval_learn$signed_PE_efficacy)
  73. exp1_interval_learn$PE_prev = as.numeric(exp1_interval_learn$PE_prev)
  74. exp1_interval$FeedPrev = as.factor(exp1_interval$FeedPrev)
  75. ###exp2###
  76. exp2_interval = read_csv("/beha/exp2_interval.csv")
  77. exp2_interval_learn = read_csv("/beha/exp2_interval_learnHB.csv")
  78. exp2_check = read_excel("/beha/exp2_check.xlsx")
  79. exp2_interval_learn = exp2_interval_learn %>%
  80. group_by(SubID) %>%
  81. mutate(Cong_prev = lag(meanCongruency, 1)) %>%
  82. mutate(un_PE_prev = lag(unsigned_PE_efficacy, 1)) %>%
  83. mutate(PE_prev = lag(signed_PE_efficacy, 1))
  84. exp2_interval_learn$duration = as.numeric(exp2_interval_learn$duration)
  85. exp2_interval$gender = as.factor(exp2_interval$gender)
  86. exp2_interval_learn$gender = as.factor(exp2_interval_learn$gender)
  87. exp2_interval_learn$FeedCode = as.factor(exp2_interval_learn$FeedCode)
  88. exp2_interval_learn$FeedPrev = as.factor(exp2_interval_learn$FeedPrev)
  89. exp2_interval_learn$mbased_efficacy = as.numeric(exp2_interval_learn$mbased_efficacy)
  90. exp2_interval_learn$mbased_efficacy_prev = as.numeric(exp2_interval_learn$mbased_efficacy_prev)
  91. exp1_interval_learn$unsigned_PE_efficacy = as.numeric(exp1_interval_learn$unsigned_PE_efficacy)
  92. exp2_interval_learn$un_PE_prev = as.numeric(exp2_interval_learn$un_PE_prev)
  93. exp1_interval_learn$signed_PE_efficacy = as.numeric(exp1_interval_learn$signed_PE_efficacy)
  94. exp2_interval_learn$PE_prev = as.numeric(exp2_interval_learn$PE_prev)
  95. exp2_interval$FeedPrev = as.factor(exp2_interval$FeedPrev)
  96. ```
  97. ### Exp1 and Exp2 post rating
  98. ```{r exp1 and exp2 post rating des}
  99. exp1_check_emotion_sub = exp1_check %>%
  100. dplyr::summarise(emotion_downward = mean(emotion1),
  101. emotion_upward = mean(emotion2),
  102. emotion_lateral = mean(emotion3))
  103. exp1_check_emotion_sub
  104. exp2_check_emotion_sub = exp2_check %>%
  105. dplyr::summarise(emotion_downward = mean(emotion1),
  106. emotion_upward = mean(emotion2),
  107. emotion_lateral = mean(emotion3))
  108. exp2_check_emotion_sub
  109. ```
  110. ```{r exp1 check post emotion}
  111. exp1_check_emotion = exp1_check %>%
  112. pivot_longer(cols = starts_with("emotion"),
  113. names_to = "cond",
  114. values_to = "emotion") %>%
  115. mutate(cond = factor(cond,
  116. levels = c("emotion1","emotion2","emotion3"),
  117. labels = c("emotion_downward","emotion_upward","emotion_lateral")))
  118. exp1_check_emotion_avo = aov_ez(id = "SubID", dv = "emotion",
  119. within = "cond", data = exp1_check_emotion)
  120. exp1_check_emotion_avo
  121. exp1_check_emotion_post = pairs(emmeans(exp1_check_emotion_avo, ~ cond),
  122. adjust = "bonferroni")
  123. exp1_check_emotion_post
  124. ```
  125. ```{r exp2 check post emotion}
  126. exp2_check_emotion = exp2_check %>%
  127. pivot_longer(cols = starts_with("emotion"),
  128. names_to = "cond",
  129. values_to = "emotion") %>%
  130. mutate(cond = factor(cond,
  131. levels = c("emotion1","emotion2","emotion3"),
  132. labels = c("emotion_downward","emotion_upward","emotion_lateral")))
  133. exp2_check_emotion_avo = aov_ez(id = "SubID", dv = "emotion",
  134. within = "cond", data = exp2_check_emotion)
  135. exp2_check_emotion_avo
  136. exp2_check_emotion_post = pairs(emmeans(exp2_check_emotion_avo, ~ cond),
  137. adjust = "bonferroni")
  138. exp2_check_emotion_post
  139. ```
  140. ### Exp1 descriptive statistics
  141. ```{r exp1 rate_score and model_based efficacy descriptive}
  142. exp1_interval_efficacy = exp1_interval_learn %>%
  143. group_by(SubID) %>%
  144. mutate(FeedCode = factor(FeedCode, levels = c("1", "2"),
  145. labels=c("Downward","Upward")))
  146. contrasts(exp1_interval_efficacy$gender) = contr.sum
  147. contrasts(exp1_interval_efficacy$FeedCode) = contr.sum
  148. ###exp1 rate_score###
  149. exp1_rate_feedback = exp1_interval_learn %>%
  150. dplyr::group_by(SubID) %>%
  151. fill(rate_score, .direction = "up")%>%
  152. drop_na(rate_score)%>%
  153. dplyr::group_by(FeedCode) %>%
  154. dplyr::summarise(rate_score_mean = round(mean(rate_score),3),
  155. rate_score_sd = round(sd(rate_score),3),
  156. rate_score_se=rate_score_sd/sqrt(32))
  157. exp1_rate_feedback
  158. ###exp1 model_based efficacy###
  159. exp1_efficacy_feedback = exp1_interval_learn %>%
  160. dplyr::group_by(SubID) %>%
  161. fill(mbased_efficacy, .direction = "up")%>%
  162. drop_na(mbased_efficacy)%>%
  163. dplyr::group_by(FeedCode) %>%
  164. dplyr::summarise(mbased_efficacy_mean = round(mean(mbased_efficacy),3),
  165. mbased_efficacy_sd = round(sd(mbased_efficacy),3),
  166. mbased_efficacy_se=mbased_efficacy_sd/sqrt(32))
  167. exp1_efficacy_feedback
  168. ```
  169. ```{r exp1 behavior descriptive}
  170. ###exp1 CRPS ###
  171. exp1_interval_CRPS = exp1_interval %>%
  172. dplyr::group_by(SubID, FeedPrev) %>%
  173. filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
  174. CRPS < mean(CRPS) + 3 * sd(CRPS))
  175. exp1_CRPS_feedback = exp1_interval_CRPS %>%
  176. dplyr::group_by(FeedPrev) %>%
  177. dplyr::summarise(CRPS_mean = round(mean(CRPS),3),
  178. CRPS_sd = round(sd(CRPS),3),
  179. CRPS_se=CRPS_sd/sqrt(32))
  180. exp1_CRPS_feedback
  181. ###exp1 RT ###
  182. exp1_interval_RT = exp1_interval %>%
  183. dplyr::group_by(SubID, FeedPrev) %>%
  184. filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
  185. meanRT < mean(meanRT) + 3 * sd(meanRT))
  186. exp1_RT_feedback = exp1_interval_RT %>%
  187. dplyr::group_by(FeedPrev) %>%
  188. dplyr::summarise(RT_mean = round(mean(meanRT)),
  189. RT_sd = round(sd(meanRT)),
  190. RT_se=RT_sd/sqrt(32))
  191. exp1_RT_feedback
  192. ###exp1 ACC ###
  193. exp1_ACC_feedback = exp1_interval %>%
  194. drop_na(FeedPrev) %>%
  195. dplyr::group_by(FeedPrev) %>%
  196. dplyr::summarise(ACC_mean = round(mean(ACC),3),
  197. ACC_sd = round(sd(ACC),3),
  198. ACC_se=ACC_sd/sqrt(32))
  199. exp1_ACC_feedback
  200. ###exp1 feedback count###
  201. exp1_feedback_sub = exp1_interval %>%
  202. group_by(SubID,FeedCode) %>%
  203. dplyr::summarise(counts = n()) %>%
  204. ungroup()
  205. exp1_feedback_count = exp1_feedback_sub %>%
  206. dplyr::group_by(FeedCode) %>%
  207. dplyr::summarise(feed_mean = round(mean(counts),3),
  208. feed_sd = round(sd(counts),3),
  209. feed_se=feed_sd/sqrt(32))
  210. exp1_feedback_count
  211. ```
  212. ### Exp1 efficacy analysis
  213. ```{r exp1 rate_score and feedback}
  214. exp1_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
  215. (1+FeedCode|SubID),
  216. exp1_interval_efficacy, REML=FALSE)
  217. exp1_rate.feedback_anova = anova(exp1_rate.feedback_lmm)
  218. exp1_rate.feedback_anova
  219. summary(exp1_rate.feedback_lmm)
  220. exp1_rate.feedback_std_ci = model_parameters(
  221. exp1_rate.feedback_lmm,
  222. standardize = "refit",
  223. ci_method = "wald",
  224. ci = 0.95,
  225. effects = "all",
  226. iterations = 1000,
  227. summary = getOption("parameters_mixed_summary", FALSE),
  228. digits = 3)
  229. exp1_rate.feedback_std_ci
  230. ```
  231. ```{r exp1 rate_score and feedback plot}
  232. exp1_sub_rate_feedback = exp1_interval_efficacy %>%
  233. dplyr::group_by(SubID) %>%
  234. fill(rate_score, .direction = "up")%>%
  235. drop_na(rate_score)%>%
  236. dplyr::group_by(SubID, FeedCode) %>%
  237. dplyr::summarise(rate_score_mean = round(mean(rate_score),3),
  238. rate_score_sd = round(sd(rate_score),3),
  239. rate_score_se=rate_score_sd/sqrt(32))
  240. exp1_rate.feedback_plot = ggbarplot(exp1_sub_rate_feedback, x = "FeedCode",
  241. y = "rate_score_mean",
  242. alpha = 0.6, ylab= "Rate",
  243. xlab = "Social Comparison",
  244. color = "black",fill = "FeedCode",
  245. add = c("mean_se", "jitter"),
  246. add.params = list(color = "FeedCode"),
  247. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  248. legend = 'right', position = position_dodge(width =0.4))+
  249. scale_y_continuous(breaks = seq(0, 100, by = 20), expand = c(0, 0)) +
  250. coord_cartesian(ylim = c(0, 105))+
  251. theme(axis.text = element_text(size = 16, family = "serif"),
  252. axis.title = element_text(size = 20, family = "serif"))
  253. exp1_rate.feedback_plot = ggpar(exp1_rate.feedback_plot, legend = 'right') +
  254. theme(legend.text = element_text(size = 12, family = "serif"),
  255. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  256. exp1_rate.feedback_plot
  257. ```
  258. ```{r exp1 rate_score and efficacy}
  259. exp1_efficacy.rate_lmm = lmerTest::lmer(rate_score ~ age+gender+ mbased_efficacy+
  260. (1+mbased_efficacy|SubID),
  261. exp1_interval_efficacy, REML=FALSE)
  262. exp1_efficacy.rate_anova = anova(exp1_efficacy.rate_lmm)
  263. exp1_efficacy.rate_anova
  264. summary(exp1_efficacy.rate_lmm)
  265. exp1_efficacy.rate_std_ci = model_parameters(
  266. exp1_efficacy.rate_lmm,
  267. standardize = "refit",
  268. ci_method = "wald",
  269. ci = 0.95,
  270. effects = "all",
  271. iterations = 1000,
  272. summary = getOption("parameters_mixed_summary", FALSE),
  273. digits = 3)
  274. exp1_efficacy.rate_std_ci
  275. ```
  276. ```{r exp1 rate_score and efficacy plot}
  277. eff_df0 <- Effect(c("mbased_efficacy"), exp1_efficacy.rate_lmm,
  278. xlevels = list(mbased_efficacy = seq(min(exp1_interval_efficacy$mbased_efficacy, na.rm = TRUE),
  279. max(exp1_interval_efficacy$mbased_efficacy, na.rm = TRUE),
  280. by = 0.1)))
  281. exp1.rate.efficacy = as.data.frame(eff_df0)
  282. head(exp1.rate.efficacy)
  283. len1 = length(exp1_interval_efficacy$mbased_efficacy)
  284. exp1.plot.rate.efficacy <- ggplot(exp1.rate.efficacy,
  285. aes(x = mbased_efficacy, y = fit)) +
  286. geom_line(color = "#F8766D", linewidth = 1, linetype = 1) +
  287. geom_ribbon(aes(ymin = fit - se, ymax = fit + se),
  288. fill = "#F8766D", alpha = 0.1) +
  289. gg.side +
  290. scale_x_continuous(limits = c(0, 1))
  291. exp1.plot.rate.efficacy
  292. ```
  293. ```{r exp1 rate_score and efficacy plot}
  294. exp1_sub_rate_efficacy = exp1_interval_learn %>%
  295. group_by(RoundID) %>%
  296. dplyr::summarise(
  297. efficacy_mean = round(mean(mbased_efficacy, na.rm = TRUE), 3),
  298. efficacy_sd = round(sd(mbased_efficacy, na.rm = TRUE), 3),
  299. efficacy_se = efficacy_sd / sqrt(32),
  300. Rate_mean = round(mean(EfficacyProbeRespLin, na.rm = TRUE),3),
  301. Rate_sd = round(sd(EfficacyProbeRespLin, na.rm = TRUE), 3),
  302. Rate_se = Rate_sd / sqrt(32))%>%
  303. drop_na(Rate_mean)
  304. exp1_rate.efficacy_plot = ggplot(data = exp1_sub_rate_efficacy, aes(x = RoundID)) +
  305. # Plot the "rate" line and confidence interval
  306. geom_line(aes(y = Rate_mean, color = "rate"), size = 1) +
  307. geom_ribbon(aes(ymin =Rate_mean - Rate_se,
  308. ymax = Rate_mean + Rate_se, fill = "rate"),
  309. alpha = 0.2) +
  310. # Plot the "CRPS" line and confidence interval
  311. geom_line(aes(y = efficacy_mean, color = "efficacy"), size = 1) +
  312. geom_ribbon(aes(ymin = efficacy_mean - efficacy_se,
  313. ymax = efficacy_mean + efficacy_se, fill = "efficacy"),
  314. alpha = 0.2) +
  315. # Labels and scales
  316. labs(x = "RoundID", y = "Value", color = "Legend", fill = "Legend") +
  317. scale_x_continuous(breaks = seq(0, max(exp1_sub_rate_efficacy$RoundID), by = 24)) +
  318. scale_color_manual(values = c("rate" = "#808080", "efficacy" = "#749857")) + # Specify colors
  319. scale_fill_manual(values = c("rate" = "#A9A9A9", "efficacy" = "#749857")) + # Specify fill colors
  320. ylim(0.25, 0.75) +
  321. theme_minimal() +
  322. theme(legend.position = "top")+gg.side # Place the legend at the top
  323. exp1_rate.efficacy_plot
  324. ```
  325. ```{r exp1 efficacy and social comparison}
  326. exp1_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~age+ gender+FeedCode+
  327. (1+FeedCode|SubID),exp1_interval_efficacy, REML=FALSE)
  328. exp1_efficacy.feedback_anova = anova(exp1_efficacy.feedback_lmm)
  329. exp1_efficacy.feedback_anova
  330. summary(exp1_efficacy.feedback_lmm)
  331. exp1_efficacy.feedback_std_ci = model_parameters(
  332. exp1_efficacy.feedback_lmm,
  333. standardize = "refit",
  334. ci_method = "wald",
  335. ci = 0.95,
  336. effects = "all",
  337. iterations = 1000,
  338. summary = getOption("parameters_mixed_summary", FALSE),
  339. digits = 3)
  340. exp1_efficacy.feedback_std_ci
  341. ```
  342. ```{r exp1 efficacy and social comparison plot}
  343. exp1_sub_efficacy_feedback = exp1_interval_efficacy %>%
  344. dplyr::filter(FeedCode == "Downward"|FeedCode == "Upward") %>%
  345. dplyr::group_by(SubID, FeedCode) %>%
  346. dplyr::summarise(mbased_efficacy_mean = round(mean(mbased_efficacy),3),
  347. mbased_efficacy_sd =round(sd(mbased_efficacy),3),
  348. mbased_efficacy_se=mbased_efficacy_sd/sqrt(32))
  349. exp1_efficacy.feedback_plot= ggbarplot(exp1_sub_efficacy_feedback, x = "FeedCode",
  350. y = "mbased_efficacy_mean",
  351. alpha = 0.6,ylab= "Efficacy",
  352. xlab = "Social Comparison",
  353. color = "black",fill = "FeedCode",
  354. add = c("mean_se", "jitter"),
  355. add.params = list(color = "FeedCode"),
  356. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  357. legend = 'right',
  358. position = position_dodge(width =0.4))+
  359. scale_y_continuous(breaks = seq(0, 1, by = 0.2), expand = c(0, 0)) +
  360. coord_cartesian(ylim = c(0, 1.05))+
  361. theme(axis.text = element_text(size = 16, family = "serif"),
  362. axis.title = element_text(size = 20, family = "serif"))
  363. exp1_efficacy.feedback_plot = ggpar(exp1_efficacy.feedback_plot, legend = 'right') +
  364. theme(legend.text = element_text(size = 12, family = "serif"),
  365. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  366. exp1_efficacy.feedback_plot
  367. ```
  368. ## Exp1 behavior analysis
  369. ### Exp1 CRPS analysis
  370. ```{r exp1 CRPS and social comparison}
  371. exp1_feedback.CRPS = exp1_interval_CRPS %>%
  372. dplyr::filter(FeedPrev == "1"|FeedPrev == "2") %>%
  373. dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
  374. levels = c("Downward","Upward")))
  375. contrasts(exp1_feedback.CRPS$FeedPrev) = contr.sum
  376. contrasts(exp1_feedback.CRPS$gender) = contr.sum
  377. exp1_feedback.CRPS_lmm = lmerTest::lmer(CRPS ~ age+gender+FeedPrev+meanCongruency+
  378. (1+FeedPrev+meanCongruency|SubID),exp1_feedback.CRPS, REML=FALSE)
  379. exp1_feedback.CRPS_anova = anova(exp1_feedback.CRPS_lmm)
  380. exp1_feedback.CRPS_anova
  381. summary(exp1_feedback.CRPS_lmm)
  382. exp1_feedback.CRPS_std_ci = model_parameters(
  383. exp1_feedback.CRPS_lmm,
  384. standardize = "refit",
  385. ci_method = "wald",
  386. ci = 0.95,
  387. effects = "all",
  388. iterations = 1000,
  389. summary = getOption("parameters_mixed_summary", FALSE),
  390. digits = 3)
  391. exp1_feedback.CRPS_std_ci
  392. ```
  393. ```{r exp1 CRPS and social comparison plot}
  394. exp1_sub_CRPS_feedback = exp1_feedback.CRPS %>%
  395. dplyr::group_by(SubID,FeedPrev) %>%
  396. dplyr::summarise(CRPS_mean = round(mean(CRPS),3),
  397. CRPS_sd = round(sd(CRPS),3),
  398. CRPS_se=CRPS_sd/sqrt(32))
  399. exp1_CRPS.feedback_plot = ggbarplot(exp1_sub_CRPS_feedback, x = "FeedPrev",
  400. y = "CRPS_mean", alpha = 0.6,
  401. ylab= "CRPS", xlab = "Social Comparison",
  402. color = "black",fill = "FeedPrev",
  403. add = c("mean_se", "jitter"),
  404. add.params = list(color = "FeedPrev"),
  405. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  406. legend = 'right', position = position_dodge(width =0.4)) +
  407. scale_y_continuous(breaks = seq(0, 1.25, by = 0.2), expand = c(0, 0)) +
  408. coord_cartesian(ylim = c(0, 1.25))+
  409. annotate("text",x=1.35,y=0.97,label="",size = 6) +
  410. theme(axis.text = element_text(size = 16, family = "serif"),
  411. axis.title = element_text(size = 20, family = "serif"))
  412. exp1_CRPS.feedback_plot = ggpar(exp1_CRPS.feedback_plot, legend = 'right') +
  413. theme(legend.text = element_text(size = 12, family = "serif"),
  414. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  415. exp1_CRPS.feedback_plot
  416. ```
  417. ```{r exp1 CRPS and efficacy}
  418. ###exp1 CRPS and efficacy LMM### un_PE_prev PE_prev
  419. exp1_efficacy.CRPS = exp1_interval_learn %>%
  420. group_by(SubID,FeedPrev) %>%
  421. filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
  422. CRPS < mean(CRPS) + 3 * sd(CRPS))
  423. contrasts(exp1_efficacy.CRPS$gender) = contr.sum
  424. exp1_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~age+gender+mbased_efficacy_prev+meanCongruency+
  425. (1+mbased_efficacy_prev+meanCongruency|SubID),
  426. exp1_efficacy.CRPS, REML=FALSE)
  427. exp1_efficacy.CRPS_anova = anova(exp1_efficacy.CRPS_lmm)
  428. summary(exp1_efficacy.CRPS_lmm)
  429. exp1_efficacy.CRPS_anova
  430. exp1_efficacy.CRPS_std_ci = model_parameters(
  431. exp1_efficacy.CRPS_lmm,
  432. standardize = "refit",
  433. ci_method = "wald",
  434. ci = 0.95,
  435. effects = "all",
  436. iterations = 1000,
  437. summary = getOption("parameters_mixed_summary", FALSE),
  438. digits = 3)
  439. exp1_efficacy.CRPS_std_ci
  440. ```
  441. ```{r CRPS and efficacy plot}
  442. eff_df1 = Effect(c("mbased_efficacy_prev"), exp1_efficacy.CRPS_lmm,
  443. xlevels = list(mbased_efficacy_prev = seq(min(exp1_efficacy.CRPS$mbased_efficacy_prev, na.rm = TRUE),
  444. max(exp1_efficacy.CRPS$mbased_efficacy_prev, na.rm = TRUE),
  445. by = 0.1)))
  446. exp1.CRPS.efficacy = as.data.frame(eff_df1)
  447. head(exp1.CRPS.efficacy)
  448. len1 = length(exp1.CRPS.efficacy$mbased_efficacy_prev)
  449. exp1.plot.CRPS.efficacy = ggplot(exp1.CRPS.efficacy,
  450. aes(x = mbased_efficacy_prev, y = fit)) +
  451. geom_line(color = "#F8766D", linewidth = 1, linetype = 1) +
  452. geom_ribbon(aes(ymin = fit - se, ymax = fit + se),
  453. fill = "#F8766D", alpha = 0.1) +
  454. gg.side +
  455. scale_x_continuous(limits = c(0, 1)) +
  456. scale_y_continuous(
  457. limits = c(0.92, 1.01),
  458. breaks = seq(0, 2, by = 0.02) # y轴每0.2一个刻度
  459. )
  460. exp1.plot.CRPS.efficacy
  461. ```
  462. ### Exp1 RT analysis
  463. ```{r exp1 RT and social comparison}
  464. ###exp1 RT LMM###
  465. exp1_feedback.RT = exp1_interval_RT %>%
  466. filter(FeedPrev == "1"|FeedPrev == "2") %>%
  467. dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
  468. levels = c("Downward","Upward")))
  469. contrasts(exp1_feedback.RT$FeedPrev)<-contr.sum
  470. contrasts(exp1_feedback.RT$gender)<-contr.sum
  471. exp1_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
  472. (1+FeedPrev+meanCongruency|SubID),exp1_feedback.RT, REML=FALSE)
  473. exp1_feedback.RT_anova = anova(exp1_feedback.RT_lmm)
  474. exp1_feedback.RT_anova
  475. summary(exp1_feedback.RT_lmm)
  476. exp1_feedback.RT_std_ci = model_parameters(
  477. exp1_feedback.RT_lmm,
  478. standardize = "refit",
  479. ci_method = "wald",
  480. ci = 0.95,
  481. effects = "all",
  482. iterations = 1000,
  483. summary = getOption("parameters_mixed_summary", FALSE),
  484. digits = 3)
  485. exp1_feedback.RT_std_ci
  486. ```
  487. ```{r exp1 RT and social comparison plot}
  488. exp1_sub_RT_feedback = exp1_interval_RT %>%
  489. filter(FeedPrev == "1"|FeedPrev == "2") %>%
  490. mutate(FeedPrev = factor(recode(FeedPrev, "1" = "Downward", "2" = "Upward"),
  491. levels = c("Downward", "Upward"))) %>%
  492. dplyr::group_by(SubID, FeedPrev) %>%
  493. dplyr::summarise(RT_mean = round(mean(meanRT),3),
  494. RT_sd = round(sd(meanRT),3),
  495. RT_se=RT_sd/sqrt(32))
  496. exp1_RT.feedback_plot= ggbarplot(exp1_sub_RT_feedback, x = "FeedPrev",
  497. y = "RT_mean", alpha = 0.6,
  498. ylab= "Reaction time (ms)",
  499. xlab = "Social Comparison",
  500. color = "black",fill = "FeedPrev",
  501. add = c("mean_se", "jitter"),
  502. add.params = list(color = "FeedPrev"),
  503. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  504. legend = 'right', position = position_dodge(width =0.4)) +
  505. scale_y_continuous(breaks = c(0, seq(0, 1150, by = 200)), expand = c(0, 0))+
  506. coord_cartesian(ylim = c(0, 1150)) +
  507. annotate("text",x=1.35,y=710,label="",size = 6) +
  508. theme(axis.text = element_text(size = 16, family = "serif"),
  509. axis.title = element_text(size = 20, family = "serif"))
  510. exp1_RT.feedback_plot = ggpar(exp1_RT.feedback_plot, legend = 'right') +
  511. theme(legend.text = element_text(size = 12, family = "serif"),
  512. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  513. exp1_RT.feedback_plot
  514. ```
  515. ```{r exp1 RT and efficacy}
  516. ###exp1 CRPS and efficacy LMM### un_PE_prev PE_prev
  517. exp1_efficacy.RT = exp1_interval_learn %>%
  518. dplyr::group_by(SubID,FeedPrev) %>%
  519. filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
  520. meanRT < mean(meanRT) + 3 * sd(meanRT))
  521. contrasts(exp1_efficacy.RT$gender) = contr.sum
  522. exp1_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
  523. (1+mbased_efficacy_prev+meanCongruency|SubID),
  524. data = exp1_efficacy.RT, REML=FALSE)
  525. exp1_efficacy.RT_anova = anova(exp1_efficacy.RT_lmm)
  526. exp1_efficacy.RT_anova
  527. summary(exp1_efficacy.RT_lmm)
  528. exp1_efficacy.RT_std_ci = model_parameters(
  529. exp1_efficacy.RT_lmm,
  530. standardize = "refit",
  531. df_method = "satterthwaite",
  532. ci_method = "wald",
  533. ci = 0.95,
  534. effects = "all",
  535. iterations = 1000,
  536. summary = getOption("parameters_mixed_summary", FALSE),
  537. digits = 3)
  538. exp1_efficacy.RT_std_ci
  539. ```
  540. ```{r exp1 RT and efficacy plot}
  541. eff_df2 = Effect(c("mbased_efficacy_prev"),exp1_efficacy.RT_lmm,
  542. xlevels = list(mbased_efficacy_prev = seq(min(exp1_efficacy.RT$mbased_efficacy_prev, na.rm = TRUE),
  543. max(exp1_efficacy.RT$mbased_efficacy_prev, na.rm = TRUE),
  544. by = 0.1)))
  545. exp1.RT.efficacy = as.data.frame(eff_df2)
  546. head(exp1.RT.efficacy)
  547. len2<-length(exp1.RT.efficacy$mbased_efficacy_prev)
  548. exp1.plot.RT.efficacy <- ggplot()+
  549. geom_line(data=exp1.RT.efficacy,
  550. aes(x=mbased_efficacy_prev, y=fit),
  551. color="#F8766D",size=1,linetype=1)+
  552. geom_ribbon(data=exp1.RT.efficacy,
  553. aes(x=mbased_efficacy_prev, max = fit + se, min = fit- se),
  554. fill = "#F8766D",
  555. alpha=0.1,
  556. inherit.aes = FALSE)+ylim(c(600, 740))+ scale_x_continuous(limits = c(0, 1)) +gg.side
  557. exp1.plot.RT.efficacy
  558. ```
  559. ###Exp1 LMM power
  560. ```{r exp1 efficacy and behavior power}
  561. ###rate & feedack###
  562. exp1_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
  563. (1+FeedCode|SubID),
  564. exp1_interval_efficacy, REML=FALSE)
  565. exp1_rate.feedback_anova = anova(exp1_rate.feedback_lmm)
  566. exp1_rate.feedback_anova
  567. summary(exp1_rate.feedback_lmm)
  568. model_rate_fb_exp1=powerSim(exp1_rate.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  569. ###efficacy & rate###
  570. exp1_efficacy.rate_lmm = lmerTest::lmer(rate_score ~ age+gender+ mbased_efficacy+
  571. (1+mbased_efficacy|SubID),
  572. exp1_interval_efficacy, REML=FALSE)
  573. exp1_efficacy.rate_anova = anova(exp1_efficacy.rate_lmm)
  574. exp1_efficacy.rate_anova
  575. summary(exp1_efficacy.rate_lmm)
  576. model_rate_eff_exp1=powerSim(exp1_efficacy.rate_lmm,fixed("mbased_efficacy", "t"),nsim=1000)
  577. ###efficacy & feedback###
  578. exp1_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~ age+gender+FeedCode+
  579. (1+FeedCode|SubID),exp1_interval_efficacy, REML=FALSE)
  580. exp1_efficacy.feedback_anova = anova(exp1_efficacy.feedback_lmm)
  581. exp1_efficacy.feedback_anova
  582. summary(exp1_efficacy.feedback_lmm)
  583. model_eff_fb_exp1=powerSim(exp1_efficacy.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  584. # ###CRPS & feedback###
  585. exp1_feedback.CRPS_lmm = lmerTest::lmer(CRPS ~ age+gender+FeedPrev+meanCongruency+
  586. (1+FeedPrev+meanCongruency|SubID),exp1_feedback.CRPS, REML=FALSE)
  587. exp1_feedback.CRPS_anova = anova(exp1_feedback.CRPS_lmm)
  588. exp1_feedback.CRPS_anova
  589. summary(exp1_feedback.CRPS_lmm)
  590. model_CRPS_fb_exp1=powerSim(exp1_feedback.CRPS_lmm,fixed("FeedPrev", "f"),nsim=1000)
  591. ###CRPS & efficacy###
  592. exp1_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~ age+gender+mbased_efficacy_prev+meanCongruency+
  593. (1+mbased_efficacy_prev+meanCongruency|SubID),
  594. exp1_efficacy.CRPS, REML=FALSE)
  595. exp1_efficacy.CRPS_anova = anova(exp1_efficacy.CRPS_lmm)
  596. exp1_efficacy.CRPS_anova
  597. summary(exp1_efficacy.CRPS_lmm)
  598. model_CRPS_eff_exp1=powerSim(exp1_efficacy.CRPS_lmm,
  599. fixed("mbased_efficacy_prev", "t"),nsim=1000)
  600. # ###RT & feedback###
  601. exp1_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
  602. (1+FeedPrev+meanCongruency|SubID),
  603. exp1_feedback.RT, REML=FALSE)
  604. exp1_feedback.RT_anova = anova(exp1_feedback.RT_lmm)
  605. exp1_feedback.RT_anova
  606. summary(exp1_feedback.RT_lmm)
  607. model_RT_fb_exp1=powerSim(exp1_feedback.RT_lmm,fixed("FeedPrev", "f"),nsim=1000)
  608. ###RT & efficacy###
  609. exp1_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
  610. (1+mbased_efficacy_prev+meanCongruency|SubID),
  611. data = exp1_efficacy.RT, REML=FALSE)
  612. exp1_efficacy.RT_anova = anova(exp1_efficacy.RT_lmm)
  613. exp1_efficacy.RT_anova
  614. summary(exp1_efficacy.RT_lmm)
  615. model_RT_eff_exp1=powerSim(exp1_efficacy.RT_lmm,
  616. fixed("mbased_efficacy_prev", "t"),nsim=1000)
  617. ```
  618. ## Exp2 model analysis
  619. ### Exp2 descriptive statistics
  620. ```{r exp2 rate_score and social comparison descriptive}
  621. exp2_interval_efficacy = exp2_interval_learn %>%
  622. group_by(SubID) %>%
  623. mutate(FeedCode = factor(FeedCode, levels = c("1", "2"),
  624. labels=c("Downward","Upward")))
  625. contrasts(exp2_interval_efficacy$FeedCode) = contr.sum
  626. contrasts(exp2_interval_efficacy$gender) = contr.sum
  627. ###exp2 rate_score###
  628. exp2_rate_feedback = exp2_interval_learn %>%
  629. dplyr::group_by(SubID) %>%
  630. fill(rate_score, .direction = "up")%>%
  631. drop_na(rate_score)%>%
  632. dplyr::group_by(FeedCode) %>%
  633. dplyr::summarise(rate_score_mean = round(mean(rate_score),3),
  634. rate_score_sd = round(sd(rate_score),3),
  635. rate_score_se=rate_score_sd/sqrt(34))
  636. exp2_rate_feedback
  637. ###exp2 model_based efficacy###
  638. exp2_efficacy_feedback = exp2_interval_learn %>%
  639. dplyr::group_by(SubID) %>%
  640. fill(mbased_efficacy, .direction = "up")%>%
  641. drop_na(mbased_efficacy)%>%
  642. dplyr::group_by(FeedCode) %>%
  643. dplyr::summarise(mbased_efficacy_mean = round(mean(mbased_efficacy),3),
  644. mbased_efficacy_sd = round(sd(mbased_efficacy),3),
  645. mbased_efficacy_se=mbased_efficacy_sd/sqrt(34))
  646. exp2_efficacy_feedback
  647. ```
  648. ```{r exp2 CRPS and RT descriptive}
  649. ###exp2 CRPS ###
  650. exp2_interval_CRPS = exp2_interval_learn %>%
  651. dplyr::group_by(SubID, FeedPrev) %>%
  652. filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
  653. CRPS < mean(CRPS) + 3 * sd(CRPS))
  654. exp2_sub_CRPS_feedback = exp2_interval %>%
  655. dplyr::group_by(SubID, FeedPrev) %>%
  656. filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
  657. CRPS < mean(CRPS) + 3 * sd(CRPS)) %>%
  658. dplyr::group_by(SubID, FeedPrev) %>%
  659. dplyr::summarise(CRPS = round(mean(CRPS),3))
  660. exp2_CRPS_feedback = exp2_sub_CRPS_feedback %>%
  661. dplyr::group_by(FeedPrev) %>%
  662. dplyr::summarise(CRPS_mean = round(mean(CRPS),3),
  663. CRPS_sd = round(sd(CRPS),3),
  664. CRPS_se=CRPS_sd/sqrt(34))
  665. exp2_CRPS_feedback
  666. ###exp2 RT ###
  667. exp2_interval_RT = exp2_interval_learn %>%
  668. dplyr::group_by(SubID, FeedPrev) %>%
  669. filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
  670. meanRT < mean(meanRT) + 3 * sd(meanRT))
  671. exp2_sub_RT_feedback=exp2_interval_learn %>%
  672. dplyr::group_by(SubID, FeedPrev) %>%
  673. filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
  674. meanRT < mean(meanRT) + 3 * sd(meanRT))%>%
  675. dplyr::group_by(SubID, FeedPrev) %>%
  676. dplyr::summarise(RT = round(mean(meanRT)))
  677. exp2_RT_feedback = exp2_sub_RT_feedback %>%
  678. dplyr::group_by(FeedPrev) %>%
  679. dplyr::summarise(RT_mean = round(mean(RT)),
  680. RT_sd = round(sd(RT)),
  681. RT_se=RT_sd/sqrt(34))
  682. exp2_RT_feedback
  683. ###exp2 ACC ###
  684. exp2_ACC_feedback = exp2_interval %>%
  685. drop_na(FeedPrev) %>%
  686. dplyr::group_by(FeedPrev) %>%
  687. dplyr::summarise(ACC_mean = round(mean(ACC),3),
  688. ACC_sd = round(sd(ACC),3),
  689. ACC_se=ACC_sd/sqrt(32))
  690. exp2_ACC_feedback
  691. ###exp2 feedback count###
  692. exp2_feedback_sub = exp2_interval %>%
  693. group_by(SubID,FeedCode) %>%
  694. dplyr::summarise(counts = n()) %>%
  695. ungroup()
  696. exp2_feedback_count = exp2_feedback_sub %>%
  697. dplyr::group_by(FeedCode) %>%
  698. dplyr::summarise(feed_mean = round(mean(counts),3),
  699. feed_sd = round(sd(counts),3),
  700. feed_se=feed_sd/sqrt(32))
  701. exp2_feedback_count
  702. ```
  703. ###Exp2 efficacy analysis
  704. ```{r exp2 rate_score and social comparison}
  705. exp2_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
  706. (1+FeedCode|SubID),
  707. data = exp2_interval_efficacy, REML=FALSE)
  708. exp2_rate.feedback_anova = anova(exp2_rate.feedback_lmm)
  709. exp2_rate.feedback_anova
  710. summary(exp2_rate.feedback_lmm)
  711. exp2_rate.feedback_std_ci = model_parameters(
  712. exp2_rate.feedback_lmm,
  713. standardize = "refit",
  714. ci_method = "wald",
  715. ci = 0.95,
  716. effects = "all",
  717. iterations = 1000,
  718. summary = getOption("parameters_mixed_summary", FALSE),
  719. digits = 3)
  720. exp2_rate.feedback_std_ci
  721. ```
  722. ```{r exp2 rate_score and efficacy}
  723. exp2_efficacy.rate_lmm= lmerTest::lmer(rate_score ~age+gender+mbased_efficacy+
  724. (1+mbased_efficacy|SubID),
  725. data = exp2_interval_learn, REML=FALSE)
  726. exp2_efficacy.rate_anova = anova(exp2_efficacy.rate_lmm)
  727. exp2_efficacy.rate_anova
  728. summary(exp2_efficacy.rate_lmm)
  729. exp2_efficacy.rate_std_ci = model_parameters(
  730. exp2_efficacy.rate_lmm,
  731. standardize = "refit",
  732. ci_method = "wald",
  733. ci = 0.95,
  734. effects = "all",
  735. iterations = 1000,
  736. summary = getOption("parameters_mixed_summary", FALSE),
  737. digits = 3)
  738. exp2_efficacy.rate_std_ci
  739. ```
  740. ```{r rate_score and efficacy plot}
  741. exp2_sub_rate_efficacy = exp2_interval_efficacy %>%
  742. group_by(RoundID) %>%
  743. dplyr::summarise(
  744. efficacy_mean = round(mean(mbased_efficacy, na.rm = TRUE), 3),
  745. efficacy_sd = round(sd(mbased_efficacy, na.rm = TRUE), 3),
  746. efficacy_se = efficacy_sd / sqrt(32),
  747. Rate_mean = round(mean(EfficacyProbeRespLin, na.rm = TRUE),3),
  748. Rate_sd = round(sd(EfficacyProbeRespLin, na.rm = TRUE), 3),
  749. Rate_se = Rate_sd / sqrt(34))%>%
  750. drop_na(Rate_mean)
  751. exp2_rate.efficacy_plot = ggplot(data = exp2_sub_rate_efficacy, aes(x = RoundID)) +
  752. # Plot the "rate" line and confidence interval
  753. geom_line(aes(y = Rate_mean, color = "rate"), size = 1) +
  754. geom_ribbon(aes(ymin =Rate_mean - Rate_se,
  755. ymax = Rate_mean + Rate_se, fill = "rate"),
  756. alpha = 0.2) +
  757. # Plot the "CRPS" line and confidence interval
  758. geom_line(aes(y = efficacy_mean, color = "efficacy"), size = 1) +
  759. geom_ribbon(aes(ymin = efficacy_mean - efficacy_se,
  760. ymax = efficacy_mean + efficacy_se, fill = "efficacy"),
  761. alpha = 0.2) +
  762. # Labels and scales
  763. labs(x = "RoundID", y = "Value", color = "Legend", fill = "Legend") +
  764. scale_x_continuous(breaks = seq(0, max(exp2_sub_rate_efficacy$RoundID), by = 24)) +
  765. scale_color_manual(values = c("rate" = "#808080", "efficacy" = "#749857")) + # Specify colors
  766. scale_fill_manual(values = c("rate" = "#A9A9A9", "efficacy" = "#749857")) + # Specify fill colors
  767. ylim(0.25, 0.75) +
  768. theme_minimal() +
  769. theme(legend.position = "top")+gg.side # Place the legend at the top
  770. exp2_rate.efficacy_plot
  771. ```
  772. ```{r exp2 efficacy and social comparison}
  773. exp2_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~ age+gender+FeedCode+
  774. (1+FeedCode|SubID),
  775. data = exp2_interval_efficacy, REML=FALSE)
  776. exp2_efficacy.feedback_anova = anova(exp2_efficacy.feedback_lmm)
  777. exp2_efficacy.feedback_anova
  778. summary(exp2_efficacy.feedback_lmm)
  779. exp2_efficacy.feedback_std_ci = model_parameters(
  780. exp2_efficacy.feedback_lmm,
  781. standardize = "refit",
  782. ci_method = "wald",
  783. ci = 0.95,
  784. effects = "all",
  785. iterations = 1000,
  786. summary = getOption("parameters_mixed_summary", FALSE),
  787. digits = 3)
  788. exp2_efficacy.feedback_std_ci
  789. ```
  790. ##Exp2 behavior analysis
  791. ### Exp2 CRPS analysis
  792. ```{r exp2 CRPS and social comparison}
  793. exp2_feedback.CRPS = exp2_interval_CRPS %>%
  794. group_by(SubID) %>%
  795. dplyr::filter(FeedPrev == "1"|FeedPrev == "2") %>%
  796. dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
  797. levels = c("Downward","Upward")))
  798. contrasts(exp2_feedback.CRPS$FeedPrev) = contr.sum
  799. contrasts(exp2_feedback.CRPS$gender) = contr.sum
  800. exp2_feedback.CRPS_lmm = lmerTest::lmer(CRPS~age+gender+FeedPrev+meanCongruency+
  801. (1+FeedPrev+meanCongruency|SubID), exp2_feedback.CRPS, REML=FALSE)
  802. exp2_feedback.CRPS_anova = anova(exp2_feedback.CRPS_lmm)
  803. exp2_feedback.CRPS_anova
  804. summary(exp2_feedback.CRPS_lmm)
  805. exp2_feedback.CRPS_std_ci = model_parameters(
  806. exp2_feedback.CRPS_lmm,
  807. standardize = "refit",
  808. ci_method = "profile",
  809. ci = 0.95,
  810. digits = 3)
  811. exp2_feedback.CRPS_std_ci
  812. ```
  813. ```{r exp2 CRPS and efficacy}
  814. exp2_efficacy.CRPS = exp2_interval_learn %>%
  815. group_by(SubID) %>%
  816. dplyr::group_by(SubID,FeedPrev) %>%
  817. filter(CRPS > mean(CRPS) - 3 * sd(CRPS),
  818. CRPS < mean(CRPS) + 3 * sd(CRPS))
  819. contrasts(exp2_efficacy.CRPS$gender)<-contr.sum
  820. exp2_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~ age+gender+mbased_efficacy_prev+meanCongruency+
  821. (1+mbased_efficacy_prev+meanCongruency|SubID),
  822. data=exp2_efficacy.CRPS, REML=FALSE)
  823. summary(exp2_efficacy.CRPS_lmm)
  824. exp2_efficacy.CRPS_anova = anova(exp2_efficacy.CRPS_lmm)
  825. exp2_efficacy.CRPS_anova
  826. exp2_efficacy.CRPS_std_ci = model_parameters(
  827. exp2_efficacy.CRPS_lmm,
  828. standardize = "refit",
  829. ci_method = "profile",
  830. ci = 0.95,
  831. digits = 3)
  832. exp2_efficacy.CRPS_std_ci
  833. ```
  834. ### Exp2 RT analysis
  835. ```{r exp2 RT and social comparison}
  836. exp2_feedback.RT = exp2_interval_RT %>%
  837. group_by(SubID) %>%
  838. filter(FeedPrev == "1"|FeedPrev == "2") %>%
  839. dplyr::mutate(FeedPrev = factor(recode(FeedPrev,"1" = "Downward", "2" = "Upward"),
  840. levels = c("Downward","Upward")))
  841. contrasts(exp2_feedback.RT$FeedPrev) = contr.sum
  842. contrasts(exp2_feedback.RT$gender) = contr.sum
  843. exp2_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
  844. (1+FeedPrev+meanCongruency|SubID), exp2_feedback.RT, REML=FALSE)
  845. exp2_feedback.RT_anova = anova(exp2_feedback.RT_lmm)
  846. exp2_feedback.RT_anova
  847. summary(exp2_feedback.RT_lmm)
  848. exp2_feedback.RT_std_ci = model_parameters(
  849. exp2_feedback.RT_lmm,
  850. standardize = "refit",
  851. df_method = "satterthwaite",
  852. ci_method = "wald",
  853. ci = 0.95,
  854. effects = "all",
  855. iterations = 1000,
  856. summary = getOption("parameters_mixed_summary", FALSE),
  857. digits = 3)
  858. exp2_feedback.RT_std_ci
  859. ```
  860. ```{r exp2 RT and efficacy}
  861. exp2_efficacy.RT = exp2_interval_learn %>%
  862. group_by(SubID) %>%
  863. dplyr::group_by(SubID,FeedPrev) %>%
  864. filter(meanRT > mean(meanRT) - 3 * sd(meanRT),
  865. meanRT < mean(meanRT) + 3 * sd(meanRT))
  866. contrasts(exp2_efficacy.RT$gender) = contr.sum
  867. exp2_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
  868. (1+mbased_efficacy_prev+meanCongruency|SubID),
  869. data=exp2_efficacy.RT, REML=FALSE)
  870. exp2_efficacy.RT_anova = anova(exp2_efficacy.RT_lmm)
  871. exp2_efficacy.RT_anova
  872. summary(exp2_efficacy.RT_lmm)
  873. exp2_efficacy.RT_std_ci = model_parameters(
  874. exp2_efficacy.RT_lmm,
  875. standardize = "refit",
  876. df_method = "satterthwaite",
  877. ci_method = "wald",
  878. ci = 0.95,
  879. effects = "all",
  880. iterations = 1000,
  881. summary = getOption("parameters_mixed_summary", FALSE),
  882. digits = 3)
  883. exp2_efficacy.RT_std_ci
  884. ```
  885. ###Exp1 LMM power
  886. ```{r exp2 efficacy and behavior power}
  887. ###rate & feedack###
  888. exp2_rate.feedback_lmm = lmerTest::lmer(rate_score ~ age+gender+FeedCode+
  889. (1+FeedCode|SubID),
  890. exp2_interval_efficacy, REML=FALSE)
  891. exp2_rate.feedback_anova = anova(exp2_rate.feedback_lmm)
  892. exp2_rate.feedback_anova
  893. summary(exp2_rate.feedback_lmm)
  894. model_rate_fb_exp2=powerSim(exp2_rate.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  895. ###efficacy & rate###
  896. exp2_efficacy.rate_lmm = lmerTest::lmer(rate_score ~ age+gender+ mbased_efficacy+
  897. (1+mbased_efficacy|SubID),
  898. exp2_interval_efficacy, REML=FALSE)
  899. exp2_efficacy.rate_anova = anova(exp2_efficacy.rate_lmm)
  900. exp2_efficacy.rate_anova
  901. summary(exp2_efficacy.rate_lmm)
  902. model_rate_eff_exp2=powerSim(exp2_efficacy.rate_lmm,fixed("mbased_efficacy", "t"),nsim=1000)
  903. ###efficacy & feedback###
  904. exp2_efficacy.feedback_lmm = lmerTest::lmer(mbased_efficacy ~ age+gender+FeedCode+
  905. (1+FeedCode|SubID),exp2_interval_efficacy, REML=FALSE)
  906. exp2_efficacy.feedback_anova = anova(exp2_efficacy.feedback_lmm)
  907. exp2_efficacy.feedback_anova
  908. summary(exp2_efficacy.feedback_lmm)
  909. model_eff_fb_exp2=powerSim(exp2_efficacy.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  910. # ###CRPS & feedback###
  911. exp2_feedback.CRPS_lmm = lmerTest::lmer(CRPS ~ age+gender+FeedPrev+meanCongruency+
  912. (1+FeedPrev+meanCongruency|SubID),exp2_feedback.CRPS, REML=FALSE)
  913. exp2_feedback.CRPS_anova = anova(exp2_feedback.CRPS_lmm)
  914. exp2_feedback.CRPS_anova
  915. summary(exp2_feedback.CRPS_lmm)
  916. model_CRPS_fb_exp2=powerSim(exp2_feedback.CRPS_lmm,fixed("FeedPrev", "f"),nsim=1000)
  917. ###CRPS & efficacy###
  918. exp2_efficacy.CRPS_lmm =lmerTest::lmer(CRPS ~ age+gender+mbased_efficacy_prev+meanCongruency+
  919. (1+mbased_efficacy_prev+meanCongruency|SubID),
  920. exp2_efficacy.CRPS, REML=FALSE)
  921. exp2_efficacy.CRPS_anova = anova(exp2_efficacy.CRPS_lmm)
  922. exp2_efficacy.CRPS_anova
  923. summary(exp2_efficacy.CRPS_lmm)
  924. model_CRPS_eff_exp2=powerSim(exp2_efficacy.CRPS_lmm,
  925. fixed("mbased_efficacy_prev", "t"),nsim=1000)
  926. # ###RT & feedback###
  927. exp2_feedback.RT_lmm = lmerTest::lmer(meanRT~age+gender+FeedPrev+meanCongruency+
  928. (1+FeedPrev+meanCongruency|SubID),
  929. exp2_feedback.RT, REML=FALSE)
  930. exp2_feedback.RT_anova = anova(exp2_feedback.RT_lmm)
  931. exp2_feedback.RT_anova
  932. summary(exp2_feedback.RT_lmm)
  933. model_RT_fb_exp2=powerSim(exp2_feedback.RT_lmm,fixed("FeedPrev", "f"),nsim=1000)
  934. ###RT & efficacy###
  935. exp2_efficacy.RT_lmm = lmerTest::lmer(meanRT ~ age+gender+mbased_efficacy_prev+meanCongruency+
  936. (1+mbased_efficacy_prev+meanCongruency|SubID),
  937. data = exp2_efficacy.RT, REML=FALSE)
  938. exp2_efficacy.RT_anova = anova(exp2_efficacy.RT_lmm)
  939. exp2_efficacy.RT_anova
  940. summary(exp2_efficacy.RT_lmm)
  941. model_RT_eff_exp2=powerSim(exp2_efficacy.RT_lmm,
  942. fixed("mbased_efficacy_prev", "t"),nsim=1000)
  943. ```
  944. # Exp2 ERP analysis
  945. ```{r import exp2 ERPS data}
  946. ###ERP data##
  947. cue_ERP = read.csv(".../ERP/Cue_alltrial.csv", header = T) %>%
  948. dplyr::select(SubID,RoundID,CNV)
  949. feed_ERP = read.csv(".../ERP/Feed_alltrial.csv", header = T) %>%
  950. dplyr::select(SubID,RoundID,RewP,P3,LPP)
  951. ###ERSP data##
  952. cue_tfa_beta=read_excel(".../Data/ERP/TFAcue_db.xlsx") %>%
  953. dplyr::select(SubID,RoundID,cuebeta)
  954. ###combine data###
  955. exp2_feedERPS_combined = merge(exp2_interval_learn, feed_ERP,by =c("SubID","RoundID"), all = TRUE) %>%
  956. arrange(SubID,RoundID)
  957. exp2_cue_ERSP = merge(cue_ERP,cue_tfa_beta,by =c("SubID","RoundID"), all = TRUE)
  958. exp2_cueERSP_combined = merge(exp2_interval_learn, exp2_cue_ERSP,by =c("SubID","RoundID"), all = TRUE)%>%
  959. arrange(SubID,RoundID)
  960. ```
  961. ```{r import exp2 ERPS data}
  962. exp2_feedERPS_combined$age= as.numeric(exp2_feedERPS_combined$age)
  963. exp2_feedERPS_combined$gender= as.factor(exp2_feedERPS_combined$gender)
  964. exp2_feedERPS_combined$RewP= as.numeric(exp2_feedERPS_combined$RewP)
  965. exp2_feedERPS_combined$P3= as.numeric(exp2_feedERPS_combined$P3)
  966. exp2_feedERPS_combined$LPP= as.numeric(exp2_feedERPS_combined$LPP)
  967. exp2_cueERSP_combined$age= as.numeric(exp2_cueERSP_combined$age)
  968. exp2_cueERSP_combined$mbased_efficacy_prev = as.numeric(exp2_cueERSP_combined$mbased_efficacy_prev)
  969. exp2_cueERSP_combined$gender= as.factor(exp2_cueERSP_combined$gender)
  970. exp2_cueERSP_combined$CNV= as.numeric(exp2_cueERSP_combined$CNV)
  971. exp2_cueERSP_combined$cuebeta= as.numeric(exp2_cueERSP_combined$cuebeta)
  972. exp2_interval_feedERPS = exp2_feedERPS_combined %>%
  973. filter(FeedCode == "1"|FeedCode== "2") %>%
  974. mutate(FeedCode = factor(FeedCode, levels = c("1", "2"),
  975. labels=c("Downward","Upward")))
  976. contrasts(exp2_interval_feedERPS$FeedCode) = contr.sum
  977. contrasts(exp2_interval_feedERPS$gender) = contr.sum
  978. exp2_interval_cueERPS = exp2_cueERSP_combined %>%
  979. filter(FeedPrev == "1"|FeedPrev== "2") %>%
  980. mutate(FeedPrev = factor(FeedPrev, levels = c("1", "2"),
  981. labels=c("Downward","Upward")))
  982. contrasts(exp2_interval_cueERPS$FeedPrev) = contr.sum
  983. contrasts(exp2_interval_cueERPS$gender) = contr.sum
  984. contrasts(exp2_cueERSP_combined$FeedPrev) = contr.sum
  985. contrasts(exp2_cueERSP_combined$gender) = contr.sum
  986. ```
  987. ### Exp2 Feedback phase analysis
  988. ```{r RewP and social comparison lmm}
  989. exp2_RewP.feedback_lmm = lmerTest::lmer(RewP~age+gender+FeedCode+
  990. (1+FeedCode|SubID),exp2_interval_feedERPS, REML=FALSE)
  991. exp2_RewP.feedback_anova = anova(exp2_RewP.feedback_lmm)
  992. exp2_RewP.feedback_anova
  993. summary(exp2_RewP.feedback_lmm )
  994. exp2_RewP.feedback_std_ci = model_parameters(
  995. exp2_RewP.feedback_lmm,
  996. standardize = "refit",
  997. df_method = "satterthwaite",
  998. ci_method = "wald",
  999. ci = 0.95,
  1000. effects = "all",
  1001. iterations = 1000,
  1002. summary = getOption("parameters_mixed_summary", FALSE),
  1003. digits = 3)
  1004. exp2_RewP.feedback_std_ci
  1005. ```
  1006. ```{r RewP and social comparison des}
  1007. exp2_RewP_feedback = exp2_interval_feedERPS %>%
  1008. dplyr::group_by(SubID) %>%
  1009. drop_na(RewP)%>%
  1010. dplyr::group_by(FeedCode) %>%
  1011. dplyr::summarise(RewP_mean = round(mean(RewP),3),
  1012. RewP_sd = round(sd(RewP),3),
  1013. RewP_se=RewP_sd/sqrt(34))
  1014. exp2_RewP_feedback
  1015. ```
  1016. ```{r RewP and social comparison plot}
  1017. exp2_sub_RewP_feedback = exp2_interval_ERPS %>%
  1018. dplyr::group_by(SubID) %>%
  1019. drop_na(RewP)%>%
  1020. dplyr::group_by(SubID, FeedCode) %>%
  1021. dplyr::summarise(RewP_mean = round(mean(RewP),3),
  1022. RewP_sd = round(sd(RewP),3),
  1023. RewP_se=RewP_sd/sqrt(34))
  1024. exp2_RewP.feedback_plot= ggbarplot(exp2_sub_RewP_feedback, x = "FeedCode",
  1025. y = "RewP_mean",
  1026. alpha = 0.6, ylab= "RewP",
  1027. xlab = "Social Comparison",
  1028. color = "black",fill = "FeedCode",
  1029. add = c("mean_se","jitter"),
  1030. add.params = list(color = "FeedCode"),
  1031. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  1032. legend = 'right', position = position_dodge(width =0.4)) +
  1033. scale_y_continuous(breaks = seq(0, 25, by = 5), expand = c(0, 0)) +
  1034. coord_cartesian(ylim = c(0, 28))+
  1035. theme(axis.text = element_text(size = 16, family = "serif"),
  1036. axis.title = element_text(size = 20, family = "serif"))
  1037. exp2_RewP.feedback_plot = ggpar(exp2_RewP.feedback_plot, legend = 'right') +
  1038. theme(legend.text = element_text(size = 12, family = "serif"),
  1039. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  1040. exp2_RewP.feedback_plot
  1041. ```
  1042. ```{r P3 and social comparison lmm}
  1043. exp2_P3.feedback_lmm = lmerTest::lmer(P3~age+gender+FeedCode+
  1044. (1+FeedCode|SubID),exp2_interval_feedERPS, REML=FALSE)
  1045. exp2_P3.efficacy.fd_anova = anova(exp2_P3.feedback_lmm)
  1046. exp2_P3.efficacy.fd_anova
  1047. summary(exp2_P3.feedback_lmm)
  1048. exp2_P3.feedback_std_ci = model_parameters(
  1049. exp2_P3.feedback_lmm,
  1050. standardize = "refit",
  1051. df_method = "satterthwaite",
  1052. ci_method = "wald",
  1053. ci = 0.95,
  1054. effects = "all",
  1055. iterations = 1000,
  1056. summary = getOption("parameters_mixed_summary", FALSE),
  1057. digits = 3)
  1058. exp2_P3.feedback_std_ci
  1059. ```
  1060. ```{r P3 and social comparison des}
  1061. exp2_P3_feedback = exp2_interval_ERPS %>%
  1062. dplyr::group_by(SubID) %>%
  1063. drop_na(P3)%>%
  1064. dplyr::group_by(FeedCode) %>%
  1065. dplyr::summarise(P3_mean = round(mean(P3),3),
  1066. P3_sd = round(sd(P3),3),
  1067. P3_se=P3_sd/sqrt(34))
  1068. exp2_P3_feedback
  1069. ```
  1070. ```{r P3 and social comparison plot}
  1071. exp2_sub_P3_feedback = exp2_interval_ERPS %>%
  1072. dplyr::group_by(SubID) %>%
  1073. drop_na(P3)%>%
  1074. dplyr::group_by(SubID, FeedCode) %>%
  1075. dplyr::summarise(P3_mean = round(mean(P3),3),
  1076. P3_sd = round(sd(P3),3),
  1077. P3_se=P3_sd/sqrt(34))
  1078. exp2_P3.feedback_plot= ggbarplot(exp2_sub_P3_feedback, x = "FeedCode",
  1079. y = "P3_mean",
  1080. alpha = 0.6, ylab= "P3",
  1081. xlab = "Social Comparison",
  1082. color = "black",fill = "FeedCode",
  1083. add = c("mean_se","jitter"),
  1084. add.params = list(color = "FeedCode"),
  1085. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  1086. legend = 'right', position = position_dodge(width =0.4)) +
  1087. scale_y_continuous(breaks = seq(0, 25, by = 5), expand = c(0, 0)) +
  1088. coord_cartesian(ylim = c(0, 27))+
  1089. theme(axis.text = element_text(size = 16, family = "serif"),
  1090. axis.title = element_text(size = 20, family = "serif"))
  1091. exp2_P3.feedback_plot = ggpar(exp2_P3.feedback_plot, legend = 'right') +
  1092. theme(legend.text = element_text(size = 12, family = "serif"),
  1093. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  1094. exp2_P3.feedback_plot
  1095. ```
  1096. ```{r LPP and social comparison lmm}
  1097. exp2_LPP.feedback_lmm = lmerTest::lmer(LPP~age+gender+FeedCode+
  1098. (1+FeedCode|SubID),
  1099. exp2_interval_feedERPS, REML=FALSE)
  1100. exp2_LPP.feedback_anova = anova(exp2_LPP.feedback_lmm)
  1101. exp2_LPP.feedback_anova
  1102. summary(exp2_LPP.feedback_lmm)
  1103. exp2_LPP.feedback_std_ci = model_parameters(
  1104. exp2_LPP.feedback_lmm,
  1105. standardize = "refit",
  1106. df_method = "satterthwaite",
  1107. ci_method = "wald",
  1108. ci = 0.95,
  1109. effects = "all",
  1110. iterations = 1000,
  1111. summary = getOption("parameters_mixed_summary", FALSE),
  1112. digits = 3)
  1113. exp2_LPP.feedback_std_ci
  1114. ```
  1115. ```{r LPP and social comparison des}
  1116. exp2_LPP_feedback = exp2_interval_feedERPS %>%
  1117. dplyr::group_by(SubID) %>%
  1118. drop_na(LPP)%>%
  1119. dplyr::group_by(FeedCode) %>%
  1120. dplyr::summarise(LPP_mean = round(mean(LPP),3),
  1121. LPP_sd = round(sd(LPP),3),
  1122. LPP_se=LPP_sd/sqrt(34))
  1123. exp2_LPP_feedback
  1124. ```
  1125. ```{r LPP and social comparison plot}
  1126. exp2_sub_LPP_feedback = exp2_interval_ERPS %>%
  1127. dplyr::group_by(SubID) %>%
  1128. drop_na(LPP)%>%
  1129. dplyr::group_by(SubID, FeedCode) %>%
  1130. dplyr::summarise(LPP_mean = round(mean(LPP),3),
  1131. LPP_sd = round(sd(LPP),3),
  1132. LPP_se=LPP_sd/sqrt(34))
  1133. exp2_LPP.feedback_plot= ggbarplot(exp2_sub_LPP_feedback, x = "FeedCode",
  1134. y = "LPP_mean",
  1135. alpha = 0.6, ylab= "LPP",
  1136. xlab = "Social Comparison",
  1137. color = "black",fill = "FeedCode",
  1138. add = c("mean_se","jitter"),
  1139. add.params = list(color = "FeedCode"),
  1140. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  1141. legend = 'right', position = position_dodge(width =0.4)) +
  1142. scale_y_continuous(breaks = seq(-4, 10, by = 2), expand = c(0, 0)) +
  1143. coord_cartesian(ylim = c(-5, 11))+
  1144. theme(axis.text = element_text(size = 16, family = "serif"),
  1145. axis.title = element_text(size = 20, family = "serif"))
  1146. exp2_LPP.feedback_plot = ggpar(exp2_LPP.feedback_plot, legend = 'right') +
  1147. theme(legend.text = element_text(size = 12, family = "serif"),
  1148. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  1149. exp2_LPP.feedback_plot
  1150. ```
  1151. ```{r feedback power}
  1152. exp2_RewP.feedback_lmm = lmerTest::lmer(RewP~age+gender+FeedCode+
  1153. (1+FeedCode|SubID),exp2_interval_feedERPS, REML=FALSE)
  1154. summary(exp2_RewP.feedback_lmm )
  1155. modelRewP=powerSim(exp2_RewP.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  1156. exp2_P3.feedback_lmm = lmerTest::lmer(P3~age+gender+FeedCode+
  1157. (1+FeedCode|SubID),exp2_interval_ERPS, REML=FALSE)
  1158. summary(exp2_P3.feedback_lmm)
  1159. modelP3=powerSim(exp2_P3.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  1160. exp2_LPP.feedback_lmm = lmerTest::lmer(LPP~age+gender+FeedCode+
  1161. (1+FeedCode|SubID),
  1162. exp2_interval_ERPS, REML=FALSE)
  1163. summary(exp2_LPP.feedback_lmm)
  1164. modelLPP=powerSim(exp2_LPP.feedback_lmm,fixed("FeedCode", "f"),nsim=1000)
  1165. ```
  1166. ##Exp2 Cue pahse analysis
  1167. ```{r CNV and social comparison}
  1168. exp2_CNV.feedback_lmm = lmerTest::lmer(CNV~age+gender+FeedPrev+
  1169. (1+FeedPrev|SubID),
  1170. exp2_interval_cueERPS, REML=FALSE)
  1171. exp2_CNV.feedback_anova = anova(exp2_CNV.feedback_lmm)
  1172. exp2_CNV.feedback_anova
  1173. summary(exp2_CNV.feedback_lmm)
  1174. exp2_CNV.feedback_std_ci = model_parameters(
  1175. exp2_CNV.feedback_lmm,
  1176. standardize = "refit",
  1177. df_method = "satterthwaite",
  1178. ci_method = "wald",
  1179. ci = 0.95,
  1180. effects = "all",
  1181. iterations = 1000,
  1182. summary = getOption("parameters_mixed_summary", FALSE),
  1183. digits = 3)
  1184. exp2_CNV.feedback_std_ci
  1185. ```
  1186. ```{r CNV and social comparison des}
  1187. exp2_CNV_feedback = exp2_interval_cueERPS %>%
  1188. dplyr::group_by(SubID) %>%
  1189. drop_na(CNV)%>%
  1190. dplyr::group_by(FeedPrev) %>%
  1191. dplyr::summarise(CNV_mean = round(mean(CNV),3),
  1192. CNV_sd = round(sd(CNV),3),
  1193. CNV_se = CNV_sd/sqrt(34))
  1194. exp2_CNV_feedback
  1195. ```
  1196. ```{r CNV and social comparison plot}
  1197. exp2_sub_CNV_feedback = exp2_interval_cueERPS %>%
  1198. dplyr::group_by(SubID) %>%
  1199. drop_na(CNV)%>%
  1200. dplyr::group_by(SubID, FeedPrev) %>%
  1201. dplyr::summarise(CNV_mean = round(mean(CNV),3),
  1202. CNV_sd = round(sd(CNV),3),
  1203. CNV_se = CNV_sd/sqrt(34))
  1204. exp2_CNV.feedback_plot= ggbarplot(exp2_sub_CNV_feedback, x = "FeedPrev",
  1205. y = "CNV_mean", alpha = 0.6,
  1206. ylab= "CNV", xlab = "Social Comparison",
  1207. color = "black",fill = "FeedPrev",
  1208. add = c("mean_se","jitter"),
  1209. add.params = list(color = "FeedPrev"),
  1210. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  1211. legend = 'right', position = position_dodge(width =0.4))+
  1212. scale_y_continuous(breaks = seq(-8, 8, by = 2), expand = c(0, 0)) +
  1213. coord_cartesian(ylim = c(-7.5, 7.5))+
  1214. theme(axis.text = element_text(size = 16, family = "serif"),
  1215. axis.title = element_text(size = 20, family = "serif"))
  1216. exp2_CNV.feedback_plot = ggpar(exp2_CNV.feedback_plot, legend = 'right') +
  1217. theme(legend.text = element_text(size = 12, family = "serif"),
  1218. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  1219. exp2_CNV.feedback_plot
  1220. ```
  1221. ```{r CNV and efficacy}
  1222. exp2_CNV.efficacy_lmm = lmerTest::lmer(CNV~gender+mbased_efficacy_prev+
  1223. (1+mbased_efficacy_prev|SubID),
  1224. exp2_interval_cueERPS, REML=FALSE)
  1225. exp2_CNV.efficacy_anova = anova(exp2_CNV.efficacy_lmm)
  1226. exp2_CNV.efficacy_anova
  1227. summary(exp2_CNV.efficacy_lmm)
  1228. exp2_CNV.efficacy_std_ci = model_parameters(
  1229. exp2_CNV.efficacy_lmm,
  1230. standardize = "refit",
  1231. df_method = "satterthwaite",
  1232. ci_method = "wald",
  1233. ci = 0.95,
  1234. effects = "all",
  1235. iterations = 1000,
  1236. summary = getOption("parameters_mixed_summary", FALSE),
  1237. digits = 3)
  1238. exp2_CNV.efficacy_std_ci
  1239. ```
  1240. ```{r CNV and efficacy plot}
  1241. eff_df3 <- Effect(c("mbased_efficacy_prev"), exp2_CNV.efficacy_lmm,
  1242. xlevels = list(mbased_efficacy_prev = seq(min(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE),
  1243. max(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE), 0.1)))
  1244. exp2.CNV.efficacy <- as.data.frame(eff_df3)
  1245. head(exp2.CNV.efficacy)
  1246. len3 <- length(exp2.CNV.efficacy$mbased_efficacy_prev)
  1247. exp2.plot.CNV.efficacy <-
  1248. ggplot() +
  1249. geom_line(data = exp2.CNV.efficacy,
  1250. aes(x = mbased_efficacy_prev, y = fit, color = "S"),
  1251. color = "#F8766D", size = 1, linetype = 1) +
  1252. geom_ribbon(data = exp2.CNV.efficacy,
  1253. aes(x = mbased_efficacy_prev, ymax = fit + se, ymin = fit - se),
  1254. fill = "#F8766D", alpha = 0.1, inherit.aes = FALSE) +
  1255. gg.side +
  1256. scale_y_continuous(breaks = scales::breaks_width(1))
  1257. xmax <- max(exp2.CNV.efficacy$mbased_efficacy_prev, na.rm = TRUE)
  1258. exp2.plot.CNV.efficacy <- exp2.plot.CNV.efficacy +
  1259. coord_cartesian(xlim = c(0, xmax))
  1260. exp2.plot.CNV.efficacy
  1261. ```
  1262. ```{r CNV and effort}
  1263. exp2_CNV.CRPS_lmm = lmerTest::lmer(CRPS~age+gender+mbased_efficacy_prev+CNV+
  1264. (1+mbased_efficacy_prev+CNV|SubID),
  1265. exp2_interval_cueERPS, REML=FALSE)
  1266. exp2_CNV.CRPS_anova = anova(exp2_CNV.CRPS_lmm)
  1267. exp2_CNV.CRPS_anova
  1268. summary(exp2_CNV.CRPS_lmm)
  1269. exp2_CNV.CRPS_std_ci = model_parameters(
  1270. exp2_CNV.CRPS_lmm,
  1271. standardize = "refit",
  1272. df_method = "satterthwaite",
  1273. ci_method = "wald",
  1274. ci = 0.95,
  1275. effects = "all",
  1276. iterations = 1000,
  1277. summary = getOption("parameters_mixed_summary", FALSE),
  1278. digits = 3)
  1279. exp2_CNV.CRPS_std_ci
  1280. ```
  1281. ```{r Cuebeta and social comparison}
  1282. exp2_Cuebeta.fd_lmm = lmerTest::lmer(cuebeta~age+gender+FeedPrev+(1+FeedPrev|SubID),
  1283. exp2_interval_cueERPS, REML=FALSE)
  1284. exp2_Cuebeta.fd_anova = anova(exp2_Cuebeta.fd_lmm)
  1285. exp2_Cuebeta.fd_anova
  1286. summary(exp2_Cuebeta.fd_lmm)
  1287. exp2_Cuebeta.fd_std_ci = model_parameters(
  1288. exp2_Cuebeta.fd_lmm,
  1289. standardize = "refit",
  1290. df_method = "satterthwaite",
  1291. ci_method = "wald",
  1292. ci = 0.95,
  1293. effects = "all",
  1294. iterations = 1000,
  1295. summary = getOption("parameters_mixed_summary", FALSE),
  1296. digits = 3)
  1297. exp2_Cuebeta.fd_std_ci
  1298. ```
  1299. ```{r Cuebeta and social comparison des}
  1300. exp2_Cuebeta_feedback = exp2_interval_cueERPS %>%
  1301. dplyr::group_by(SubID) %>%
  1302. drop_na(cuebeta)%>%
  1303. dplyr::group_by(FeedPrev) %>%
  1304. dplyr::summarise(cuebeta_mean = round(mean(cuebeta),3),
  1305. cuebeta_sd = round(sd(cuebeta),3),
  1306. cuebeta_se=cuebeta_sd/sqrt(34))
  1307. exp2_Cuebeta_feedback
  1308. ```
  1309. ```{r Cuebeta and social comparison plot}
  1310. exp2_sub_cue_feedback = exp2_interval_cueERPS %>%
  1311. dplyr::group_by(SubID) %>%
  1312. drop_na(cuebeta)%>%
  1313. dplyr::group_by(SubID,FeedPrev) %>%
  1314. dplyr::summarise(cuebeta_mean = round(mean(cuebeta),3),
  1315. cuebeta_sd = round(sd(cuebeta),3),
  1316. cuebeta_se=cuebeta_sd/sqrt(34))
  1317. exp2_cuebeta.feedback.plot = ggbarplot(exp2_sub_cue_feedback, x = "FeedPrev",
  1318. y = "cuebeta_mean", alpha = 0.6,
  1319. ylab= "cuebeta", xlab = "Social Comparison",
  1320. color = "black",fill = "FeedPrev",
  1321. add = c("mean_se","jitter"),
  1322. add.params = list(color = "FeedPrev"),
  1323. palette =c("#1b7c3d","#2b6a99"),width = 0.4,
  1324. legend = 'right', position = position_dodge(width =0.4)) +
  1325. scale_y_continuous(
  1326. breaks = seq(-1.5, 1.5, by = 0.5),
  1327. labels = scales::number_format(accuracy = 0.1)
  1328. ) +
  1329. coord_cartesian(ylim = c(-1.5, 1.5))+
  1330. theme(axis.text = element_text(size = 16, family = "serif"),
  1331. axis.title = element_text(size = 20, family = "serif"))
  1332. exp2_cuebeta.feedback.plot = ggpar(exp2_cuebeta.feedback.plot, legend = 'right') +
  1333. theme(legend.text = element_text(size = 12, family = "serif"),
  1334. legend.title = element_text(size = 14, family = "serif", face = "bold"))
  1335. exp2_cuebeta.feedback.plot
  1336. ```
  1337. ```{r Cuebeta and efficacy}
  1338. exp2_Cuebeta.efficacy_lmm = lmerTest::lmer(cuebeta~age+gender+mbased_efficacy_prev+
  1339. (1+mbased_efficacy_prev|SubID),exp2_interval_cueERPS, REML=FALSE)
  1340. exp2_Cuebeta.efficacy_anova = anova(exp2_Cuebeta.efficacy_lmm)
  1341. exp2_Cuebeta.efficacy_anova
  1342. summary(exp2_Cuebeta.efficacy_lmm)
  1343. exp2_Cuebeta.efficacy_std_ci = model_parameters(
  1344. exp2_Cuebeta.efficacy_lmm,
  1345. standardize = "refit",
  1346. df_method = "satterthwaite",
  1347. ci_method = "wald",
  1348. ci = 0.95,
  1349. effects = "all",
  1350. iterations = 1000,
  1351. summary = getOption("parameters_mixed_summary", FALSE),
  1352. digits = 3)
  1353. exp2_Cuebeta.efficacy_std_ci
  1354. ```
  1355. ```{r Cuebeta and efficacy plot}
  1356. eff_df4 <- Effect(c("mbased_efficacy_prev"), exp2_Cuebeta.efficacy_lmm,
  1357. xlevels = list(mbased_efficacy_prev = seq(min(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE),
  1358. max(exp2_interval_cueERPS$mbased_efficacy_prev, na.rm = TRUE), 0.1)))
  1359. exp2.Cuebeta.efficacy <- as.data.frame(eff_df4)
  1360. head(exp2.Cuebeta.efficacy)
  1361. len4<-length(exp2_interval_cueERPS$mbased_efficacy_prev)
  1362. exp2.plot.Cuebeta.efficacy <- ggplot()+
  1363. geom_line(data=exp2.Cuebeta.efficacy, aes(x=mbased_efficacy_prev, y=fit,color="S"),color="#F8766D",size=1,linetype=1)+
  1364. geom_ribbon(data=exp2.Cuebeta.efficacy, aes(x=mbased_efficacy_prev, max = fit + se, min = fit- se),
  1365. fill = "#F8766D",alpha=0.1, inherit.aes = FALSE)+gg.side
  1366. xmax <- max(exp2.Cuebeta.efficacy$mbased_efficacy_prev, na.rm = TRUE)
  1367. exp2.plot.Cuebeta.efficacy <- exp2.plot.Cuebeta.efficacy +
  1368. coord_cartesian(xlim = c(0, xmax))
  1369. exp2.plot.Cuebeta.efficacy
  1370. ```
  1371. ```{r cue power}
  1372. exp2_CNV.feedback_lmm = lmerTest::lmer(CNV~age+gender+FeedPrev+
  1373. (1+FeedPrev|SubID),
  1374. exp2_interval_cueERPS, REML=FALSE)
  1375. summary(exp2_CNV.feedback_lmm)
  1376. modelCNV=powerSim(exp2_CNV.feedback_lmm,fixed("FeedPrev", "f"),nsim=1000)
  1377. exp2_CNV.efficacy_lmm = lmerTest::lmer(CNV~age+gender+mbased_efficacy_prev+
  1378. (1+mbased_efficacy_prev|SubID),
  1379. exp2_interval_cueERPS, REML=FALSE)
  1380. summary(exp2_CNV.efficacy_lmm)
  1381. model_eff_CNV=powerSim(exp2_CNV.efficacy_lmm,fixed("mbased_efficacy_prev", "f"),nsim=1000)
  1382. exp2_Cuebeta.fd_lmm = lmerTest::lmer(cuebeta~age+gender+FeedPrev+(1+FeedPrev|SubID),
  1383. exp2_interval_cueERPS, REML=FALSE)
  1384. summary(exp2_Cuebeta.fd_lmm)
  1385. modelCuebeta=powerSim(exp2_Cuebeta.fd_lmm,fixed("FeedPrev", "f"),nsim=1000)
  1386. exp2_Cuebeta.efficacy_lmm = lmerTest::lmer(cuebeta~age+gender+mbased_efficacy_prev+
  1387. (1+mbased_efficacy_prev|SubID),
  1388. exp2_interval_cueERPS, REML=FALSE)
  1389. summary(exp2_Cuebeta.efficacy_lmm)
  1390. model_eff_Cuebeta=powerSim(exp2_Cuebeta.efficacy_lmm,fixed("mbased_efficacy_prev", "f"),nsim=1000)
  1391. ```
  1392. # Exp1 and Exp2 hddm
  1393. ## Exp1 hddm analysis
  1394. ```{r exp1 social comaprison hddm,echo = FALSE}
  1395. ###model1 social comparison feedback ###
  1396. exp1_feedback.hddm = read.csv('.../HDDM/exp1_feedback_cong_traces7000.csv')
  1397. exp1_feedback.traces = exp1_feedback.hddm %>%
  1398. dplyr::select(v_Intercept,v_Feed.T.up.,
  1399. a_Intercept,a_Feed.T.up.)%>%
  1400. dplyr::rename(v_upward = v_Intercept,
  1401. v_diff = v_Feed.T.up.,
  1402. a_upward = a_Intercept,
  1403. a_diff = a_Feed.T.up.)%>%
  1404. mutate(v_downward = v_diff+ v_upward,
  1405. a_downward = a_diff + a_upward)
  1406. # Add the posterior probabilities
  1407. exp1_feedback_hypotheses = list(
  1408. t1 = hypothesis(exp1_feedback.traces, "v_downward > v_upward"),
  1409. t2 = hypothesis(exp1_feedback.traces, "a_downward < a_upward"))
  1410. exp1_feedback.hddm.results = data.frame(
  1411. test = c("v_downward > v_upward",
  1412. "a_downward < a_upward"),
  1413. Post.Prob = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$Post.Prob),
  1414. estimate = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$Estimate),
  1415. ci.lower = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$CI.Lower),
  1416. ci.upper = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$CI.Upper),
  1417. est.error = sapply(exp1_feedback_hypotheses, function(x) x$hypothesis$Est.Error))
  1418. exp1_feedback.hddm.results
  1419. ```
  1420. ```{r exp1 social comaprison hddm plot}
  1421. exp1_feedback.plot = bind_rows(
  1422. exp1_feedback.traces %>%
  1423. mutate(diff = v_diff,
  1424. Category = 'v')%>%
  1425. dplyr::select(diff,Category),
  1426. exp1_feedback.traces %>%
  1427. mutate(diff = a_diff,
  1428. Category = 'a')%>%
  1429. dplyr::select(diff,Category),
  1430. )
  1431. exp1_feedback.hddm=ggplot(exp1_feedback.plot, aes(x = diff, fill = Category)) +
  1432. geom_density(alpha = 0.4, aes(color = Category)) +
  1433. scale_fill_manual(values = c('#24A669', '#BF6B82')) +
  1434. scale_color_manual(values = c('#24A669', '#BF6B82'))+
  1435. labs(x = 'Social', y = 'Density')+gg.side
  1436. exp1_feedback.hddm
  1437. ```
  1438. ```{r exp1 efficacy hddm,echo = FALSE}
  1439. ###model2 efficacy ###
  1440. exp1_efficacy.hddm = read.csv(".../HDDM/exp1_efficacy_traces.csv")
  1441. exp1_efficacy.traces<-exp1_efficacy.hddm %>%
  1442. dplyr::select(v_Intercept,
  1443. v_mbased_efficacy_prev,
  1444. a_Intercept,
  1445. a_mbased_efficacy_prev)
  1446. # Add the posterior probabilities
  1447. exp1_efficacy_hypotheses = list(
  1448. t1 = hypothesis(exp1_efficacy.traces, "v_Intercept < 0"),
  1449. t2 = hypothesis(exp1_efficacy.traces, "v_mbased_efficacy_prev > 0"),
  1450. t3 = hypothesis(exp1_efficacy.traces, "a_Intercept > 0"),
  1451. t4 = hypothesis(exp1_efficacy.traces, "a_mbased_efficacy_prev < 0"))
  1452. exp1_efficacy.hddm.results = data.frame(
  1453. test = c("v_Intercept < 0",
  1454. "v_mbased_efficacy_prev > 0",
  1455. "a_Intercept > 0",
  1456. "a_mbased_efficacy_prev < 0"),
  1457. Post.Prob = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$Post.Prob),
  1458. estimate = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$Estimate),
  1459. ci.lower = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$CI.Lower),
  1460. ci.upper = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$CI.Upper),
  1461. est.error = sapply(exp1_efficacy_hypotheses, function(x) x$hypothesis$Est.Error))
  1462. exp1_efficacy.hddm.results
  1463. ```
  1464. ```{r exp1 efficacy hddm plot}
  1465. exp1_efficacy.plot = bind_rows(
  1466. exp1_efficacy.traces %>%
  1467. dplyr::mutate(Intercept = v_Intercept,
  1468. mbased_efficacy = v_mbased_efficacy_prev,
  1469. Category = 'v')%>%
  1470. dplyr::select(Intercept,mbased_efficacy,Category),
  1471. exp1_efficacy.traces %>%
  1472. dplyr::mutate(Intercept = a_Intercept,
  1473. mbased_efficacy = a_mbased_efficacy_prev,
  1474. Category = 'a')%>%
  1475. dplyr::select(Intercept,mbased_efficacy,Category),
  1476. )
  1477. exp1_efficacy.hddm=ggplot(exp1_efficacy.plot, aes(x = mbased_efficacy, fill = Category)) +
  1478. geom_density(alpha = 0.4, aes(color = Category)) +
  1479. scale_fill_manual(values = c('#24A669', '#BF6B82')) +
  1480. scale_color_manual(values = c('#24A669', '#BF6B82')) +
  1481. labs(x = 'Efficacy', y = 'Density')+gg.side
  1482. exp1_efficacy.hddm
  1483. ```
  1484. ## Exp2 hddm analysis
  1485. ```{r exp2 social comparison hddm}
  1486. ###model1 social comparison feedback ###
  1487. exp2_feedback.hddm = read.csv(".../HDDM/exp2_feedback_cong_traces7000.csv")
  1488. exp2_feedback.traces = exp2_feedback.hddm %>%
  1489. dplyr::select(v_Intercept,v_Feed.T.down.,
  1490. a_Intercept,a_Feed.T.down.)%>%
  1491. dplyr::rename(v_diff = v_Feed.T.down.,
  1492. v_downward = v_Intercept,
  1493. a_diff = a_Feed.T.down.,
  1494. a_downward = a_Intercept)%>%
  1495. mutate(v_upward = v_downward + v_diff,
  1496. a_upward = a_downward + a_diff)
  1497. # Add the posterior probabilities
  1498. exp2_feedback_hypotheses = list(
  1499. t1 = hypothesis(exp2_feedback.traces, "v_downward > v_upward"),
  1500. t2 = hypothesis(exp2_feedback.traces, "a_downward < a_upward"))
  1501. exp2_feedback.hddm.results = data.frame(
  1502. test = c("v_downward > v_upward",
  1503. "a_downward < a_upward"),
  1504. Post.Prob = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$Post.Prob),
  1505. estimate = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$Estimate),
  1506. ci.lower = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$CI.Lower),
  1507. ci.upper = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$CI.Upper),
  1508. est.error = sapply(exp2_feedback_hypotheses, function(x) x$hypothesis$Est.Error))
  1509. exp2_feedback.hddm.results
  1510. ```
  1511. ```{r exp2 efficacy hddm}
  1512. ###model1 efficacy ###
  1513. exp2_efficacy.hddm = read.csv(".../HDDM/exp2_efficacy_traces.csv")
  1514. exp2_efficacy.traces = exp2_efficacy.hddm %>%
  1515. dplyr::select(v_Intercept,
  1516. v_mbased_efficacy_prev,
  1517. a_Intercept,
  1518. a_mbased_efficacy_prev)
  1519. # Add the posterior probabilities
  1520. exp2_efficacy_hypotheses = list(
  1521. t1 = hypothesis(exp2_efficacy.traces, "v_Intercept < 0"),
  1522. t2 = hypothesis(exp2_efficacy.traces, "v_mbased_efficacy_prev > 0"),
  1523. t3 = hypothesis(exp2_efficacy.traces, "a_Intercept > 0"),
  1524. t4 = hypothesis(exp2_efficacy.traces, "a_mbased_efficacy_prev < 0"))
  1525. exp2_efficacy.hddm.results = data.frame(
  1526. test = c("v_Intercept < 0",
  1527. "v_mbased_efficacy_prev > 0",
  1528. "a_Intercept > 0",
  1529. "a_mbased_efficacy_prev < 0"),
  1530. Post.Prob = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$Post.Prob),
  1531. estimate = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$Estimate),
  1532. ci.lower = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$CI.Lower),
  1533. ci.upper = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$CI.Upper),
  1534. est.error = sapply(exp2_efficacy_hypotheses, function(x) x$hypothesis$Est.Error))
  1535. exp2_efficacy.hddm.results
  1536. ```
  1537. ```{r LOOIC plot}
  1538. df1 <- tribble(
  1539. ~Model, ~dLOOIC,
  1540. "Intercept", 552.194,
  1541. "1LR", 287.183,
  1542. "2LR", 0
  1543. ) %>%
  1544. mutate(Model = factor(Model, levels = c("2LR","1LR","Intercept")))
  1545. p1 <- ggplot(df1, aes(x = Model, y = dLOOIC)) +
  1546. geom_col(width = 0.7) +
  1547. geom_text(aes(label = sprintf("%.1f", dLOOIC)),
  1548. vjust = -0.3, size = 3) +
  1549. labs(x = NULL, y = "ΔLOOIC (best model = 0; lower is better)") +
  1550. theme_classic() +
  1551. coord_cartesian(ylim = c(0, max(df1$dLOOIC) * 1.15))+gg.side
  1552. p1
  1553. ```

analysis_HB_scripts.Rmd, no license · at the source

Overview

Authors: Jiarui Dong1,2, Yachao Rong3, Shengjie Ma1,2, Yang Xu1,2, Ping Wei1,2
ORCID iDs: Yang Xu, Ping Wei
  1. School of Psychology, Capital Normal University,Beijing, China
  2. Beijing Key Laboratory of Learning and Cognition, Capital Normal University,Beijing, China
  3. Faculty of Education, Henan Normal University,Xinxiang, China
Institutions: Capital Normal University (China); Henan Normal University (China)
Journal: Communications biology, volume 9, issue 1, article 984
Dates: received 30 September 2025; accepted 28 April 2026; published online 9 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s42003-026-10229-5 · PMID 42106486 · PMCID PMC13381887 · OpenAlex W7160691893
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism)
Methods: Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, Preprocessing, Evoked potentials, fMRI & imaging, Physiology & signal measures
Keywords: Human behaviour, Social neuroscience
MeSH: Social Comparison*, Computer Simulation, Contingent Negative Variation, Electroencephalography, Female, Humans, Male, Reward, Self Efficacy (* major topic)
Topic: Neural and Behavioral Psychology Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: National Natural Science Foundation of China (National Science Foundation of China) (32471105, 31971030); Youth Beijing Scholar Program of Beijing Government
Citations: cited by 1 paper (Europe PMC); 74 references in the paper

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

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Languages: R (1)
Size: 20 files, 1 script
Software Heritage: not checked
Found in: “Code availability”
Holds: 1 notebook
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: afex (1 file), brms (1 file), easystats (1 file), emmeans (1 file), ggplot2 (1 file), ggpubr (1 file), lmerTest (1 file), psych (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
1 file
At the source:

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://doi.org/10.1038/s42003-026-10229-5

BibTeX

@article{dong2026neurocomputational,
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/s42003-026-10229-5},
url = {https://doi.org/10.1038/s42003-026-10229-5},
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/05/09
VL - 9
IS - 1
SP - 984
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/s42003-026-10229-5
UR - https://doi.org/10.1038/s42003-026-10229-5
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s42003-026-10229-5",
"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": "Commun Biol",
"volume": "9",
"issue": "1",
"page": "984",
"DOI": "10.1038/s42003-026-10229-5",
"PMID": "42106486",
"PMCID": "PMC13381887",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s42003-026-10229-5",
"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 biology
In 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 America
In 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: NeuroImage
In 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: eLife
In 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 America
In 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 psychiatry
In 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 one
In 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 reports
In 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 advances
In 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.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

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.