OSCR

Distinct Representations of Irrelevant Emotional Information in the Visual Network Are Associated With Psychopathology in Youth.

Code ↔ Paper

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

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R Markdown · 1,900 lines · 89 KB · no license

  1. ---
  2. title: "visual_emotion_processing_psychopathology"
  3. output: html_document
  4. date: "2025-11-25"
  5. ---
  6. # Main steps
  7. - part 1 - general setup
  8. - part 2 - dissimilarity and total problem score
  9. - part 3 - dissimilarity and performance
  10. - part 4 - effect sizes
  11. - part 5 - performance and total problem score
  12. - part 6 - demographic table
  13. - part 7 - mediation
  14. note: Pearson correlations was calculated by python RSAtoolbox package
  15. last update on: 2026-04-24
  16. author: Yen-Chu Lin
  17. # part 1 - general setup
  18. - (1) load packages
  19. ```{r setup, include=FALSE}
  20. knitr::opts_chunk$set(echo = TRUE)
  21. library(tidyverse)
  22. library(lme4)
  23. library(lmerTest)
  24. library(sjPlot)
  25. require(MuMIn)
  26. library(effsize) # for cohen.d
  27. library(tableone)
  28. library(vtable)
  29. library(summarytools)
  30. library(MatchIt)
  31. ```
  32. - (2) functions
  33. ```{r}
  34. select_condition_and_combine_dataframes_v1 <- function(
  35. r_visual, r_limbic, r_dorsal, r_ventral, r_frontal, r_default, r_somatic, r_v1, col_name){
  36. # the function subsets dataframe based on condition selected & combine all dataframes including v1
  37. # also see select_conditions & combine_networks
  38. # subset data based on col_name
  39. rvis <- r_visual[c("src_subject_id",col_name)]
  40. rlim <- r_limbic[c("src_subject_id",col_name)]
  41. rdor <- r_dorsal[c("src_subject_id",col_name)]
  42. rven <- r_ventral[c("src_subject_id",col_name)]
  43. rfro <- r_frontal[c("src_subject_id",col_name)]
  44. rdef <- r_default[c("src_subject_id",col_name)]
  45. rsom <- r_somatic[c("src_subject_id",col_name)]
  46. rv1 <- r_v1[c("src_subject_id",col_name)]
  47. colnames(rvis)[2] <- "vis"
  48. colnames(rlim)[2] <- "lim"
  49. colnames(rdor)[2] <- "dor"
  50. colnames(rven)[2] <- "ven"
  51. colnames(rfro)[2] <- "fro"
  52. colnames(rdef)[2] <- "def"
  53. colnames(rsom)[2] <- "som"
  54. colnames(rv1)[2] <- "v1"
  55. # combine all 7 networks & v1 into one dataframe
  56. data <- merge(rvis, rlim, by="src_subject_id")
  57. data <- merge(data, rdor, by="src_subject_id")
  58. data <- merge(data, rven, by="src_subject_id")
  59. data <- merge(data, rfro, by="src_subject_id")
  60. data <- merge(data, rdef, by="src_subject_id")
  61. data <- merge(data, rsom, by="src_subject_id")
  62. data <- merge(data, rv1, by="src_subject_id")
  63. # return data
  64. return(data)
  65. }
  66. func_merge_df <- function(data_r, fam_site_id, nback) {
  67. # merge with family ad site ids
  68. data_full <- merge(data_r, fam_site_id, by="src_subject_id")
  69. # merge with nback
  70. data_full <- merge(data_full, nback, by="src_subject_id")
  71. return(data_full)
  72. }
  73. vector_to_factor <- function(data_long) {
  74. data_long$src_subject_id <- as.factor(data_long$src_subject_id)
  75. data_long$condition <- as.factor(data_long$condition)
  76. data_long$rel_family_id <- as.factor(data_long$rel_family_id)
  77. data_long$site_id_l <- as.factor(data_long$site_id_l)
  78. data_long$network <- as.factor(data_long$network)
  79. return(data_long)
  80. }
  81. ```
  82. - (3) inputs
  83. ```{r}
  84. # file path
  85. r_file_path <- "/Volumes/FABlab drive 2/Processed data/RSA_Pearson_correlations/"
  86. abcd_file_path <- "/Volumes/FABlab drive 2/Data/abcd-data-release-4.0/"
  87. subj_list_path <- "/Volumes/FABlab drive 2/Processed data/"
  88. # dissimilarity (Pearson correlation files)
  89. file1 <- "visual_pearson_corr.csv"
  90. file2 <- "limbic_pearson_corr_0back.csv"
  91. file3 <- "limbic_pearson_corr_2back.csv"
  92. file4 <- "doratt_pearson_corr_0back.csv"
  93. file5 <- "doratt_pearson_corr_2back.csv"
  94. file6 <- "venatt_pearson_corr_0back.csv"
  95. file7 <- "venatt_pearson_corr_2back.csv"
  96. file8 <- "sommot_pearson_corr_0back.csv"
  97. file9 <- "sommot_pearson_corr_2back.csv"
  98. file10 <- "control_pearson_corr_0back.csv"
  99. file11 <- "control_pearson_corr_2back.csv"
  100. file12 <- "default_pearson_corr_0back.csv"
  101. file13 <- "default_pearson_corr_2back.csv"
  102. file14 <- "v1_pearson_corr.csv"
  103. # CBCL scores
  104. cbcl_filename <- "abcd_cbcls01.txt"
  105. cbcl_col_select <-
  106. c("subjectkey",
  107. "cbcl_scr_dsm5_adhd_t","cbcl_scr_dsm5_adhd_r",
  108. "cbcl_scr_syn_attention_t","cbcl_scr_syn_attention_r",
  109. "cbcl_scr_syn_external_t","cbcl_scr_syn_external_r",
  110. "cbcl_scr_syn_internal_t","cbcl_scr_syn_internal_r",
  111. "cbcl_scr_syn_totprob_t","cbcl_scr_syn_totprob_r",
  112. "cbcl_scr_syn_anxdep_r","cbcl_scr_syn_withdep_r",
  113. "cbcl_scr_syn_somatic_r","cbcl_scr_syn_social_r",
  114. "cbcl_scr_syn_thought_r","cbcl_scr_syn_rulebreak_r",
  115. "cbcl_scr_syn_aggressive_r"
  116. )
  117. # N-back behavioral data (accuracy)
  118. naback_behav_filename <- "abcd_mrinback02.txt"
  119. nback_col_select <-
  120. c("subjectkey",
  121. "tfmri_nb_all_beh_c0bpf_rate","tfmri_nb_all_beh_c0bnf_rate","tfmri_nb_all_beh_c0bngf_rate",
  122. "tfmri_nb_all_beh_c2bpf_rate","tfmri_nb_all_beh_c2bnf_rate","tfmri_nb_all_beh_c2bngf_rate",
  123. "tfmri_nb_all_beh_c0b_rate","tfmri_nb_all_beh_c2b_rate"
  124. )
  125. # list of clean subjects
  126. subj_filename <- "cleanedsubjectkeys.csv"
  127. # family income, caregiver education, and child race/ethnicity
  128. pdemo_filename <- "pdem02.txt"
  129. pdemo_col_select <-
  130. c("subjectkey","demo_prnt_ed_v2","demo_prtnr_ed_v2",
  131. "demo_prnt_income_v2", "demo_prtnr_income_v2","demo_comb_income_v2",
  132. "demo_race_a_p___10", "demo_race_a_p___11", "demo_race_a_p___12", "demo_race_a_p___13",
  133. "demo_race_a_p___14", "demo_race_a_p___15", "demo_race_a_p___16", "demo_race_a_p___17",
  134. "demo_race_a_p___18", "demo_race_a_p___19", "demo_race_a_p___20", "demo_race_a_p___21",
  135. "demo_race_a_p___22", "demo_race_a_p___23", "demo_race_a_p___24", "demo_race_a_p___25",
  136. "demo_race_a_p___77", "demo_race_a_p___99","demo_ethn_v2")
  137. ```
  138. - (4) load files
  139. ```{r}
  140. # load the dissimilarity files
  141. r_vis <- read.csv(paste(r_file_path, file1, sep=""), header = TRUE)
  142. r_lim_0b <- read.csv(paste(r_file_path, file2, sep=""), header = TRUE)
  143. r_lim_2b <- read.csv(paste(r_file_path, file3, sep=""), header = TRUE)
  144. r_dor_0b <- read.csv(paste(r_file_path, file4, sep=""), header = TRUE)
  145. r_dor_2b <- read.csv(paste(r_file_path, file5, sep=""), header = TRUE)
  146. r_ven_0b <- read.csv(paste(r_file_path, file6, sep=""), header = TRUE)
  147. r_ven_2b <- read.csv(paste(r_file_path, file7, sep=""), header = TRUE)
  148. r_som_0b <- read.csv(paste(r_file_path, file8, sep=""), header = TRUE)
  149. r_som_2b <- read.csv(paste(r_file_path, file9, sep=""), header = TRUE)
  150. r_fro_0b <- read.csv(paste(r_file_path, file10, sep=""), header = TRUE)
  151. r_fro_2b <- read.csv(paste(r_file_path, file11, sep=""), header = TRUE)
  152. r_def_0b <- read.csv(paste(r_file_path, file12, sep=""), header = TRUE)
  153. r_def_2b <- read.csv(paste(r_file_path, file13, sep=""), header = TRUE)
  154. r_v1 <- read.csv(paste(r_file_path, file14, sep=""), header = TRUE)
  155. r_vis_0b <- r_vis[c("src_subject_id","X0happy0fear","X0happy0neu","X0neu0fear")]
  156. r_vis_2b <- r_vis[c("src_subject_id","X2happy2fear","X2happy2neu","X2neu2fear")]
  157. r_v1_0b <- r_v1[c("src_subject_id","X0happy0fear","X0happy0neu","X0neu0fear")]
  158. r_v1_2b <- r_v1[c("src_subject_id","X2happy2fear","X2happy2neu","X2neu2fear")]
  159. # load cbcl
  160. abcd_cbcl <- read.delim(paste(abcd_file_path, cbcl_filename, sep=""), header = TRUE) %>% filter(eventname == "2_year_follow_up_y_arm_1")
  161. abcd_cbcl <- abcd_cbcl[cbcl_col_select]
  162. abcd_cbcl$subjectkey <- gsub("NDAR_", "", abcd_cbcl$subjectkey)
  163. names(abcd_cbcl)[names(abcd_cbcl) == 'subjectkey'] <- 'src_subject_id'
  164. # load the file with family_id and subset the columns we need
  165. acspsw <- read.delim(paste(abcd_file_path, "acspsw03.txt", sep=""), header = TRUE) %>%
  166. slice(-1) %>%
  167. filter(eventname == "baseline_year_1_arm_1") %>% # only has data from baseline & year 1
  168. subset(select = c("subjectkey", "rel_family_id"))
  169. # load the file with site_id and subset the columns we need
  170. abcd_site <- read.delim(paste(abcd_file_path, "abcd_lt01.txt", sep=""), header = TRUE) %>%
  171. slice(-1) %>%
  172. filter(eventname == "2_year_follow_up_y_arm_1") %>%
  173. subset(select = c("subjectkey", "site_id_l","interview_age","sex"))
  174. # combine family id and site id
  175. fam_site_id <- merge(acspsw, abcd_site, by = "subjectkey")
  176. fam_site_id$subjectkey <- gsub("NDAR_", "", fam_site_id$subjectkey)
  177. names(fam_site_id)[names(fam_site_id) == 'subjectkey'] <- 'src_subject_id'
  178. # load a clean list of subject to use in the neuroimaging analysis
  179. subj_list <- read.csv(paste(subj_list_path, subj_filename, sep=""), header = FALSE) %>%
  180. slice(-1)
  181. # load N-back behavioral data
  182. nback <- read.delim(paste(abcd_file_path, naback_behav_filename, sep=""), header = TRUE) %>% filter(eventname == "2_year_follow_up_y_arm_1")
  183. nback <- nback[nback_col_select] %>% na.omit()
  184. nback$subjectkey <- gsub("NDAR_", "", nback$subjectkey)
  185. names(nback)[names(nback) == 'subjectkey'] <- 'src_subject_id'
  186. # load family income and caregiver education data
  187. abcd_pdem <- read.delim(paste(abcd_file_path, pdemo_filename, sep=""), header = TRUE) %>%
  188. slice(-1) %>%
  189. select(all_of(pdemo_col_select))
  190. abcd_pdem <- abcd_pdem[pdemo_col_select] %>% na.omit()
  191. abcd_pdem$subjectkey <- gsub("NDAR_", "", abcd_pdem$subjectkey)
  192. names(abcd_pdem)[names(abcd_pdem) == 'subjectkey'] <- 'src_subject_id'
  193. # time 3 (year 3 follow-up) CBCL scores
  194. abcd_cbcl_3year <- read.delim(paste(abcd_file_path, cbcl_filename, sep=""), header = TRUE) %>%
  195. filter(eventname == "3_year_follow_up_y_arm_1") %>%
  196. select(all_of(c("src_subject_id","cbcl_scr_syn_totprob_r")))
  197. abcd_cbcl_3year$src_subject_id <- gsub("NDAR_", "", abcd_cbcl_3year$src_subject_id)
  198. abcd_cbcl_3year$cbcl_scr_syn_totprob_r <- as.numeric(abcd_cbcl_3year$cbcl_scr_syn_totprob_r)
  199. # rename the columns
  200. names(abcd_cbcl_3year)[names(abcd_cbcl_3year) == 'cbcl_scr_syn_totprob_r'] <- 'cbcl_scr_syn_totprob_r_3year'
  201. # check for completeness
  202. abcd_cbcl_3year_totprob_r <- abcd_cbcl_3year[complete.cases(abcd_cbcl_3year$cbcl_scr_syn_totprob_r_3year), ]
  203. dim(abcd_cbcl_3year_totprob_r) # 6133 2
  204. ```
  205. - (5) preprocess dataframes
  206. ```{r}
  207. # dissimilarity
  208. ## SUBSETTING DATA BASED ON CONDITION SELECTED
  209. ### 0-back ###
  210. col_name1 <- "X0happy0fear"
  211. col_name2 <- "X0happy0neu"
  212. col_name3 <- "X0neu0fear"
  213. # subset and combine dataframes
  214. data_hf_0b <- select_condition_and_combine_dataframes_v1(
  215. r_vis_0b, r_lim_0b, r_dor_0b, r_ven_0b, r_fro_0b, r_def_0b, r_som_0b, r_v1_0b, col_name1)
  216. data_hn_0b <- select_condition_and_combine_dataframes_v1(
  217. r_vis_0b, r_lim_0b, r_dor_0b, r_ven_0b, r_fro_0b, r_def_0b, r_som_0b, r_v1_0b, col_name2)
  218. data_fn_0b <- select_condition_and_combine_dataframes_v1(
  219. r_vis_0b, r_lim_0b, r_dor_0b, r_ven_0b, r_fro_0b, r_def_0b, r_som_0b, r_v1_0b, col_name3)
  220. ### 2-back ###
  221. col_name4 <- "X2happy2fear"
  222. col_name5 <- "X2happy2neu"
  223. col_name6 <- "X2neu2fear"
  224. # subset and combine dataframes
  225. data_hf_2b <- select_condition_and_combine_dataframes_v1(
  226. r_vis_2b, r_lim_2b, r_dor_2b, r_ven_2b, r_fro_2b, r_def_2b, r_som_2b, r_v1_2b, col_name4)
  227. data_hn_2b <- select_condition_and_combine_dataframes_v1(
  228. r_vis_2b, r_lim_2b, r_dor_2b, r_ven_2b, r_fro_2b, r_def_2b, r_som_2b, r_v1_2b, col_name5)
  229. data_fn_2b <- select_condition_and_combine_dataframes_v1(
  230. r_vis_2b, r_lim_2b, r_dor_2b, r_ven_2b, r_fro_2b, r_def_2b, r_som_2b, r_v1_2b, col_name6)
  231. # sanity check
  232. # exclude subjects with NA for dissimilarity
  233. # dim(data_hf_0b) # 4952 9
  234. # dim(data_hf_2b) # 4952 9
  235. # dim(data_hn_0b) # 4952 9
  236. # dim(data_hn_2b) # 4952 9
  237. # dim(data_fn_0b) # 4952 9
  238. # dim(data_fn_2b) # 4952 9
  239. # check completeness
  240. # dim(data_hf_0b[complete.cases(data_hf_0b), ]) # 4952 9
  241. # dim(data_hf_2b[complete.cases(data_hf_2b), ]) # 4952 9
  242. # dim(data_hn_0b[complete.cases(data_hn_0b), ]) # 4952 9
  243. # dim(data_hn_2b[complete.cases(data_hn_2b), ]) # 4952 9
  244. # dim(data_fn_0b[complete.cases(data_fn_0b), ]) # 4952 9
  245. # dim(data_fn_2b[complete.cases(data_fn_2b), ]) # 4952 9
  246. # head(data_hf_0b)
  247. ```
  248. # part 2 - dissimilarity and CBCL score
  249. - (1) process datasets for dissimilarity and total problems score
  250. ```{r}
  251. # merge dataframes
  252. ### 0-back ###
  253. # (1) add a column to specify the condition
  254. data_hf_0b$condition <- "hf"
  255. data_hn_0b$condition <- "hn"
  256. data_fn_0b$condition <- "fn"
  257. # (2) merge distance with family id and site id
  258. data_hf0b <- func_merge_df(data_hf_0b, fam_site_id, nback)
  259. data_hn0b <- func_merge_df(data_hn_0b, fam_site_id, nback)
  260. data_fn0b <- func_merge_df(data_fn_0b, fam_site_id, nback)
  261. # (3) merge with cbcl
  262. data_hf0b <- merge(data_hf0b, abcd_cbcl, by="src_subject_id")
  263. data_hn0b <- merge(data_hn0b, abcd_cbcl, by="src_subject_id")
  264. data_fn0b <- merge(data_fn0b, abcd_cbcl, by="src_subject_id")
  265. # (4) convert the data into long format
  266. colname_list <- c("vis","lim","dor","ven","fro","def","som","v1")
  267. data_hf0b_long <-
  268. pivot_longer(data_hf0b, cols = all_of(colname_list), names_to = "network", values_to = "dis")
  269. data_hn0b_long <-
  270. pivot_longer(data_hn0b, cols = all_of(colname_list), names_to = "network", values_to = "dis")
  271. data_fn0b_long <-
  272. pivot_longer(data_fn0b, cols = all_of(colname_list), names_to = "network", values_to = "dis")
  273. # (5) COMBINE ALL THREE CONDITIONS
  274. data_0back <- rbind(data_hf0b_long, data_hn0b_long, data_fn0b_long)
  275. # (6) make age and CBCL scores numeric
  276. cbcl_col_numeric <-
  277. c("interview_age",
  278. "cbcl_scr_dsm5_adhd_t","cbcl_scr_dsm5_adhd_r",
  279. "cbcl_scr_syn_attention_t","cbcl_scr_syn_attention_r",
  280. "cbcl_scr_syn_external_t","cbcl_scr_syn_external_r",
  281. "cbcl_scr_syn_internal_t","cbcl_scr_syn_internal_r",
  282. "cbcl_scr_syn_totprob_t","cbcl_scr_syn_totprob_r",
  283. "cbcl_scr_syn_anxdep_r","cbcl_scr_syn_withdep_r",
  284. "cbcl_scr_syn_somatic_r","cbcl_scr_syn_social_r",
  285. "cbcl_scr_syn_thought_r","cbcl_scr_syn_rulebreak_r",
  286. "cbcl_scr_syn_aggressive_r"
  287. )
  288. data_hf0b_long <- data_hf0b_long %>%
  289. mutate_at(cbcl_col_numeric, as.numeric) %>%
  290. mutate_at(nback_col_select[-1], as.numeric)
  291. data_hn0b_long <- data_hn0b_long %>%
  292. mutate_at(cbcl_col_numeric, as.numeric) %>%
  293. mutate_at(nback_col_select[-1], as.numeric)
  294. data_fn0b_long <- data_fn0b_long %>%
  295. mutate_at(cbcl_col_numeric, as.numeric) %>%
  296. mutate_at(nback_col_select[-1], as.numeric)
  297. data_0back <- data_0back %>%
  298. mutate_at(cbcl_col_numeric, as.numeric) %>%
  299. mutate_at(nback_col_select[-1], as.numeric)
  300. ### 2-back ###
  301. # (1) add a column to specify the condition
  302. data_hf_2b$condition <- "hf"
  303. data_hn_2b$condition <- "hn"
  304. data_fn_2b$condition <- "fn"
  305. # (2) merge distance with family id and site id
  306. data_hf2b <- func_merge_df(data_hf_2b, fam_site_id, nback)
  307. data_hn2b <- func_merge_df(data_hn_2b, fam_site_id, nback)
  308. data_fn2b <- func_merge_df(data_fn_2b, fam_site_id, nback)
  309. # (3) merge with cbcl
  310. data_hf2b <- merge(data_hf2b, abcd_cbcl, by="src_subject_id")
  311. data_hn2b <- merge(data_hn2b, abcd_cbcl, by="src_subject_id")
  312. data_fn2b <- merge(data_fn2b, abcd_cbcl, by="src_subject_id")
  313. # (4) convert the data into long format
  314. colname_list <- c("vis","lim","dor","ven","fro","def","som","v1")
  315. data_hf2b_long <-
  316. pivot_longer(data_hf2b, cols = all_of(colname_list), names_to = "network", values_to = "dis")
  317. data_hn2b_long <-
  318. pivot_longer(data_hn2b, cols = all_of(colname_list), names_to = "network", values_to = "dis")
  319. data_fn2b_long <-
  320. pivot_longer(data_fn2b, cols = all_of(colname_list), names_to = "network", values_to = "dis")
  321. # (5) COMBINE ALL THREE CONDITIONS
  322. data_2back <- rbind(data_hf2b_long, data_hn2b_long, data_fn2b_long)
  323. # (6) make age and CBCL scores numeric
  324. data_hf2b_long <- data_hf2b_long %>%
  325. mutate_at(cbcl_col_numeric, as.numeric) %>%
  326. mutate_at(nback_col_select[-1], as.numeric)
  327. data_hn2b_long <- data_hn2b_long %>%
  328. mutate_at(cbcl_col_numeric, as.numeric) %>%
  329. mutate_at(nback_col_select[-1], as.numeric)
  330. data_fn2b_long <- data_fn2b_long %>%
  331. mutate_at(cbcl_col_numeric, as.numeric) %>%
  332. mutate_at(nback_col_select[-1], as.numeric)
  333. data_2back <- data_2back %>%
  334. mutate_at(cbcl_col_numeric, as.numeric) %>%
  335. mutate_at(nback_col_select[-1], as.numeric)
  336. ```
  337. - (2) mixed model - dissimilarity vs. cbcl
  338. one model per network
  339. ```{r}
  340. vector_to_factor <- function(data_long) {
  341. data_long$src_subject_id <- as.factor(data_long$src_subject_id)
  342. data_long$rel_family_id <- as.factor(data_long$rel_family_id)
  343. data_long$site_id_l <- as.factor(data_long$site_id_l)
  344. return(data_long)
  345. }
  346. data_0back <- vector_to_factor(data_0back)
  347. data_2back <- vector_to_factor(data_2back)
  348. ### total problem score ###
  349. ## 0-back ##
  350. # vis
  351. lme2_0back_vis_tol <- lmer(cbcl_scr_syn_totprob_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  352. summary(lme2_0back_vis_tol) # 0.940 ; no interactions
  353. # lim
  354. lme2_0back_lim_tol <- lmer(cbcl_scr_syn_totprob_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  355. summary(lme2_0back_lim_tol) # 0.487 ; no interactions
  356. # v1
  357. lme2_0back_v1_tol <- lmer(cbcl_scr_syn_totprob_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  358. summary(lme2_0back_v1_tol) # 0.0359 * ; no interactions
  359. ## 2-back ##
  360. # vis
  361. lme2_2back_vis_tol <- lmer(cbcl_scr_syn_totprob_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  362. summary(lme2_2back_vis_tol) # 0.00016 *** ; no interactions
  363. # lim
  364. lme2_2back_lim_tol <- lmer(cbcl_scr_syn_totprob_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  365. summary(lme2_2back_lim_tol) # 0.477 ; no interactions
  366. # v1
  367. lme2_2back_v1_tol <- lmer(cbcl_scr_syn_totprob_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  368. summary(lme2_2back_v1_tol) # 6.73e-05 *** ; no interactions
  369. ### internalization score ###
  370. ## 0-back ##
  371. # vis
  372. lme2_0back_vis_int <- lmer(cbcl_scr_syn_internal_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  373. summary(lme2_0back_vis_int) # 0.0145 * ; no interactions
  374. # lim
  375. lme2_0back_lim_int <- lmer(cbcl_scr_syn_internal_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  376. summary(lme2_0back_lim_int) # 0.834 ; no interactions
  377. # v1
  378. lme2_0back_v1_int <- lmer(cbcl_scr_syn_internal_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  379. summary(lme2_0back_v1_int) # 0.473 ; no interactions
  380. ## 2-back ##
  381. # vis
  382. lme2_2back_vis_int <- lmer(cbcl_scr_syn_internal_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  383. summary(lme2_2back_vis_int) # 0.325 ; no interactions
  384. # lim
  385. lme2_2back_lim_int <- lmer(cbcl_scr_syn_internal_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  386. summary(lme2_2back_lim_int) # 0.970 ; no interactions
  387. # v1
  388. lme2_2back_v1_int <- lmer(cbcl_scr_syn_internal_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  389. summary(lme2_2back_v1_int) # 0.624 ; no interactions
  390. ### externalization score ###
  391. ## 0-back ##
  392. # vis
  393. lme2_0back_vis_ext <- lmer(cbcl_scr_syn_external_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  394. summary(lme2_0back_vis_ext) # 0.168 ; no interactions
  395. # lim
  396. lme2_0back_lim_ext <- lmer(cbcl_scr_syn_external_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  397. summary(lme2_0back_lim_ext) # 0.265 ; no interactions
  398. # v1
  399. lme2_0back_v1_ext <- lmer(cbcl_scr_syn_external_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  400. summary(lme2_0back_v1_ext) # 0.0217 * ; no interactions
  401. ## 2-back ##
  402. # vis
  403. lme2_2back_vis_ext <- lmer(cbcl_scr_syn_external_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  404. summary(lme2_2back_vis_ext) # 0.001170 ** ; no interactions
  405. # lim
  406. lme2_2back_lim_ext <- lmer(cbcl_scr_syn_external_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  407. summary(lme2_2back_lim_ext) # 0.554 ; no interactions
  408. # v1
  409. lme2_2back_v1_ext <- lmer(cbcl_scr_syn_external_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  410. summary(lme2_2back_v1_ext) # 1.01e-05 *** ; no interactions
  411. ```
  412. additional models for CBCL sub-scales
  413. ### anxiety/depression score ###
  414. ```{r}
  415. ## 0-back ##
  416. # lim
  417. lme2_0back_lim_anxdep <- lmer(cbcl_scr_syn_anxdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  418. summary(lme2_0back_lim_anxdep) # 0.9227 ; no interactions
  419. # vis
  420. lme2_0back_vis_anxdep <- lmer(cbcl_scr_syn_anxdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  421. summary(lme2_0back_vis_anxdep) # 0.1643 ; no interactions
  422. # v1
  423. lme2_0back_v1_anxdep <- lmer(cbcl_scr_syn_anxdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  424. summary(lme2_0back_v1_anxdep) # 0.8706 ; no interactions
  425. ## 2-back ##
  426. # lim
  427. lme2_2back_lim_anxdep <- lmer(cbcl_scr_syn_anxdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  428. summary(lme2_2back_lim_anxdep) # 0.5283 ; no interactions
  429. # vis
  430. lme2_2back_vis_anxdep <- lmer(cbcl_scr_syn_anxdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  431. summary(lme2_2back_vis_anxdep) # 0.6005 ; no interactions
  432. # v1
  433. lme2_2back_v1_anxdep <- lmer(cbcl_scr_syn_anxdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  434. summary(lme2_2back_v1_anxdep) # 0.7857 ; no interactions
  435. ```
  436. ### withdrawn/depression score ###
  437. ```{r}
  438. ## 0-back ##
  439. # lim
  440. lme2_0back_lim_withdep <- lmer(cbcl_scr_syn_withdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  441. summary(lme2_0back_lim_withdep) # 0.37028 ; no interactions
  442. # vis
  443. lme2_0back_vis_withdep <- lmer(cbcl_scr_syn_withdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  444. summary(lme2_0back_vis_withdep) # 0.00141 ** ; no interactions
  445. # v1
  446. lme2_0back_v1_withdep <- lmer(cbcl_scr_syn_withdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  447. summary(lme2_0back_v1_withdep) # 0.02769 *; no interactions
  448. ## 2-back ##
  449. # lim
  450. lme2_2back_lim_withdep <- lmer(cbcl_scr_syn_withdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  451. summary(lme2_2back_lim_withdep) # 0.39684 ; no interactions
  452. # vis
  453. lme2_2back_vis_withdep <- lmer(cbcl_scr_syn_withdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  454. summary(lme2_2back_vis_withdep) # 0.64523 ; no interactions
  455. # v1
  456. lme2_2back_v1_withdep <- lmer(cbcl_scr_syn_withdep_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  457. summary(lme2_2back_v1_withdep) # 0.63588 ; no interactions
  458. ```
  459. ### somatic complaints score ###
  460. ```{r}
  461. ## 0-back ##
  462. # lim
  463. lme2_0back_lim_somatic <- lmer(cbcl_scr_syn_somatic_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  464. summary(lme2_0back_lim_somatic) # 0.899 ; no interactions
  465. # vis
  466. lme2_0back_vis_somatic <- lmer(cbcl_scr_syn_somatic_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  467. summary(lme2_0back_vis_somatic) # 0.206 ; no interactions
  468. # v1
  469. lme2_0back_v1_somatic <- lmer(cbcl_scr_syn_somatic_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  470. summary(lme2_0back_v1_somatic) # 0.985 ; no interactions
  471. ## 2-back ##
  472. # lim
  473. lme2_2back_lim_somatic <- lmer(cbcl_scr_syn_somatic_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  474. summary(lme2_2back_lim_somatic) # 0.977 ; no interactions
  475. # vis
  476. lme2_2back_vis_somatic <- lmer(cbcl_scr_syn_somatic_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  477. summary(lme2_2back_vis_somatic) # 0.157 ; no interactions
  478. # v1
  479. lme2_2back_v1_somatic <- lmer(cbcl_scr_syn_somatic_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  480. summary(lme2_2back_v1_somatic) # 0.722 ; no interactions
  481. ```
  482. ### rule-breaking behavior score ###
  483. ```{r}
  484. ## 0-back ##
  485. # lim
  486. lme2_0back_lim_rulebreak <- lmer(cbcl_scr_syn_rulebreak_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  487. summary(lme2_0back_lim_rulebreak) # 0.646 ; no interactions
  488. # vis
  489. lme2_0back_vis_rulebreak <- lmer(cbcl_scr_syn_rulebreak_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  490. summary(lme2_0back_vis_rulebreak) # 0.160 ; no interactions
  491. # v1
  492. lme2_0back_v1_rulebreak <- lmer(cbcl_scr_syn_rulebreak_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  493. summary(lme2_0back_v1_rulebreak) # 0.523 ; no interactions
  494. ## 2-back ##
  495. # lim
  496. lme2_2back_lim_rulebreak <- lmer(cbcl_scr_syn_rulebreak_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  497. summary(lme2_2back_lim_rulebreak) # 0.374 ; no interactions
  498. # vis
  499. lme2_2back_vis_rulebreak <- lmer(cbcl_scr_syn_rulebreak_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  500. summary(lme2_2back_vis_rulebreak) # 0.0691 ; no interactions
  501. # v1
  502. lme2_2back_v1_rulebreak <- lmer(cbcl_scr_syn_rulebreak_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  503. summary(lme2_2back_v1_rulebreak) # 0.0189 * ; no interactions
  504. ```
  505. ### aggressive behavior score ###
  506. ```{r}
  507. ## 0-back ##
  508. # lim
  509. lme2_0back_lim_aggressive <- lmer(cbcl_scr_syn_aggressive_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  510. summary(lme2_0back_lim_aggressive) # 0.20935 ; no interactions
  511. # vis
  512. lme2_0back_vis_aggressive <- lmer(cbcl_scr_syn_aggressive_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  513. summary(lme2_0back_vis_aggressive) # 0.01586 * ; no interactions
  514. # v1
  515. lme2_0back_v1_aggressive <- lmer(cbcl_scr_syn_aggressive_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  516. summary(lme2_0back_v1_aggressive) # 0.00101 ** ; no interactions
  517. ## 2-back ##
  518. # lim
  519. lme2_2back_lim_aggressive <- lmer(cbcl_scr_syn_aggressive_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  520. summary(lme2_2back_lim_aggressive) # 0.68314 ; no interactions
  521. # vis
  522. lme2_2back_vis_aggressive <- lmer(cbcl_scr_syn_aggressive_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  523. summary(lme2_2back_vis_aggressive) # 0.000485 *** ; no interactions
  524. # v1
  525. lme2_2back_v1_aggressive <- lmer(cbcl_scr_syn_aggressive_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  526. summary(lme2_2back_v1_aggressive) # 1.73e-06 *** ; no interactions
  527. ```
  528. ### social problems score ###
  529. ```{r}
  530. ## 0-back ##
  531. # lim
  532. lme2_0back_lim_social <- lmer(cbcl_scr_syn_social_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  533. summary(lme2_0back_lim_social) # 0.168 ; no interactions
  534. # vis
  535. lme2_0back_vis_social <- lmer(cbcl_scr_syn_social_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  536. summary(lme2_0back_vis_social) # 0.0688 ; no interactions
  537. # v1
  538. lme2_0back_v1_social <- lmer(cbcl_scr_syn_social_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  539. summary(lme2_0back_v1_social) # 0.00103 ** ; no interactions
  540. ## 2-back ##
  541. # lim
  542. lme2_2back_lim_social <- lmer(cbcl_scr_syn_social_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  543. summary(lme2_2back_lim_social) # 0.288 ; no interactions
  544. # vis
  545. lme2_2back_vis_social <- lmer(cbcl_scr_syn_social_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  546. summary(lme2_2back_vis_social) # 3.32e-05 *** ; no interactions
  547. # v1
  548. lme2_2back_v1_social <- lmer(cbcl_scr_syn_social_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  549. summary(lme2_2back_v1_social) # 4.57e-05 *** ; no interactions
  550. ```
  551. ### thought problems score ###
  552. ```{r}
  553. ## 0-back ##
  554. # lim
  555. lme2_0back_lim_thought <- lmer(cbcl_scr_syn_thought_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  556. summary(lme2_0back_lim_thought) # 0.70670 ; no interactions
  557. # vis
  558. lme2_0back_vis_thought <- lmer(cbcl_scr_syn_thought_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  559. summary(lme2_0back_vis_thought) # 0.576680 ; no interactions
  560. # v1
  561. lme2_0back_v1_thought <- lmer(cbcl_scr_syn_thought_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  562. summary(lme2_0back_v1_thought) # 0.043311 * ; no interactions
  563. ## 2-back ##
  564. # lim
  565. lme2_2back_lim_thought <- lmer(cbcl_scr_syn_thought_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  566. summary(lme2_2back_lim_thought) # 0.524190 ; no interactions
  567. # vis
  568. lme2_2back_vis_thought <- lmer(cbcl_scr_syn_thought_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  569. summary(lme2_2back_vis_thought) # 0.00191 ** ; no interactions
  570. # v1
  571. lme2_2back_v1_thought <- lmer(cbcl_scr_syn_thought_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  572. summary(lme2_2back_v1_thought) # 0.00732 ** ; no interactions
  573. ```
  574. ### attention problems score ###
  575. ```{r}
  576. ## 0-back ##
  577. # lim
  578. lme2_0back_lim_attention <- lmer(cbcl_scr_syn_attention_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  579. summary(lme2_0back_lim_attention) # 0.87337 ; no interactions
  580. # vis
  581. lme2_0back_vis_attention <- lmer(cbcl_scr_syn_attention_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  582. summary(lme2_0back_vis_attention) # 0.1514 ; no interactions
  583. # v1
  584. lme2_0back_v1_attention <- lmer(cbcl_scr_syn_attention_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  585. summary(lme2_0back_v1_attention) # 0.000538 *** ; no interactions
  586. ## 2-back ##
  587. # lim
  588. lme2_2back_lim_attention <- lmer(cbcl_scr_syn_attention_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  589. summary(lme2_2back_lim_attention) # 0.2165 ; no interactions
  590. # vis
  591. lme2_2back_vis_attention <- lmer(cbcl_scr_syn_attention_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  592. summary(lme2_2back_vis_attention) # 4.2e-05 *** ; no interactions
  593. # v1
  594. lme2_2back_v1_attention <- lmer(cbcl_scr_syn_attention_r ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  595. summary(lme2_2back_v1_attention) # 0.000116 *** ; no interactions
  596. ```
  597. - (3) plot - dissimilarity vs. cbcl
  598. (3.1) cbcl score distributions
  599. ```{r}
  600. # preprocess dataset
  601. cbcl_col_list <-
  602. c(
  603. "cbcl_scr_syn_attention_t", "cbcl_scr_syn_attention_r",
  604. "cbcl_scr_syn_external_t", "cbcl_scr_syn_external_r",
  605. "cbcl_scr_syn_internal_t", "cbcl_scr_syn_internal_r",
  606. "cbcl_scr_syn_totprob_t", "cbcl_scr_syn_totprob_r",
  607. "cbcl_scr_syn_anxdep_r","cbcl_scr_syn_withdep_r",
  608. "cbcl_scr_syn_somatic_r","cbcl_scr_syn_social_r",
  609. "cbcl_scr_syn_thought_r","cbcl_scr_syn_rulebreak_r",
  610. "cbcl_scr_syn_aggressive_r"
  611. )
  612. data_cbcl <- data_hf0b %>%
  613. mutate_at(cbcl_col_list, as.numeric)
  614. f1_totptob_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_totprob_r)) +
  615. geom_histogram(binwidth=2, color = "black", fill = "white") +
  616. scale_y_continuous(expand = c(0,0), limits = c(0,600)) +
  617. labs(x = "total problems raw score",
  618. y = "number of subjects") +
  619. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  620. f1_ext_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_external_r)) +
  621. geom_histogram(binwidth=1, color = "black", fill = "white") +
  622. scale_y_continuous(expand = c(0,0), limits = c(0,1700)) +
  623. labs(x = "externalizing problems raw score",
  624. y = "number of subjects") +
  625. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  626. f1_int_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_internal_r)) +
  627. geom_histogram(binwidth=1, color = "black", fill = "white") +
  628. scale_y_continuous(expand = c(0,0), limits = c(0,1000)) +
  629. labs(x = "internalizing problems raw score",
  630. y = "number of subjects") +
  631. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  632. f1_totptob_t <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_totprob_t)) +
  633. geom_histogram(binwidth=1, color = "black", fill = "white") +
  634. scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  635. scale_y_continuous(expand = c(0,0), limits = c(0,350)) +
  636. labs(x = "total problems t-score",
  637. y = "number of subjects") +
  638. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  639. f1_ext_t <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_external_t)) +
  640. geom_histogram(binwidth=1, color = "black", fill = "white") +
  641. scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  642. scale_y_continuous(expand = c(0,0), limits = c(0,1300)) +
  643. labs(x = "externalizing problems t-score",
  644. y = "number of subjects") +
  645. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  646. f1_int_t <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_internal_t)) +
  647. geom_histogram(binwidth=1, color = "black", fill = "white") +
  648. scale_x_continuous(expand = c(0,0),limits = c(20,95)) +
  649. scale_y_continuous(expand = c(0,0), limits = c(0,600)) +
  650. labs(x = "internalizing problems t-score",
  651. y = "number of subjects") +
  652. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  653. f1_totptob_r
  654. f1_ext_r
  655. f1_int_r
  656. f1_totptob_t
  657. f1_ext_t
  658. f1_int_t
  659. # sanity check
  660. # min(data_0back["cbcl_scr_syn_totprob_r"]) # 0
  661. # max(data_0back["cbcl_scr_syn_totprob_r"]) # 161
  662. # min(data_0back["cbcl_scr_syn_internal_r"]) # 0
  663. # max(data_0back["cbcl_scr_syn_internal_r"]) # 50
  664. # min(data_0back["cbcl_scr_syn_external_r"]) # 0
  665. # max(data_0back["cbcl_scr_syn_external_r"]) # 50
  666. # min(data_2back["cbcl_scr_syn_totprob_r"]) # 0
  667. # max(data_2back["cbcl_scr_syn_totprob_r"]) # 161
  668. # min(data_2back["cbcl_scr_syn_internal_r"]) # 0
  669. # max(data_2back["cbcl_scr_syn_internal_r"]) # 50
  670. # min(data_2back["cbcl_scr_syn_external_r"]) # 0
  671. # max(data_2back["cbcl_scr_syn_external_r"]) # 50
  672. # min(data_2back["cbcl_scr_syn_totprob_t"]) # 24
  673. # max(data_2back["cbcl_scr_syn_totprob_t"]) # 88
  674. # min(data_2back["cbcl_scr_syn_internal_t"]) # 33
  675. # max(data_2back["cbcl_scr_syn_internal_t"]) # 90
  676. # min(data_2back["cbcl_scr_syn_external_t"]) # 33
  677. # max(data_2back["cbcl_scr_syn_external_t"]) # 83
  678. # min(data_0back["dis"]) # 0.00586022
  679. # max(data_0back["dis"]) # 1.757153
  680. # min(data_2back["dis"]) # 0.006938755
  681. # max(data_2back["dis"]) # 1.900827
  682. # head(data_0back)
  683. ```
  684. ```{r}
  685. f1_anxdep_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_anxdep_r)) +
  686. geom_histogram(binwidth=1, color = "black", fill = "white") +
  687. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  688. scale_y_continuous(expand = c(0,0), limits = c(0,2000)) +
  689. labs(x = "anxious/depressed raw score",
  690. y = "number of subjects") +
  691. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  692. f1_anxdep_r
  693. ```
  694. ```{r}
  695. f1_withdep_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_withdep_r)) +
  696. geom_histogram(binwidth=1, color = "black", fill = "white") +
  697. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  698. scale_y_continuous(expand = c(0,0), limits = c(0,3000)) +
  699. labs(x = "withdrawn/depressed raw score",
  700. y = "number of subjects") +
  701. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  702. f1_withdep_r
  703. ```
  704. ```{r}
  705. f1_somatic_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_somatic_r)) +
  706. geom_histogram(binwidth=1, color = "black", fill = "white") +
  707. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  708. scale_y_continuous(expand = c(0,0), limits = c(0,2500)) +
  709. labs(x = "somatic complaints raw score",
  710. y = "number of subjects") +
  711. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  712. f1_somatic_r
  713. ```
  714. ```{r}
  715. f1_social_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_social_r)) +
  716. geom_histogram(binwidth=1, color = "black", fill = "white") +
  717. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  718. scale_y_continuous(expand = c(0,0), limits = c(0,3000)) +
  719. labs(x = "social problems raw score",
  720. y = "number of subjects") +
  721. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  722. f1_social_r
  723. ```
  724. ```{r}
  725. f1_thought_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_thought_r)) +
  726. geom_histogram(binwidth=1, color = "black", fill = "white") +
  727. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  728. scale_y_continuous(expand = c(0,0), limits = c(0,2500)) +
  729. labs(x = "thought problems raw score",
  730. y = "number of subjects") +
  731. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  732. f1_thought_r
  733. ```
  734. ```{r}
  735. f1_rulebreak_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_rulebreak_r)) +
  736. geom_histogram(binwidth=1, color = "black", fill = "white") +
  737. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  738. scale_y_continuous(expand = c(0,0), limits = c(0,3000)) +
  739. labs(x = "rule-breaking behavior raw score",
  740. y = "number of subjects") +
  741. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  742. f1_rulebreak_r
  743. ```
  744. ```{r}
  745. f1_aggressive_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_aggressive_r)) +
  746. geom_histogram(binwidth=1, color = "black", fill = "white") +
  747. # scale_x_continuous(expand = c(0,0), limits = c(20,95)) +
  748. scale_y_continuous(expand = c(0,0), limits = c(0,2000)) +
  749. labs(x = "aggressive behavior raw score",
  750. y = "number of subjects") +
  751. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  752. f1_aggressive_r
  753. ```
  754. ```{r}
  755. f1_attention_r <- ggplot(data_cbcl, aes(x=cbcl_scr_syn_attention_r)) +
  756. geom_histogram(binwidth=1, color = "black", fill = "white") +
  757. #scale_x_continuous(expand = c(0,0), limits = c(-1,21)) +
  758. scale_y_continuous(expand = c(0,0), limits = c(0,2000)) +
  759. labs(x = "attention problems raw score",
  760. y = "number of subjects") +
  761. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18), aspect.ratio = 1)
  762. f1_attention_r
  763. ```
  764. (3.2) subjects with both ext and int problems (check overlaps)
  765. ```{r}
  766. # head(data_cbcl)
  767. sum((data_cbcl$cbcl_scr_syn_external_t>=60) & (data_cbcl$cbcl_scr_syn_internal_t>=60)) # 204
  768. length(data_cbcl$src_subject_id[(data_cbcl$cbcl_scr_syn_external_t>=60) & (data_cbcl$cbcl_scr_syn_internal_t>=60)]) # 204
  769. # data_cbcl$src_subject_id[(data_cbcl$cbcl_scr_syn_external_t>=60) & (data_cbcl$cbcl_scr_syn_internal_t>=60)]
  770. ```
  771. (3.3) total problems score plot
  772. ```{r}
  773. # cbcl_scr_syn_totprob_r
  774. ### 0-back ###
  775. # vis
  776. f2_0back_vis_tol <-
  777. ggplot(data_0back[data_0back$network == "vis",], aes(cbcl_scr_syn_totprob_r, dis)) +
  778. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  779. labs(x="total problems score", y="dissimilarities", title="Vis", fill="count") +
  780. scale_x_continuous(expand = c(0,0), limits = c(-10,180)) +
  781. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  782. theme_classic() +
  783. theme(text = element_text(size = 20),
  784. axis.text.x = element_text(size = 18),
  785. axis.text.y = element_text(size = 18))
  786. # lim
  787. f2_0back_lim_tol <-
  788. ggplot(data_0back[data_0back$network == "lim",], aes(cbcl_scr_syn_totprob_r, dis)) +
  789. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  790. labs(x="total problems score", y="dissimilarities", title="Lim", fill="count") +
  791. scale_x_continuous(expand = c(0,0), limits = c(-10,180)) +
  792. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  793. theme_classic() +
  794. theme(text = element_text(size = 20),
  795. axis.text.x = element_text(size = 18),
  796. axis.text.y = element_text(size = 18))
  797. # v1
  798. f2_0back_v1_tol <-
  799. ggplot(data_0back[data_0back$network == "v1",], aes(cbcl_scr_syn_totprob_r, dis)) +
  800. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  801. labs(x="total problems score", y="dissimilarities", title="V1", fill="count") +
  802. scale_x_continuous(expand = c(0,0), limits = c(-10,180)) +
  803. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  804. theme_classic() +
  805. theme(text = element_text(size = 20),
  806. axis.text.x = element_text(size = 18),
  807. axis.text.y = element_text(size = 18))
  808. ### 2-back ###
  809. # vis
  810. f2_2back_vis_tol <-
  811. ggplot(data_2back[data_2back$network == "vis",], aes(cbcl_scr_syn_totprob_r, dis)) +
  812. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  813. labs(x="total problems score", y="dissimilarities", title="Vis", fill="count") +
  814. scale_x_continuous(expand = c(0,0), limits = c(-10,180)) +
  815. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  816. theme_classic() +
  817. theme(text = element_text(size = 20),
  818. axis.text.x = element_text(size = 18),
  819. axis.text.y = element_text(size = 18))
  820. # lim
  821. f2_2back_lim_tol <-
  822. ggplot(data_2back[data_2back$network == "lim",], aes(cbcl_scr_syn_totprob_r, dis)) +
  823. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  824. labs(x="total problems score", y="dissimilarities", title="Lim", fill="count") +
  825. scale_x_continuous(expand = c(0,0), limits = c(-10,180)) +
  826. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  827. theme_classic() +
  828. theme(text = element_text(size = 20),
  829. axis.text.x = element_text(size = 18),
  830. axis.text.y = element_text(size = 18))
  831. # v1
  832. f2_2back_v1_tol <-
  833. ggplot(data_2back[data_2back$network == "v1",], aes(cbcl_scr_syn_totprob_r, dis)) +
  834. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  835. labs(x="total problems score", y="dissimilarities", title="V1", fill="count") +
  836. scale_x_continuous(expand = c(0,0), limits = c(-10,180)) +
  837. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  838. theme_classic() +
  839. theme(text = element_text(size = 20),
  840. axis.text.x = element_text(size = 18),
  841. axis.text.y = element_text(size = 18))
  842. f2_0back_vis_tol
  843. f2_0back_lim_tol
  844. f2_0back_v1_tol
  845. f2_2back_vis_tol
  846. f2_2back_lim_tol
  847. f2_2back_v1_tol
  848. ```
  849. (3.4) internalizating score plot
  850. ```{r}
  851. # cbcl_scr_syn_internal_r
  852. ### 0-back ###
  853. # vis
  854. f2_0back_vis_int <-
  855. ggplot(data_0back[data_0back$network == "vis",], aes(cbcl_scr_syn_internal_r, dis)) +
  856. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  857. labs(x="internalizing problems score", y="dissimilarities", title="Vis", fill="count") +
  858. scale_x_continuous(expand = c(0,0), limits = c(-2,60)) +
  859. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  860. theme_classic() +
  861. theme(text = element_text(size = 20),
  862. axis.text.x = element_text(size = 18),
  863. axis.text.y = element_text(size = 18))
  864. # lim
  865. f2_0back_lim_int <-
  866. ggplot(data_0back[data_0back$network == "lim",], aes(cbcl_scr_syn_internal_r, dis)) +
  867. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  868. labs(x="internalizing problems score", y="dissimilarities", title="Lim", fill="count") +
  869. scale_x_continuous(expand = c(0,0), limits = c(-2,60)) +
  870. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  871. theme_classic() +
  872. theme(text = element_text(size = 20),
  873. axis.text.x = element_text(size = 18),
  874. axis.text.y = element_text(size = 18))
  875. # v1
  876. f2_0back_v1_int <-
  877. ggplot(data_0back[data_0back$network == "v1",], aes(cbcl_scr_syn_internal_r, dis)) +
  878. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  879. labs(x="internalizing problems score", y="dissimilarities", title="V1", fill="count") +
  880. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  881. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  882. theme_classic() +
  883. theme(text = element_text(size = 20),
  884. axis.text.x = element_text(size = 18),
  885. axis.text.y = element_text(size = 18))
  886. ### 2-back ###
  887. # vis
  888. f2_2back_vis_int <-
  889. ggplot(data_2back[data_2back$network == "vis",], aes(cbcl_scr_syn_internal_r, dis)) +
  890. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  891. labs(x="internalizing problems score", y="dissimilarities", title="Vis", fill="count") +
  892. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  893. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  894. theme_classic() +
  895. theme(text = element_text(size = 20),
  896. axis.text.x = element_text(size = 18),
  897. axis.text.y = element_text(size = 18))
  898. # lim
  899. f2_2back_lim_int <-
  900. ggplot(data_2back[data_2back$network == "lim",], aes(cbcl_scr_syn_internal_r, dis)) +
  901. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  902. labs(x="internalizing problems score", y="dissimilarities", title="Lim", fill="count") +
  903. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  904. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  905. theme_classic() +
  906. theme(text = element_text(size = 20),
  907. axis.text.x = element_text(size = 18),
  908. axis.text.y = element_text(size = 18))
  909. # v1
  910. f2_2back_v1_int <-
  911. ggplot(data_2back[data_2back$network == "v1",], aes(cbcl_scr_syn_internal_r, dis)) +
  912. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  913. labs(x="internalizing problems score", y="dissimilarities", title="V1", fill="count") +
  914. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  915. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  916. theme_classic() +
  917. theme(text = element_text(size = 20),
  918. axis.text.x = element_text(size = 18),
  919. axis.text.y = element_text(size = 18))
  920. f2_0back_vis_int
  921. f2_0back_lim_int
  922. f2_0back_v1_int
  923. f2_2back_vis_int
  924. f2_2back_lim_int
  925. f2_2back_v1_int
  926. ```
  927. (3.5) externalizating score plot
  928. ```{r}
  929. # cbcl_scr_syn_external_r
  930. ### 0-back ###
  931. # vis
  932. f2_0back_vis_ext <-
  933. ggplot(data_0back[data_0back$network == "vis",], aes(cbcl_scr_syn_external_r, dis)) +
  934. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  935. labs(x="externalizing problems score", y="dissimilarities", title="Vis", fill="count") +
  936. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  937. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  938. theme_classic() +
  939. theme(text = element_text(size = 20),
  940. axis.text.x = element_text(size = 18),
  941. axis.text.y = element_text(size = 18))
  942. # lim
  943. f2_0back_lim_ext <-
  944. ggplot(data_0back[data_0back$network == "lim",], aes(cbcl_scr_syn_external_r, dis)) +
  945. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  946. labs(x="externalizing problems score", y="dissimilarities", title="Lim", fill="count") +
  947. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  948. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  949. theme_classic() +
  950. theme(text = element_text(size = 20),
  951. axis.text.x = element_text(size = 18),
  952. axis.text.y = element_text(size = 18))
  953. # v1
  954. f2_0back_v1_ext <-
  955. ggplot(data_0back[data_0back$network == "v1",], aes(cbcl_scr_syn_external_r, dis)) +
  956. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  957. labs(x="externalizing problems score", y="dissimilarities", title="V1", fill="count") +
  958. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  959. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  960. theme_classic() +
  961. theme(text = element_text(size = 20),
  962. axis.text.x = element_text(size = 18),
  963. axis.text.y = element_text(size = 18))
  964. ### 2-back ###
  965. # vis
  966. f2_2back_vis_ext <-
  967. ggplot(data_2back[data_2back$network == "vis",], aes(cbcl_scr_syn_external_r, dis)) +
  968. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  969. labs(x="externalizing problems score", y="dissimilarities", title="Vis", fill="count") +
  970. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  971. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  972. theme_classic() +
  973. theme(text = element_text(size = 20),
  974. axis.text.x = element_text(size = 18),
  975. axis.text.y = element_text(size = 18))
  976. # lim
  977. f2_2back_lim_ext <-
  978. ggplot(data_2back[data_2back$network == "lim",], aes(cbcl_scr_syn_external_r, dis)) +
  979. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  980. labs(x="externalizing problems score", y="dissimilarities", title="Lim", fill="count") +
  981. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  982. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  983. theme_classic() +
  984. theme(text = element_text(size = 20),
  985. axis.text.x = element_text(size = 18),
  986. axis.text.y = element_text(size = 18))
  987. # v1
  988. f2_2back_v1_ext <-
  989. ggplot(data_2back[data_2back$network == "v1",], aes(cbcl_scr_syn_external_r, dis)) +
  990. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  991. labs(x="externalizing problems score", y="dissimilarities", title="V1", fill="count") +
  992. scale_x_continuous(expand = c(0,0), limits = c(-2,55)) +
  993. scale_y_continuous(expand = c(0,0), limits = c(-0.1,2.1)) +
  994. theme_classic() +
  995. theme(text = element_text(size = 20),
  996. axis.text.x = element_text(size = 18),
  997. axis.text.y = element_text(size = 18))
  998. f2_0back_vis_ext
  999. f2_0back_lim_ext
  1000. f2_0back_v1_ext
  1001. f2_2back_vis_ext
  1002. f2_2back_lim_ext
  1003. f2_2back_v1_ext
  1004. ```
  1005. - (4) predicting CBCL scores
  1006. process dataframes
  1007. ```{r}
  1008. # create a data frame for CBCL prediction
  1009. data_0back_3y_cbcl <- merge(data_0back, abcd_cbcl_3year_totprob_r, by="src_subject_id")
  1010. data_2back_3y_cbcl <- merge(data_2back, abcd_cbcl_3year_totprob_r, by="src_subject_id")
  1011. # keep complete data
  1012. data_0back_3y_cbcl <- data_0back_3y_cbcl[!is.na(data_0back_3y_cbcl$cbcl_scr_syn_totprob_r_3year),]
  1013. data_2back_3y_cbcl <- data_2back_3y_cbcl[!is.na(data_2back_3y_cbcl$cbcl_scr_syn_totprob_r_3year),]
  1014. # sanity check
  1015. dim(data_0back_3y_cbcl) # 94032 27
  1016. dim(data_2back_3y_cbcl) # 94032 27
  1017. head(data_0back_3y_cbcl)
  1018. head(data_2back_3y_cbcl)
  1019. ```
  1020. mixed models - dissimilarity vs. future cbcl
  1021. ```{r}
  1022. ### future total problem score ###
  1023. ## 0-back ##
  1024. # vis
  1025. lme2_0back_vis_tol_3yr <- lmer(cbcl_scr_syn_totprob_r_3year ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back_3y_cbcl[data_0back_3y_cbcl$network == "vis",])
  1026. summary(lme2_0back_vis_tol_3yr) # 0.4407 ; no interactions
  1027. # lim
  1028. lme2_0back_lim_tol_3yr <- lmer(cbcl_scr_syn_totprob_r_3year ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back_3y_cbcl[data_0back_3y_cbcl$network == "lim",])
  1029. summary(lme2_0back_lim_tol_3yr) # 0.9499 ; no interactions
  1030. # v1
  1031. lme2_0back_v1_tol_3yr <- lmer(cbcl_scr_syn_totprob_r_3year ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back_3y_cbcl[data_0back_3y_cbcl$network == "v1",])
  1032. summary(lme2_0back_v1_tol_3yr) # 0.000457 *** ; no interactions
  1033. ## 2-back ##
  1034. # vis
  1035. lme2_2back_vis_tol_3yr <- lmer(cbcl_scr_syn_totprob_r_3year ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back_3y_cbcl[data_2back_3y_cbcl$network == "vis",])
  1036. summary(lme2_2back_vis_tol_3yr) # 0.000525 *** ; no interactions
  1037. # lim
  1038. lme2_2back_lim_tol_3yr <- lmer(cbcl_scr_syn_totprob_r_3year ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back_3y_cbcl[data_2back_3y_cbcl$network == "lim",])
  1039. summary(lme2_2back_lim_tol_3yr) # 0.8226 ; no interactions
  1040. # v1
  1041. lme2_2back_v1_tol_3yr <- lmer(cbcl_scr_syn_totprob_r_3year ~ dis * condition + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back_3y_cbcl[data_2back_3y_cbcl$network == "v1",])
  1042. summary(lme2_2back_v1_tol_3yr) # 1.04e-06 *** ; no interactions
  1043. ```
  1044. - (5) group analysis (using > 63 as the clinical threshold)
  1045. process dataset
  1046. ```{r}
  1047. # group match with age, sex, & site id
  1048. low_score = 50
  1049. cut_off_score = 63
  1050. ### for 0-back ###
  1051. # subsetting data
  1052. data_0back_cbclgroup <- data_0back[(data_0back$network == "vis" & data_0back$condition == "hf"),]
  1053. # check number of subjects
  1054. sum(data_0back_cbclgroup$cbcl_scr_syn_totprob_t <= low_score) # 3573
  1055. sum(data_0back_cbclgroup$cbcl_scr_syn_totprob_t > cut_off_score) # 264
  1056. # add a column to label the cbcl group (0 - low, 1 - high)
  1057. data_0back_cbclgroup$cbcl_group_clinical <-
  1058. ifelse(data_0back_cbclgroup$cbcl_scr_syn_totprob_t <= low_score, 0, # is less than or equals to low_score, set as 0
  1059. ifelse(data_0back_cbclgroup$cbcl_scr_syn_totprob_t > cut_off_score, 1, NA)) # is equals to or more than cut_off_score, set as 1; NA otherwise
  1060. # data cleaning
  1061. # save the subset data of only low and high groups
  1062. data_0back_cbclgroup <- data_0back_cbclgroup[!is.na(data_0back_cbclgroup$cbcl_group_clinical),]
  1063. data_0back_cbclgroup$site_id_l <- as.character(data_0back_cbclgroup$site_id_l)
  1064. # data matching
  1065. matchit_model <- matchit(
  1066. cbcl_group_clinical ~ interview_age + sex + site_id_l,
  1067. data = data_0back_cbclgroup,
  1068. method = "nearest", # nearest neighbor matching
  1069. distance = "logit", # propensity score via logistic regression
  1070. ratio = 1, # 1:1 matching
  1071. replace = FALSE # without replacement
  1072. )
  1073. summary(matchit_model)
  1074. # get matched dataframe
  1075. df_match_0back <- match_data(matchit_model,
  1076. data = data_0back_cbclgroup,
  1077. distance = "prop.score")
  1078. # get the list of the subject ids
  1079. matched_subject_id <- df_match_0back$src_subject_id
  1080. # get the matched data
  1081. data_0back_matched <- data_0back[data_0back$src_subject_id %in% matched_subject_id,]
  1082. data_2back_matched <- data_2back[data_2back$src_subject_id %in% matched_subject_id,]
  1083. # add a column to label the cbcl group (0 - low, 1 - high)
  1084. data_0back_matched$cbcl_group_clinical <-
  1085. ifelse(data_0back_matched$cbcl_scr_syn_totprob_t <= low_score, 0,
  1086. ifelse(data_0back_matched$cbcl_scr_syn_totprob_t > cut_off_score, 1, NA))
  1087. data_2back_matched$cbcl_group_clinical <-
  1088. ifelse(data_2back_matched$cbcl_scr_syn_totprob_t <= low_score, 0,
  1089. ifelse(data_2back_matched$cbcl_scr_syn_totprob_t > cut_off_score, 1, NA))
  1090. # sanity check
  1091. dim(data_0back_matched) # 12672 27 (264*2*8*3
  1092. dim(data_2back_matched) # 12672 27
  1093. head(data_0back_matched)
  1094. head(data_2back_matched)
  1095. ```
  1096. compare dissimilarities between groups
  1097. ```{r}
  1098. # t-tests
  1099. # t-test of all dissimilarities (all emotion comparisons)
  1100. ### 0-back ###
  1101. ttest_vis_0b <- t.test(dis ~ cbcl_group_clinical, data = data_0back_matched[data_0back_matched$network == "vis",])
  1102. ttest_lim_0b <- t.test(dis ~ cbcl_group_clinical, data = data_0back_matched[data_0back_matched$network == "lim",])
  1103. ttest_v1_0b <- t.test(dis ~ cbcl_group_clinical, data = data_0back_matched[data_0back_matched$network == "v1",])
  1104. ttest_vis_0b # 0.001511
  1105. ttest_lim_0b # 0.05925
  1106. ttest_v1_0b # 0.004075
  1107. ### 2-back ###
  1108. ttest_vis_2b <- t.test(dis ~ cbcl_group_clinical, data = data_2back_matched[data_2back_matched$network == "vis",])
  1109. ttest_lim_2b <- t.test(dis ~ cbcl_group_clinical, data = data_2back_matched[data_2back_matched$network == "lim",])
  1110. ttest_v1_2b <- t.test(dis ~ cbcl_group_clinical, data = data_2back_matched[data_2back_matched$network == "v1",])
  1111. ttest_vis_2b # 3.222e-06
  1112. ttest_lim_2b # 0.0005018
  1113. ttest_v1_2b # 0.004273
  1114. # ttest_vis_2b$statistic
  1115. # ttest_vis_2b$p.value
  1116. # effect sizes
  1117. ### 0-back ###
  1118. # a function to get a sub-dataframe for low group
  1119. func_low_group_0b <- function(network_name) {
  1120. group1 <- data_0back_matched[(data_0back_matched$network == network_name & data_0back_matched$cbcl_group_clinical == 0),]
  1121. return(group1$dis)
  1122. }
  1123. # a function to get a sub-dataframe for high group
  1124. func_high_group_0b <- function(network_name) {
  1125. group2 <- data_0back_matched[(data_0back_matched$network == network_name & data_0back_matched$cbcl_group_clinical == 1),]
  1126. return(group2$dis)
  1127. }
  1128. cohen.d(func_low_group_0b("vis"), func_high_group_0b("vis")) # -0.1597133 (negligible)
  1129. cohen.d(func_low_group_0b("lim"), func_high_group_0b("lim")) # -0.09485952 (negligible)
  1130. cohen.d(func_low_group_0b("v1"), func_high_group_0b("v1")) # -0.1445535 (negligible)
  1131. ### 2-back ###
  1132. # a function to get a sub-dataframe for low group
  1133. func_low_group_2b <- function(network_name) {
  1134. group1 <- data_2back_matched[(data_2back_matched$network == network_name & data_2back_matched$cbcl_group_clinical == 0),]
  1135. return(group1$dis)
  1136. }
  1137. # a function to get a sub-dataframe for high group
  1138. func_high_group_2b <- function(network_name) {
  1139. group2 <- data_2back_matched[(data_2back_matched$network == network_name & data_2back_matched$cbcl_group_clinical == 1),]
  1140. return(group2$dis)
  1141. }
  1142. cohen.d(func_low_group_2b("vis"), func_high_group_2b("vis")) # -0.2348411 (small)
  1143. cohen.d(func_low_group_2b("lim"), func_high_group_2b("lim")) # -0.1752295 (negligible)
  1144. cohen.d(func_low_group_2b("v1"), func_high_group_2b("v1")) # -0.1438009 (negligible)
  1145. ```
  1146. # part 3 - dissimilarity and performance
  1147. - (1) process datasets
  1148. ```{r}
  1149. # Calculate the mean accuracy of all faces
  1150. # 0-back
  1151. data_0back <- data_0back %>%
  1152. mutate(data_0back, allface_0b_rate = rowMeans(select(data_0back, c("tfmri_nb_all_beh_c0bpf_rate","tfmri_nb_all_beh_c0bnf_rate", "tfmri_nb_all_beh_c0bngf_rate"))))
  1153. # 2-back
  1154. data_2back <- data_2back %>%
  1155. mutate(data_2back, allface_2b_rate = rowMeans(select(data_2back, c("tfmri_nb_all_beh_c2bpf_rate","tfmri_nb_all_beh_c2bnf_rate","tfmri_nb_all_beh_c2bngf_rate"))))
  1156. # head(data_0back)
  1157. # head(data_2back)
  1158. ```
  1159. - (2) mixed models
  1160. ```{r}
  1161. ###### controlled for overall performance ######
  1162. ## 0-back ##
  1163. # vis #
  1164. lmer3_0back_vis <- lmer(allface_0b_rate ~ dis + tfmri_nb_all_beh_c0b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  1165. summary(lmer3_0back_vis) # 0.8330
  1166. # lim #
  1167. lmer3_0back_lim <- lmer(allface_0b_rate ~ dis + tfmri_nb_all_beh_c0b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  1168. summary(lmer3_0back_lim) # 0.1511
  1169. # v1
  1170. lmer3_0back_v1 <- lmer(allface_0b_rate ~ dis + tfmri_nb_all_beh_c0b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  1171. summary(lmer3_0back_v1) # 0.391
  1172. ## 2-back ##
  1173. # vis #
  1174. lmer3_2back_vis <- lmer(allface_2b_rate ~ dis + tfmri_nb_all_beh_c2b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  1175. summary(lmer3_2back_vis) # 0.000977 ***
  1176. # lim
  1177. lmer3_2back_lim <- lmer(allface_2b_rate ~ dis + tfmri_nb_all_beh_c2b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  1178. summary(lmer3_2back_lim) # 0.00492 **
  1179. # v1
  1180. lmer3_2back_v1 <- lmer(allface_2b_rate ~ dis + tfmri_nb_all_beh_c2b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  1181. summary(lmer3_2back_v1) # 0.0215 *
  1182. ```
  1183. - (3) plots
  1184. ```{r}
  1185. # scatter plot of all three dissimilarity and cbcl scores
  1186. ## 0-back
  1187. # vis
  1188. f3_0back_vis <-
  1189. ggplot(data_0back[data_0back$network == "vis",], aes(x=dis, y=allface_0b_rate)) +
  1190. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  1191. labs(title = "Vis (0-back)",
  1192. x = "Dissimilarity",
  1193. y = "Accuracy") +
  1194. scale_x_continuous(expand = c(0,0), limits = c(0,2)) +
  1195. scale_y_continuous(expand = c(0,0), limits = c(0.5,1.1)) +
  1196. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18))
  1197. # lim
  1198. f3_0back_lim <-
  1199. ggplot(data_0back[data_0back$network == "lim",], aes(x=dis, y=allface_0b_rate)) +
  1200. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  1201. labs(title = "Lim (0-back)",
  1202. x = "Dissimilarity",
  1203. y = "Accuracy") +
  1204. scale_x_continuous(expand = c(0,0), limits = c(0,2)) +
  1205. scale_y_continuous(expand = c(0,0), limits = c(0.5,1.1)) +
  1206. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18))
  1207. # v1
  1208. f3_0back_v1 <-
  1209. ggplot(data_0back[data_0back$network == "v1",], aes(x=dis, y=allface_0b_rate)) +
  1210. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  1211. labs(title = "V1 (0-back)",
  1212. x = "Dissimilarity",
  1213. y = "Accuracy") +
  1214. scale_x_continuous(expand = c(0,0), limits = c(0,2)) +
  1215. scale_y_continuous(expand = c(0,0), limits = c(0.5,1.1)) +
  1216. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18))
  1217. ## 2-back
  1218. # vis
  1219. f3_2back_vis <-
  1220. ggplot(data_2back[data_2back$network == "vis",], aes(x=dis, y=allface_2b_rate)) +
  1221. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  1222. labs(title = "Vis (2-back)",
  1223. x = "Dissimilarity",
  1224. y = "Accuracy") +
  1225. scale_x_continuous(expand = c(0,0), limits = c(0,2)) +
  1226. scale_y_continuous(expand = c(0,0), limits = c(0.5,1.1)) +
  1227. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18))
  1228. # lim
  1229. f3_2back_lim <-
  1230. ggplot(data_2back[data_2back$network == "lim",], aes(x=dis, y=allface_2b_rate)) +
  1231. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  1232. labs(title = "Lim (2-back)",
  1233. x = "Dissimilarity",
  1234. y = "Accuracy") +
  1235. scale_x_continuous(expand = c(0,0), limits = c(0,2)) +
  1236. scale_y_continuous(expand = c(0,0), limits = c(0.5,1.1)) +
  1237. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18))
  1238. # v1
  1239. f3_2back_v1 <-
  1240. ggplot(data_2back[data_2back$network == "v1",], aes(x=dis, y=allface_2b_rate)) +
  1241. geom_hex() + stat_smooth(color="red", fill="red", method=lm, size=0.5, level=0.999) +
  1242. labs(title = "V1 (2-back)",
  1243. x = "Dissimilarity",
  1244. y = "Accuracy") +
  1245. scale_x_continuous(expand = c(0,0), limits = c(0,2)) +
  1246. scale_y_continuous(expand = c(0,0), limits = c(0.5,1.1)) +
  1247. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 18))
  1248. f3_0back_vis
  1249. f3_0back_lim
  1250. f3_0back_v1
  1251. f3_2back_vis
  1252. f3_2back_lim
  1253. f3_2back_v1
  1254. ```
  1255. - (4) mixed models with three levels of emotion comparisons
  1256. ```{r}
  1257. ###### controlled for overall performance ######
  1258. ## 0-back ##
  1259. # vis #
  1260. lmer3_0back_vis <- lmer(allface_0b_rate ~ dis * condition + tfmri_nb_all_beh_c0b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "vis",])
  1261. summary(lmer3_0back_vis) # 0.7076
  1262. # lim #
  1263. lmer3_0back_lim <- lmer(allface_0b_rate ~ dis * condition + tfmri_nb_all_beh_c0b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "lim",])
  1264. summary(lmer3_0back_lim) # 0.1559
  1265. # v1
  1266. lmer3_0back_v1 <- lmer(allface_0b_rate ~ dis * condition + tfmri_nb_all_beh_c0b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_0back[data_0back$network == "v1",])
  1267. summary(lmer3_0back_v1) # 0.4662
  1268. ## 2-back ##
  1269. # vis #
  1270. lmer3_2back_vis <- lmer(allface_2b_rate ~ dis * condition + tfmri_nb_all_beh_c2b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "vis",])
  1271. summary(lmer3_2back_vis) # 0.019417 *
  1272. # lim
  1273. lmer3_2back_lim <- lmer(allface_2b_rate ~ dis * condition + tfmri_nb_all_beh_c2b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "lim",])
  1274. summary(lmer3_2back_lim) # 0.0878 .
  1275. # v1
  1276. lmer3_2back_v1 <- lmer(allface_2b_rate ~ dis * condition + tfmri_nb_all_beh_c2b_rate + sex + interview_age + (1|site_id_l/rel_family_id), data = data_2back[data_2back$network == "v1",])
  1277. summary(lmer3_2back_v1) # 0.157
  1278. ```
  1279. # part 4 - effect sizes
  1280. - (1) process dataset for effect sizes
  1281. ```{r}
  1282. # merge the dataframes
  1283. data_hf_0b_eff <- merge(data_hf_0b, fam_site_id, by="src_subject_id")
  1284. data_hn_0b_eff <- merge(data_hn_0b, fam_site_id, by="src_subject_id")
  1285. data_fn_0b_eff <- merge(data_fn_0b, fam_site_id, by="src_subject_id")
  1286. data_hf_2b_eff <- merge(data_hf_2b, fam_site_id, by="src_subject_id")
  1287. data_hn_2b_eff <- merge(data_hn_2b, fam_site_id, by="src_subject_id")
  1288. data_fn_2b_eff <- merge(data_fn_2b, fam_site_id, by="src_subject_id")
  1289. data_hf_0b_eff$nback <- "0_back"
  1290. data_hn_0b_eff$nback <- "0_back"
  1291. data_fn_0b_eff$nback <- "0_back"
  1292. data_hf_2b_eff$nback <- "2_back"
  1293. data_hn_2b_eff$nback <- "2_back"
  1294. data_fn_2b_eff$nback <- "2_back"
  1295. data_hf_0b_eff$condition <- "hf"
  1296. data_hn_0b_eff$condition <- "hn"
  1297. data_fn_0b_eff$condition <- "fn"
  1298. data_hf_2b_eff$condition <- "hf"
  1299. data_hn_2b_eff$condition <- "hn"
  1300. data_fn_2b_eff$condition <- "fn"
  1301. data_hf_0b_eff$v1 <- NULL
  1302. data_hn_0b_eff$v1 <- NULL
  1303. data_fn_0b_eff$v1 <- NULL
  1304. data_hf_2b_eff$v1 <- NULL
  1305. data_hn_2b_eff$v1 <- NULL
  1306. data_fn_2b_eff$v1 <- NULL
  1307. # (6.1) sanity check
  1308. dim(data_hf_0b_eff) # 4952 14
  1309. dim(data_hf_2b_eff) # 4952 14
  1310. dim(data_hn_0b_eff) # 4952 14
  1311. dim(data_hn_2b_eff) # 4952 14
  1312. dim(data_fn_0b_eff) # 4952 14
  1313. dim(data_fn_2b_eff) # 4952 14
  1314. # head(data_hf_0b_eff)
  1315. ```
  1316. - (2) Process dataframe for mixed effect models
  1317. one model for each network - association between 1-r and each network (for example, vis vs. non-vis)
  1318. ```{r}
  1319. list_eff <- c("vis","lim","dor","ven","fro","def","som")
  1320. ### 0-back ###
  1321. # convert the data into long format
  1322. data_hf_0b_long <- pivot_longer(data_hf_0b_eff, cols = all_of(list_eff), names_to = "network", values_to = "dis")
  1323. data_hn_0b_long <- pivot_longer(data_hn_0b_eff, cols = all_of(list_eff), names_to = "network", values_to = "dis")
  1324. data_fn_0b_long <- pivot_longer(data_fn_0b_eff, cols = all_of(list_eff), names_to = "network", values_to = "dis")
  1325. # COMBINE ALL THREE CONDITIONS
  1326. data_0b <- rbind(data_hf_0b_long, data_hn_0b_long, data_fn_0b_long)
  1327. # convert vector objects to factors
  1328. data_0b <- vector_to_factor(data_0b)
  1329. # setup the data for mixed effect model
  1330. data_0b$vis <- (data_0b$network == "vis") * 1
  1331. data_0b$lim <- (data_0b$network == "lim") * 1
  1332. data_0b$dor <- (data_0b$network == "dor") * 1
  1333. data_0b$ven <- (data_0b$network == "ven") * 1
  1334. data_0b$fro <- (data_0b$network == "fro") * 1
  1335. data_0b$def <- (data_0b$network == "def") * 1
  1336. data_0b$som <- (data_0b$network == "som") * 1
  1337. data_0b$vis <- as.factor(data_0b$vis)
  1338. data_0b$lim <- as.factor(data_0b$lim)
  1339. data_0b$dor <- as.factor(data_0b$dor)
  1340. data_0b$ven <- as.factor(data_0b$ven)
  1341. data_0b$fro <- as.factor(data_0b$fro)
  1342. data_0b$def <- as.factor(data_0b$def)
  1343. data_0b$som <- as.factor(data_0b$som)
  1344. ### 2-back ###
  1345. # convert the data into long format
  1346. data_hf_2b_long <- pivot_longer(data_hf_2b_eff, cols = all_of(list_eff), names_to = "network", values_to = "dis")
  1347. data_hn_2b_long <- pivot_longer(data_hn_2b_eff, cols = all_of(list_eff), names_to = "network", values_to = "dis")
  1348. data_fn_2b_long <- pivot_longer(data_fn_2b_eff, cols = all_of(list_eff), names_to = "network", values_to = "dis")
  1349. # COMBINE ALL THREE CONDITIONS
  1350. data_2b <- rbind(data_hf_2b_long, data_hn_2b_long, data_fn_2b_long)
  1351. # convert vector objects to factors
  1352. data_2b <- vector_to_factor(data_2b)
  1353. # setup the data for mixed effect model
  1354. data_2b$vis <- (data_2b$network == "vis") * 1
  1355. data_2b$lim <- (data_2b$network == "lim") * 1
  1356. data_2b$dor <- (data_2b$network == "dor") * 1
  1357. data_2b$ven <- (data_2b$network == "ven") * 1
  1358. data_2b$fro <- (data_2b$network == "fro") * 1
  1359. data_2b$def <- (data_2b$network == "def") * 1
  1360. data_2b$som <- (data_2b$network == "som") * 1
  1361. data_2b$vis <- as.factor(data_2b$vis)
  1362. data_2b$lim <- as.factor(data_2b$lim)
  1363. data_2b$dor <- as.factor(data_2b$dor)
  1364. data_2b$ven <- as.factor(data_2b$ven)
  1365. data_2b$fro <- as.factor(data_2b$fro)
  1366. data_2b$def <- as.factor(data_2b$def)
  1367. data_2b$som <- as.factor(data_2b$som)
  1368. ```
  1369. - (3) run mixed models
  1370. use R marginal squared as effect sizes of each network
  1371. ```{r}
  1372. ### 0-back ###
  1373. # run mixed effect model for seven networks separately
  1374. lme1_vis_0b <- lmer(dis ~ vis * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1375. lme1_lim_0b <- lmer(dis ~ lim * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1376. lme1_dor_0b <- lmer(dis ~ dor * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1377. lme1_ven_0b <- lmer(dis ~ ven * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1378. lme1_fro_0b <- lmer(dis ~ fro * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1379. lme1_def_0b <- lmer(dis ~ def * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1380. lme1_som_0b <- lmer(dis ~ som * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_0b)
  1381. # get the R squared marginal values
  1382. m <- matrix(ncol = 0, nrow = 0) # create an empty matrix
  1383. r_squared_0back <- data.frame(m) # empty matrix to dataframe
  1384. r_squared_0back <- r.squaredGLMM(lme1_vis_0b) %>%
  1385. rbind(r_squared_0back, r.squaredGLMM(lme1_lim_0b)) %>%
  1386. rbind(r_squared_0back, r.squaredGLMM(lme1_dor_0b)) %>%
  1387. rbind(r_squared_0back, r.squaredGLMM(lme1_ven_0b)) %>%
  1388. rbind(r_squared_0back, r.squaredGLMM(lme1_fro_0b)) %>%
  1389. rbind(r_squared_0back, r.squaredGLMM(lme1_def_0b)) %>%
  1390. rbind(r_squared_0back, r.squaredGLMM(lme1_som_0b))
  1391. row.names(r_squared_0back) <- list_eff
  1392. ### 2-back ###
  1393. # run mixed effect model for seven networks separately
  1394. lme1_vis_2b <- lmer(dis ~ vis * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1395. lme1_lim_2b <- lmer(dis ~ lim * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1396. lme1_dor_2b <- lmer(dis ~ dor * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1397. lme1_ven_2b <- lmer(dis ~ ven * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1398. lme1_fro_2b <- lmer(dis ~ fro * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1399. lme1_def_2b <- lmer(dis ~ def * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1400. lme1_som_2b <- lmer(dis ~ som * condition + (1|src_subject_id) + (1|site_id_l/rel_family_id), data = data_2b)
  1401. # get the R squared marginal values
  1402. m <- matrix(ncol = 0, nrow = 0) # create an empty matrix
  1403. r_squared_2back <- data.frame(m) # empty matrix to dataframe
  1404. r_squared_2back <- r.squaredGLMM(lme1_vis_2b) %>%
  1405. rbind(r_squared_2back, r.squaredGLMM(lme1_lim_2b)) %>%
  1406. rbind(r_squared_2back, r.squaredGLMM(lme1_dor_2b)) %>%
  1407. rbind(r_squared_2back, r.squaredGLMM(lme1_ven_2b)) %>%
  1408. rbind(r_squared_2back, r.squaredGLMM(lme1_fro_2b)) %>%
  1409. rbind(r_squared_2back, r.squaredGLMM(lme1_def_2b)) %>%
  1410. rbind(r_squared_2back, r.squaredGLMM(lme1_som_2b))
  1411. row.names(r_squared_2back) <- list_eff
  1412. r_squared_0back
  1413. r_squared_2back
  1414. ```
  1415. - (4) plot - effect sizes bar plots
  1416. ```{r}
  1417. df_plot = data.frame(network=rownames(r_squared_0back),
  1418. r2m_0back=as.numeric(r_squared_0back[-1][,1]),
  1419. r2m_2back=as.numeric(r_squared_2back[-1][,1]))
  1420. # list_eff <- c("vis","lim","dor","ven","fro","def","som") # defined before
  1421. plot_order_of_networks <- c("dor","ven","fro","lim","def","vis","som")
  1422. # 0-back
  1423. f1_0back <- ggplot(data=df_plot, aes(x = network, y = r2m_0back)) +
  1424. geom_bar(stat = "identity", position = "dodge", color = "black", fill = "white") +
  1425. aes(x = factor(network, plot_order_of_networks), y = r2m_0back) +
  1426. labs(x = "Functional networks",
  1427. y = "Effect sizes") +
  1428. scale_y_continuous(expand = c(0,0), limits = c(0,0.6)) +
  1429. labs(title = "0-back") +
  1430. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 20), axis.text.x = element_text(angle = 90, hjust = 1), aspect.ratio = 1)
  1431. f1_0back
  1432. # 2-back
  1433. f1_2back <- ggplot(data=df_plot, aes(x = network, y = r2m_2back)) +
  1434. geom_bar(stat = "identity", position = "dodge", color = "black", fill = "white") +
  1435. aes(x = factor(network, plot_order_of_networks), y = r2m_2back) +
  1436. labs(x = "Functional networks",
  1437. y = "Effect sizes") +
  1438. scale_y_continuous(expand = c(0,0), limits = c(0,0.6)) +
  1439. labs(title = "2-back") +
  1440. theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(size = 20), axis.text.x = element_text(angle = 90, hjust = 1), aspect.ratio = 1)
  1441. f1_2back
  1442. ```
  1443. - (5) cohen.d
  1444. ```{r}
  1445. # 0-back
  1446. cohen.d(data_0back$dis[data_0back$network == "vis"], data_0back$dis[!(data_0back$network == "vis")]) # -0.7819427 (medium)
  1447. cohen.d(data_0back$dis[data_0back$network == "lim"], data_0back$dis[!(data_0back$network == "lim")]) # 1.161041 (large)
  1448. cohen.d(data_0back$dis[data_0back$network == "fro"], data_0back$dis[!(data_0back$network == "fro")]) # 0.1922416 (negligible)
  1449. cohen.d(data_0back$dis[data_0back$network == "dor"], data_0back$dis[!(data_0back$network == "dor")]) # -0.1743875 (negligible)
  1450. cohen.d(data_0back$dis[data_0back$network == "ven"], data_0back$dis[!(data_0back$network == "ven")]) # 0.2764237 (small)
  1451. cohen.d(data_0back$dis[data_0back$network == "def"], data_0back$dis[!(data_0back$network == "def")]) # 0.4370847 (small)
  1452. cohen.d(data_0back$dis[data_0back$network == "som"], data_0back$dis[!(data_0back$network == "som")]) # 0.4547063 (small)
  1453. # 2-back
  1454. cohen.d(data_2back$dis[data_2back$network == "vis"], data_2back$dis[!(data_2back$network == "vis")]) # -0.5052931 (medium)
  1455. cohen.d(data_2back$dis[data_2back$network == "lim"], data_2back$dis[!(data_2back$network == "lim")]) # 1.417457 (large)
  1456. cohen.d(data_2back$dis[data_2back$network == "fro"], data_2back$dis[!(data_2back$network == "fro")]) # -0.1085989 (negligible)
  1457. cohen.d(data_2back$dis[data_2back$network == "dor"], data_2back$dis[!(data_2back$network == "dor")]) # -0.3534341 (small)
  1458. cohen.d(data_2back$dis[data_2back$network == "ven"], data_2back$dis[!(data_2back$network == "ven")]) # 0.01807474 (negligible)
  1459. cohen.d(data_2back$dis[data_2back$network == "def"], data_2back$dis[!(data_2back$network == "def")]) # 0.2594864 (small)
  1460. cohen.d(data_2back$dis[data_2back$network == "som"], data_2back$dis[!(data_2back$network == "som")]) # 0.527744 (medium)
  1461. ```
  1462. # part 5 - performance and total problem score
  1463. - (1) data processing
  1464. ```{r}
  1465. # for three way interactions
  1466. # preprocess subj_list
  1467. names(subj_list)[names(subj_list) == 'V1'] <- 'src_subject_id'
  1468. subj_list$src_subject_id <- gsub("NDAR_", "", subj_list$src_subject_id)
  1469. # merge dataframes
  1470. nback_sub <- nback[,c("src_subject_id","tfmri_nb_all_beh_c0bpf_rate","tfmri_nb_all_beh_c0bnf_rate","tfmri_nb_all_beh_c0bngf_rate","tfmri_nb_all_beh_c2bpf_rate","tfmri_nb_all_beh_c2bnf_rate","tfmri_nb_all_beh_c2bngf_rate")]
  1471. perf_psy <- merge(fam_site_id, nback_sub, by="src_subject_id")
  1472. perf_psy <- merge(perf_psy, abcd_cbcl, by="src_subject_id")
  1473. perf_psy <- merge(perf_psy, subj_list, by="src_subject_id")
  1474. perf_psy <- perf_psy %>%
  1475. mutate_at(c("interview_age","cbcl_scr_syn_totprob_t","cbcl_scr_syn_totprob_r","tfmri_nb_all_beh_c0bpf_rate","tfmri_nb_all_beh_c0bnf_rate","tfmri_nb_all_beh_c0bngf_rate","tfmri_nb_all_beh_c2bpf_rate","tfmri_nb_all_beh_c2bnf_rate","tfmri_nb_all_beh_c2bngf_rate"), as.numeric)
  1476. # head(perf_psy)
  1477. dim(perf_psy) # 5003 21
  1478. # select subjects with clean imaging data
  1479. perf_psy <- merge(data_hf_0b["src_subject_id"], perf_psy, by="src_subject_id")
  1480. # head(perf_psy)
  1481. dim(perf_psy) # 4952 21
  1482. # pivot longer
  1483. perf_psy_long <-
  1484. pivot_longer(perf_psy, cols = c("tfmri_nb_all_beh_c0bpf_rate","tfmri_nb_all_beh_c0bnf_rate","tfmri_nb_all_beh_c0bngf_rate","tfmri_nb_all_beh_c2bpf_rate","tfmri_nb_all_beh_c2bnf_rate","tfmri_nb_all_beh_c2bngf_rate"), names_to = "nback_condition", values_to = "nback_perf")
  1485. # extract 0-back and 2-back & emotions
  1486. perf_psy_long$nback_condition <- gsub("tfmri_nb_all_beh_","",as.character(perf_psy_long$nback_condition))
  1487. perf_psy_long$nback_condition <- gsub("_rate","",as.character(perf_psy_long$nback_condition))
  1488. perf_psy_long$nback_condition <- gsub("b","_b",as.character(perf_psy_long$nback_condition))
  1489. perf_psy_long <- perf_psy_long %>% separate(nback_condition,c("nback","emotion"))
  1490. perf_psy_long <- perf_psy_long %>%
  1491. mutate_at(c("nback","emotion"), as.factor)
  1492. # head(perf_psy_long)
  1493. dim(perf_psy_long) # 30018 18
  1494. ```
  1495. - (2) full mix model
  1496. ```{r}
  1497. lmer6_acc_psych_threelevel <- lmer(nback_perf ~ cbcl_scr_syn_totprob_r * nback * emotion + sex + interview_age + (1|site_id_l/rel_family_id), data = perf_psy_long)
  1498. summary(lmer6_acc_psych_threelevel)
  1499. tab_model(lmer6_acc_psych_threelevel, digits = 4)
  1500. ```
  1501. - (3) three-way anova
  1502. ```{r}
  1503. anova_model1 <- aov(nback_perf ~ cbcl_scr_syn_totprob_r * nback * emotion, data = perf_psy_long)
  1504. summary(anova_model1)
  1505. tab_model(anova_model1)
  1506. ```
  1507. - (4) plot
  1508. ```{r}
  1509. # Create the scatter plot and add the regression line
  1510. p <- ggplot(data = perf_psy_long, aes(x=cbcl_scr_syn_totprob_r, y=nback_perf, color=emotion, shape=emotion)) +
  1511. geom_point(aes(color=emotion),alpha = 0.5) +
  1512. facet_wrap(~nback) +
  1513. geom_smooth(method = "lm", se = TRUE, alpha = 0.1) +
  1514. scale_color_manual(values=c('#999999','#56B4E9','#E69F00')) +
  1515. labs(title = "", x = "CBCL total problems score", y = "Accuracy") +
  1516. theme_classic() +
  1517. theme(text = element_text(size = 20))
  1518. p
  1519. ```
  1520. # part 6 - demographics table
  1521. - (1) preprocessing
  1522. ```{r}
  1523. # demographic table includes
  1524. # (1) age
  1525. # (2) sex assigned at birth; female (%)
  1526. # (3) race/ethnicity (%)
  1527. # (4) family income (%)
  1528. # (5) caregiver education (%)
  1529. # select subjects with clean imaging data
  1530. abcd_pdem <- merge(perf_psy["src_subject_id"], abcd_pdem, by="src_subject_id")
  1531. abcd_pdem <- merge(abcd_pdem, fam_site_id, by="src_subject_id")
  1532. abcd_pdem <- abcd_pdem %>%
  1533. mutate_at("interview_age", as.numeric)
  1534. # sanity check
  1535. dim(abcd_pdem) # 4952 47
  1536. # head(abcd_pdem)
  1537. # re-code household income into three levels
  1538. household.income = abcd_pdem$demo_comb_income_v2
  1539. household.income[abcd_pdem$demo_comb_income_v2 == "1"] = 1 # "[<50K]"
  1540. household.income[abcd_pdem$demo_comb_income_v2 == "2"] = 1 # "[<50K]"
  1541. household.income[abcd_pdem$demo_comb_income_v2 == "3"] = 1 # "[<50K]"
  1542. household.income[abcd_pdem$demo_comb_income_v2 == "4"] = 1 # "[<50K]"
  1543. household.income[abcd_pdem$demo_comb_income_v2 == "5"] = 1 # "[<50K]"
  1544. household.income[abcd_pdem$demo_comb_income_v2 == "6"] = 1 # "[<50K]"
  1545. household.income[abcd_pdem$demo_comb_income_v2 == "7"] = 2 # "[>=50K & <100K]"
  1546. household.income[abcd_pdem$demo_comb_income_v2 == "8"] = 2 # "[>=50K & <100K]"
  1547. household.income[abcd_pdem$demo_comb_income_v2 == "9"] = 3 # "[>=100K]"
  1548. household.income[abcd_pdem$demo_comb_income_v2 == "10"] = 3 # "[>=100K]"
  1549. household.income[abcd_pdem$demo_comb_income_v2 == "777"] = NA
  1550. household.income[abcd_pdem$demo_comb_income_v2 == "999"] = NA
  1551. household.income[household.income %in% c(NA, "999", "777")] = NA
  1552. abcd_pdem$household.income = factor(household.income, levels= 1:3, labels = c("[<50K]", "[>=50K & <100K]", "[>=100K]") )
  1553. # re-code caregiver education into five levels
  1554. high.educ1 = abcd_pdem$demo_prnt_ed_v2
  1555. high.educ2 = abcd_pdem$demo_prtnr_ed_v2
  1556. high.educ1[which(high.educ1 == "999")] = NA
  1557. high.educ2[which(high.educ2 == "999")] = NA
  1558. high.educ1[which(high.educ1 == "777")] = NA
  1559. high.educ2[which(high.educ2 == "777")] = NA
  1560. high.educ = pmax(as.numeric(as.character(high.educ1)), as.numeric(as.character(high.educ2)), na.rm=T)
  1561. idx <- which(high.educ %in% 0:12, arr.ind = TRUE)
  1562. high.educ[idx] = 1 # "< HS Diploma"
  1563. idx <- which(high.educ %in% 13:14, arr.ind = TRUE)
  1564. high.educ[idx] = 2 # "HS Diploma/GED"
  1565. idx <- which(high.educ %in% 15:17, arr.ind = TRUE)
  1566. high.educ[idx] = 3 # "Some College"
  1567. idx <- which(high.educ == 18, arr.ind = TRUE)
  1568. high.educ[idx] = 4 # "Bachelor"
  1569. idx <- which(high.educ %in% 19:21, arr.ind = TRUE)
  1570. high.educ[idx] = 5 # "Post Graduate Degree"
  1571. high.educ[which(high.educ == "999")]=NA
  1572. high.educ[which(high.educ == "777")]=NA
  1573. abcd_pdem$high.educ = factor(high.educ, levels= 1:5, labels = c("< HS Diploma","HS Diploma/GED","Some College","Bachelor","Post Graduate Degree") )
  1574. # re-code racial categories with more easily identifiable variable names (into 8 levels)
  1575. abcd_pdem$white= (abcd_pdem$demo_race_a_p___10 == 1)*1
  1576. abcd_pdem$black= (abcd_pdem$demo_race_a_p___11 == 1)*1
  1577. abcd_pdem$asian = 0
  1578. abcd_pdem$asian[abcd_pdem$demo_race_a_p___18 == 1 | abcd_pdem$demo_race_a_p___19 == 1 |
  1579. abcd_pdem$demo_race_a_p___20 == 1 | abcd_pdem$demo_race_a_p___21 == 1 |
  1580. abcd_pdem$demo_race_a_p___22 == 1 | abcd_pdem$demo_race_a_p___23 == 1 |
  1581. abcd_pdem$demo_race_a_p___24==1] = 1
  1582. abcd_pdem$aian = 0
  1583. abcd_pdem$aian[abcd_pdem$demo_race_a_p___12 == 1 | abcd_pdem$demo_race_a_p___13 == 1] = 1
  1584. abcd_pdem$nhpi = 0
  1585. abcd_pdem$nhpi[abcd_pdem$demo_race_a_p___14 == 1 | abcd_pdem$demo_race_a_p___15 == 1 |
  1586. abcd_pdem$demo_race_a_p___16 == 1 | abcd_pdem$demo_race_a_p___17 == 1] = 1
  1587. abcd_pdem$other = 0
  1588. abcd_pdem$other[abcd_pdem$demo_race_a_p___25 == 1] = 1
  1589. # generate mixed category
  1590. abcd_pdem$mixed =
  1591. abcd_pdem$white + abcd_pdem$black + abcd_pdem$asian + abcd_pdem$aian + abcd_pdem$nhpi + abcd_pdem$other
  1592. abcd_pdem$mixed[abcd_pdem$mixed <= 1] = 0
  1593. abcd_pdem$mixed[abcd_pdem$mixed > 1] = 1
  1594. # generate single race.ethnicity variable
  1595. # note: If you want fewer categories, change code here so that different categories (e.g., other, mixed) have same value (e.g., both = 7)
  1596. abcd_pdem$race.eth = NA
  1597. abcd_pdem$race.eth[abcd_pdem$demo_ethn_v2 == 1] = 1
  1598. abcd_pdem$race.eth[abcd_pdem$white == 1] = 2
  1599. abcd_pdem$race.eth[abcd_pdem$black == 1] = 3
  1600. abcd_pdem$race.eth[abcd_pdem$asian == 1] = 4
  1601. abcd_pdem$race.eth[abcd_pdem$aian == 1] = 5
  1602. abcd_pdem$race.eth[abcd_pdem$nhpi == 1] = 6
  1603. abcd_pdem$race.eth[abcd_pdem$other == 1] = 7
  1604. abcd_pdem$race.eth[abcd_pdem$mixed == 1] = 8
  1605. abcd_pdem$race.eth <- factor(abcd_pdem$race.eth, levels = 1:8,
  1606. labels = c("Hispanic", "White", "Black", "Asian", "AIAN", "NHPI", "Other", "Mixed"))
  1607. # head(abcd_pdem)
  1608. ```
  1609. - (2) generate the table
  1610. ```{r}
  1611. # create a summary/demographics table
  1612. vars1 <- c("interview_age", "sex", "race.eth", "high.educ", "household.income")
  1613. tab1 <- CreateTableOne(vars = vars1, data = abcd_pdem)
  1614. tabAsStringMatrix <- print(tab1, printToggle = FALSE, noSpaces = TRUE)
  1615. tab1 = knitr::kable(tabAsStringMatrix)
  1616. tab1
  1617. ```
  1618. # part 7 - mediation
  1619. - (1) mediation analysis - all three emotional comparisons
  1620. ```{r}
  1621. library(mediation)
  1622. detach("package:lmerTest", unload = TRUE) # must unload lmerTest to run mediation
  1623. # detach("package:psych", unload = TRUE) # also be sure psych is detached
  1624. # using average accuracy of all faces
  1625. # IV - acc, DV - psy, med - sqED
  1626. ### 0-back ###
  1627. # vis
  1628. lme4_0back_vis.0 <-
  1629. lmer(cbcl_scr_syn_totprob_r ~ allface_0b_rate + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "vis",])
  1630. lme4_0back_vis.M <-
  1631. lmer(dis ~ allface_0b_rate + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "vis",])
  1632. lme4_0back_vis.Y <-
  1633. lmer(cbcl_scr_syn_totprob_r ~ allface_0b_rate + dis + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "vis",])
  1634. lme4_med_0back_vis <-
  1635. mediate(model.m = lme4_0back_vis.M, model.y = lme4_0back_vis.Y, treat='allface_0b_rate', mediator = 'dis', data=data_0back[data_0back$network == "vis",], sims=1000, dropobs=TRUE)
  1636. summary(lme4_0back_vis.0)
  1637. summary(lme4_0back_vis.M)
  1638. summary(lme4_0back_vis.Y)
  1639. summary(lme4_med_0back_vis) # ACME -0.65252 -1.11414 -0.17 0.006 **
  1640. # lim
  1641. lme4_0back_lim.0 <-
  1642. lmer(cbcl_scr_syn_totprob_r ~ allface_0b_rate + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "lim",])
  1643. lme4_0back_lim.M <-
  1644. lmer(dis ~ allface_0b_rate + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "lim",])
  1645. lme4_0back_lim.Y <-
  1646. lmer(cbcl_scr_syn_totprob_r ~ allface_0b_rate + dis + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "lim",])
  1647. lme4_med_0back_lim <-
  1648. mediate(model.m = lme4_0back_lim.M, model.y = lme4_0back_lim.Y, treat='allface_0b_rate', mediator = 'dis', data=data_0back[data_0back$network == "lim",], sims=1000, dropobs=TRUE)
  1649. summary(lme4_0back_lim.0)
  1650. summary(lme4_0back_lim.M)
  1651. summary(lme4_0back_lim.Y)
  1652. summary(lme4_med_0back_lim) # ACME -0.08545 -0.26251 0.06 0.26
  1653. # v1
  1654. lme4_0back_v1.0 <-
  1655. lmer(cbcl_scr_syn_totprob_r ~ allface_0b_rate + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "v1",])
  1656. lme4_0back_v1.M <-
  1657. lmer(dis ~ allface_0b_rate + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "v1",])
  1658. lme4_0back_v1.Y <-
  1659. lmer(cbcl_scr_syn_totprob_r ~ allface_0b_rate + dis + sex + interview_age + (1|site_id_l), data = data_0back[data_0back$network == "v1",])
  1660. lme4_med_0back_v1 <-
  1661. mediate(model.m = lme4_0back_v1.M, model.y = lme4_0back_v1.Y, treat='allface_0b_rate', mediator = 'dis', data=data_0back[data_0back$network == "v1",], sims=1000, dropobs=TRUE)
  1662. summary(lme4_0back_v1.0)
  1663. summary(lme4_0back_v1.M)
  1664. summary(lme4_0back_v1.Y)
  1665. summary(lme4_med_0back_v1) # ACME -0.6463 -1.0603 -0.27 <2e-16 ***
  1666. ## 2-back ###
  1667. # vis
  1668. lme4_2back_vis.0 <-
  1669. lmer(cbcl_scr_syn_totprob_r ~ allface_2b_rate + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "vis",])
  1670. lme4_2back_vis.M <-
  1671. lmer(dis ~ allface_2b_rate + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "vis",])
  1672. lme4_2back_vis.Y <-
  1673. lmer(cbcl_scr_syn_totprob_r ~ allface_2b_rate + dis + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "vis",])
  1674. lme4_med_2back_vis <-
  1675. mediate(model.m = lme4_2back_vis.M, model.y = lme4_2back_vis.Y, treat='allface_2b_rate', mediator = 'dis', data=data_2back[data_2back$network == "vis",], sims=1000, dropobs=TRUE)
  1676. summary(lme4_2back_vis.0)
  1677. summary(lme4_2back_vis.M)
  1678. summary(lme4_2back_vis.Y)
  1679. summary(lme4_med_2back_vis) # ACME -1.1415 -1.6326 -0.66 <2e-16 ***
  1680. # lim
  1681. lme4_2back_lim.0 <-
  1682. lmer(cbcl_scr_syn_totprob_r ~ allface_2b_rate + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "lim",])
  1683. lme4_2back_lim.M <-
  1684. lmer(dis ~ allface_2b_rate + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "lim",])
  1685. lme4_2back_lim.Y <-
  1686. lmer(cbcl_scr_syn_totprob_r ~ allface_2b_rate + dis + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "lim",])
  1687. lme4_med_2back_lim <-
  1688. mediate(model.m = lme4_2back_lim.M, model.y = lme4_2back_lim.Y, treat='allface_2b_rate', mediator = 'dis', data=data_2back[data_2back$network == "lim",], sims=1000, dropobs=TRUE)
  1689. summary(lme4_2back_lim.0)
  1690. summary(lme4_2back_lim.M)
  1691. summary(lme4_2back_lim.Y)
  1692. summary(lme4_med_2back_lim) # ACME -0.5729 -0.9724 -0.20 <2e-16 ***
  1693. # v1
  1694. lme4_2back_v1.0 <-
  1695. lmer(cbcl_scr_syn_totprob_r ~ allface_2b_rate + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "v1",])
  1696. lme4_2back_v1.M <-
  1697. lmer(dis ~ allface_2b_rate + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "v1",])
  1698. lme4_2back_v1.Y <-
  1699. lmer(cbcl_scr_syn_totprob_r ~ allface_2b_rate + dis + sex + interview_age + (1|site_id_l), data = data_2back[data_2back$network == "v1",])
  1700. lme4_med_2back_v1 <-
  1701. mediate(model.m = lme4_2back_v1.M, model.y = lme4_2back_v1.Y, treat='allface_2b_rate', mediator = 'dis', data=data_2back[data_2back$network == "v1",], sims=1000, dropobs=TRUE)
  1702. summary(lme4_2back_v1.0)
  1703. summary(lme4_2back_v1.M)
  1704. summary(lme4_2back_v1.Y)
  1705. summary(lme4_med_2back_v1) # ACME -0.47589 -0.77228 -0.19 0.002 **
  1706. ```

