OSCR

Dissecting the interplay of model-based control, impulsivity and compulsivity on self-control in daily life.

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.

The 1 match
  1. [1] § Methods › Regression model ↔ Data and code/SelfControl_2tasks_MLM_OSF.R, lines 218–266 · score 0.56 · random intercepts, random slopes, variables, fit, EEG, conflict strength

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 · 495 lines · 20 KB · no license · 1 match

  1. ################################################################################################################################################
  2. setwd('your directory')
  3. #### Load packages####
  4. # load required packages
  5. if(!require(readxl)){
  6. install.packages("readxl") # v 1.4.4
  7. library(readxl)
  8. }
  9. # load required packages
  10. if(!require(car)){
  11. install.packages("car") # v 3.1-3
  12. library(car)
  13. }
  14. # load required packages
  15. if(!require(tidyr)){
  16. install.packages("tidyr") # v 1.1.3
  17. library(tidyr)
  18. }
  19. # load required packages
  20. if(!require(dplyr)){
  21. install.packages("dplyr") # v 1.1.4
  22. library(dplyr)
  23. }
  24. # load required packages
  25. if(!require(psych)){
  26. install.packages("psych") # v 2.4.12
  27. library(psych)
  28. }
  29. # load required packages
  30. if(!require(stats)){
  31. install.packages("stats") # v 4.4.3
  32. library(stats)
  33. }
  34. # load required packages
  35. if(!require(DHARMa)){
  36. install.packages("DHARMa") # v 0.4.7
  37. library(DHARMa)
  38. }
  39. # load required packages
  40. if(!require(lme4)){
  41. install.packages("lme4") # v 1.1-36
  42. library(lme4)
  43. }
  44. # load required packages
  45. if(!require(emmeans)){
  46. install.packages("emmeans") # v 1.10.7
  47. library(emmeans)
  48. }
  49. # load required packages
  50. if(!require(sjPlot)){
  51. install.packages("sjPlot") # v 2.8.17
  52. library(sjPlot)
  53. }
  54. # load required packages
  55. if(!require(report)){
  56. install.packages("report") # v 0.6.1
  57. library(report)
  58. }
  59. # load required packages
  60. if(!require(interactions)){
  61. install.packages("interactions") # v 1.2.0
  62. library(interactions)
  63. }
  64. # load required packages
  65. if(!require(ggplot2)){
  66. install.packages("ggplot2") # v 3.5.1
  67. library(ggplot2)
  68. }
  69. #### Read Dataset ####
  70. SC_data_indiv <- openxlsx::read.xlsx("SC_2tasks_indiv.xlsx")
  71. SC_data_indiv <- dplyr::rename(SC_data_indiv, TotalMiss = Miss , TotalDes = Des , TotalCon = Con ,
  72. TotalConEnact = ConEnact , TotalResEnact = ResEnact ,
  73. MeanConStrength = ConStrength , MeanDesStrength = DesStrength,
  74. MeanDesStrengthEnact = DesStrengthEnact)
  75. names <- SC_data_indiv$name
  76. SC_data_indiv$namesNew <- factor(x = SC_data_indiv$name, levels = names)
  77. EMA_long <- read.csv("your directory\\EMA_longForm.csv")
  78. exclude <- setdiff(EMA_long$name, SC_data_indiv$name)
  79. EMA_long <- EMA_long[!EMA_long$name %in% exclude, ] #frame originally contains all participants
  80. AllData <- full_join(SC_data_indiv, EMA_long, by = c("name"))
  81. glmmData <- subset(AllData, select = c(1, 4, 7, 10, 13, 16, 21, 38, 39, 82, 86, 87, 89:93)) # only needed columns
  82. glmmData$resistance[glmmData$resistance == 0] <- -1
  83. # extract only conflicted situations
  84. glmmData_conflict <- (glmmData %>% filter(conflict==1))
  85. # scale all continuous predictors
  86. glmmData[,c(2:9 )]<-scale(glmmData[,c(2:9)],center=F,scale=T) #mean betas, BIS, OCI
  87. glmmData[,c(13, 15 )] <- scale(glmmData[,c(13, 15 )], center = F, scale = T) #conf and des strength
  88. glmmData_conflict[,c(2:9 )]<-scale(glmmData_conflict[,c(2:9)],center=F,scale=T) #mean betas, BIS, OCI
  89. glmmData_conflict[,c(13, 15 )] <- scale(glmmData_conflict[,c(13, 15 )], center = F, scale = T) #conf and des strength
  90. #### desriptives ####
  91. psych::describe(SC_data_indiv[, c(18:22, 30:32, 38:39, 52:81)])
  92. ##################################################################################
  93. # checking assumptions
  94. #
  95. # The assumptions of generalised linear mixed models are a combination of
  96. # the assumptions of GLMs and mixed models.
  97. #
  98. # The observed y are independent, conditional on some predictors x
  99. #
  100. # The response y come from a known distribution from the exponential family,
  101. # with a known mean variance relationship
  102. #
  103. # There is a straight line relationship between some known function (link) of the mean of y
  104. # and the predictors x and random effects z
  105. #
  106. # Random effects z are independent of y
  107. #
  108. # Random effects z are normally distributed
  109. ##################################################################################
  110. # Model Random Slope
  111. fit.bin <- glmer(enactment ~ 1 + desire_strength + conflict_strength + BIS + OCI +
  112. (1 + desire_strength + conflict_strength|name),
  113. family = binomial("logit"), data = glmmData,
  114. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  115. summary(fit.bin)
  116. # examine residual plots - plots difficult to interpret for binary data
  117. par(mfrow = c(1, 2))
  118. plot(residuals(fit.bin) ~ fitted(fit.bin), main = "residuals v.s. Fitted")
  119. qqnorm(residuals(fit.bin)) #seems ok
  120. #check dispersion
  121. # https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html#general-remarks-on-interperting-residual-patterns-and-tests
  122. # https://github.com/florianhartig/DHARMa/issues/181
  123. # https://github.com/florianhartig/DHARMa/issues/396
  124. ss <- DHARMa::simulateResiduals(fit.bin, plot = T) #straight diagnonal --> looks ok
  125. testDispersion(ss) #n.s.
  126. simulationOutput = recalculateResiduals(ss , group = glmmData$name)
  127. testDispersion(simulationOutput) #n.s.
  128. plot(simulationOutput) #KS test distribution, dispersion and residual vs. predicted values ok, but outlier test significant
  129. # check normality of RE
  130. r_int<- ranef(fit.bin)$name$`(Intercept)`
  131. shapiro.test(r_int) # p <.001
  132. qqPlot(r_int)
  133. r_conf<- ranef(fit.bin)$name$conflict_strength
  134. shapiro.test(r_conf) # p .63
  135. qqPlot(r_conf)
  136. r_des<- ranef(fit.bin)$name$desire_strength
  137. shapiro.test(r_des) # p .044
  138. qqPlot(r_des)
  139. ##################################################################################
  140. # Level 1 predictors will be desire and conflict strength (Krönke et al., 2020),
  141. # level 2 predictors will be impulsivity and compulsivity
  142. # enactment ~ desire strength * conflict strength * impulsivity * compulsivity + (desire strength * conflict strength | participant)
  143. ##################################################################################
  144. ##################################################################################
  145. # models for different situations
  146. ##################################################################################
  147. ## all situations
  148. # fit null model
  149. fit0a <- glm(enactment ~ 1, family = binomial("logit"), data = glmmData)
  150. summary(fit0a)
  151. # fit baseline model (2 levels)
  152. fit0b <- glmer(enactment ~ (1|name), family = binomial("logit"), data = glmmData)
  153. summary(fit0b)
  154. # see if random effects warranted - if significant then yes
  155. null.id = -2 * logLik(fit0a) + 2 * logLik(fit0b)
  156. pchisq(as.numeric(null.id), df=1, lower.tail=F) #yes: p 8.7e-238
  157. ## conflict situations
  158. # fit null model
  159. fit0a <- glm(enactment ~ 1, family = binomial("logit"), data = glmmData_conflict)
  160. summary(fit0a)
  161. # fit baseline model (2 levels)
  162. fit0b <- glmer(enactment ~ (1|name), family = binomial("logit"), data = glmmData_conflict)
  163. summary(fit0b)
  164. # see if random effects warranted - if significant then yes
  165. null.id = -2 * logLik(fit0a) + 2 * logLik(fit0b)
  166. pchisq(as.numeric(null.id), df=1, lower.tail=F) #yes: p 4.3e-31
  167. # examine estimates of the community effects or residuals
  168. u0 <- ranef(fit0b, condVar = TRUE)
  169. u0se <- sqrt(attr(u0[[1]], "postVar")[1, , ])
  170. commid <- as.numeric((str_sub(rownames(u0[[1]]), start = -4)))
  171. u0tab <- cbind("commid" = commid, "u0" = u0[[1]], "u0se" = u0se)
  172. colnames(u0tab)[2] <- "u0"
  173. u0tab <- u0tab[order(u0tab$u0), ]
  174. u0tab <- cbind(u0tab, c(1:dim(u0tab)[1]))
  175. u0tab <- u0tab[order(u0tab$commid), ]
  176. colnames(u0tab)[4] <- "u0rank"
  177. # The plot shows the estimated residuals for all 236 participants in the sample. For a
  178. # substantial number of participants, the 95% confidence interval does not overlap
  179. # the horizontal line at zero, indicating that enactment of desires in these
  180. # participants is significantly above average (above the zero line) or below average
  181. # (below the zero line)
  182. plot(u0tab$u0rank, u0tab$u0, type = "n", xlab = "u_rank",
  183. ylab = "conditional modes of r.e. for comm_id:_cons", ylim = c(-4, 4))
  184. segments(u0tab$u0rank, u0tab$u0 - 1.96*u0tab$u0se, u0tab$u0rank, u0tab$u0 + 1.96*u0tab$u0se)
  185. points(u0tab$u0rank, u0tab$u0, col = "blue")
  186. abline(h = 0, col = "red")
  187. # add explanatory variables
  188. ## all situations
  189. #random intercept
  190. fit0c <- glmer(enactment ~ desire_strength + conflict_strength + (1|name),
  191. family = binomial("logit"), data = glmmData)
  192. summary(fit0c)
  193. # random slopes
  194. fit0c1 <- glmer(enactment ~ desire_strength + conflict_strength + (1 + conflict_strength + desire_strength|name),
  195. family = binomial("logit"), data = glmmData)
  196. summary(fit0c1)
  197. # see if random slopes warranted - if significant then yes
  198. null.id = -2 * logLik(fit0c) + 2 * logLik(fit0c1)
  199. pchisq(as.numeric(null.id), df=1, lower.tail=F) #yes: p 2.04-99
  200. ## conflict situations
  201. #random intercept
  202. fit0d <- glmer(enactment ~ desire_strength + conflict_strength + (1|name),
  203. family = binomial("logit"), data = glmmData_conflict)
  204. summary(fit0d)
  205. # random slopes
  206. fit0d1 <- glmer(enactment ~ desire_strength + conflict_strength + (1 + conflict_strength + desire_strength|name),
  207. family = binomial("logit"), data = glmmData_conflict)
  208. summary(fit0d1)
  209. ###############################################################################################################
  210. ############ explore effect of EEG ###########################################################
  211. ###############################################################################################################
  212. ########## two step task
  213. # for all situations
  214. # add FRN and P3 (cor .14)
  215. fit4a0 <- glmer(enactment ~ desire_strength + conflict_strength +
  216. mean_beta_FRN + mean_beta_fbP3b +
  217. (1 + desire_strength + conflict_strength|name),
  218. family = binomial("logit"), data = glmmData,
  219. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  220. summary(fit4a0) #singular fit
  221. sjPlot::tab_model(fit4a0)
  222. report::report(fit4a0)
  223. # add BIS and OCI
  224. fit4a <- glmer(enactment ~ desire_strength + conflict_strength +
  225. mean_beta_FRN + mean_beta_fbP3b + BIS + OCI +
  226. (1 + desire_strength + conflict_strength|name),
  227. family = binomial("logit"), data = glmmData,
  228. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  229. summary(fit4a)
  230. sjPlot::tab_model(fit4a)
  231. report::report(fit4a)
  232. # add interactions with BIS and OCI
  233. fit4b <- glmer(enactment ~ desire_strength + conflict_strength +
  234. mean_beta_FRN + mean_beta_FRN:BIS + mean_beta_FRN:OCI + mean_beta_FRN:BIS:OCI +
  235. mean_beta_fbP3b + mean_beta_fbP3b:BIS + mean_beta_fbP3b:OCI + mean_beta_fbP3b:BIS:OCI +
  236. (1 + desire_strength + conflict_strength|name),
  237. family = binomial("logit"), data = glmmData,
  238. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  239. summary(fit4b)
  240. sjPlot::tab_model(fit4b)
  241. report::report(fit4b)
  242. #for conflicts
  243. # add FRN and P3
  244. fit4a02 <- glmer(enactment ~ desire_strength + conflict_strength +
  245. mean_beta_FRN + mean_beta_fbP3b +
  246. (1 + desire_strength + conflict_strength|name),
  247. family = binomial("logit"), data = glmmData_conflict,
  248. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  249. summary(fit4a02) #singular fit
  250. sjPlot::tab_model(fit4a02)
  251. report::report(fit4a02)
  252. # add BIS and OCI
  253. fit4a2 <- glmer(enactment ~ desire_strength + conflict_strength +
  254. mean_beta_FRN + mean_beta_fbP3b + BIS + OCI +
  255. (1 + desire_strength + conflict_strength|name),
  256. family = binomial("logit"), data = glmmData_conflict,
  257. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  258. summary(fit4a2)
  259. sjPlot::tab_model(fit4a2)
  260. report::report(fit4a2)
  261. # add interactions with BIS and OCI
  262. fit4b2 <- glmer(enactment ~ desire_strength + conflict_strength +
  263. mean_beta_FRN + mean_beta_FRN:BIS + mean_beta_FRN:OCI + mean_beta_FRN:BIS:OCI +
  264. mean_beta_fbP3b + mean_beta_fbP3b:BIS + mean_beta_fbP3b:OCI + mean_beta_fbP3b:BIS:OCI +
  265. (1 + desire_strength + conflict_strength|name),
  266. family = binomial("logit"), data = glmmData_conflict,
  267. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  268. summary(fit4b2)
  269. sjPlot::tab_model(fit4b2)
  270. report::report(fit4b2)
  271. ########## GONOGO task
  272. # for all situations
  273. # add N2 and P3 (cave: cor .65)
  274. fit5a0 <- glmer(enactment ~ desire_strength + conflict_strength +
  275. mean_beta_N2 + mean_beta_stimP3a +
  276. (1 + desire_strength + conflict_strength|name),
  277. family = binomial("logit"), data = glmmData,
  278. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  279. summary(fit5a0)
  280. sjPlot::tab_model(fit5a0)
  281. report::report(fit5a0)
  282. # add BIS and OCI
  283. fit5a <- glmer(enactment ~ desire_strength + conflict_strength +
  284. mean_beta_N2 + mean_beta_stimP3a + BIS + OCI +
  285. (1 + desire_strength + conflict_strength|name),
  286. family = binomial("logit"), data = glmmData,
  287. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  288. summary(fit5a)
  289. sjPlot::tab_model(fit5a)
  290. report::report(fit5a)
  291. # add interactions with BIS and OCI
  292. fit5b <- glmer(enactment ~ desire_strength + conflict_strength +
  293. mean_beta_N2 + mean_beta_N2:BIS + mean_beta_N2:OCI + mean_beta_N2:BIS:OCI +
  294. mean_beta_stimP3a + mean_beta_stimP3a:BIS + mean_beta_stimP3a:OCI + mean_beta_stimP3a:BIS:OCI +
  295. (1 + desire_strength + conflict_strength|name),
  296. family = binomial("logit"), data = glmmData,
  297. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  298. summary(fit5b)
  299. sjPlot::tab_model(fit5b)
  300. report::report(fit5b)
  301. ########### investigate interactions
  302. # Calculate mean and SD of the moderators (predictor2 and predictor3)
  303. mean_pred2 <- mean(glmmData$BIS)
  304. sd_pred2 <- sd(glmmData$BIS)
  305. mean_pred3 <- mean(glmmData$OCI)
  306. sd_pred3 <- sd(glmmData$OCI)
  307. ### Imp*Comp
  308. # Specify the values for predictor2 and predictor3 at which to estimate the simple slopes
  309. emm <- emmeans(fit4b,
  310. ~ mean_beta_FRN | BIS * OCI,
  311. at = list(BIS = c(mean_pred2 - sd_pred2, mean_pred2, mean_pred2 + sd_pred2),
  312. OCI = c(mean_pred3 - sd_pred3, mean_pred3, mean_pred3 + sd_pred3)))
  313. # View the estimated marginal means and simple slopes
  314. summary(emm)
  315. # Regrid the emmeans object to back-transform estimates
  316. regridded_emm <- regrid(emm)
  317. # Use emtrends to test the slope of FRN effect at different levels of Imp and Comp
  318. slopes <- emtrends(fit4b, ~ BIS * OCI, var = "mean_beta_FRN",
  319. at = list(BIS = c(mean_pred2 - sd_pred2, mean_pred2, mean_pred2 + sd_pred2),
  320. OCI = c(mean_pred3 - sd_pred3, mean_pred3, mean_pred3 + sd_pred3)))
  321. slopes2 <- emtrends(fit4b, ~ BIS * OCI, var = "mean_beta_FRN",
  322. at = list(BIS = c(mean_pred2 - sd_pred2, mean_pred2 + sd_pred2),
  323. OCI = c(mean_pred3 - sd_pred3, mean_pred3 + sd_pred3)))
  324. #compare slopes
  325. pairs(slopes, simple = "each")
  326. ## plot interactions
  327. glmmData$Impulsivity <- glmmData$BIS
  328. glmmData$Compulsivity <- glmmData$OCI
  329. glmmData$FRN <- glmmData$mean_beta_FRN
  330. glmmData$P3 <- glmmData$mean_beta_fbP3b
  331. glmmData$Enactment <- glmmData$enactment
  332. fit4plot <- glmer(Enactment ~ desire_strength + conflict_strength +
  333. FRN + FRN:Impulsivity + FRN:Compulsivity + Impulsivity:Compulsivity:FRN +
  334. P3 + P3:Impulsivity + P3:Compulsivity + Impulsivity:Compulsivity:P3 +
  335. (1 + desire_strength + conflict_strength|name),
  336. family = binomial("logit"), data = glmmData,
  337. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))
  338. summary(fit4plot)
  339. #FRN
  340. #big fonts get smaller when images are saved
  341. interact_plot(fit4plot, pred = FRN, modx = Impulsivity, mod2 = Compulsivity,
  342. outcome.scale = 'response', interval = T, x.label = "FRN effect", colors = "Dark2") +
  343. theme(axis.title.x = element_text( size = 30, face = "bold"),
  344. axis.title.y = element_text( size = 30, face = "bold"),
  345. plot.subtitle = element_text(size = 28),
  346. axis.text = element_text( size = 14),
  347. legend.title=element_text(size=22),
  348. legend.text=element_text(size=22))
  349. interact_plot(fit4plot, pred = FRN, modx = Compulsivity, mod2 = Impulsivity,
  350. outcome.scale = 'response', interval = T, x.label = "FRN effect", colors = "Dark2") +
  351. theme(axis.title.x = element_text( size = 30, face = "bold"),
  352. axis.title.y = element_text( size = 30, face = "bold"),
  353. plot.subtitle = element_text(size = 28),
  354. axis.text = element_text( size = 14),
  355. legend.title=element_text(size=22),
  356. legend.text=element_text(size=22))
  357. interact_plot(fit4plot, pred = FRN, modx = Compulsivity, interval = T, x.label = "FRN effect", colors = "Dark2") +
  358. geom_line(size = 1) +
  359. theme(axis.title.x = element_text( size = 30, face = "bold"),
  360. axis.title.y = element_text( size = 30, face = "bold"),
  361. axis.text = element_text( size = 14),
  362. legend.title=element_text(size=22),
  363. legend.text=element_text(size=22))
  364. interact_plot(fit4plot, pred = FRN, modx = Impulsivity, interval = T)
  365. geom_line(size = 10)
  366. #P3
  367. interact_plot(fit4plot, pred = P3, modx = Impulsivity, mod2 = Compulsivity,
  368. outcome.scale = 'response')
  369. interact_plot(fit4plot, pred = P3, modx = Compulsivity, mod2 = Impulsivity,
  370. outcome.scale = 'response')
  371. interact_plot(fit4plot, pred = P3, modx = Compulsivity)
  372. geom_line(size = 10)
  373. interact_plot(fit4plot, pred = P3, modx = Impulsivity)
  374. geom_line(size = 10)
  375. ###############################################################################################################
  376. ############ explore effect of desire and conflict occurrence ###########################################################
  377. ###############################################################################################################
  378. ### conflict occurence by EEG
  379. fit6a1 <- glmer(conflict ~ mean_beta_FRN + mean_beta_fbP3b + BIS + OCI + (1|name),
  380. family = binomial("logit"), data = glmmData,
  381. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1e9)))
  382. summary(fit6a)
  383. fit6a2 <- glmer(conflict ~ mean_beta_FRN:BIS:OCI + mean_beta_fbP3b:BIS:OCI + BIS + OCI + (1|name),
  384. family = binomial("logit"), data = glmmData,
  385. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1e9)))
  386. summary(fit6a2)
  387. sjPlot::tab_model(fit6a2)
  388. report::report(fit6a2)
  389. interact_plot(fit6a2, pred = mean_beta_FRN, modx = OCI,
  390. outcome.scale = 'response', interval = T)
  391. ggplot(glmmData, aes(x=OCI, y=conflict)) +
  392. labs(x="Compulsivity", y="Conflict") +
  393. geom_smooth(method=glm , color="#D95F02", ,size = 1.5, se=TRUE) +
  394. theme_minimal() +
  395. theme(panel.grid.minor = element_blank()) +
  396. theme(panel.grid.major = element_line(,size = 0.5,linetype = 5)) +
  397. theme(axis.title.x = element_text(color = "#34495e", size = 16, face = "bold"),
  398. axis.title.y = element_text(color = "#34495e", size = 16, face = "bold")) +
  399. ylim(0.0, 1.0)
  400. ### desire occurence
  401. fit7a <- glmer(desire ~ mean_beta_FRN:BIS:OCI + mean_beta_fbP3b:BIS:OCI + BIS + OCI + (1|name),
  402. family = binomial("logit"), data = glmmData,
  403. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1e9)))
  404. summary(fit7a)
  405. sjPlot::tab_model(fit7a)
  406. report::report(fit7a)
  407. interact_plot(fit7a, pred = mean_beta_FRN, modx = OCI,
  408. outcome.scale = 'response', interval = T)
  409. ggplot(glmmData, aes(x=OCI, y=desire)) +
  410. labs(x="Compulsivity", y="Desire") +
  411. geom_smooth(method=glm, color = "#D95F02" ,size = 1.5, se=TRUE) +
  412. theme_minimal() +
  413. theme(panel.grid.minor = element_blank()) +
  414. theme(panel.grid.major = element_line(size = 0.5,linetype = 5)) +
  415. theme(axis.title.x = element_text( size = 16, face = "bold", color = "#34495e"),
  416. axis.title.y = element_text( size = 16, face = "bold", color = "#34495e")) +
  417. ylim(0.0, 1.0)
  418. ### explore FRN and EMA
  419. fit8a <- glmer(enactment ~ conflict_strength*desire_strength + conflict_strength:mean_beta_FRN:BIS + conflict_strength:mean_beta_FRN:OCI +
  420. desire_strength:mean_beta_FRN:BIS + desire_strength:mean_beta_FRN:OCI +(1 + desire_strength + conflict_strength|name),
  421. family = binomial("logit"), data = glmmData,
  422. control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1e9)))
  423. summary(fit8a) #only EMA data predicts enactment

SelfControl_2tasks_MLM_OSF.R, no license · at the source

Overview

Authors: Kerstin Dück1, Rebecca Overmeyer1, Raoul Wüllhorst1, Tanja Endrass1
ORCID iDs: Kerstin Dück
  1. Faculty of Psychology Clinical Psychology and Addiction Research, Technische Universität Dresden, Chemnitzer Str. 46a 01187, 01062 Dresden, Germany
Institutions: Technische Universität Dresden (Germany)
Journal: Scientific reports, volume 16, issue 1, article 19167
Dates: received 10 February 2026; accepted 11 June 2026; published online 19 June 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41598-026-58046-4 · PMID 42321288 · PMCID PMC13282391 · OpenAlex W7165121732
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), cognitive (subfield)
Methods: Statistics, Smoothing, state filtering, decompositions, Preprocessing, Evoked potentials
Keywords: Diseases, Neuroscience, Psychology
MeSH: Compulsive Behavior*, Impulsive Behavior*, Self-Control*, Adult, Decision Making, Electroencephalography, Female, Humans, Male, Young Adult (* major topic)
Topic: Behavioral Health and Interventions (Applied Psychology, Psychology), according to OpenAlex
Citations: not cited yet (Europe PMC); 92 references in the paper

