OSCR

Effort produces after-effects costly for others but valued for self.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

One block of code here has a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 1 match
  1. [1] § Materials and methods › Data analysis ↔ Scripts/Data_analysis.R, lines 298 to 369 · score 0.60 · button presses, response speed, lme4, scored, pairwise, prosocial decision · block oscr:b:MTFD871WP3JS0-T · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 372 lines · 17 KB · no license · 1 match

  1. # load library packages
  2. if (!require("pacman")) install.packages("pacman")
  3. pacman::p_load(dplyr, MASS, psych, R.matlab, sjPlot, emmeans, lme4, lmerTest,
  4. ggplot2, tidyverse, readxl, ggeffects, rstatix, ggpubr)
  5. rm(list=ls()) # Clear environment
  6. ## specify your working directory ##
  7. setwd("/Users/yazheng/Documents/Papers/2_UnderReview/ProsocialEffort_EEG/SecondVersion/OSF/Data/")
  8. # Helper function: Check convergence (Recommended by Ben Bolker)
  9. didLmerConverge = function(lmerModel){
  10. relativeMaxGradient=signif(max(abs(with(lmerModel@optinfo$derivs,solve(Hessian,gradient)))),3)
  11. if (relativeMaxGradient < 0.001) {
  12. cat(sprintf("\tThe relative maximum gradient of %s is less than our 0.001 criterion.\n\tYou can safely ignore any warnings about a claimed convergence failure.\n\n", relativeMaxGradient))
  13. }
  14. else {
  15. cat(sprintf("The relative maximum gradient of %s exceeds our 0.001 criterion.\nThis looks like a real convergence failure; maybe try simplifying your model?\n\n", relativeMaxGradient))
  16. }
  17. }
  18. # Helper function: Calculate percentage of variance explained by random effects (SVD)
  19. svd_lmer = function(lmerModel){
  20. sv1_max <- svd(getME(lmerModel, "Tlist")[[1]])
  21. sv1_max$d
  22. svdValue = round(sv1_max$d^2/sum(sv1_max$d^2)*100, 2)
  23. cat("The percetage of explained variances by random effects are", svdValue)
  24. }
  25. ######################### load and clean all data #################################
  26. # Subjects to be excluded based on exclusion criteria desribed in the manuscript
  27. exclude_subs=c(129,143,111,119,154,163,134)
  28. # load data of the prosocial effort task----
  29. # load behavioral data
  30. a2= read_xlsx('Behavior/prosocial_effort_data.xlsx')
  31. # load EEG data
  32. channels <- c('FP1', 'FP2', 'F7', 'F3', 'FZ', 'F4', 'F8', 'FT7', 'FC3', 'FCZ',
  33. 'FC4', 'FT8', 'T7', 'C3', 'CZ', 'C4', 'T8', 'CP3', 'CPZ', 'CP4',
  34. 'P7', 'P3', 'PZ', 'P4', 'P8', 'O1', 'OZ', 'O2')
  35. # Performance markers
  36. Performmks = readMat('EEG/Perform_mks.mat')
  37. PstimType <- Performmks$Performmks %>% as.data.frame()
  38. colnames(PstimType) <- c('Subject','stimType')
  39. a2$Pfmmks<-PstimType$stimType
  40. # Feedback markers
  41. FBmks = readMat('EEG/FB_mks.mat')
  42. FBstimType <- FBmks$FBmks %>% as.data.frame()
  43. colnames(FBstimType) <- c('Subject','stimType')
  44. a2$FBmks<-FBstimType$stimType
  45. # Load performance-p3
  46. PerformP3 = as.data.frame(readMat('EEG/PerformP3300440.mat')$PerformP3)
  47. colnames(PerformP3) <- channels
  48. a2$PerformP3 <- apply(cbind (PerformP3$P3,PerformP3$PZ,PerformP3$P4),1, mean)
  49. # Load FRN (i.e., RewP) data
  50. FRN = as.data.frame(readMat('EEG/FRN300400.mat')$FRN)
  51. colnames(FRN) <- channels
  52. a2$FRN <- apply(cbind (FRN$FCZ,FRN$FC3,FRN$FC4),1, mean)
  53. # data preparation for the prosocial effort task
  54. # Delete seven subjects
  55. a2 <- a2[!a2$Subject%in%exclude_subs,]
  56. # Setup variables
  57. a2 <- a2 %>%
  58. mutate(
  59. IsSuccess = as.numeric(!Pfmmks %in% c(7, 8)),
  60. Feedback = ifelse(FB == "ü", "Good", "Bad"),
  61. Valence = case_when(RewardType %in% c(0.2,0.4,0.6,0.8,1) ~ "Gain",
  62. RewardType == 0 ~ "NoGain") ) %>%
  63. rename(Magnitude = PreReward,
  64. Num = Effort,
  65. Effort = EffortLevel) %>%
  66. mutate(
  67. Effort = case_when(Effort == 1 ~ 2,
  68. Effort == 2 ~ 3,
  69. Effort == 3 ~ 4,
  70. Effort == 4 ~ 5,
  71. Effort == 5 ~ 6),
  72. zEffort = as.vector(scale(Effort)),
  73. zMagnitude = as.vector(scale(Magnitude))
  74. )
  75. # Compute response speed: button presses per second
  76. a2 <- a2 %>% mutate( PressNum = case_when(
  77. Effort == 2 ~ MeanMaxNum*0.1,
  78. Effort == 3 ~ MeanMaxNum*0.3,
  79. Effort == 4 ~ MeanMaxNum*0.5,
  80. Effort == 5 ~ MeanMaxNum*0.7,
  81. Effort == 6 ~ MeanMaxNum*0.9),
  82. Speed = PressNum/ComRT )
  83. # Define contrasts
  84. a2$Subject <- as.factor(a2$Subject)
  85. a2$Effort <- as.factor(a2$Effort)
  86. a2$Magnitude <- as.factor(a2$Magnitude)
  87. a2$Valence <-factor(a2$Valence, levels = c( "Gain","NoGain"))
  88. contrasts(a2$Valence) <- contr.sdif(2)
  89. a2$Recipient <-factor(a2$Recipient, levels = c( "Self","Other"))
  90. contrasts(a2$Recipient) <- contr.sdif(2)
  91. a2$Feedback <-factor(a2$Feedback)
  92. contrasts(a2$Feedback) <- contr.sdif(2)
  93. a2$ComRT<-as.numeric(a2$ComRT)
  94. # Handle invalid ERP trials (failed responses)
  95. a2 <- a2 %>% mutate(PerformP3 = ifelse(Pfmmks == 7, NaN, PerformP3),
  96. FRN = ifelse(FBmks == 8, NaN, FRN) )
  97. # load data of the prosocial decision-making task----
  98. a3= read_xlsx('Behavior/prosocial_decision-making_data.xlsx')
  99. # data preparation for the prosocial decision-making task
  100. # Delete seven subjects
  101. a3 <- a3[!a3$Subject%in%exclude_subs,]
  102. a3 <- a3 %>%
  103. rename(Effort = EffortLevel, Recipient = Type, ChoiceRT = decide.RT,Magnitude = Cpoint ) %>%
  104. mutate(
  105. zEffort = as.numeric(scale(Effort)),
  106. zMagnitude = as.numeric(scale(Magnitude)),
  107. # Re-coding choice: 1=high-effort, 3=low-effort (0), 2=no response (NA)
  108. Choice = ifelse(Choice == 2, NA_real_,
  109. ifelse(Choice == 3, 0, 1)),
  110. ChoiceRT = ifelse(is.na(Choice), NA_real_, ChoiceRT)
  111. )
  112. # Define contrasts
  113. a3$Subject <- as.factor(a3$Subject)
  114. a3$Recipient <-factor(a3$Recipient, levels = c( "self","other"))
  115. contrasts(a3$Recipient) <- contr.sdif(2)
  116. a3$Effort <-factor(a3$Effort)
  117. a3$Magnitude <-factor(a3$Magnitude)
  118. # K (discounting rate) analysis----
  119. # load K of self and other
  120. Self <- read_xlsx('Behavior/Self_nlm.xlsx',sheet = 'self_para')
  121. Other <- read_xlsx('Behavior/Other_nlm.xlsx',sheet = 'other_para')
  122. Mdl <- cbind(Self$subj, Self$k, Other$k) %>% as.data.frame()
  123. colnames(Mdl)<-c("Subject","SelfK","OtherK")
  124. # Delete subject
  125. Mdl <- Mdl[!Mdl$Subject %in% exclude_subs,]
  126. # log-transformed K values
  127. Mdl$Self_logk <- log(Mdl$SelfK)
  128. Mdl$Other_logk <- log(Mdl$OtherK)
  129. # Normality tests
  130. shapiro.test(Mdl$Self_logk)
  131. shapiro.test(Mdl$Other_logk)
  132. # Paired-t test
  133. t.test(Mdl$Self_logk,Mdl$Other_logk,paired = TRUE)
  134. # Correlation between self-K and other K
  135. cor.test(Mdl$Self_logk,Mdl$Other_logk,method = "pearson")
  136. # Post-experimental rating data -------------------------------------------
  137. input_file = 'Rating/Rating.xlsx'
  138. # Read all Sheets and merge into one long dataframe
  139. Rat <- bind_rows(
  140. # Self data
  141. read_xlsx(input_file, sheet = 'SelfLike') %>% mutate(Recipient = "Self", Items = "Like"),
  142. read_xlsx(input_file, sheet = 'SelfDifficulity') %>% mutate(Recipient = "Self", Items = "Difficulity"),
  143. read_xlsx(input_file, sheet = 'SelfEffort') %>% mutate(Recipient = "Self", Items = "Effort"),
  144. # Other data
  145. read_xlsx(input_file, sheet = 'OtherLike') %>% mutate(Recipient = "Other", Items = "Like"),
  146. read_xlsx(input_file, sheet = 'OtherDifficulity')%>% mutate(Recipient = "Other", Items = "Difficulity"),
  147. read_xlsx(input_file, sheet = 'OtherEffort') %>% mutate(Recipient = "Other", Items = "Effort")
  148. ) %>%
  149. # Convert effort2-effort6 columns to one column
  150. pivot_longer(
  151. cols = matches("effort[0-9]+"),
  152. names_to = "Type",
  153. values_to = "Rating"
  154. ) %>%
  155. filter(!Subject %in% exclude_subs) %>%
  156. mutate(
  157. Subject = as.factor(Subject),
  158. Items = as.factor(Items),
  159. Recipient = factor(Recipient, levels = c("Self", "Other")),
  160. Effort = as.numeric(str_remove(Type, "effort")),
  161. zEffort = as.vector(scale(Effort, scale = TRUE, center = TRUE))
  162. )
  163. ############################################################ DATA ANALYSIS ####################################################################
  164. ###############################################################################################################################################
  165. ############################################################ The prosocial effort task #########################################################
  166. # Behavior analysis
  167. # Success rate
  168. print (summary(mod_suc <- glmer(IsSuccess~ Recipient*zEffort*zMagnitude + (Recipient + zEffort | Subject),
  169. data=a2,family=binomial, control = glmerControl(optimizer = 'bobyqa'))))
  170. tab_model(mod_suc,transform = NULL)
  171. # response speed
  172. print (summary(mod_speed <- lmer(Speed~ Recipient*zEffort*zMagnitude + (Recipient + zEffort | Subject),
  173. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  174. tab_model(mod_speed, p.val = "satterthwaite")
  175. # ERP analysis
  176. # Performance P3: the P3 locked to performance feedback
  177. print (summary(mod_PerformP3 <- lmer(PerformP3~ Recipient*zEffort*zMagnitude + (zEffort |Subject),
  178. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  179. tab_model(mod_PerformP3, p.val = "satterthwaite")
  180. # FRN (RewP)
  181. print (summary(mod_frn <- lmer(FRN~ Recipient*zEffort*zMagnitude*Valence + (Recipient+zEffort+zMagnitude | Subject),
  182. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  183. tab_model(mod_frn, p.val = "satterthwaite")
  184. # Slope analyses for the FRN
  185. # Recipient*Valence*zMagnitude
  186. mylist <- list(Recipient=c("Self","Other"),Valence=c("Gain","NoGain"))
  187. emtrends(mod_frn, pairwise~Recipient|Valence, var="zMagnitude",at=mylist) %>% summary(infer = c(TRUE,TRUE))
  188. # Recipient*zEffort*zMagnitude
  189. mylist <- list(zMagnitude=c(-1,1),Recipient=c("Self","Other"))
  190. emtrends(mod_frn, pairwise~Recipient|zMagnitude, var="zEffort",at=mylist) %>% summary(infer = c(TRUE,TRUE))
  191. ################################################## The prosocial decision-making task #########################################################
  192. # Behavior analysis: RT
  193. print (summary(mod_RT <- lmer(ChoiceRT~ Recipient*zMagnitude*(zEffort+I(zEffort^2)) + (Recipient+zEffort+I(zEffort^2)+zMagnitude | Subject),
  194. data=a3, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  195. tab_model(mod_RT, p.val = "satterthwaite")
  196. # Slope analyses for RT
  197. # recipient * effort
  198. emtrends(mod_RT, pairwise~Recipient, var="zEffort") %>% summary(infer = c(TRUE,TRUE))
  199. # recipient * magnitude
  200. emtrends(mod_RT, pairwise~Recipient, var="zMagnitude") %>% summary(infer = c(TRUE,TRUE))
  201. # linear effort * magnitude
  202. emtrends(mod_RT, pairwise~zMagnitude, var="zEffort",at=list(zMagnitude=c(1,-1))) %>% summary(infer = c(TRUE,TRUE))
  203. # the pure quadratic effort * magnitude
  204. eff_levels <- c(-1, 0, 1)
  205. mag_levels <- c(-1, 1)
  206. emm <- emmeans(mod_RT, ~ zEffort | zMagnitude, at = list(zEffort = eff_levels, zMagnitude = mag_levels))
  207. contrast(emm, method = "poly", max.degree = 2, by = "zMagnitude") %>% summary(infer = c(TRUE, TRUE))
  208. contrast(emm, interaction = c("poly", "pairwise"), max.degree = 2, by = NULL)
  209. # Behavior analysis: Choice
  210. print (summary(mod_choice <- glmer(Choice~ Recipient*zEffort*zMagnitude + (Recipient+zEffort+zMagnitude | Subject),
  211. data=a3, family=binomial, control = glmerControl(optimizer = 'bobyqa'))))
  212. tab_model(mod_choice,transform = NULL)
  213. # Slope analyses for choice
  214. # the interaction between recipient and effort
  215. emtrends(mod_choice, revpairwise ~ Recipient, var="zMagnitude")%>% summary( infer = c(TRUE, TRUE))
  216. # the interaction between effort and magnitude
  217. emtrends(mod_choice, revpairwise ~ zMagnitude, var="zEffort", at=list(zMagnitude=c(1,-1)))%>% summary(infer = c(TRUE, TRUE))
  218. ######################################################################### Rating data #########################################################
  219. ###############################################################################################################################################
  220. contrasts(Rat$Recipient) <- contr.sdif(2)
  221. # difficulty rating
  222. print (summary(mod_difficulty<- lmer(Rating~ Recipient*zEffort + (Recipient+zEffort | Subject),
  223. data=Rat[Rat$Items=='Difficulity',], control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  224. # effort rating
  225. print (summary(mod_effort <- lmer(Rating~ Recipient*zEffort + (Recipient+zEffort | Subject),
  226. data=Rat[Rat$Items=='Effort',], control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  227. # liking rating
  228. print (summary(mod_like <- lmer(Rating~ Recipient*zEffort + (Recipient+zEffort | Subject),
  229. data=Rat[Rat$Items=='Like',], control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  230. tab_model(mod_difficulty, mod_effort, mod_like, p.val = "satterthwaite")
  231. # interaction between recipient and effort for liking data
  232. emtrends(mod_like, ~ Recipient, var="zEffort") %>% summary(infer = c(TRUE,TRUE))
  233. # Correlations between self-reported data
  234. df_combined <- Rat %>%
  235. mutate(Items = recode(Items, "Effort" = "EffortRating")) %>%
  236. select(Subject, Items, Rating) %>%
  237. pivot_wider(names_from = Items, values_from = Rating, values_fn = mean)
  238. df_combined %>% cor_test(vars = c("Difficulity", "EffortRating", "Like")) %>% adjust_pvalue(method = "fdr")
  239. ############################################################### Other task parameters #########################################################
  240. # catch-trial data
  241. check <- read_xlsx('Behavior/catchtrial.xlsx') %>%
  242. filter(!is.na(effortchoice)) %>%
  243. mutate(
  244. effortcho = case_when(effortchoice == 1 ~ 2, effortchoice == 2 ~ 3, effortchoice == 3 ~ 4, effortchoice == 4 ~ 5, effortchoice == 5 ~ 6),
  245. rewardcho = case_when(rewardchoice == 0.1 ~ 0.2, rewardchoice == 0.2 ~ 0.4, rewardchoice == 0.3 ~ 0.6, rewardchoice == 0.4 ~ 0.8, rewardchoice == 0.5 ~ 1),
  246. EffACC = ifelse(effortcho == EffortLevel, 1, 0),
  247. RewACC = ifelse(rewardcho == Cpoint, 1, 0)
  248. ) %>%
  249. filter(!Subject %in% exclude_subs)
  250. checkACC <- check %>% group_by(Subject) %>%
  251. summarise(mEffACC = mean(EffACC, na.rm = TRUE),
  252. mRewACC = mean(RewACC, na.rm = TRUE) )
  253. print(checkACC)
  254. # averaged number of button presses across three trials ----
  255. subMPN <- a2 %>% group_by(Subject) %>% summarise(MPN = mean(MeanMaxNum, na.rm = TRUE))
  256. summary(subMPN$MPN)
  257. ################################################## Cross task analysis ##########################################################################
  258. # Whether k values estimated from the prosocial decision-making task influence the neural after-effects?
  259. # data preparation
  260. k_lookup <- Mdl %>%
  261. select(Subject, Self_logk, Other_logk) %>%
  262. mutate(Subject = as.factor(Subject)) %>%
  263. pivot_longer(cols = c(Self_logk, Other_logk),names_to = "Recipient",values_to = "logk") %>%
  264. mutate(Recipient = case_when(Recipient == "Self_logk" ~ "Self",Recipient == "Other_logk" ~ "Other"))
  265. a2 <- a2 %>%
  266. left_join(k_lookup, by = c("Subject", "Recipient")) %>%
  267. mutate(zlogk = as.numeric(scale(logk)))
  268. a3_summary <- a3 %>%
  269. group_by(Subject, Recipient) %>%
  270. summarise(p_choice = mean(Choice == 1, na.rm = TRUE), .groups = "drop") %>%
  271. mutate(Recipient = case_when(Recipient == "self" ~ "Self",Recipient == "other" ~ "Other"))
  272. a2 <- a2 %>%
  273. left_join(a3_summary, by = c("Subject", "Recipient")) %>%
  274. # group_by(Recipient) %>%
  275. mutate(zp_choice = as.numeric(scale(p_choice))) # %>% ungroup()
  276. a2$Recipient <-factor(a2$Recipient, levels = c( "Self","Other"))
  277. contrasts(a2$Recipient) <- contr.sdif(2)
  278. # log K
  279. print (summary(mod_frn_logk <- lmer(FRN~ Recipient*zEffort*zMagnitude*Valence*zlogk + (Recipient+zEffort+zMagnitude | Subject),
  280. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  281. tab_model(mod_frn_logk, p.val = "satterthwaite")
  282. mylist <- list(zMagnitude=c(-1,1),zlogk=c(-1,1),zEffort=c(-1,1))
  283. emtrends(mod_frn_logk,pairwise ~Recipient|zMagnitude + zlogk, var="zEffort",at=mylist) %>% summary(infer = c(TRUE, TRUE))
  284. # choice proportions
  285. print (summary(mod_frn_choice <- lmer(FRN~ Recipient*zEffort*zMagnitude*Valence*zp_choice + (Recipient+zEffort+zMagnitude | Subject),
  286. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  287. tab_model(mod_frn_choice, p.val = "satterthwaite")
  288. mylist <- list(zMagnitude=c(-1,1),zp_choice=c(-1,1),zEffort=c(-1,1))
  289. emtrends(mod_frn_choice,pairwise ~Recipient|zMagnitude + zp_choice, var="zEffort",at=mylist) %>% summary(infer = c(TRUE, TRUE))
  290. ################################################## Control analysis ############################################################
  291. # control for response speed and self-reported effort rating
  292. # z-scoring response speed
  293. a2<-a2%>%group_by(Subject)%>%mutate(zSpeed=as.numeric(scale(Speed)) )%>%ungroup()
  294. # control for effort rating
  295. effort_rating <- Rat[Rat$Items=='Effort',] %>% group_by(Subject) %>%
  296. mutate(ceffort_rating = as.vector(scale(Rating,scale = FALSE))) %>% ungroup() %>%
  297. select("Subject","Recipient","Effort", "Rating","ceffort_rating") %>%
  298. rename("effort_rating" = "Rating")
  299. a2 <- a2 %>%
  300. left_join(
  301. effort_rating %>%
  302. mutate(Effort = as.factor(Effort)) %>%
  303. select(Subject, Recipient, Effort, effort_rating, ceffort_rating),
  304. by = c("Subject", "Recipient", "Effort")
  305. )
  306. a2$Recipient <-factor(a2$Recipient, levels = c( "Self","Other"))
  307. contrasts(a2$Recipient) <- contr.sdif(2)
  308. # include response speed as a covariate
  309. print (summary(mod_frn_speed <- lmer(FRN~ Recipient*zEffort*zMagnitude*Valence+zSpeed + (Recipient+zEffort+zMagnitude | Subject),
  310. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  311. # include effort rating as a covariate
  312. print (summary(mod_frn_effrat <- lmer(FRN~ Recipient*zEffort*zMagnitude*Valence+effort_rating + (Recipient+zEffort+zMagnitude | Subject),
  313. data=a2, control = lmerControl(optimizer = 'bobyqa'), REML = FALSE)))
  314. tab_model(mod_frn_speed,mod_frn_effrat, p.val = "satterthwaite")

Data_analysis.R, no license · at the source

Overview

Authors: Ya Zheng1,2, Rumeng Tang3,4
ORCID iDs: Ya Zheng, Rumeng Tang
  1. Department of Psychology, Guangzhou University, Guangzhou, China
  2. Center for Reward and Social Cognition, School of Education, Guangzhou University, Guangzhou, China
  3. Guangdong Provincial Key Laboratory of Social Cognitive Neuroscience and Mental Health and Department of Psychology, Sun Yat-sen University, Guangzhou, China
  4. Department of Psychology, Dalian Medical University, Dalian, China
Journal: eLife, volume 13, article RP103566
Dates: published online 14 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.103566 · PMID 42132118 · PMCID PMC13175574 · OpenAlex W4405526730
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: EEG (modality), human (organism)
Methods: Spectral & time-frequency, Smoothing, state filtering, decompositions, Machine learning, Preprocessing, Evoked potentials, Statistics
Keywords: Human
MeSH: Reward*, Social Behavior*, Electroencephalography, Female, Humans, Male (* major topic)
Topic: Neural and Behavioral Psychology Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: National Natural Science Foundation of China (32571255, 31971027); 2024 Tertiary Education Scientific Research Project of Guangzhou Municipal Education Bureau (2024312195)
Citations: cited by 1 paper (Europe PMC); 56 references in the paper

Abstract

Engaging in prosocial behavior requires effort, yet people are often averse to exerting effort for others’ benefit. However, it remains unclear how effort exertion affects subsequent reward evaluation during prosocial acts. Here, we combined high-temporal-resolution electroencephalography with a paradigm that independently manipulated physical effort and monetary reward for self and others to elucidate the neural mechanisms underlying the reward after-effect of prosocial effort expenditure. We found dissociable reward after-effects for self-benefiting and other-benefiting effort. For self-benefiting rewards, the reward positivity (RewP) increased with effort demand, suggesting an effort-enhancement effect. In contrast, for other-benefiting rewards, the RewP decreased as effort increased, demonstrating an effort-discounting effect. Critically, this dissociation was contingent upon high reward magnitude and modulated by individual differences in effort discounting, yet remained distinct from performance evaluation. Our findings reveal distinct neural computations for self- and other-benefiting efforts, offering new insights into how prior effort expenditure shapes reward evaluation during prosocial behavior.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

OSF bvpa2

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Languages: R (2)
Size: 14 files, 2 scripts
Software Heritage: not checked
Found in: “Data availability”
Holds: README, 1 notebook
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: emmeans (2 files), ggplot2 (2 files), ggpubr (2 files), lme4 (2 files), lmerTest (2 files), psych (2 files), rstatix (2 files), tidyverse (2 files)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
3 files
At the source: osf.io/bvpa2/

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 2 scripts, each with its path and the digest of its content;
  • 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability

Data and code that support the findings of this study are available on Open Science Framework at https://osf.io/bvpa2/.

The following dataset was generated:

Zheng Y. 2026. Effort produces after-effects costly for others but valued for self. Open Science Framework. bvpa2

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 2 authors, 1 keyword, 6 MeSH terms, 2 funders, 54 references.

Cite

This paper

Zheng, Y., & Tang, R. (2026). Effort produces after-effects costly for others but valued for self. eLife, 13, RP103566. https://doi.org/10.7554/elife.103566

BibTeX

@article{zheng2026effort,
author = {Zheng, Ya and Tang, Rumeng},
title = {{Effort produces after-effects costly for others but valued for self}},
journal = {eLife},
year = {2026},
month = may,
volume = {13},
pages = {RP103566},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.103566},
url = {https://doi.org/10.7554/elife.103566},
pmid = {42132118},
pmcid = {PMC13175574}
}

RIS

TY - JOUR
AU - Zheng, Ya
AU - Tang, Rumeng
TI - Effort produces after-effects costly for others but valued for self
T2 - eLife
J2 - eLife
PY - 2026
DA - 2026/05/14
VL - 13
SP - RP103566
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.103566
UR - https://doi.org/10.7554/elife.103566
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.103566",
"type": "article-journal",
"title": "Effort produces after-effects costly for others but valued for self",
"container-title": "eLife",
"author": [
{
"family": "Zheng",
"given": "Ya"
},
{
"family": "Tang",
"given": "Rumeng"
}
],
"container-title-short": "eLife",
"volume": "13",
"page": "RP103566",
"DOI": "10.7554/elife.103566",
"PMID": "42132118",
"PMCID": "PMC13175574",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.103566",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
14
]
]
}
}

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.1093/scan/nsag030 [code]
Delaying rewards reduces egoism bias during prosocial acts.
Journal: Social cognitive and affective neuroscience
In common: psych, emmeans, lme4, 3 other tools, EEG, 11 references, author Ya Zheng
[2] doi:10.1093/scan/nsae063 [code]
Neural dynamics underlying the illusion of control during reward processing.
Journal: Social cognitive and affective neuroscience
In common: psych, emmeans, lmerTest, 3 other tools, EEG, 8 references, author Ya Zheng
[3] doi:10.1017/s0033291726103249 [code]
Inefficient integration between effort and reward in anhedonia.
Journal: Psychological medicine
In common: emmeans, lmerTest, lme4, 2 other tools, EEG, 8 references, author Ya Zheng
[4] doi:10.1093/scan/nsag029 [code]
Time and amount attributes exert distinct neural influences on gain and loss evaluation.
Journal: Social cognitive and affective neuroscience
In common: psych, emmeans, lme4, 1 other tool, EEG, 7 references, author Ya Zheng
[5] doi:10.1002/hbm.26398 [code]
Neural dissociation between reward and salience prediction errors through the lens of optimistic bias.
Journal: Human brain mapping
In common: emmeans, lme4, ggplot2, 1 other tool, EEG, 8 references, author Ya Zheng
[6] doi:10.1016/j.cub.2022.08.010 [code]
Distinct neural representations for prosocial and self-benefiting effort.
Journal: Current biology : CB
In common: rstatix, psych, lme4, 2 other tools, 6 references
[7] doi:10.1038/s41598-024-60328-8 [code]
Prediction-error-dependent processing of immediate and delayed positive feedback.
Journal: Scientific reports
In common: rstatix, psych, emmeans, 4 other tools, EEG, 5 references
[8] doi:10.7554/elife.87271 [code]
Acute stress reduces effortful prosocial behaviour.
Journal: eLife
In common: psych, emmeans, lmerTest, 4 other tools, 4 references
[9] doi:10.1016/j.neuroimage.2026.122115 [code]
Midfrontal theta power relates to response speeding following frustrative nonreward.
Journal: NeuroImage
In common: rstatix, psych, emmeans, 5 other tools, EEG, 4 references
[10] doi:10.3758/s13415-025-01303-2 [code]
Impaired reinforcement learning and coding of prediction errors in patients with cerebellar degeneration - a study with EEG and voxel-based morphometry.
Journal: Cognitive, affective & behavioral neuroscience
In common: rstatix, psych, lmerTest, 4 other tools, EEG, 3 references

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.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.7554/elife.103566.svg)](https://openscicode.org/badge/doi/10.7554/elife.103566)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.7554/elife.103566.svg
   :target: https://openscicode.org/badge/doi/10.7554/elife.103566
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.7554/elife.103566"><img src="https://openscicode.org/badge/doi/10.7554/elife.103566.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge 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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.