ABCD_emo_psy_vis.Rmd at commit 1099ea8, no license · at the source

Overview

Authors: Yen-Chu Lin1, Qingyang Meng1, Angelica Lopez-Tucker1, Janya Utkarsh1, Fin Sterner1, May I. Conley2, Lena J. Skalaban3, Richard Watts4, Dylan G. Gee5, Arielle Baskin-Sommers5, B.J. Casey1
  1. Department of Neuroscience and Behavior, Barnard College, Columbia University, New York, New York
  2. Department of Child and Adolescent Psychiatry, NYU Langone Medical Center, New York, New York
  3. Department of Psychology, University of Oregon, Eugene, Oregon
  4. Faculty of Health, University of Canterbury, Christchurch, New Zealand
  5. Department of Psychology, Yale University, New Haven, Connecticut
Institutions: Columbia University (United States); Barnard College (United States); NYU Langone Health (United States); New York University (United States); University of Oregon (United States); University of Canterbury (New Zealand); Yale University (United States)
Journal: Biological psychiatry global open science, volume 6, issue 6, article 100799
Dates: received 25 March 2026; accepted 15 July 2026; published online 29 July 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1016/j.bpsgos.2026.100799 · PMID 42741195 · PMCID PMC13572311 · OpenAlex W7171673176
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism)
Methods: Connectivity, Statistics, fMRI & imaging, Single-unit activity, calcium imaging, Machine learning
Keywords: Adolescence, Cognition, Emotion, Neuroimaging, Psychopathology, Visual cortex
Journal subjects: Archival Report
Topic: Neural and Behavioral Psychology Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: NIH (U01DA041174)
Citations: not cited yet (Europe PMC); 94 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above.