Abstract

Impaired self-control is linked to maladaptive behavior and psychopathology and may be shaped by transdiagnostic factors such as impulsivity and compulsivity. Both traits show associations with model-based control, which supports goal-directed behavior by representing long-term action consequences. To investigate how model-based control and personality traits relate to everyday self-control, we combined single-trial EEG data (modulation of the feedback-related negativity [FRN] and P3) from 236 participants during a two-step decision-making task with self-reported impulsivity (BIS-11) and compulsivity (OCI-R) and a seven-day ecological momentary assessment of daily-life self-control. Mixed-effects models revealed that desire enactment was more likely when desires were stronger and perceived conflicts weaker. The effect of model-based control varied with impulsivity and compulsivity: In individuals low in compulsivity, stronger modulations of the FRN, suggesting higher model-based control, were connected to fewer desire enactments, suggesting a protecting role of model-based control. This pattern reversed at high compulsivity levels, possibly due to greater conflict awareness but reduced behavioral regulation capacity. Impulsivity moderated compulsivity effects, such that model-based control consistently predicted reduced enactment at high impulsivity levels. These findings highlight how compulsivity and impulsivity shape the translation of cognitive control into everyday behavior and offer insights into mechanisms underlying self-control deficits.

Supplementary Information: The online version contains supplementary material available at 10.1038/s41598-026-58046-4.

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 vjnhw

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: R (1)
Size: 4 files, 1 script
Software Heritage: not checked
Found in: the text, “Regression model”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: car (1 file), easystats (1 file), emmeans (1 file), ggplot2 (1 file), lme4 (1 file), psych (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
1 file
At the source: osf.io/vjnhw/

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;
  • 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 analysis routines are available under [https://osf.io/vjnhw/].

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 2, 28 September 2026

  • Funding: added Deutsche Forschungsgemeinschaft; Technische Universität Dresden

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 3 keywords, 10 MeSH terms, 75 references.

Cite

This paper

Dück, K., Overmeyer, R., Wüllhorst, R., & Endrass, T. (2026). Dissecting the interplay of model-based control, impulsivity and compulsivity on self-control in daily life. Scientific reports, 16(1), 19167. https://doi.org/10.1038/s41598-026-58046-4

BibTeX

@article{duck2026dissecting,
author = {Dück, Kerstin and Overmeyer, Rebecca and Wüllhorst, Raoul and Endrass, Tanja},
title = {{Dissecting the interplay of model-based control, impulsivity and compulsivity on self-control in daily life}},
journal = {Scientific reports},
year = {2026},
month = jun,
volume = {16},
number = {1},
pages = {19167},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-58046-4},
url = {https://doi.org/10.1038/s41598-026-58046-4},
pmid = {42321288},
pmcid = {PMC13282391}
}

RIS

TY - JOUR
AU - Dück, Kerstin
AU - Overmeyer, Rebecca
AU - Wüllhorst, Raoul
AU - Endrass, Tanja
TI - Dissecting the interplay of model-based control, impulsivity and compulsivity on self-control in daily life
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/06/19
VL - 16
IS - 1
SP - 19167
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-58046-4
UR - https://doi.org/10.1038/s41598-026-58046-4
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-58046-4",
"type": "article-journal",
"title": "Dissecting the interplay of model-based control, impulsivity and compulsivity on self-control in daily life",
"container-title": "Scientific reports",
"author": [
{
"family": "Dück",
"given": "Kerstin"
},
{
"family": "Overmeyer",
"given": "Rebecca"
},
{
"family": "Wüllhorst",
"given": "Raoul"
},
{
"family": "Endrass",
"given": "Tanja"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "19167",
"DOI": "10.1038/s41598-026-58046-4",
"PMID": "42321288",
"PMCID": "PMC13282391",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-58046-4",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
19
]
]
}
}

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/s41398-026-04098-z [code]
Neural imbalance between feedback sensitivity and motor inhibition in compulsivity and negative urgency.
Journal: Translational psychiatry
In common: EEG, 10 references, author Kerstin Dück
[2] doi:10.1111/ejn.70451 [code]
Action or Stimulus: Individual Beliefs About Learned Associations Influence the Processing of Immediate and Delayed Feedback.
Journal: The European journal of neuroscience
In common: car, lme4, ggplot2, 1 other tool, EEG, cognitive, 7 references
[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, car, 4 other tools, EEG, cognitive, 4 references
[4] doi:10.1111/psyp.70306 [code]
From Feedback-Learning to Semantic Memory: Can Feedback-Related Brain Activity Predict Object-Word Associations?
Journal: Psychophysiology
In common: easystats, car, lme4, 2 other tools, EEG, cognitive, 4 references
[5] doi:10.1371/journal.pbio.3003767 [code]
Ultrasound neuromodulation reveals distinct roles of the dorsal anterior cingulate cortex and anterior insula in learning.
Journal: PLoS biology
In common: psych, car, emmeans, 3 other tools, cognitive, 2 references
[6] 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: psych, car, emmeans, 3 other tools, EEG, 2 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: psych, car, emmeans, 3 other tools, EEG, cognitive, 2 references
[8] doi:10.1111/psyp.70265 [code]
Neurocognitive Dynamics of Translating Information From a Spatial Map Into Action.
Journal: Psychophysiology
In common: easystats, car, emmeans, 3 other tools, EEG, cognitive, 2 references
[9] doi:10.1038/s42003-026-10229-5 [code]
The neurocomputational mechanisms underlying the impact of social comparison on effort investment.
Journal: Communications biology
In common: psych, easystats, emmeans, 2 other tools, EEG, 2 references
[10] doi:10.34133/csbj.0042 [code]
Using Steady-State Visual Evoked Potentials to Characterize Wide-Ranging Retinopathy Linked to &lt;i&gt;CRB1&lt;/i&gt;: Implications for Clinical Trials.
Journal: Computational and structural biotechnology journal
In common: psych, easystats, car, 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.