Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks.
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] § Materials and Methods › Behavioral Analysis. ↔ behavior data/oxtfmri.R, lines 564 to 625 · score 0.65 · linear mixed model, lme4, LMM, lmer, RT, Block · block
oscr:b:D75S892415K00-Z· 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 · 657 lines · 36 KB · no license · 1 match
- rm(list = ls())
- library(plyr)
- library(dplyr)
- library(tibble)
- library(tidyr)
- library(ggplot2)
- library(fpc)
- library(car)
- library(ez)
- library(HH)
- library(reshape)
- library(RColorBrewer)
- library(Rmisc)
- library(sjstats)
- library(gridExtra)
- library(lme4)
- library(nlme)
- library(utils)
- library(phia)
- library(pastecs)
- library(psych)
- library(ggpubr)
- library(ggsignif)
- library(emmeans)
- library(reshape)
- library(stringr)
- library(pbkrtest)
- library(EMAtools)
- library(lmerTest)
- library(remotes)
- library(parallel)
- library(broom)
- library(MuMIn)
- library(rlist)
- library(ggplot2)
- library(grImport)
- library(Rcpp)
- library(magick)
- library(grid)
- library(DMwR2)
- library(effsize)
- library(effects)
- library(report)
- library(TMB)
- library(sjPlot)
- library(sjmisc)
- library(psycho)
- library(parameters)
- library(performance)
- library(prediction)
- library(ggeffects)
- library(Cairo)
- library(xlsx)
- library(rJava)
- library(XLConnect)
- library(openxlsx)
- library(patchwork)
- library(scales)
- library(jsonlite)
- library(purrr)
- library(data.table)
- library(rio)
- library(cowplot)
- library(ggalt)
- library(tidyr)
- library(ggpattern)
- library(readxl)
- library(StanHeaders)
- library(qpcR)
- library(rlist)
- library(r2symbols)
- library(wesanderson)
- '%!in%' <- function(x,y)!('%in%'(x,y))
- # OT: sub
- # 3,4,5,6,8,10,14,15,19,[20],21,(22),25,29,30,31,32,33,37,38,39,40,41,43,46,50,51,53,56,60,61
- # Placebo: sub
- # 1,2,7,9,11,12,13,16,17,18,23,24,26,27,28,34,35,36,42,44,[45],47,48,49,52,54,55,57,58,59
- # sub47, has 4 runs, delete the 3rd
- # sub22---delete
- # sub20,45 --delete perfome
- ############ LEARN #############
- ####1. simple contrast coding ####
- #however,it's not work in some factor() related lmer.
- learndata_long3$Group = ordered(learndata_long3$Group, levels=c('Oxytocin','Placebo'))
- learndata_long3$S_O = ordered(learndata_long3$S_O, levels=c('Self','Other'))
- learndata_long3$Hierarchy1st = ordered(learndata_long3$Hierarchy1st, levels=c("Superior","Intermediate", "Inferior"))
- learndata_long3$Hierarchy2nd = ordered(learndata_long3$Hierarchy2nd, levels=c("Superior","Intermediate", "Inferior",'Unrelated'))
- learndata_long3$LR3rd = ordered(learndata_long3$LR3rd, levels=c('Greater than','Equal','Less than'))
- learndata_long3$Familiarity = ordered(learndata_long3$Familiarity, levels=c('Related','Unrelated'))
- #rename colname in contrast #!!!***name! not contrast it self!!!!2022
- colnames(attr(learndata_long3$Group, "contrasts")) <- c(" (PB)")
- colnames(attr(learndata_long3$S_O, "contrasts")) <- c(" (Others)")
- colnames(attr(learndata_long3$Hierarchy1st, "contrasts")) <- c(" (Sup > Inter)"," (Inf > Inter)")
- colnames(attr(learndata_long3$Hierarchy2nd, "contrasts")) <- c(" (Superior)"," (Inferior)"," (Unrelated)")
- colnames(attr(learndata_long3$LR3rd, "contrasts")) <- c(" (Greater)"," (Less)")
- colnames(attr(learndata_long3$Familiarity, "contrasts"))<- c(" (Related)")
- # 1.1 different with ramdon choice
- #block 4 starts to learn
- xtabs(~Block ,learndata_long33) #1390 1392 1390 1390 1392 1391 1392 1390 1391 [1390/2=695]
- try=xtabs(~(Block==7)+ ACC,learndata_long33)[2,] #true 0 1
- Trainramdon<-as.data.frame(matrix(nrow=9,ncol=2))
- for (i in 1:9)
- {Trainramdon[i,1]<- xtabs(~(Block==i)+ ACC,learndata_long33)[2,1]
- Trainramdon[i,2]<- xtabs(~(Block==i)+ ACC,learndata_long33)[2,2]}
- Trainramdonlist<-as.data.frame(matrix(nrow=length(unique(learndata_long33$Listname)),ncol=2))
- listnamenum=c('List23','List24','List25','List31','List32', 'List35','List36','List37','List43','List44',
- 'List26','List27','List38','List39',
- 'List28','List29','List30','List33', 'List34', 'List40','List41','List42','List45','List46') #unique(learndata_long33$Listname)
- for (i in 1:length(listnamenum))
- {Trainramdonlist[i,1]<- xtabs(~(Listname==listnamenum[i])+ ACC,learndata_long33)[2,1]
- Trainramdonlist[i,2]<- xtabs(~(Listname==listnamenum[i])+ ACC,learndata_long33)[2,2]}
- Trainchis<- list()
- for (ii in 1:length(listnamenum))
- {Trainchis$'X-squared'[ii]<- chisq.test(rbind(Trainramdonlist[ii,],c(522*2/3,522*1/3)))
- Trainchis$p[ii]<- chisq.test(rbind(Trainramdonlist[ii,],c(348,174)))[3] }
- ### ACC numeric ####
- # 2021.4--derivsFdrop2int2drop
- vNglmernew<-list()
- vNglmernew[["derivsF"]]<-glmer(ACC~Group*S_O*Block*Hierarchy1st+ (1| Subject),data = learndata_long33, glmerControl(calc.derivs = F,optCtrl = list(maxfun=1e5)),family="binomial")
- vNglmernew[["derivsFdrop2int"]] <-update(vNglmernew[["derivsF"]], .~. -Group:S_O:Block:Hierarchy1st- Group:S_O:Hierarchy1st -Group:S_O:Block -Group:Block:Hierarchy1st -S_O:Block:Hierarchy1st ) # -2*2
- vNglmernew[["derivsFdrop2int2drop"]] <-update(vNglmernew[["derivsFdrop2int"]], .~. -Group:S_O -Group:Hierarchy1st -S_O:Block) #final!!!***
- #without block 1 guess--
- vNglmernew[["derivsFnob1"]]<-glmer(ACC~Group*S_O*Block*Hierarchy1st+ (1| Subject),data = learndata_long33[which(learndata_long33$Block != 1 ),],
- glmerControl(calc.derivs = F,optCtrl = list(maxfun=1e5)),family="binomial")
- vNglmernew[["derivsFdrop2intnob1"]] <-update(vNglmernew[["derivsFnob1"]], .~. -Group:S_O:Block:Hierarchy1st- Group:S_O:Hierarchy1st -Group:S_O:Block -Group:Block:Hierarchy1st -S_O:Block:Hierarchy1st ) # -2*2
- vNglmernew[["derivsFdrop2int2dropnob1"]] <-update(vNglmernew[["derivsFdrop2intnob1"]], .~. -Group:S_O -Group:Hierarchy1st -S_O:Block) #final!!!***
- #session for emmeans
- vNglmernew[["derivsS"]]<-glmer(ACC~Group*S_O*Session*Hierarchy1st+ (1| Subject),data = learndata_long33, glmerControl(calc.derivs = F,optCtrl = list(maxfun=1e5)),family="binomial")
- vNglmernew[["derivsSd1"]]<- update(vNglmernew[["derivsS"]], .~. -Group:S_O:Session:Hierarchy1st- Group:S_O:Hierarchy1st -Group:S_O:Session -Group:Session:Hierarchy1st -S_O:Session:Hierarchy1st )
- vNglmernew[["derivsSd2"]]<- update(vNglmernew[["derivsSd1"]], .~. -Group:S_O -Group:Hierarchy1st -S_O:Session) #***
- summary(vNglmernew[["derivsFdrop2int2drop"]])
- ### results ACC Nglmernew ####
- vNglmernew=vNglmernew[sort(names(vNglmernew))]
- vNglmernewAICSIN=cbind(sapply(vNglmernew,AIC),sapply(vNglmernew,BIC),sapply(vNglmernew,isSingular)) %>% as.data.frame()
- vNglmernewAICSIN<- vNglmernewAICSIN[order(vNglmernewAICSIN$V1),] #blocksubl3 13505.00 1
- vNglmernewsum=lapply(vNglmernew,summary)
- vNglmernewAnova=lapply(within(vNglmernew, rm(Null)),Anova) #must fixed
- vNglmernewanova=lapply(vNglmernew,anova)
- vNglmernewPCA=lapply(vNglmernew,rePCA) # proportion of variance in subject or other random effects
- vNglmernewcorr=lapply(vNglmernew,VarCorr) #random effects variance in std.dev whose small~0 !same PCA
- vNglmernewcohend=lapply(vNglmernew,function(i) {rbind(c(0,0,0),lme.dscore(i,learndata_long33, type="lme4"))}) # effect size Cohen's D
- #odds ratios
- vNglmernewse=lapply(vNglmernew,function(i) {sqrt(diag(vcov(i)))}) # se
- vNglmernewconfint=list() # estimated beita~
- vNglmernewconfintodd=list() # odds ratios~
- Est=list()
- LL=list() #%95
- UL=list()
- for (i in 1:length(vNglmernew)){
- vNglmernewconfint[[i]]= cbind( Est=fixef(vNglmernew[[i]]),LL=fixef(vNglmernew[[i]]) -1.96 * vNglmernewse[[i]],UL=fixef(vNglmernew[[i]]) +1.96 * vNglmernewse[[i]]) %>%
- as.data.frame()
- names(vNglmernewconfint)[i]=names(vNglmernew)[i]
- vNglmernewconfintodd[[i]]= exp(vNglmernewconfint[[i]]) %>% plyr::rename(c("Est" = "Odds ratios", 'LL'='Odds LL', 'UL'='Odds UL'))
- names(vNglmernewconfintodd)[i]=names(vNglmernew)[i] } # odds ratios~
- #result combine
- #cat(paste("'",names(vNglmernewpara[[i]]),"'", sep = "", collapse = ", "))
- vNglmernewpara=list()
- vNglmernewperform=list()
- for (i in 1:length(vNglmernew)){
- vNglmernewpara[[i]]= cbind(model_parameters(vNglmernew[[i]],effects="fixed", exponentiate = T),vNglmernewconfintodd[[i]],vNglmernewcohend[[i]] ) %>% # b~p + odds +cohend
- mutate_if(is.numeric, round, digits=3)
- names(vNglmernewpara)[i]=names(vNglmernew)[i]
- for (j in 1:nrow(vNglmernewpara[[i]])) {
- if(vNglmernewpara[[i]]$p[j] < 0.001 ){vNglmernewpara[[i]]$Coefficient[j] <- paste(vNglmernewpara[[i]]$Coefficient[j], c('***'))}
- else if(0.001 <= vNglmernewpara[[i]]$p[j] & vNglmernewpara[[i]]$p[j] < 0.01 ){vNglmernewpara[[i]]$Coefficient[j] <- paste(vNglmernewpara[[i]]$Coefficient[j], c('**'))}
- else if(0.01 < vNglmernewpara[[i]]$p[j]& vNglmernewpara[[i]]$p[j] < 0.05 ){vNglmernewpara[[i]]$Coefficient[j] <- paste(vNglmernewpara[[i]]$Coefficient[j], c('*'))}
- # else {vNglmernewpara[[i]]$p[j] <- paste(vNglmernewpara[[i]]$p[j],c('')) }
- }
- vNglmernewpara[[i]]$Parameter<-str_replace_all(vNglmernewpara[[i]]$Parameter,c(":"=" × "))
- # vNglmernewpara[[i]]$Parameter<-str_replace_all(vNglmernewpara[[i]]$Parameter,c(
- # "Hierarchy1st1" = "Hierarchy: Superior","Hierarchy1st2" = "Hierarchy: Inferior","S_O1"="S_O: Self",
- # "Hierarchy2nd1" = "Hierarchy: Superior","Hierarchy2nd2" = "Hierarchy: Inferior","Hierarchy2nd3" = "Hierarchy: Unrelated",
- # "Familiarity1" = "Inner Group: Related","Group1" ="Group: Oxytocin"))
- vNglmernewpara[[i]]<-subset(vNglmernewpara[[i]], select=names(vNglmernewpara[[i]])!='df_error')
- vNglmernewperform[[i]]= model_performance(vNglmernew[[i]]) %>% #AIC~
- mutate_if(is.numeric, round, digits=3)
- names(vNglmernewperform)[i]=names(vNglmernew)[i]
- }
- listsumlearnACC <- do.call("rbind", lapply(vNglmernewpara[c('derivsFdrop2int2drop',"derivsFdrop2int", "derivsF")],
- function(i) {as.data.frame(i,col.names =names(vNglmernewpara$derivsFdrop))}))
- ### pair test marginal effect
- #odds ratios!!!
- #1. hierachy ----|2021.4--derivsFdrop2int2drop --no
- derivsFdropHier1=emmeans(vNglmernew$derivsFdrop2int2drop,pairwise ~ "Hierarchy1st", type = "response", reverse = TRUE)
- CIderivsFdropHier1= confint(derivsFdropHier1,level = .95, type = "response") #all
- hier1mainodds= cbind(as.data.frame(derivsFdropHier1$contrasts),CIderivsFdropHier1$contrasts[names(CIderivsFdropHier1$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #1. hierachy ----|2022.7--derivsSd2
- derivsFdropHierDB1=emmeans(vNglmernew$derivsSd2,pairwise ~ "Hierarchy1st", type = "response", reverse = TRUE)
- CIderivsFdropHierDB1= confint(derivsFdropHierDB1,level = .95, type = "response") #all
- hier1mainoddsDB1= cbind(as.data.frame(derivsFdropHierDB1$contrasts),CIderivsFdropHierDB1$contrasts[names(CIderivsFdropHierDB1$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #1.1 SO
- derivsFdropSO1=emmeans(vNglmernew$derivsFdrop2int2drop,pairwise ~ "S_O", type = "response", reverse = TRUE) #odds ratios!!!
- CIderivsFdropSO1= confint(derivsFdropSO1,level = .95, type = "response") #all
- SO1mainodds= cbind(as.data.frame(derivsFdropSO1$contrasts),CIderivsFdropSO1$contrasts[names(CIderivsFdropSO1$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- emmeans(vNglmernew$derivsFdrop2int2drop,pairwise ~ Group|S_O, type = "response", reverse = TRUE) #no
- emmeans(vNglmernew$derivsFdrop2int2drop,pairwise ~ S_O|Group, type = "response", reverse = TRUE) #** both
- #2. group*block
- derivsFdropgrpbloc1=emmeans(vNglmernew$derivsFdrop2int2drop, pairwise~ Group|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropgrpbloc1= confint(derivsFdropgrpbloc1,level = .95, type = "response") #no!
- grpblo1odds= cbind(as.data.frame(derivsFdropgrpbloc1$contrasts),CIderivsFdropgrpbloc1$contrasts[names(CIderivsFdropgrpbloc1$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- emmeans(vNglmernew$derivsFdrop2int2drop, pairwise~ Group:Block, at = list(Block = c(-16)), type = "response", reverse = TRUE) # *?
- emmeans(vNglmernew$derivsFdrop2int2drop,pairwise ~ Group:Block, type = "response", reverse = TRUE) #
- #3. SO*hier ----|2022.7--derivsSd2
- derivsFdropSohierDB1=emmeans(vNglmernew$derivsSd2, pairwise~ S_O|Hierarchy1st, type = "response", reverse = TRUE)
- CIderivsFdropSohierDB1= confint(derivsFdropSohierDB1,level = .95, type = "response") #intermediate
- Sohier1oddsDB= cbind(as.data.frame(derivsFdropSohierDB1$contrasts),CIderivsFdropSohierDB1$contrasts[names(CIderivsFdropSohierDB1$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #4. hierachy*block
- derivsFdrophierbloc1=emmeans(vNglmernew$derivsFdrop2int2drop, pairwise~ Hierarchy1st|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdrophierbloc1= confint(derivsFdrophierbloc1,level = .95, type = "response") # except blo1 super&infer + blo8/9 inter&inferior
- hierblo1odds= cbind(as.data.frame(derivsFdrophierbloc1$contrasts),CIderivsFdrophierbloc1$contrasts[names(CIderivsFdrophierbloc1$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #5.all in block
- derivsFdropbloc1=emmeans(vNglmernew$derivsFdrop2int2drop, pairwise~ Block, type = "response", at = list(Block = c(1:9))) #every all~
- CIderivsFdropbloc1= confint(derivsFdropbloc1,level = .95, type = "response")
- GlmerpairACCtrain= rbind.fill(hier1mainodds,SO1mainodds,grpblo1odds,Sohier1odds,hierblo1odds)
- for (j in 1:nrow(GlmerpairACCtrain)) {
- if(GlmerpairACCtrain$p.value[j] < 0.001 ){GlmerpairACCtrain$odds.ratio[j] <- paste(GlmerpairACCtrain$odds.ratio[j], c('***'))}
- else if(0.001 <= GlmerpairACCtrain$p.value[j] & GlmerpairACCtrain$p.value[j] < 0.01 ){GlmerpairACCtrain$odds.ratio[j] <- paste(GlmerpairACCtrain$odds.ratio[j], c('**'))}
- else if(0.01 < GlmerpairACCtrain$p.value[j]& GlmerpairACCtrain$p.value[j] < 0.05 ){GlmerpairACCtrain$odds.ratio[j] <- paste(GlmerpairACCtrain$odds.ratio[j], c('*'))}
- }
- ## main effect -A:B1/B2-
- convNglmernew= vector("list",length(vNglmernew))
- convFac= vector("list",length(names(ref_grid(vNglmernew[[length(vNglmernew)]])@levels)))
- for (i in 1:length(vNglmernew)){
- for (j in 1:length(names(ref_grid(vNglmernew[[i]])@levels))) {
- convFac[[j]]=emmeans(vNglmernew[[i]], as.formula(paste("pairwise ~",names(ref_grid(vNglmernew[[i]])@levels)[j])), adjust ="bonf")
- names(convFac)[j]=names(ref_grid(vNglmernew[[i]])@levels)[j]} #onelmer1[j]~ update the emmeans name!
- convNglmernew[[i]]=convFac
- names(convNglmernew)[i]=names(vNglmernew)[i] }
- ## interaction effect: simple effects-- A1/A2:B1/B2
- intervNglmernew= vector("list",length(vNglmernew))
- intervFac= vector("list",length(names(ref_grid(vNglmernew[[length(vNglmernew)]])@levels)))
- for (i in 1:length(vNglmernew)){
- for (j in 1:length(names(ref_grid(vNglmernew[[i]])@levels))) {
- intervFac[[j]]=joint_tests(vNglmernew[[i]], as.formula(paste("by='",names(ref_grid(vNglmernew[[i]])@levels)[j],"'", sep = "")))
- names(intervFac)[j]=names(ref_grid(vNglmernew[[i]])@levels)[j]}
- intervNglmernew[[i]]=intervFac
- names(intervNglmernew)[i]=names(vNglmernew)[i]}
- ####RT numeric####
- vNlmerRT<- list()
- vNlmerRT[["derivsF"]]<-lmerTest::lmer(RT~Group*S_O*Block*Hierarchy1st+ (1| Subject),data = learndata_long33,REML = F)
- vNlmerRT[["derivsFdrop2int"]]<-update(vNlmerRT[["derivsF"]], .~. -Group:S_O:Block:Hierarchy1st - S_O:Hierarchy1st:Block - Group:S_O:Hierarchy1st- Group:Block:Hierarchy1st -Group:S_O:Block) # but no main effect, the interaction is weird
- vNlmerRT[["derivsFdrop2int2drop"]]<-update(vNlmerRT[["derivsFdrop2int"]], .~. -Group:Hierarchy1st-Group:S_O ) # final!*** and group show marginal
- vNlmerRT[["derivsFdrop2int2drop1"]]<-update(vNlmerRT[["derivsFdrop2int2drop"]], .~. -Block:Hierarchy1st) # final!*** and group show marginal
- vNlmerRT[["derivsF"]]<-lmerTest::lmer(RT~Group*S_O*Block*Hierarchy1st+ (1| Subject),data = learndata_long33,REML = F)
- vNlmerRT[["derivsFdrop2int"]]<-update(vNlmerRT[["derivsF"]], .~. -Group:S_O:Block:Hierarchy1st - S_O:Hierarchy1st:Block - Group:S_O:Hierarchy1st- Group:Block:Hierarchy1st -Group:S_O:Block) # but no main effect, the interaction is weird
- vNlmerRT[["derivsFdrop2int2drop"]]<-update(vNlmerRT[["derivsFdrop2int"]], .~. -Group:Hierarchy1st-Group:S_O ) # final!*** and group show marginal
- vNlmerRT[["derivsFdrop2int2drop1"]]<-update(vNlmerRT[["derivsFdrop2int2drop"]], .~. -Block:Hierarchy1st) # final!*** and group show marginal
- ### results RT Nlmer ####
- vNlmerRT=vNlmerRT[sort(names(vNlmerRT))]
- vNlmerRTAICSIN=cbind(sapply(vNlmerRT,AIC),sapply(vNlmerRT,BIC),sapply(vNlmerRT,isSingular)) %>% as.data.frame()
- vNlmerRTAICSIN<- vNlmerRTAICSIN[order(vNlmerRTAICSIN$V1),]
- vNlmerRTsum=lapply(vNlmerRT,summary)
- vNlmerRTAnova=lapply(vNlmerRT,Anova)
- vNlmerRTanova=lapply(vNlmerRT,anova)
- vNlmerRTPCA=lapply(vNlmerRT,rePCA) # proportion of variance in subject or other random effects
- vNlmerRTcorr=lapply(vNlmerRT,VarCorr) # small~0 !same PCA
- vNlmerRTcohend=lapply(vNlmerRT,function(i) {rbind(c(0,0,0),lme.dscore(i,learndata_long33, type="lme4"))}) # effect size cohend
- #ODDS
- vNglmernewseRT=lapply(vNlmerRT,function(i) {sqrt(diag(vcov(i)))}) # se
- vNglmernewconfintRT=list() # estimated beita~
- vNglmernewconfintoddRT=list() # odds ratios~
- Est=list()
- LL=list() #%95
- UL=list()
- for (i in 1:length(vNlmerRT)){
- vNglmernewconfintRT[[i]]= cbind( Est=fixef(vNlmerRT[[i]]),LL=fixef(vNlmerRT[[i]]) -1.96 * vNglmernewseRT[[i]],UL=fixef(vNlmerRT[[i]]) +1.96 * vNglmernewseRT[[i]]) %>%
- as.data.frame()
- names(vNglmernewconfintRT)[i]=names(vNlmerRT)[i]
- vNglmernewconfintoddRT[[i]]= exp(vNglmernewconfintRT[[i]]) %>% plyr::rename(c("Est" = "Odds ratios", 'LL'='Odds LL', 'UL'='Odds UL'))
- names(vNglmernewconfintoddRT)[i]=names(vNlmerRT)[i]
- vNlmerRTcohend[[i]]=plyr::rename(vNlmerRTcohend[[i]],c("t" = "cohedt")) #double t in cohed so rename
- } # odds ratios~
- vNglmernewRTpara=list()
- vNglmernewperformRT=list()
- for (i in 1:length(vNlmerRT)){
- vNglmernewRTpara[[i]]= cbind(model_parameters(vNlmerRT[[i]],effects="fixed"),vNglmernewconfintoddRT[[i]],vNlmerRTcohend[[i]] )%>%
- mutate_if(is.numeric, round, digits=3)
- names(vNglmernewRTpara)[i]=names(vNlmerRT)[i]
- for (j in 1:nrow(vNglmernewRTpara[[i]])) {
- if(vNglmernewRTpara[[i]]$p[j] < 0.001 ){vNglmernewRTpara[[i]]$Coefficient[j] <- paste(vNglmernewRTpara[[i]]$Coefficient[j], c('***'))}
- else if(0.001 <= vNglmernewRTpara[[i]]$p[j] & vNglmernewRTpara[[i]]$p[j] < 0.01 ){vNglmernewRTpara[[i]]$Coefficient[j] <- paste(vNglmernewRTpara[[i]]$Coefficient[j], c('**'))}
- else if(0.01 < vNglmernewRTpara[[i]]$p[j]& vNglmernewRTpara[[i]]$p[j] < 0.05 ){vNglmernewRTpara[[i]]$Coefficient[j] <- paste(vNglmernewRTpara[[i]]$Coefficient[j], c('*'))}
- else {vNglmernewRTpara[[i]]$p[j] <- paste(vNglmernewRTpara[[i]]$p[j],c('')) }}
- vNglmernewRTpara[[i]]$Parameter<-str_replace_all(vNglmernewRTpara[[i]]$Parameter,c(":"=" × "))
- vNglmernewRTpara[[i]]<-subset(vNglmernewRTpara[[i]], select=names(vNglmernewRTpara[[i]])!='df_error')
- vNglmernewperformRT[[i]]= model_performance(vNlmerRT[[i]]) %>% #AIC~
- mutate_if(is.numeric, round, digits=3)
- names(vNglmernewperformRT)[i]=names(vNlmerRT)[i]}
- ### pair test marginal effect |2021.10--derivsF no
- emm_options((pbkrtest.limit = 30000))
- #1. hierachy ,pbkrtest.limit = 12518 ajust='bonferroni',
- derivsFdropHier1RT=emmeans(vNlmerRT$derivsFdrop2int2drop1,pairwise ~ "Hierarchy1st", type = "response", reverse = TRUE) #ESTIMATE
- CIderivsFdropHier1RT= confint(derivsFdropHier1RT,level = .95, type = "response") #all
- hier1mainoddsRT= cbind(as.data.frame(derivsFdropHier1RT$contrasts),CIderivsFdropHier1RT$contrasts[names(CIderivsFdropHier1RT$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #2. group*block
- derivsFdropgrpbloc1RT=emmeans(vNlmerRT$derivsFdrop2int2drop1, pairwise~ Group|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropgrpbloc1RT= confint(derivsFdropgrpbloc1RT,level = .95, type = "response") #no!
- grpblo1oddsRT= cbind(as.data.frame(derivsFdropgrpbloc1RT$contrasts),CIderivsFdropgrpbloc1RT$contrasts[names(CIderivsFdropgrpbloc1RT$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #3. SO*group
- derivsFdropSogrp1RT=emmeans(vNlmerRT$derivsFdrop2int2drop1, pairwise~ S_O|Group, type = "response", reverse = TRUE)
- CIderivsFdropSogrp1RT= confint(derivsFdropSogrp1RT,level = .95, type = "response") #intermediate
- Sogrp1oddsRT= cbind(as.data.frame(derivsFdropSogrp1RT$contrasts),CIderivsFdropSogrp1RT$contrasts[names(CIderivsFdropSogrp1RT$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #3.1 SO*hierachy
- derivsFdropSohier1RT=emmeans(vNlmerRT$derivsFdrop2int2drop1, pairwise~ S_O|Hierarchy1st, type = "response", reverse = TRUE)
- CIderivsFdropSohier1RT= confint(derivsFdropSohier1RT,level = .95, type = "response") #intermediate
- Sohier1oddsRT= cbind(as.data.frame(derivsFdropSohier1RT$contrasts),CIderivsFdropSohier1RT$contrasts[names(CIderivsFdropSohier1RT$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #4. SO*block
- derivsFdropSObloc1RT=emmeans(vNlmerRT$derivsFdrop2int2drop1, pairwise~ S_O|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropSObloc1RT= confint(derivsFdropSObloc1RT,level = .95, type = "response") # except blo1 super&infer + blo8/9 inter&inferior
- SOblo1oddsRT= cbind(as.data.frame(derivsFdropSObloc1RT$contrasts),CIderivsFdropSObloc1RT$contrasts[names(CIderivsFdropSObloc1RT$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3) #blo5
- #5. group*block*SO
- derivsFdropgrpSOgrpbloc1RT=emmeans(vNlmerRT$derivsFdrop2int2drop1, pairwise~ S_O|Group|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropSOgrpbloc1RT= confint(derivsFdropgrpSOgrpbloc1RT,level = .95, type = "response") #no!
- SOgrpblo1oddsRT= cbind(as.data.frame(derivsFdropgrpSOgrpbloc1RT$contrasts),CIderivsFdropSOgrpbloc1RT$contrasts[names(CIderivsFdropSOgrpbloc1RT$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- GlmerpairRTtrain= rbind.fill(hier1mainoddsRT,grpblo1oddsRT,Sogrp1oddsRT,SOblo1oddsRT,SOgrpblo1oddsRT,Sohier1oddsRT)
- for (j in 1:nrow(GlmerpairRTtrain)) {
- if(GlmerpairRTtrain$p.value[j] < 0.001 ){GlmerpairRTtrain$estimate[j] <- paste(GlmerpairRTtrain$estimate[j], c('***'))}
- else if(0.001 <= GlmerpairRTtrain$p.value[j] & GlmerpairRTtrain$p.value[j] < 0.01 ){GlmerpairRTtrain$estimate[j] <- paste(GlmerpairRTtrain$estimate[j], c('**'))}
- else if(0.01 < GlmerpairRTtrain$p.value[j]& GlmerpairRTtrain$p.value[j] < 0.05 ){GlmerpairRTtrain$estimate[j] <- paste(GlmerpairRTtrain$estimate[j], c('*'))}
- }
- #####…………………………##########
- ############ TEST #############
- ####1. simple contrast coding ####
- testdata_long3$Group = ordered(testdata_long3$Group, levels=c('Oxytocin','Placebo'))
- testdata_long3$S_O = ordered(testdata_long3$S_O, levels=c('Self','Other'))
- testdata_long3$THierarchy1st = ordered(testdata_long3$THierarchy1st, levels=c('Intermediate','1RankInterval', '2RankInterval', '3RankInterval'))
- testdata_long3$THierarchy2nd = ordered(testdata_long3$THierarchy2nd, levels=c('Superior', 'Intermediate', 'Inferior', 'Mix') )
- testdata_long3$TR3rd = ordered(testdata_long3$TR3rd, levels=c('Greater than','Equal','Less than'))
- contrasts(testdata_long3$Group)=solve(t(matrix(c(1/2,1/2, 1,-1), ncol=2)))[,2] # Oxytocin -0.5 Placebo 0.5 #lib{YawMMF}contr.simple(2)
- contrasts(testdata_long3$S_O)=solve(t(matrix(c(1/2,1/2, 1,-1), ncol=2)))[,2] # Self -0.5 Other 0.5 #
- contrasts(testdata_long3$Block)=contr.simple(9) #2-1 ~
- contrasts(testdata_long3$THierarchy1st)=solve(t(matrix(c(1/4,1/4,1/4,1/4, -1,1,0,0, -1,0,1,0, -1,0,0,1), ncol=4)))[,2:4]
- contrasts(testdata_long3$THierarchy2nd)=solve(t(matrix(c(1/4,1/4,1/4,1/4, 1,-1,0,0, 0,-1,1,0, 0,-1,0,1), ncol=4)))[,2:4]
- contrasts(testdata_long3$TR3rd)=solve(t(matrix(c(1/3,1/3,1/3, 1,-1,0, 0,-1,1), ncol=3)))[,2:3]
- #rename colname in contrast
- colnames(attr(testdata_long3$Group, "contrasts")) <- c(" (PB)")
- colnames(attr(testdata_long3$S_O, "contrasts")) <- c(" (Others)")
- colnames(attr(testdata_long3$THierarchy1st, "contrasts")) <- c(" (1RankInterval)"," (2RankInterval)"," (3RankInterval)")
- colnames(attr(testdata_long3$THierarchy2nd, "contrasts")) <- c(" (Superior)"," (Inferior)"," (Mix)")
- colnames(attr(testdata_long3$TR3rd, "contrasts")) <- c(" (Greater)"," (Less)")
- testdata_long3[c("Block","Group","S_O","THierarchy1st","THierarchy2nd","TR3rd")]=
- lapply(testdata_long3[c("Block","Group","S_O","THierarchy1st","THierarchy2nd","TR3rd")], as.factor)
- #### Treat as numeric####
- testdata_long33=testdata_long3
- testdata_long33$Block = as.numeric(testdata_long33$Block)
- ###ACC numeric####
- #
- vNglmertest<- list()
- #only self--Grop*block*self | 2021.4 final**
- vNglmertest[["derivsFS"]]<-glmer(ACC~Group*S_O*Block+ (1| Subject),data = testdata_long33, glmerControl(calc.derivs = F,optCtrl = list(maxfun=1e5)),family="binomial")
- vNglmertest[["derivsFSdrop"]]<-update(vNglmertest[["derivsFS"]], .~.- Group:S_O:Block-S_O:Block) #good!
- vNglmertest[["Tinterval1st"]]<-glmer(ACC~Group*S_O*Block*TRANK1st+ (1| Subject),data = testdata_long33, glmerControl(calc.derivs = F,optCtrl = list(maxfun=1e5)),family="binomial")
- vNglmertest[["Tinterval1stdrop"]]<-update(vNglmertest[["Tinterval1st"]], .~. -Group:S_O -S_O:TRANK1st
- -Group:S_O:Block -Group:S_O:TRANK1st - Group:Block:TRANK1st -S_O:Block:TRANK1st - Group:S_O:Block:TRANK1st) #
- ### results ACC test Nglmer report ####
- vNglmertest=vNglmertest[sort(names(vNglmertest))]
- vNglmertestAICSIN=cbind(sapply(vNglmertest,AIC),sapply(vNglmertest,BIC),sapply(vNglmertest,isSingular)) %>% as.data.frame()
- vNglmertestAICSIN<- vNglmertestAICSIN[order(vNglmertestAICSIN$V1),] #blocksubl3 13505.00 1
- vNglmertestsum=lapply(vNglmertest,summary)
- vNglmertestAnova=lapply(within(vNglmertest, rm(Null)),Anova) #must fixed
- vNglmertestanova=lapply(vNglmertest,anova)
- vNglmertestPCA=lapply(vNglmertest,rePCA) # proportion of variance in subject or other random effects
- vNglmertestcorr=lapply(vNglmertest,VarCorr) #random effects variance in std.dev whose small~0 !same PCA
- vNglmertestcohend=lapply(vNglmertest,function(i) {rbind(c(0,0,0),lme.dscore(i,testdata_long33, type="lme4"))}) # effect size cohend
- #vNglmertestACC= lapply(vNglmertest,model_performance)
- #odds ratios
- vNglmertestse=lapply(vNglmertest,function(i) {sqrt(diag(vcov(i)))}) # se
- vNglmertestconfint=list() # estimated beita~
- vNglmertestconfintodd=list() # odds ratios~
- Est=list()
- LL=list() #%95
- UL=list()
- for (i in 1:length(vNglmertest)){
- vNglmertestconfint[[i]]= cbind( Est=fixef(vNglmertest[[i]]),LL=fixef(vNglmertest[[i]]) -1.96 * vNglmertestse[[i]],UL=fixef(vNglmertest[[i]]) +1.96 * vNglmertestse[[i]]) %>%
- as.data.frame()
- names(vNglmertestconfint)[i]=names(vNglmertest)[i]
- vNglmertestconfintodd[[i]]= exp(vNglmertestconfint[[i]]) %>% plyr::rename(c("Est" = "Odds ratios", 'LL'='Odds LL', 'UL'='Odds UL'))
- names(vNglmertestconfintodd)[i]=names(vNglmertest)[i] } # odds ratios~95
- vNglmertestpara=list()
- vNglmertestperform=list()
- for (i in 1:length(vNglmertest)){
- vNglmertestpara[[i]]= cbind(model_parameters(vNglmertest[[i]],effects="fixed", exponentiate = T),vNglmertestconfintodd[[i]],vNglmertestcohend[[i]] ) %>% # b~p + odds +cohend
- mutate_if(is.numeric, round, digits=3)
- names(vNglmertestpara)[i]=names(vNglmertest)[i]
- for (j in 1:nrow(vNglmertestpara[[i]])) {
- if(vNglmertestpara[[i]]$p[j] < 0.001 ){vNglmertestpara[[i]]$Coefficient[j] <- paste(vNglmertestpara[[i]]$Coefficient[j], c('***'))}
- else if(0.001 <= vNglmertestpara[[i]]$p[j] & vNglmertestpara[[i]]$p[j] < 0.01 ){vNglmertestpara[[i]]$Coefficient[j] <- paste(vNglmertestpara[[i]]$Coefficient[j], c('**'))}
- else if(0.01 < vNglmertestpara[[i]]$p[j]& vNglmertestpara[[i]]$p[j] < 0.05 ){vNglmertestpara[[i]]$Coefficient[j] <- paste(vNglmertestpara[[i]]$Coefficient[j], c('*'))}
- else {vNglmertestpara[[i]]$p[j] <- paste(vNglmertestpara[[i]]$p[j],c('')) }}
- vNglmertestpara[[i]]$Parameter<-str_replace_all(vNglmertestpara[[i]]$Parameter,c(":"=" × "))
- vNglmertestpara[[i]]<-subset(vNglmertestpara[[i]], select=names(vNglmertestpara[[i]])!='df_error')
- vNglmertestperform[[i]]= model_performance(vNglmertest[[i]]) %>% #AIC~
- mutate_if(is.numeric, round, digits=3)
- names(vNglmertestperform)[i]=names(vNglmertest)[i]
- }
- listsumtestACC <- do.call("rbind", vNglmertestpara)
- listAICtestACC <-rbind.fill(vNglmertestperform)
- row.names(listAICtestACC)<- names(vNglmertestperform)
- ### pair test marginal
- ##odds ratio !!
- #1. group*block |derivsFSdrop---2021.10
- derivsFdropgrpbloctest1=emmeans(vNglmertest$derivsFSdrop, pairwise~ Group|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropgrpbloctest1= confint(derivsFdropgrpbloctest1,level = .95, type = "response") #no!
- grpblo1oddstest= cbind(as.data.frame(derivsFdropgrpbloctest1$contrasts),CIderivsFdropgrpbloctest1$contrasts[names(CIderivsFdropgrpbloctest1$contrasts) %in% c("asymp.LCL", "asymp.UCL")]) %>%
- mutate_if(is.numeric, round, digits=3)
- #2.group*SO
- derivsFdropSogrptest1=emmeans(vNglmertest$derivsFSdrop, pairwise~ S_O|Group, type = "response", reverse = TRUE)
- CIderivsFdropSogrptest1= confint(derivsFdropSogrptest1,level = .95, type = "response") #intermediate
- Sogrp1oddstest= cbind(as.data.frame(derivsFdropSogrptest1$contrasts),CIderivsFdropSogrptest1$contrasts[names(CIderivsFdropSogrptest1$contrasts) %in% c("asymp.LCL", "asymp.UCL")]) %>%
- mutate_if(is.numeric, round, digits=3)
- GlmerpairACCtest= rbind.fill(grpblo1oddstest,Sogrp1oddstest)
- for (j in 1:nrow(GlmerpairACCtest)) {
- if(GlmerpairACCtest$p.value[j] < 0.001 ){GlmerpairACCtest$odds.ratio[j] <- paste(GlmerpairACCtest$odds.ratio[j], c('***'))}
- else if(0.001 <= GlmerpairACCtest$p.value[j] & GlmerpairACCtest$p.value[j] < 0.01 ){GlmerpairACCtest$odds.ratio[j] <- paste(GlmerpairACCtest$odds.ratio[j], c('**'))}
- else if(0.01 < GlmerpairACCtest$p.value[j]& GlmerpairACCtest$p.value[j] < 0.05 ){GlmerpairACCtest$odds.ratio[j] <- paste(GlmerpairACCtest$odds.ratio[j], c('*'))}
- }
- describetestACCRT=rBind(describeBy(testdata_long33~Group, mat=TRUE),describeBy(testdata_long33~S_O, mat=TRUE))
- set_theme(base = theme_classic(), axis.textsize = .9)
- PACCtest_LRSodds= plot_model(vNglmertest$derivsFSdrop, type = "est",wrap.labels = 50, axis.lim = c(0.1,5),show.values = TRUE, show.intercept = T, value.offset = .3,colors = c("blue","red"),title = '',
- axis.labels = rev(c("(Intercept)", "Group (PB)","S_O (Others)","Block" , "Group (PB) × S_O (Others)","Group (PB) × Block" ))) # value.size = 2,
- pACC_Test=c('PACCtest_LRSodds')
- lapply(pACC_Test,function(x){ggsave(file=paste("D:/fmriOT/faststone/",x,"png",sep="."),dpi = 300, width =14, height = 10, units = "cm",type="cairo",get(x))})
- #t1st interval
- plot_model(vNglmertest$Tinterval1stdrop, type = "est",wrap.labels = 50, axis.lim = c(0.1,5),show.values = TRUE, show.intercept = T, value.offset = .3,colors = c("blue","red"),title = '') # value.size = 2,
- plot_model(vNglmertest$Tinterval1st, type = "est",wrap.labels = 50, axis.lim = c(0.1,5),show.values = TRUE, show.intercept = T, value.offset = .3,colors = c("blue","red"),title = '') # value.size = 2,
- ####RT numeric####
- # LMM(Linear Mixed Model) with ML
- testdata_long33$RT=as.numeric(testdata_long33$RT)
- vNlmertestRT<- list()
- vNlmertestRT[["derivsFS"]]<-lmerTest::lmer(RT~Group*S_O*Block+ (1| Subject),data = testdata_long33, REML = F )
- vNlmertestRT[["derivsFSdrop"]]<-update(vNlmertestRT[["derivsFS"]], .~.- Group:S_O:Block-S_O:Group) #good!
- ### RT Nlmer report results ####
- vNlmertestRT=vNlmertestRT[sort(names(vNlmertestRT))]
- vNlmertestRTAICSIN=cbind(sapply(vNlmertestRT,AIC),sapply(vNlmertestRT,BIC),sapply(vNlmertestRT,isSingular)) %>% as.data.frame()
- vNlmertestRTAICSIN<- vNlmertestRTAICSIN[order(vNlmertestRTAICSIN$V1),]
- vNlmertestRTsum=lapply(vNlmertestRT,summary)
- vNlmertestRTAnova=lapply(vNlmertestRT,Anova)
- vNlmertestRTanova=lapply(vNlmertestRT,anova)
- vNlmertestRTPCA=lapply(vNlmertestRT,rePCA) # proportion of variance in subject or other random effects
- vNlmertestRTcorr=lapply(vNlmertestRT,VarCorr) # small~0 !same PCA
- vNlmertestRTcohend=lapply(vNlmertestRT,function(i) {rbind(c(0,0,0),lme.dscore(i,testdata_long33, type="lme4"))}) # effect size cohend
- #ODDS
- vNglmertestseRT=lapply(vNlmertestRT,function(i) {sqrt(diag(vcov(i)))}) # se
- vNglmertestconfintRT=list() # estimated beita~
- vNglmertestconfintoddRT=list() # odds ratios~
- Est=list()
- LL=list() #%95
- UL=list()
- for (i in 1:length(vNlmertestRT)){
- vNglmertestconfintRT[[i]]= cbind( Est=fixef(vNlmertestRT[[i]]),LL=fixef(vNlmertestRT[[i]]) -1.96 * vNglmertestseRT[[i]],UL=fixef(vNlmertestRT[[i]]) +1.96 * vNglmertestseRT[[i]]) %>%
- as.data.frame()
- names(vNglmertestconfintRT)[i]=names(vNlmertestRT)[i]
- vNglmertestconfintoddRT[[i]]= exp(vNglmertestconfintRT[[i]]) %>% plyr::rename(c("Est" = "Odds ratios", 'LL'='Odds LL', 'UL'='Odds UL'))
- names(vNglmertestconfintoddRT)[i]=names(vNlmertestRT)[i]
- vNlmertestRTcohend[[i]]=plyr::rename(vNlmertestRTcohend[[i]],c("t" = "cohedt")) #double t in cohed so rename
- } # odds ratios~
- vNglmertestRTpara=list()
- vNglmertestperformRT=list()
- for (i in 1:length(vNlmertestRT)){
- vNglmertestRTpara[[i]]= cbind(model_parameters(vNlmertestRT[[i]],effects="fixed"),vNglmertestconfintoddRT[[i]],vNlmertestRTcohend[[i]] )%>%
- mutate_if(is.numeric, round, digits=3)
- names(vNglmertestRTpara)[i]=names(vNlmertestRT)[i]
- for (j in 1:nrow(vNglmertestRTpara[[i]])) {
- if(vNglmertestRTpara[[i]]$p[j] < 0.001 ){vNglmertestRTpara[[i]]$Coefficient[j] <- paste(vNglmertestRTpara[[i]]$Coefficient[j], c('***'))}
- else if(0.001 <= vNglmertestRTpara[[i]]$p[j] & vNglmertestRTpara[[i]]$p[j] < 0.01 ){vNglmertestRTpara[[i]]$Coefficient[j] <- paste(vNglmertestRTpara[[i]]$Coefficient[j], c('**'))}
- else if(0.01 < vNglmertestRTpara[[i]]$p[j]& vNglmertestRTpara[[i]]$p[j] < 0.05 ){vNglmertestRTpara[[i]]$Coefficient[j] <- paste(vNglmertestRTpara[[i]]$Coefficient[j], c('*'))}
- else {vNglmertestRTpara[[i]]$p[j] <- paste(vNglmertestRTpara[[i]]$p[j],c('')) }}
- vNglmertestRTpara[[i]]$Parameter<-str_replace_all(vNglmertestRTpara[[i]]$Parameter,c(":"=" × "))
- vNglmertestRTpara[[i]]<-subset(vNglmertestRTpara[[i]], select=names(vNglmertestRTpara[[i]])!='df_error')
- vNglmertestperformRT[[i]]= model_performance(vNlmertestRT[[i]]) %>% #AIC~
- mutate_if(is.numeric, round, digits=3)
- names(vNglmertestperformRT)[i]=names(vNlmertestRT)[i]
- }
- listsumtestRT <- do.call("rbind",vNglmertestRTpara)
- listAICtestRT <-rbind.fill(vNglmertestperformRT[c( "derivsFS","derivsFSdrop")])
- row.names(listAICtestRT)<-c( "derivsFS","derivsFSdrop")
- ### pair test marginal effect
- emm_options((pbkrtest.limit = 30000))
- #1. group*block
- #derivsFS --2021.10--no
- derivsFdropgrpbloc1RTtest=emmeans(vNlmertestRT$derivsFSdrop, pairwise~ Group|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropgrpbloc1RTtest= confint(derivsFdropgrpbloc1RTtest,level = .95, type = "response") #no!
- grpblo1oddsRTtest= cbind(as.data.frame(derivsFdropgrpbloc1RTtest$contrasts),CIderivsFdropgrpbloc1RTtest$contrasts[names(CIderivsFdropgrpbloc1RTtest$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3)
- #4. SO*block
- derivsFdropSObloc1RTtest=emmeans(vNlmertestRT$derivsFSdrop, pairwise~ S_O|Block, at = list(Block = c(1:9)), type = "response", reverse = TRUE) #every all~
- CIderivsFdropSObloc1RTtest= confint(derivsFdropSObloc1RTtest,level = .95, type = "response") #
- SOblo1oddsRTtest= cbind(as.data.frame(derivsFdropSObloc1RTtest$contrasts),CIderivsFdropSObloc1RTtest$contrasts[names(CIderivsFdropSObloc1RTtest$contrasts) %in% c( "asymp.LCL" , "asymp.UCL" )]) %>%
- mutate_if(is.numeric, round, digits=3) #blo5
- GlmerpairRTtest= rbind.fill(grpblo1oddsRTtest,SOblo1oddsRTtest)
- for (j in 1:nrow(GlmerpairRTtest)) {
- if(GlmerpairRTtest$p.value[j] < 0.001 ){GlmerpairRTtest$estimate[j] <- paste(GlmerpairRTtest$estimate[j], c('***'))}
- else if(0.001 <= GlmerpairRTtest$p.value[j] & GlmerpairRTtest$p.value[j] < 0.01 ){GlmerpairRTtest$estimate[j] <- paste(GlmerpairRTtest$estimate[j], c('**'))}
- else if(0.01 < GlmerpairRTtest$p.value[j]& GlmerpairRTtest$p.value[j] < 0.05 ){GlmerpairRTtest$estimate[j] <- paste(GlmerpairRTtest$estimate[j], c('*'))}
- }
- #
- set_theme(base = theme_classic(), axis.textsize = .9)
- PRT_TRFSodds=plot_model(vNlmertestRT$derivsFSdrop, type = "est",wrap.labels = 50,axis.lim = c(-1,3),value.size = 4, show.values = TRUE, show.intercept = T, value.offset = .3,colors = c("blue","red"),title = '',
- axis.labels = rev(c('(Intercept)','Group (PB)','S_O (Others)','Block', 'Group (PB) × Block', 'S_O (Others) × Block')))
oxtfmri.R, no license · at the source
Overview
- Key Laboratory of Brain, Cognition and Education Sciences (South China Normal University), Ministry of Education, Guangzhou 510631, China
- School of Psychology, Center for Studies of Psychological Application, and Guangdong Key Laboratory of Mental Health and Cognitive Science, South China Normal University, Guangzhou 510631, China
- Laboratory of Neuroeconomics, Institut des Sciences Cognitives Marc Jeannerod, CNRS, Lyon 69675, France
- Université Claude Bernard Lyon 1, Lyon 69100, France
- Faculty of Education, Northeast Normal University, Changchun 130024, China
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.
OSF wjbpz
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
7 files
- behavior data/
oxtfmri.R , R, 657 lines, 1 match - model data/
f_RL_ELO_1_alpha.m , MATLAB, 102 lines - model data/
f_RL_ELO_3_alpha.m , MATLAB, 113 lines - model data/
f_RL_ELO_step_by_step414 , MATLAB, 130 lines.m - model data/
f_Rescola.m , MATLAB, 106 lines - model data/
f_Transfer.m , MATLAB, 112 lines - model data/
mainscriptmodel.m , MATLAB, 188 lines
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;
- 7 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.
Code and data availability statement
The paper has a code and data 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 wjbpz
Read it in the paper: doi.org/10.1073/pnas.2606871123.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 4 keywords, 13 MeSH terms, 2 funders, 53 references.
Cite
This paper
Liu, J., Qu, C., Philippe, R., Li, S., Derrington, E., & Dreher, J.-C. (2026). Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks. Proceedings of the National Academy of Sciences of the United States of America, 123(25), e2606871123. https://
BibTeX
@article{liu2026oxytocin
author = {Liu, Jiawei and Qu, Chen and Philippe, Rémi and Li, Siying and Derrington, Edmund and Dreher, Jean-Claude},
title = {{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},
year = {2026},
month = jun,
volume = {123},
number = {25},
pages = {e2606871123},
publisher = {National Academy of Sciences},
issn = {0027-8424},
doi = {10.1073/
url = {https://
pmid = {42296342},
pmcid = {PMC13291526}
}
RIS
TY - JOUR
AU - Liu, Jiawei
AU - Qu, Chen
AU - Philippe, Rémi
AU - Li, Siying
AU - Derrington, Edmund
AU - Dreher, Jean-Claude
TI - Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks
T2 - Proceedings of the National Academy of Sciences of the United States of America
J2 - Proc Natl Acad Sci U S A
PY - 2026
DA - 2026/
VL - 123
IS - 25
SP - e2606871123
SN - 0027-8424
PB - National Academy of Sciences
DO - 10.1073/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1073/
"type": "article-journal",
"title": "Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks",
"container-title": "Proceedings of the National Academy of Sciences of the United States of America",
"author": [
{
"family": "Liu",
"given": "Jiawei"
},
{
"family": "Qu",
"given": "Chen"
},
{
"family": "Philippe",
"given": "Rémi"
},
{
"family": "Li",
"given": "Siying"
},
{
"family": "Derrington",
"given": "Edmund"
},
{
"family": "Dreher",
"given": "Jean-Claude"
}
],
"container-title-short":
"volume": "123",
"issue": "25",
"page": "e2606871123",
"DOI": "10.1073/
"PMID": "42296342",
"PMCID": "PMC13291526",
"ISSN": "0027-8424",
"publisher": "National Academy of Sciences",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
15
]
]
}
}
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.1038/s42003-024-05976-2 [code]
- Transcranial direct current stimulation suggests a causal role of the medial prefrontal cortex in learning social hierarchy.Journal: Communications biologyIn common: 7 references, 2 authors
- [2] doi:10.1093/brain/awaf056 [code]
- Ventromedial prefrontal cortex lesions disrupt learning to reward others.Journal: Brain : a journal of neurologyIn common: easystats, psych, emmeans, 7 other tools, 3 references
- [3] doi:10.3758/s13415-026-01401-9 [code]
- Dissociable impacts of perceived race and ascribed status in event-related brain potentials and multivariate network activity.Journal: Cognitive, affective & behavioral neuroscienceIn common: nlme, easystats, psych, 7 other tools, 2 references
- [4] doi:10.1038/s41467-023-43747-5 [code]
- Neural substrates of parallel devaluation-sensitive and devaluation-insensitive Pavlovian learning in humans.Journal: Nature communicationsIn common: nlme, easystats, psych, 8 other tools, 1 reference
- [5] doi:10.1371/journal.pbio.3003079 [code]
- Dorsomedial and ventromedial prefrontal cortex lesions differentially impact social influence and temporal discounting.Journal: PLoS biologyIn common: easystats, psych, emmeans, 6 other tools, 3 references
- [6] doi:10.1038/s41598-022-11269-7 [code]
- Juvenile handling rescues autism-related effects of prenatal exposure to valproic acid.Journal: Scientific reportsIn common: easystats, psych, emmeans, 7 other tools, 1 reference
- [7] doi:10.1093/scan/nsag009 [code]
- Covert neural and autonomic signatures of shared perception.Journal: Social cognitive and affective neuroscienceIn common: broom, easystats, emmeans, 7 other tools, 1 reference
- [8] doi:10.1007/s00213-024-06541-9 [code]
- L-DOPA and oxytocin influence the neural correlates of performance monitoring for self and others.Journal: PsychopharmacologyIn common: emmeans, lmerTest, lme4, 4 other tools, 4 references
- [9] doi:10.1093/brain/awab345 [code]
- Multimodal mechanisms of human socially reinforced learning across neurodegenerative diseases.Journal: Brain : a journal of neurologyIn common: psych, emmeans, reshape2, 4 other tools, 3 references
- [10] doi:10.1038/s41467-024-47491-2 [code]
- Neurocomputational mechanisms involved in adaptation to fluctuating intentions of others.Journal: Nature communicationsIn common: 2 references, 2 authors
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 7 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:964de425c68729ea…
Add the badge to the code's README
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 -->
[](https://openscicode.org/badge/doi/10.1073/pnas.2606871123)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1073/pnas.2606871123.svg
:target: https://openscicode.org/badge/doi/10.1073/pnas.2606871123
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1073/pnas.2606871123"><img src="https://openscicode.org/badge/doi/10.1073/pnas.2606871123.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.