yenchu-lin/abcd_vis_psychopathology

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 1099ea8d8a8558c240376c456e542d096a4cebb2, 23 June 2026
Languages: R (1)
Size: 3 files, 1 script
Software Heritage: not archived
Found in: the text, “Associations of Neural Dissimilarity With Cognit”
Holds: README, 1 notebook
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: lme4 (1 file), lmerTest (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
2 files

Tracing map

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

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 1 script, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

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

Data

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

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, 11 authors, 6 keywords, 1 funder, 89 references.

Cite

This paper

Lin, Y.-C., Meng, Q., Lopez-Tucker, A., Utkarsh, J., Sterner, F., Conley, M. I., Skalaban, L. J., Watts, R., Gee, D. G., Baskin-Sommers, A., & Casey, B. (2026). Distinct Representations of Irrelevant Emotional Information in the Visual Network Are Associated With Psychopathology in Youth. Biological psychiatry global open science, 6(6), 100799. https://doi.org/10.1016/j.bpsgos.2026.100799

BibTeX

@article{lin2026distinct,
author = {Lin, Yen-Chu and Meng, Qingyang and Lopez-Tucker, Angelica and Utkarsh, Janya and Sterner, Fin and Conley, May I. and Skalaban, Lena J. and Watts, Richard and Gee, Dylan G. and Baskin-Sommers, Arielle and Casey, B.J.},
title = {{Distinct Representations of Irrelevant Emotional Information in the Visual Network Are Associated With Psychopathology in Youth}},
journal = {Biological psychiatry global open science},
year = {2026},
month = jul,
volume = {6},
number = {6},
pages = {100799},
publisher = {Elsevier},
issn = {2667-1743},
doi = {10.1016/j.bpsgos.2026.100799},
url = {https://doi.org/10.1016/j.bpsgos.2026.100799},
pmid = {42741195},
pmcid = {PMC13572311}
}

RIS

TY - JOUR
AU - Lin, Yen-Chu
AU - Meng, Qingyang
AU - Lopez-Tucker, Angelica
AU - Utkarsh, Janya
AU - Sterner, Fin
AU - Conley, May I.
AU - Skalaban, Lena J.
AU - Watts, Richard
AU - Gee, Dylan G.
AU - Baskin-Sommers, Arielle
AU - Casey, B.J.
TI - Distinct Representations of Irrelevant Emotional Information in the Visual Network Are Associated With Psychopathology in Youth
T2 - Biological psychiatry global open science
J2 - Biol Psychiatry Glob Open Sci
PY - 2026
DA - 2026/07/29
VL - 6
IS - 6
SP - 100799
SN - 2667-1743
PB - Elsevier
DO - 10.1016/j.bpsgos.2026.100799
UR - https://doi.org/10.1016/j.bpsgos.2026.100799
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.bpsgos.2026.100799",
"type": "article-journal",
"title": "Distinct Representations of Irrelevant Emotional Information in the Visual Network Are Associated With Psychopathology in Youth",
"container-title": "Biological psychiatry global open science",
"author": [
{
"family": "Lin",
"given": "Yen-Chu"
},
{
"family": "Meng",
"given": "Qingyang"
},
{
"family": "Lopez-Tucker",
"given": "Angelica"
},
{
"family": "Utkarsh",
"given": "Janya"
},
{
"family": "Sterner",
"given": "Fin"
},
{
"family": "Conley",
"given": "May I."
},
{
"family": "Skalaban",
"given": "Lena J."
},
{
"family": "Watts",
"given": "Richard"
},
{
"family": "Gee",
"given": "Dylan G."
},
{
"family": "Baskin-Sommers",
"given": "Arielle"
},
{
"family": "Casey",
"given": "B.J."
}
],
"container-title-short": "Biol Psychiatry Glob Open Sci",
"volume": "6",
"issue": "6",
"page": "100799",
"DOI": "10.1016/j.bpsgos.2026.100799",
"PMID": "42741195",
"PMCID": "PMC13572311",
"ISSN": "2667-1743",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.bpsgos.2026.100799",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
29
]
]
}
}

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.1002/jcv2.70135 [code]
Alterations in resting-state functional connectivity relate to psychopathology trajectories during emerging adolescence.
Journal: JCPP advances
In common: lmerTest, lme4, tidyverse, 9 references
[2] doi:10.1016/j.dcn.2026.101769 [code]
Differential adolescent neurodevelopment of emotion processing across internalizing psychopathology and childhood adversity.
Journal: Developmental cognitive neuroscience
In common: tidyverse, 11 references
[3] doi:10.1038/s41467-026-73072-6 [code]
Mapping the spatiotemporal continuum of structural connectivity development across the human connectome in youth.
Journal: Nature communications
In common: lmerTest, lme4, tidyverse, 7 references
[4] doi:10.1016/j.ynirp.2026.100366 [code]
Lower resting-state functional connectivity between frontoparietal and sensory networks is associated with recent pain intensity in a community sample of youth.
Journal: Neuroimage. Reports
In common: lmerTest, lme4, tidyverse, 4 references
[5] doi:10.1038/s41514-026-00456-9 [code]
Exploring the link between body physiology and cognition: the role of the brain and aging.
Journal: npj aging
In common: tidyverse, 7 references
[6] doi:10.7554/elife.108109 [code]
Multimodal MRI marker of cognition explains the association between cognition and mental health in the UK Biobank.
Journal: eLife
In common: 8 references
[7] doi:10.1038/s41467-026-73668-y [code]
Convergent and divergent brain-cognition development in early adolescence.
Journal: Nature communications
In common: lme4, tidyverse, 5 references
[8] doi:10.1038/s42003-026-10282-0 [code]
Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife.
Journal: Communications biology
In common: lmerTest, lme4, tidyverse, 3 references
[9] doi:10.1038/s41467-026-71428-6 [code]
Binding items to contexts through conjunctive neural representations with the method of loci.
Journal: Nature communications
In common: lmerTest, lme4, tidyverse, 3 references
[10] doi:10.1007/s42761-026-00394-5 [code]
Amygdalar Pattern Similarity to Negative and Neutral Images, Ratings of the Images, and PET-Measured Amyloid and Tau Levels in Older Adults Without Dementia.
Journal: Affective science
In common: tidyverse, 4 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.

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.