OSCR

Timing and tempo of puberty and neurodevelopment following adversity: A registered report.

Code ↔ Paper

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

The 1 match
  1. [1] § Method › Measures › Adversity exposure ↔ ELAfromABCD_ELAplus.Rmd, lines 255–388 · score 0.67 · sum score, neighborhood, crime, safety, incarceration, CRPBI

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 · 829 lines · 41 KB · MIT · 1 match

  1. ---
  2. title: "acesinabcd"
  3. author: "FB"
  4. date: "2024-03-11"
  5. output:
  6. word_document: default
  7. html_document: default
  8. ---
  9. ```{r setup, include=FALSE}
  10. knitr::opts_chunk$set(echo = TRUE)
  11. ```
  12. ## ELA+ scores for ABCD data
  13. Running this code will create ELA+ scores for Baseline through Year 3.
  14. Need to run the setup file (ELAfromABCD_setup.Rmd) first to create the necessary RDS and CSV files.
  15. IMPORTANT: Make sure to run the ENTIRE code to get the correct scores.
  16. ```{r load-packages}
  17. library(dplyr)
  18. library(tidyr)
  19. ```
  20. ```{r load-data}
  21. #read RDS file
  22. ela_in_abcd=readRDS("ela_in_abcd.rds")
  23. mh_py_le_bs=read.csv("mh_py_le_bs.csv")
  24. #create baseline dataset
  25. ela_in_abcd_bs = ela_in_abcd[ela_in_abcd$eventname == "baseline_year_1_arm_1", ]
  26. #add in life events "baseline" data
  27. #remove the variable label from main data set and re-add without eventname so the calculated baseline appears inline with other baseline data
  28. ela_in_abcd_bs = ela_in_abcd_bs[c("src_subject_id","eventname","ksads_ptsd_raw_761_p","ksads_ptsd_raw_762_p","ksads_ptsd_raw_763_p", "ksads_ptsd_raw_764_p","ksads_ptsd_raw_765_p","ksads_ptsd_raw_767_p","ksads_ptsd_raw_768_p","ksads_ptsd_raw_769_p","ksads_ptsd_raw_766_p","ksads_ptsd_raw_756_p","ksads_ptsd_raw_757_p","ksads_ptsd_raw_758_p","ksads_ptsd_raw_759_p","ksads_ptsd_raw_760_p","fes_youth_q5","crpbi_y_ss_parent_ace","demo_fam_exp1_v2","demo_fam_exp2_v2","demo_fam_exp3_v2","demo_fam_exp4_v2","demo_fam_exp5_v2","demo_fam_exp6_v2","demo_fam_exp7_v2","asr_scr_totprob_t","asr_q06_p","asr_q06_p_ace","asr_scr_totprob_t_ace","famhx_ss_momdad_ma_p","famhx_ss_momdad_alc_p","famhx_ss_momdad_dg_p","famhx_ss_momdad_dprs_p","famhx_ss_momdad_hspd_p","famhx_ss_momdad_scd_p","famhx_ss_momdad_vs_p","nbh_crime_y_ela","neighborhood2r_p_ela","neighborhood3r_p_ela")]
  29. ela_in_abcd_bs = left_join(ela_in_abcd_bs, mh_py_le_bs, by=c("src_subject_id"))
  30. #create separate dfs for remaining time points
  31. ela_in_abcd_yr1 = ela_in_abcd[ela_in_abcd$eventname == "1_year_follow_up_y_arm_1", ]
  32. ela_in_abcd_yr2 = ela_in_abcd[ela_in_abcd$eventname == "2_year_follow_up_y_arm_1", ]
  33. ela_in_abcd_yr3 = ela_in_abcd[ela_in_abcd$eventname == "3_year_follow_up_y_arm_1", ]
  34. ela_in_abcd_yr4 = ela_in_abcd[ela_in_abcd$eventname == "4_year_follow_up_y_arm_1", ]
  35. #creating function to sum items in each domain where it will sum across the row as long as at least one variable is not NA
  36. sum_score <- function(x){
  37. if (all(is.na(x))) {
  38. suma <- NA
  39. }
  40. else {
  41. suma <- sum(x, na.rm = T)
  42. }
  43. return(suma)
  44. }
  45. ```
  46. ```{r ela-plus-baseline}
  47. #calculating baseline scores for each domain
  48. #for domains with multiple items, if any of the items is endorsed, domain score = 1
  49. #abuse_phy
  50. #KSADS Shot, stabbed, or beaten brutally by a non-family member ksads_ptsd_raw_761_p
  51. #KSADS Shot, stabbed, or beaten brutally by a grown up in the home ksads_ptsd_raw_762_p
  52. #KSADS Beaten to the point of having bruises by a grown up in the home ksads_ptsd_raw_763_p
  53. #KSADS A non-family member threatened to kill your child ksads_ptsd_raw_764_p
  54. #KSADS A family member threatened to kill your child ksads_ptsd_raw_765_p
  55. #create dataframe with phys abuse items
  56. abuse_phy_bs_data = c("ksads_ptsd_raw_761_p" , "ksads_ptsd_raw_762_p", "ksads_ptsd_raw_763_p", "ksads_ptsd_raw_764_p", "ksads_ptsd_raw_765_p")
  57. #sum the items as long as they're not all NA
  58. ela_in_abcd_bs$abuse_phy_sum = apply(ela_in_abcd_bs[abuse_phy_bs_data],1, sum_score)
  59. #binary recode as anything > 0 is 1
  60. ela_in_abcd_bs$abuse_phy_bs = ifelse(ela_in_abcd_bs$abuse_phy_sum == 0, 0, 1)
  61. #abuse_sex
  62. #KSADS A grown up in the home touched your child in their privates, had your child touch their privates, or did other sexual things to your child ksads_ptsd_raw_767_p
  63. #KSADS An adult outside your family touched your child in their privates, had your child touch their privates or did other sexual things to your child ksads_ptsd_raw_768_p
  64. #KSADS A peer forced your child to do something sexually ksads_ptsd_raw_769_p
  65. #create dataframe with sexual abuse items
  66. abuse_sex_bs_data = c("ksads_ptsd_raw_767_p" , "ksads_ptsd_raw_768_p", "ksads_ptsd_raw_769_p")
  67. #sum the items as long as they're not all NA
  68. ela_in_abcd_bs$abuse_sex_sum = apply(ela_in_abcd_bs[abuse_sex_bs_data],1, sum_score)
  69. #binary recode as anything > 0 is 1
  70. ela_in_abcd_bs$abuse_sex_bs = ifelse(ela_in_abcd_bs$abuse_sex_sum == 0, 0, 1)
  71. #abuse_emo
  72. #Family Environment Family members often criticize each other. fes_youth_q5
  73. #utilizing youth report only to ensure youth exposure (e.g., not parents criticizing without kid present)
  74. #yes/no item; no sum or recode necessary
  75. ela_in_abcd_bs$abuse_emo_bs = ela_in_abcd_bs$fes_youth_q5
  76. #neglect_phy
  77. #Demographics Needed food but couldn't afford to buy it or couldn't afford to go out to get it?P demo_fam_exp1_v2_l/demo_fam_exp1_v2
  78. #Demographics Had someone who needed to see a doctor or go to the hospital but didn't go because you could not afford it?P demo_fam_exp6_v2/demo_fam_exp6_v2_l
  79. #Demographics Had someone who needed a dentist but couldn't go because you could not afford it?P demo_fam_exp7_v2/demo_fam_exp7_v2_l
  80. #create dataframe with physical neglect items
  81. neglect_phy_bs_data = c("demo_fam_exp1_v2", "demo_fam_exp6_v2", "demo_fam_exp7_v2")
  82. #sum the items as long as they're not all NA
  83. ela_in_abcd_bs$neglect_phy_sum = apply(ela_in_abcd_bs[neglect_phy_bs_data],1, sum_score)
  84. #binary recode as anything > 0 is 1
  85. ela_in_abcd_bs$neglect_phy_bs = ifelse(ela_in_abcd_bs$neglect_phy_sum == 0, 0, 1)
  86. #neglect_emo
  87. #CRPBI parent *CRPBI Mean Parent (primary caregiver)Y crpbi_y_ss_parent_ace
  88. #all recoding done previously
  89. ela_in_abcd_bs$neglect_emo_bs = ela_in_abcd_bs$crpbi_y_ss_parent_ace
  90. #divorce
  91. #Life Events Parents separated or divorced?Y,P ple_separ_p/ple_separ_y (ple_separ_p_bs/ple_separ_y_bs)
  92. #create dataframe with parent divorce items
  93. divorce_bs_data = c("ple_separ_p_bs", "ple_separ_y_bs")
  94. #sum the items as long as they're not both NA
  95. ela_in_abcd_bs$divorce_bs_sum = apply(ela_in_abcd_bs[divorce_bs_data],1, sum_score)
  96. #binary recode as anything > 0 is 1
  97. ela_in_abcd_bs$divorce_bs = ifelse(ela_in_abcd_bs$divorce_bs_sum == 0, 0, 1)
  98. #violence in home
  99. #KSADS Witness the grownups in the home push, shove or hit one anotherP ksads_ptsd_raw_766_p
  100. #yes/no item; no sum or recode necessary
  101. ela_in_abcd_bs$violence_bs = ela_in_abcd_bs$ksads_ptsd_raw_766_p
  102. #mental illness
  103. #Life Events Family member had mental/emotional problem?Y,P ple_mh_p/ple_mh_y (ple_mh_p_bs/ple_mh_y_bs)
  104. #Adult Self-Report Total Problems ASR Syndrome Scale (t-score)P asr_scr_totprob_t_ace (1=greater than t-score>63)
  105. #Family History Depression Biological ParentP famhx_ss_momdad_dprs_p
  106. #Family History Suicide Biological ParentP famhx_ss_momdad_scd_p
  107. #Family History Mania Biological ParentP famhx_ss_momdad_ma_p
  108. #Family History Psychosis Biological ParentP famhx_ss_momdad_vs_p
  109. #Family History Either parent hospitalized due to emotional/mental problem famhx_ss_momdad_hspd_p
  110. #create dataframe with mental illness items
  111. mi_sum_bs_data = c("ple_mh_p_bs", "ple_mh_y_bs", "asr_scr_totprob_t_ace", "famhx_ss_momdad_dprs_p", "famhx_ss_momdad_scd_p", "famhx_ss_momdad_ma_p", "famhx_ss_momdad_vs_p", "famhx_ss_momdad_hspd_p")
  112. #sum the items as long as they're not all NA
  113. ela_in_abcd_bs$mi_sum = apply(ela_in_abcd_bs[mi_sum_bs_data],1, sum_score)
  114. #binary recode as anything > 0 is 1
  115. ela_in_abcd_bs$mi_bs = ifelse(ela_in_abcd_bs$mi_sum == 0, 0, 1)
  116. #Incarcerated Relative
  117. #Life Events Someone in the family was arrested?Y,P ple_arrest_p/ple_arrest_y (ple_arrest_p_bs/ple_arrest_y_bs)
  118. #Life Events Parents/caregiver got into trouble with the law?Y,P ple_law_p/ple_law_y (ple_law_p_bs/ple_law_y_bs)
  119. #Life Events One of the parents/caregivers went to jail?Y,P ple_jail_p/ple_jail_y (ple_jail_p_bs/ple_jail_y_bs)
  120. #create dataframe with incarceration items
  121. incar_sum_bs_data = c("ple_arrest_p_bs", "ple_arrest_y_bs", "ple_law_p_bs", "ple_law_y_bs", "ple_jail_p_bs", "ple_jail_y_bs")
  122. #sum the items as long as they're not all NA
  123. ela_in_abcd_bs$incar_sum = apply(ela_in_abcd_bs[incar_sum_bs_data],1, sum_score)
  124. #binary recode as anything > 0 is 1
  125. ela_in_abcd_bs$incar_bs = ifelse(ela_in_abcd_bs$incar_sum == 0, 0, 1)
  126. #Substance Use
  127. #Life Events Family member had drug and/or alcohol problem?Y,P ple_sud_p/ple_sud_y (ple_sud_p_bs/ple_sud_y_bs)
  128. #Adult Self-Report I use drugs (other than alcohol, nicotine) for nonmedical purposesP asr_q06_p_ace
  129. #Family History AUD Biological ParentP famhx_ss_momdad_alc_p
  130. #Family History SUD Biological ParentP famhx_ss_momdad_dg_p
  131. #create dataframe with substance use items
  132. su_sum_bs_data = c("ple_sud_p_bs", "ple_sud_y_bs", "asr_q06_p_ace", "famhx_ss_momdad_alc_p", "famhx_ss_momdad_dg_p")
  133. #sum the items as long as they're not all NA
  134. ela_in_abcd_bs$su_sum = apply(ela_in_abcd_bs[su_sum_bs_data],1, sum_score)
  135. #binary recode as anything > 0 is 1
  136. ela_in_abcd_bs$su_bs = ifelse(ela_in_abcd_bs$su_sum == 0, 0, 1)
  137. #Exposure
  138. #ksads_ptsd_raw_756_p Witnessed or caught in a fire that caused significant property damage or personal injury
  139. #ksads_ptsd_raw_757_p Witnessed or caught in a natural disaster that caused significant property damage or personal injury
  140. #ksads_ptsd_raw_758_p Witnessed or present during an act of terrorism (e.g., Boston marathon bombing)
  141. #ksads_ptsd_raw_759_p Witnessed death or mass destruction in a war zone
  142. #ksads_ptsd_raw_760_p Witnessed someone shot or stabbed in the community
  143. #0 = No; 1 = Yes
  144. #create dataframe with exposure items
  145. exposure_bs_data = c("ksads_ptsd_raw_756_p" , "ksads_ptsd_raw_757_p", "ksads_ptsd_raw_758_p", "ksads_ptsd_raw_759_p", "ksads_ptsd_raw_760_p")
  146. #sum the items as long as they're not all NA
  147. ela_in_abcd_bs$exposure_sum = apply(ela_in_abcd_bs[exposure_bs_data],1, sum_score)
  148. #binary recode as anything > 0 is 1
  149. ela_in_abcd_bs$exposure_bs = ifelse(ela_in_abcd_bs$exposure_sum == 0, 0, 1)
  150. #Safety
  151. #Life Events Was a victim of crime/violence/assault? ple_victim_p/ple_victim_y (ple_victim_p_bs/ple_victim_y_bs)
  152. #*My neighborhood is safe from crime. neighborhood3r_p_ace/nbh_crime_y_ela
  153. #Violence is not a problem in my neighborhood. neighborhood2r_p_ace
  154. #recoded in setup: 4/5=0, 3/2/1=1
  155. #create dataframe with safety items
  156. safety_sum_bs_data = c("neighborhood2r_p_ela","neighborhood3r_p_ela","nbh_crime_y_ela", "ple_victim_p_bs", "ple_victim_y_bs")
  157. #sum the items as long as they're not all NA
  158. ela_in_abcd_bs$safety_sum = apply(ela_in_abcd_bs[safety_sum_bs_data],1, sum_score)
  159. #binary recode as anything > 0 is 1
  160. ela_in_abcd_bs$safety_bs = ifelse(ela_in_abcd_bs$safety_sum == 0, 0, 1)
  161. #Resources
  162. #Were without telephone service because you could not afford it?P demo_fam_exp2_v2
  163. #Didn't pay the full amount of the rent or mortgage because you could not afford it?P demo_fam_exp3_v2
  164. #Were evicted from your home for not paying the rent or mortgage?P demo_fam_exp4_v2
  165. #Had services turned off by the gas or electric company, or the oil company wouldn't deliver oil because payments were not made?P demo_fam_exp5_v2
  166. #create dataframe with resources items
  167. resources_bs_data = c("demo_fam_exp2_v2" , "demo_fam_exp3_v2", "demo_fam_exp4_v2", "demo_fam_exp5_v2")
  168. #sum the items as long as they're not all NA
  169. ela_in_abcd_bs$resources_sum = apply(ela_in_abcd_bs[resources_bs_data],1, sum_score)
  170. #binary recode as anything > 0 is 1
  171. ela_in_abcd_bs$resources_bs = ifelse(ela_in_abcd_bs$resources_sum == 0, 0, 1)
  172. #Family Separation
  173. #not collected until year 3/4
  174. #Placed in foster care? ple_foster_care_p/ple_foster_care_y
  175. #One of the parents/caregivers was deported? ple_deported_p/ple_deported_y
  176. #*SUM SCORE*
  177. ela_in_abcd_bs$ela_plus_bs = ela_in_abcd_bs$abuse_phy_bs + ela_in_abcd_bs$abuse_sex_bs + ela_in_abcd_bs$abuse_emo_bs + ela_in_abcd_bs$neglect_phy_bs + ela_in_abcd_bs$neglect_emo_bs + ela_in_abcd_bs$divorce_bs + ela_in_abcd_bs$violence_bs + ela_in_abcd_bs$incar_bs + ela_in_abcd_bs$su_bs + ela_in_abcd_bs$mi_bs + ela_in_abcd_bs$exposure_bs + ela_in_abcd_bs$safety_bs + ela_in_abcd_bs$resources_bs
  178. ```
  179. ```{r ela-plus-yr1}
  180. #yr 1
  181. #abuse_phy
  182. #cannot be calculated at Year 1 due to no KSADS
  183. #domain score will be equal to that at Baseline
  184. #abuse_sex
  185. #cannot be calculated at Year 1 due to no KSADS
  186. #domain score will be equal to that at Baseline
  187. #abuse_emo
  188. #Family Environment Family members often criticize each other. fes_youth_q5
  189. #utilizing youth only to ensure youth exposure
  190. ela_in_abcd_yr1$abuse_emo_yr1 = ela_in_abcd_yr1$fes_youth_q5
  191. #neglect_phy
  192. #Demographics Needed food but couldn't afford to buy it or couldn't afford to go out to get it?P demo_fam_exp1_v2_l/demo_fam_exp1_v2
  193. #Demographics Had someone who needed to see a doctor or go to the hospital but didn't go because you could not afford it?P demo_fam_exp6_v2/demo_fam_exp6_v2_l
  194. #Demographics Had someone who needed a dentist but couldn't go because you could not afford it?P demo_fam_exp7_v2/demo_fam_exp7_v2_l
  195. #create dataframe with physical neglect items
  196. neglect_phy_sum_yr1_data = c("demo_fam_exp1_v2_l", "demo_fam_exp6_v2_l", "demo_fam_exp7_v2_l")
  197. #sum the items as long as they're not all NA
  198. ela_in_abcd_yr1$neglect_phy_sum = apply(ela_in_abcd_yr1[neglect_phy_sum_yr1_data],1, sum_score)
  199. #binary recode as anything > 0 is 1
  200. ela_in_abcd_yr1$neglect_phy_yr1 = ifelse(ela_in_abcd_yr1$neglect_phy_sum == 0, 0, 1)
  201. #neglect_emo
  202. #CRPBI parent *CRPBI Mean Parent (primary caregiver)Y crpbi_y_ss_parent_ace
  203. ela_in_abcd_yr1$neglect_emo_yr1 = ela_in_abcd_yr1$crpbi_y_ss_parent_ace
  204. #divorce
  205. #create dataframe with divorce items
  206. divorce_yr1_data = c("ple_separ_p" , "ple_separ_y")
  207. #sum the items as long as they're not all NA
  208. ela_in_abcd_yr1$divorce_sum = apply(ela_in_abcd_yr1[divorce_yr1_data],1, sum_score)
  209. #binary recode as anything > 0 is 1
  210. ela_in_abcd_yr1$divorce_yr1 = ifelse(ela_in_abcd_yr1$divorce_sum == 0, 0, 1)
  211. #violence in home (violence)
  212. #cannot be calculated at Year 1 due to no KSADS
  213. #domain score will be equal to that at Baseline
  214. #mental illness (mi)
  215. #Life Events Family member had mental/emotional problem?Y,P ple_mh_p/ple_mh_y (ple_mh_p_yr1/ple_mh_y_yr1)
  216. #No ASR or Fam Hx update at Y1
  217. #create dataframe with mi items
  218. mi_sum_yr1_data = c("ple_mh_p", "ple_mh_y")
  219. #sum the items as long as they're not all NA
  220. ela_in_abcd_yr1$mi_sum = apply(ela_in_abcd_yr1[mi_sum_yr1_data],1, sum_score)
  221. #binary recode as anything > 0 is 1
  222. ela_in_abcd_yr1$mi_yr1 = ifelse(ela_in_abcd_yr1$mi_sum == 0, 0, 1)
  223. #Incarcerated Relative
  224. #Life Events Someone in the family was arrested?Y,P ple_arrest_p/ple_arrest_y (ple_arrest_p_yr1/ple_arrest_y_yr1)
  225. #Life Events Parents/caregiver got into trouble with the law?Y,P ple_law_p/ple_law_y (ple_law_p_yr1/ple_law_y_yr1)
  226. #Life Events One of the parents/caregivers went to jail?Y,P ple_jail_p/ple_jail_y (ple_jail_p_yr1/ple_jail_y_yr1)
  227. #create dataframe with incarceration items
  228. incar_sum_yr1_data = c("ple_arrest_p" , "ple_arrest_y" , "ple_law_p" , "ple_law_y" , "ple_jail_y" , "ple_jail_p")
  229. #sum the items as long as they're not all NA
  230. ela_in_abcd_yr1$incar_sum = apply(ela_in_abcd_yr1[incar_sum_yr1_data],1, sum_score)
  231. #binary recode as anything > 0 is 1
  232. ela_in_abcd_yr1$incar_yr1 = ifelse(ela_in_abcd_yr1$incar_sum == 0, 0, 1)
  233. #Substance Use
  234. #Life Events Family member had drug and/or alcohol problem?Y,P ple_sud_p/ple_sud_y (ple_sud_p_yr1/ple_sud_y_yr1)
  235. #No ASR or Fam Hx update at Y1
  236. ela_in_abcd_yr1$ple_sud_y_yr1 = ela_in_abcd_yr1$ple_sud_y
  237. #create dataframe with substance use items
  238. su_sum_yr1_data = c("ple_sud_p","ple_sud_y")
  239. #sum the items as long as they're not all NA
  240. ela_in_abcd_yr1$su_sum = apply(ela_in_abcd_yr1[su_sum_yr1_data],1, sum_score)
  241. #binary recode as anything > 0 is 1
  242. ela_in_abcd_yr1$su_yr1 = ifelse(ela_in_abcd_yr1$su_sum == 0, 0, 1)
  243. #Exposure
  244. #cannot be calculated at Year 1 due to no KSADS
  245. #domain score will be equal to that at Baseline
  246. #Safety
  247. #Life Events Was a victim of crime/violence/assault? ple_victim_p/ple_victim_y (ple_victim_p_bs/ple_victim_y_bs)
  248. #*My neighborhood is safe from crime. neighborhood3r_p_ace/nbh_crime_y_ela
  249. #Violence is not a problem in my neighborhood. neighborhood2r_p_ace
  250. #recoded in setup: 4/5=0, 3/2/1=1
  251. #create dataframe with safety items
  252. safety_sum_yr1_data = c("neighborhood2r_p_ela","neighborhood3r_p_ela","nbh_crime_y_ela", "ple_victim_p", "ple_victim_y")
  253. #sum the items as long as they're not all NA
  254. ela_in_abcd_yr1$safety_sum = apply(ela_in_abcd_yr1[safety_sum_yr1_data],1, sum_score)
  255. #binary recode as anything > 0 is 1
  256. ela_in_abcd_yr1$safety_yr1 = ifelse(ela_in_abcd_yr1$safety_sum == 0, 0, 1)
  257. #Resources
  258. #Were without telephone service because you could not afford it?P demo_fam_exp2_v2
  259. #Didn't pay the full amount of the rent or mortgage because you could not afford it?P demo_fam_exp3_v2
  260. #Were evicted from your home for not paying the rent or mortgage?P demo_fam_exp4_v2
  261. #Had services turned off by the gas or electric company, or the oil company wouldn't deliver oil because payments were not made?P demo_fam_exp5_v2
  262. #create dataframe with resources items
  263. resources_yr1_data = c("demo_fam_exp2_v2_l" , "demo_fam_exp3_v2_l", "demo_fam_exp4_v2_l", "demo_fam_exp5_v2_l")
  264. #sum the items as long as they're not all NA
  265. ela_in_abcd_yr1$resources_sum = apply(ela_in_abcd_yr1[resources_yr1_data],1, sum_score)
  266. #binary recode as anything > 0 is 1
  267. ela_in_abcd_yr1$resources_yr1 = ifelse(ela_in_abcd_yr1$resources_sum == 0, 0, 1)
  268. #Family Separation
  269. #not collected until year 3/4
  270. #Placed in foster care? ple_foster_care_p/ple_foster_care_y
  271. #One of the parents/caregivers was deported? ple_deported_p/ple_deported_y
  272. ```
  273. ```{r ela-plus-yr2}
  274. #yr 2
  275. #abuse_phy
  276. #KSADS Shot, stabbed, or beaten brutally by a non-family member ksads_ptsd_raw_761_p
  277. #KSADS Shot, stabbed, or beaten brutally by a grown up in the home ksads_ptsd_raw_762_p
  278. #KSADS Beaten to the point of having bruises by a grown up in the home ksads_ptsd_raw_763_p
  279. #KSADS A non-family member threatened to kill your child ksads_ptsd_raw_764_p
  280. #KSADS A family member threatened to kill your child ksads_ptsd_raw_765_p
  281. #create dataframe with physical abuse items
  282. abuse_phy_yr2_data = c("ksads_ptsd_raw_761_p" , "ksads_ptsd_raw_762_p", "ksads_ptsd_raw_763_p", "ksads_ptsd_raw_764_p", "ksads_ptsd_raw_765_p")
  283. #sum the items as long as they're not all NA
  284. ela_in_abcd_yr2$abuse_phy_sum = apply(ela_in_abcd_yr2[abuse_phy_yr2_data],1, sum_score)
  285. #binary recode as anything > 0 is 1
  286. ela_in_abcd_yr2$abuse_phy_yr2 = ifelse(ela_in_abcd_yr2$abuse_phy_sum == 0, 0, 1)
  287. #abuse_sex
  288. #KSADS A grown up in the home touched your child in their privates, had your child touch their privates, or did other sexual things to your childP ksads_ptsd_raw_767_p
  289. #KSADS An adult outside your family touched your child in their privates, had your child touch their privates or did other sexual things to your childP ksads_ptsd_raw_768_p
  290. #KSADS A peer forced your child to do something sexuallyP ksads_ptsd_raw_769_p
  291. #create dataframe with sexual abuse items
  292. abuse_sex_yr2_data = c("ksads_ptsd_raw_767_p" , "ksads_ptsd_raw_768_p", "ksads_ptsd_raw_769_p")
  293. #sum the items as long as they're not all NA
  294. ela_in_abcd_yr2$abuse_sex_sum = apply(ela_in_abcd_yr2[abuse_sex_yr2_data],1, sum_score)
  295. #binary recode as anything > 0 is 1
  296. ela_in_abcd_yr2$abuse_sex_yr2 = ifelse(ela_in_abcd_yr2$abuse_sex_sum == 0, 0, 1)
  297. #abuse_emo
  298. #Family Environment Family members often criticize each other. fes_youth_q5
  299. #utilizing youth only to ensure youth exposure
  300. #no recode necessary (binary yes/no variable)
  301. ela_in_abcd_yr2$abuse_emo_yr2 = ela_in_abcd_yr2$fes_youth_q5
  302. #neglect_phy
  303. #Demographics Needed food but couldn't afford to buy it or couldn't afford to go out to get it?P demo_fam_exp1_v2_l/demo_fam_exp1_v2
  304. #Demographics Had someone who needed to see a doctor or go to the hospital but didn't go because you could not afford it?P demo_fam_exp6_v2/demo_fam_exp6_v2_l
  305. #Demographics Had someone who needed a dentist but couldn't go because you could not afford it?P demo_fam_exp7_v2/demo_fam_exp7_v2_l
  306. #create dataframe with physical neglect items
  307. neglect_phy_yr2_data = c("demo_fam_exp1_v2_l" , "demo_fam_exp6_v2_l", "demo_fam_exp7_v2_l")
  308. #sum the items as long as they're not all NA
  309. ela_in_abcd_yr2$neglect_phy_sum = apply(ela_in_abcd_yr2[neglect_phy_yr2_data],1, sum_score)
  310. #binary recode as anything > 0 is 1
  311. ela_in_abcd_yr2$neglect_phy_yr2 = ifelse(ela_in_abcd_yr2$neglect_phy_sum == 0, 0, 1)
  312. #neglect_emo
  313. #CRPBI parent *CRPBI Mean Parent (primary caregiver)Y crpbi_y_ss_parent_ace
  314. #only ~5000 with scores, so without further information, omitting for Year 2
  315. #domain score will stay same as Year 1
  316. #divorce
  317. #Life Events Parents separated or divorced?Y,P ple_separ_p/ple_separ_y (ple_separ_p_yr2/ple_separ_y_yr2)
  318. #create dataframe with divorce items
  319. divorce_yr2_data = c("ple_separ_p", "ple_separ_y")
  320. #sum the items as long as they're not all NA
  321. ela_in_abcd_yr2$divorce_sum = apply(ela_in_abcd_yr2[divorce_yr2_data],1, sum_score)
  322. #binary recode as anything > 0 is 1
  323. ela_in_abcd_yr2$divorce_yr2 = ifelse(ela_in_abcd_yr2$divorce_sum == 0, 0, 1)
  324. #violence in home (violence)
  325. #KSADS Witness the grownups in the home push, shove or hit one anotherP ksads_ptsd_raw_766_p
  326. #no recode necessary (binary yes/no variable)
  327. ela_in_abcd_yr2$violence_yr2 = ela_in_abcd_yr2$ksads_ptsd_raw_766_p
  328. #mental illness (mi)
  329. #Life Events Family member had mental/emotional problem?Y,P ple_mh_p/ple_mh_y (ple_mh_p_yr2/ple_mh_y_yr2)
  330. #Adult Self-Report Total Problems ASR Syndrome Scale (t-score)P asr_scr_totprob_t_ace (1=greater than t-score>=64)
  331. #No Fam Hx at Y2
  332. #create dataframe with mental illness items
  333. mi_yr2_data = c("ple_mh_p", "ple_mh_y", "asr_scr_totprob_t_ace")
  334. #sum the items as long as they're not all NA
  335. ela_in_abcd_yr2$mi_sum = apply(ela_in_abcd_yr2[mi_yr2_data],1, sum_score)
  336. #binary recode as anything > 0 is 1
  337. ela_in_abcd_yr2$mi_yr2 = ifelse(ela_in_abcd_yr2$mi_sum == 0, 0, 1)
  338. #Incarcerated Relative
  339. #Life Events Someone in the family was arrested?Y,P ple_arrest_p/ple_arrest_y (ple_arrest_p_yr2/ple_arrest_y_yr2)
  340. #Life Events Parents/caregiver got into trouble with the law?Y,P ple_law_p/ple_law_y (ple_law_p_yr2/ple_law_y_yr2)
  341. #Life Events One of the parents/caregivers went to jail?Y,P ple_jail_p/ple_jail_y (ple_jail_p_yr2/ple_jail_y_yr2)
  342. #create dataframe with incarceration items
  343. incar_yr2_data = c("ple_arrest_p" , "ple_arrest_y" , "ple_law_p", "ple_law_y", "ple_jail_p", "ple_jail_y")
  344. #sum the items as long as they're not all NA
  345. ela_in_abcd_yr2$incar_sum = apply(ela_in_abcd_yr2[incar_yr2_data],1, sum_score)
  346. #binary recode as anything > 0 is 1
  347. ela_in_abcd_yr2$incar_yr2 = ifelse(ela_in_abcd_yr2$incar_sum == 0, 0, 1)
  348. #Substance Use
  349. #Life Events Family member had drug and/or alcohol problem?Y,P ple_sud_p/ple_sud_y (ple_sud_p_yr2/ple_sud_y_yr2)
  350. #Adult Self-Report I use drugs (other than alcohol, nicotine) for nonmedical purposesP asr_q06_p_ace
  351. #No Fam Hx update at Y2
  352. #create dataframe with substance use items
  353. su_yr2_data = c("ple_sud_p","ple_sud_y","asr_q06_p_ace")
  354. #sum the items as long as they're not all NA
  355. ela_in_abcd_yr2$su_sum = apply(ela_in_abcd_yr2[su_yr2_data],1, sum_score)
  356. #binary recode as anything > 0 is 1
  357. ela_in_abcd_yr2$su_yr2 = ifelse(ela_in_abcd_yr2$su_sum == 0, 0, 1)
  358. #Exposure
  359. #Witnessed or caught in a fire that caused significant property damage or personal injuryP ksads_ptsd_raw_756_p
  360. #Witnessed or caught in a natural disaster that caused significant property damage or personal injuryP ksads_ptsd_raw_757_p
  361. #Witnessed or present during an act of terrorism (e.g., Boston marathon bombing)P ksads_ptsd_raw_758_p
  362. #Witnessed death or mass destruction in a war zoneP ksads_ptsd_raw_759_p
  363. #Witnessed someone shot or stabbed in the community ksads_ptsd_raw_760_p
  364. #0 = No; 1 = Yes
  365. #create dataframe with exposure items
  366. exposure_yr2_data = c("ksads_ptsd_raw_756_p" , "ksads_ptsd_raw_757_p", "ksads_ptsd_raw_758_p", "ksads_ptsd_raw_759_p", "ksads_ptsd_raw_760_p")
  367. #sum the items as long as they're not all NA
  368. ela_in_abcd_yr2$exposure_sum = apply(ela_in_abcd_yr2[exposure_yr2_data],1, sum_score)
  369. #binary recode as anything > 0 is 1
  370. ela_in_abcd_yr2$exposure_yr2 = ifelse(ela_in_abcd_yr2$exposure_sum == 0, 0, 1)
  371. #Safety
  372. #Life Events Was a victim of crime/violence/assault? ple_victim_p/ple_victim_y (ple_victim_p_bs/ple_victim_y_bs)
  373. #*My neighborhood is safe from crime. neighborhood3r_p_ace/nbh_crime_y_ela
  374. #Violence is not a problem in my neighborhood. neighborhood2r_p_ace
  375. #recoded in setup: 4/5=0, 3/2/1=1
  376. #create dataframe with safety items
  377. safety_sum_yr2_data = c("neighborhood2r_p_ela","neighborhood3r_p_ela","nbh_crime_y_ela", "ple_victim_p", "ple_victim_y")
  378. #sum the items as long as they're not all NA
  379. ela_in_abcd_yr2$safety_sum = apply(ela_in_abcd_yr2[safety_sum_yr2_data],1, sum_score)
  380. #binary recode as anything > 0 is 1
  381. ela_in_abcd_yr2$safety_yr2 = ifelse(ela_in_abcd_yr2$safety_sum == 0, 0, 1)
  382. #Resources
  383. #Were without telephone service because you could not afford it? demo_fam_exp2_v2
  384. #Didn't pay the full amount of the rent or mortgage because you could not afford it? demo_fam_exp3_v2
  385. #Were evicted from your home for not paying the rent or mortgage? demo_fam_exp4_v2
  386. #Had services turned off by the gas or electric company, or the oil company wouldn't deliver oil because payments were not made? demo_fam_exp5_v2
  387. #create dataframe with resources items
  388. resources_yr2_data = c("demo_fam_exp2_v2_l" , "demo_fam_exp3_v2_l", "demo_fam_exp4_v2_l", "demo_fam_exp5_v2_l")
  389. #sum the items as long as they're not all NA
  390. ela_in_abcd_yr2$resources_sum = apply(ela_in_abcd_yr2[resources_yr2_data],1, sum_score)
  391. #binary recode as anything > 0 is 1
  392. ela_in_abcd_yr2$resources_yr2 = ifelse(ela_in_abcd_yr2$resources_sum == 0, 0, 1)
  393. #Separation
  394. #not collected until year 3/4
  395. #Placed in foster care? ple_foster_care_p/ple_foster_care_y
  396. #One of the parents/caregivers was deported? ple_deported_p/ple_deported_y
  397. ```
  398. ```{r ela-plus-yr3}
  399. #yr 3
  400. #abuse_phy
  401. #cannot be calculated at Year 1 due to no KSADS
  402. #domain score will be equal to that at Baseline
  403. #abuse_sex
  404. #cannot be calculated at Year 1 due to no KSADS
  405. #domain score will be equal to that at Baseline
  406. #abuse_emo
  407. #Family Environment Family members often criticize each other. fes_youth_q5
  408. #utilizing youth only to ensure youth exposure
  409. ela_in_abcd_yr3$abuse_emo_yr3 = ela_in_abcd_yr3$fes_youth_q5
  410. #neglect_phy
  411. #Demographics Needed food but couldn't afford to buy it or couldn't afford to go out to get it? demo_fam_exp1_v2_l/demo_fam_exp1_v2
  412. #Demographics Had someone who needed to see a doctor or go to the hospital but didn't go because you could not afford it? demo_fam_exp6_v2/demo_fam_exp6_v2_l
  413. #Demographics Had someone who needed a dentist but couldn't go because you could not afford it? demo_fam_exp7_v2/demo_fam_exp7_v2_l
  414. #create dataframe with physical neglect items
  415. neglect_phy_sum_yr3_data = c("demo_fam_exp1_v2_l", "demo_fam_exp6_v2_l", "demo_fam_exp7_v2_l")
  416. #sum the items as long as they're not all NA
  417. ela_in_abcd_yr3$neglect_phy_sum = apply(ela_in_abcd_yr3[neglect_phy_sum_yr3_data],1, sum_score)
  418. #binary recode as anything > 0 is 1
  419. ela_in_abcd_yr3$neglect_phy_yr3 = ifelse(ela_in_abcd_yr3$neglect_phy_sum == 0, 0, 1)
  420. #neglect_emo
  421. #CRPBI parent *CRPBI Mean Parent (primary caregiver)Y crpbi_y_ss_parent_ace
  422. ela_in_abcd_yr3$neglect_emo_yr3 = ela_in_abcd_yr3$crpbi_y_ss_parent_ace
  423. #divorce
  424. #create dataframe with divorce items
  425. divorce_yr3_data = c("ple_separ_p" , "ple_separ_y")
  426. #sum the items as long as they're not all NA
  427. ela_in_abcd_yr3$divorce_sum = apply(ela_in_abcd_yr3[divorce_yr3_data],1, sum_score)
  428. #binary recode as anything > 0 is 1
  429. ela_in_abcd_yr3$divorce_yr3 = ifelse(ela_in_abcd_yr3$divorce_sum == 0, 0, 1)
  430. #violence in home (violence)
  431. #cannot be calculated at Year 3 due to no KSADS
  432. #domain score will be equal to that at Year 2
  433. #mental illness (mi)
  434. #Life Events Family member had mental/emotional problem? ple_mh_p/ple_mh_y
  435. #create dataframe with mi items
  436. mi_sum_yr3_data = c("ple_mh_p", "ple_mh_y")
  437. #sum the items as long as they're not all NA
  438. ela_in_abcd_yr3$mi_sum = apply(ela_in_abcd_yr3[mi_sum_yr3_data],1, sum_score)
  439. #binary recode as anything > 0 is 1
  440. ela_in_abcd_yr3$mi_yr3 = ifelse(ela_in_abcd_yr3$mi_sum == 0, 0, 1)
  441. #Incarcerated Relative
  442. #Life Events Someone in the family was arrested?Y,P ple_arrest_p/ple_arrest_y
  443. #Life Events Parents/caregiver got into trouble with the law?Y,P ple_law_p/ple_law_y
  444. #Life Events One of the parents/caregivers went to jail?Y,P ple_jail_p/ple_jail_y
  445. #create dataframe with incarceration items
  446. incar_sum_yr3_data = c("ple_arrest_p" , "ple_arrest_y" , "ple_law_p" , "ple_law_y" , "ple_jail_y" , "ple_jail_p")
  447. #sum the items as long as they're not all NA
  448. ela_in_abcd_yr3$incar_sum = apply(ela_in_abcd_yr3[incar_sum_yr3_data],1, sum_score)
  449. #binary recode as anything > 0 is 1
  450. ela_in_abcd_yr3$incar_yr3 = ifelse(ela_in_abcd_yr3$incar_sum == 0, 0, 1)
  451. #Substance Use
  452. #Life Events Family member had drug and/or alcohol problem? ple_sud_p/ple_sud_y
  453. #No ASR or Fam Hx at Y3
  454. #create dataframe with incarceration items
  455. su_sum_yr3_data = c("ple_sud_p","ple_sud_y")
  456. #create dataframe with substance use items
  457. ela_in_abcd_yr3$su_sum = apply(ela_in_abcd_yr3[su_sum_yr3_data],1, sum_score)
  458. #binary recode as anything > 0 is 1
  459. ela_in_abcd_yr3$su_yr3 = ifelse(ela_in_abcd_yr3$su_sum == 0, 0, 1)
  460. #Exposure
  461. #cannot be calculated at Year 3 due to no KSADS
  462. #domain score will be equal to that at Year 2
  463. #Safety
  464. #Life Events Was a victim of crime/violence/assault? ple_victim_p/ple_victim_y
  465. #*My neighborhood is safe from crime. neighborhood3r_p_ace/nbh_crime_y_ela
  466. #Violence is not a problem in my neighborhood. neighborhood2r_p_ace
  467. #recoded in setup: 4/5=0, 3/2/1=1
  468. #create dataframe with safety items
  469. safety_sum_yr3_data = c("neighborhood2r_p_ela","neighborhood3r_p_ela","nbh_crime_y_ela", "ple_victim_p", "ple_victim_y")
  470. #sum the items as long as they're not all NA
  471. ela_in_abcd_yr3$safety_sum = apply(ela_in_abcd_yr3[safety_sum_yr3_data],1, sum_score)
  472. #binary recode as anything > 0 is 1
  473. ela_in_abcd_yr3$safety_yr3 = ifelse(ela_in_abcd_yr3$safety_sum == 0, 0, 1)
  474. #Resources
  475. #Were without telephone service because you could not afford it? demo_fam_exp2_v2
  476. #Didn't pay the full amount of the rent or mortgage because you could not afford it? demo_fam_exp3_v2
  477. #Were evicted from your home for not paying the rent or mortgage? demo_fam_exp4_v2
  478. #Had services turned off by the gas or electric company, or the oil company wouldn't deliver oil because payments were not made? demo_fam_exp5_v2
  479. #create dataframe with resources items
  480. resources_yr3_data = c("demo_fam_exp2_v2_l" , "demo_fam_exp3_v2_l", "demo_fam_exp4_v2_l", "demo_fam_exp5_v2_l")
  481. #sum the items as long as they're not all NA
  482. ela_in_abcd_yr3$resources_sum = apply(ela_in_abcd_yr3[resources_yr3_data],1, sum_score)
  483. #binary recode as anything > 0 is 1
  484. ela_in_abcd_yr3$resources_yr3 = ifelse(ela_in_abcd_yr3$resources_sum == 0, 0, 1)
  485. ##New domain for Y3 - parents deported/foster care
  486. #create dateframe with separation items
  487. sep_yr3_data = c("ple_foster_care_p","ple_foster_care_y","ple_deported_p","ple_deported_y")
  488. #sum the items as long as they're not all NA
  489. ela_in_abcd_yr3$sep_sum = apply(ela_in_abcd_yr3[sep_yr3_data],1, sum_score)
  490. #binary recode as anything > 0 is 1
  491. ela_in_abcd_yr3$sep_yr3 = ifelse(ela_in_abcd_yr3$sep_sum == 0, 0, 1)
  492. ```
  493. ```{r ela-longitudinal}
  494. ##LONGITUDINAL SCORE CREATION
  495. #join annual scores to Baseline
  496. #pulling just scores, no eventnames (wide format)
  497. bs_scores = ela_in_abcd_bs[c("src_subject_id", "ela_plus_bs", "abuse_phy_bs", "abuse_sex_bs", "abuse_emo_bs", "neglect_phy_bs", "neglect_emo_bs", "divorce_bs", "violence_bs", "mi_bs", "incar_bs", "su_bs","exposure_bs", "safety_bs", "resources_bs")]
  498. yr1_scores = ela_in_abcd_yr1[c("src_subject_id", "abuse_emo_yr1", "neglect_phy_yr1", "neglect_emo_yr1", "divorce_yr1", "mi_yr1", "incar_yr1", "su_yr1","safety_yr1","resources_yr1")]
  499. yr2_scores = ela_in_abcd_yr2[c("src_subject_id", "abuse_phy_yr2", "abuse_sex_yr2", "abuse_emo_yr2", "neglect_phy_yr2", "divorce_yr2", "violence_yr2", "mi_yr2", "incar_yr2", "su_yr2","exposure_yr2", "safety_yr2", "resources_yr2")]
  500. yr3_scores = ela_in_abcd_yr3[c("src_subject_id", "abuse_emo_yr3", "neglect_phy_yr3", "neglect_emo_yr3", "divorce_yr3", "mi_yr3", "incar_yr3", "su_yr3","safety_yr3","resources_yr3","sep_yr3")]
  501. step1 = left_join(bs_scores,yr1_scores, by=c("src_subject_id"))
  502. step2 = left_join(step1,yr2_scores, by=c("src_subject_id"))
  503. ela_final = left_join(step2, yr3_scores, by=c("src_subject_id"))
  504. #save bs data
  505. #prep for return to long format
  506. bs_scores[,'fam_sep'] = NA
  507. bs_scores$eventname="baseline_year_1_arm_1"
  508. lookup = c(ela_plus="ela_plus_bs", abuse_phy = "abuse_phy_bs", abuse_sex = "abuse_sex_bs", abuse_emo = "abuse_emo_bs", neglect_phy = "neglect_phy_bs", neglect_emo = "neglect_emo_bs", divorce = "divorce_bs", violence = "violence_bs", mental = "mi_bs", incar = "incar_bs", sud = "su_bs", exposure = "exposure_bs", safety = "safety_bs", resources = "resources_bs")
  509. bs_scores=rename(bs_scores, all_of(lookup))
  510. #building score - adding items by timepoint
  511. #for each domain, if current and any/all previous timepoints 0, will be 0; otherwise, 1
  512. #yr1 by domain
  513. ela_final$abuse_phy_yr1_build = ifelse(ela_final$abuse_phy_bs == 0, 0, 1)
  514. ela_final$abuse_sex_yr1_build = ifelse(ela_final$abuse_sex_bs == 0, 0, 1)
  515. ela_final$abuse_emo_yr1_build = ifelse(ela_final$abuse_emo_bs == 0 & ela_final$abuse_emo_yr1 == 0, 0, 1)
  516. ela_final$neglect_phy_yr1_build = ifelse(ela_final$neglect_phy_bs == 0 & ela_final$neglect_phy_yr1 == 0, 0, 1)
  517. ela_final$neglect_emo_yr1_build = ifelse(ela_final$neglect_emo_bs == 0 & ela_final$neglect_emo_yr1 == 0, 0, 1)
  518. ela_final$divorce_yr1_build = ifelse(ela_final$divorce_bs == 0 & ela_final$divorce_yr1 == 0, 0, 1)
  519. ela_final$violence_yr1_build = ifelse(ela_final$violence_bs == 0, 0, 1)
  520. ela_final$mi_yr1_build = ifelse(ela_final$mi_bs == 0 & ela_final$mi_yr1 == 0, 0, 1)
  521. ela_final$incar_yr1_build = ifelse(ela_final$incar_bs == 0 & ela_final$incar_yr1 == 0, 0, 1)
  522. ela_final$su_yr1_build = ifelse(ela_final$su_bs == 0 & ela_final$su_yr1 == 0, 0, 1)
  523. ela_final$safety_yr1_build = ifelse(ela_final$safety_bs == 0 & ela_final$safety_yr1 == 0, 0, 1)
  524. ela_final$exposure_yr1_build = ifelse(ela_final$exposure_bs == 0, 0, 1)
  525. ela_final$resources_yr1_build = ifelse(ela_final$resources_bs == 0 & ela_final$resources_yr1 == 0, 0, 1)
  526. #yr1 sum score
  527. ela_final$ela_plus_yr1 = ela_final$abuse_phy_yr1_build + ela_final$abuse_sex_yr1_build + ela_final$abuse_emo_yr1_build + ela_final$neglect_phy_yr1_build + ela_final$neglect_emo_yr1_build + ela_final$divorce_yr1_build + ela_final$violence_yr1_build + ela_final$mi_yr1_build + ela_final$incar_yr1_build + ela_final$su_yr1_build + ela_final$safety_yr1_build + ela_final$exposure_yr1_build + ela_final$resources_yr1_build
  528. #save yr1 data
  529. yr1_scores_final = ela_final[c("src_subject_id", "ela_plus_yr1", "abuse_phy_yr1_build", "abuse_sex_yr1_build", "abuse_emo_yr1_build", "neglect_phy_yr1_build", "neglect_emo_yr1_build", "divorce_yr1_build", "violence_yr1_build", "mi_yr1_build", "incar_yr1_build", "su_yr1_build", "exposure_yr1_build", "safety_yr1_build", "resources_yr1_build")]
  530. #prep for return to long format
  531. #empty column for family separation
  532. yr1_scores_final[,'fam_sep'] = NA
  533. yr1_scores_final$eventname="1_year_follow_up_y_arm_1"
  534. lookup = c(ela_plus = "ela_plus_yr1", abuse_phy = "abuse_phy_yr1_build", abuse_sex = "abuse_sex_yr1_build", abuse_emo = "abuse_emo_yr1_build", neglect_phy = "neglect_phy_yr1_build", neglect_emo = "neglect_emo_yr1_build", divorce = "divorce_yr1_build", violence = "violence_yr1_build", mental = "mi_yr1_build", incar = "incar_yr1_build", sud = "su_yr1_build", exposure = "exposure_yr1_build", safety = "safety_yr1_build", resources = "resources_yr1_build")
  535. yr1_scores_final=rename(yr1_scores_final, all_of(lookup))
  536. #yr2 by domain
  537. ela_final$abuse_phy_yr2_build = ifelse(ela_final$abuse_phy_bs == 0 & ela_final$abuse_phy_yr2 == 0, 0, 1)
  538. ela_final$abuse_sex_yr2_build = ifelse(ela_final$abuse_sex_bs == 0 & ela_final$abuse_sex_yr2 == 0, 0, 1)
  539. ela_final$abuse_emo_yr2_build = ifelse(ela_final$abuse_emo_bs == 0 & ela_final$abuse_emo_yr1 == 0 & ela_final$abuse_emo_yr2 == 0, 0, 1)
  540. ela_final$neglect_phy_yr2_build = ifelse(ela_final$neglect_phy_bs == 0 & ela_final$neglect_phy_yr1 == 0 & ela_final$neglect_phy_yr2 == 0, 0, 1)
  541. ela_final$neglect_emo_yr2_build = ela_final$neglect_emo_yr1_build
  542. ela_final$divorce_yr2_build = ifelse(ela_final$divorce_bs == 0 & ela_final$divorce_yr1 == 0 & ela_final$divorce_yr2 == 0, 0, 1)
  543. ela_final$violence_yr2_build = ifelse(ela_final$violence_bs == 0 & ela_final$violence_yr2 == 0, 0, 1)
  544. ela_final$mi_yr2_build = ifelse(ela_final$mi_bs == 0 & ela_final$mi_yr1 == 0 & ela_final$mi_yr2 == 0, 0, 1)
  545. ela_final$incar_yr2_build = ifelse(ela_final$incar_bs == 0 & ela_final$incar_yr1 == 0 & ela_final$incar_yr2 == 0, 0, 1)
  546. ela_final$su_yr2_build = ifelse(ela_final$su_bs == 0 & ela_final$su_yr1 == 0 & ela_final$su_yr2 == 0, 0, 1)
  547. ela_final$exposure_yr2_build = ifelse(ela_final$exposure_bs == 0 & ela_final$exposure_yr2 == 0, 0, 1)
  548. ela_final$safety_yr2_build = ifelse(ela_final$safety_bs == 0 & ela_final$safety_yr1 ==0 & ela_final$safety_yr2 == 0, 0, 1)
  549. ela_final$resources_yr2_build = ifelse(ela_final$resources_bs == 0 & ela_final$resources_yr1 ==0 & ela_final$resources_yr2 == 0, 0, 1)
  550. #yr2 sum score
  551. ela_final$ela_plus_yr2 = ela_final$abuse_phy_yr2_build + ela_final$abuse_sex_yr2_build + ela_final$abuse_emo_yr2_build + ela_final$neglect_phy_yr2_build + ela_final$neglect_emo_yr2_build + ela_final$divorce_yr2_build + ela_final$violence_yr2_build + ela_final$mi_yr2_build + ela_final$incar_yr2_build + ela_final$su_yr2_build + ela_final$exposure_yr2_build + ela_final$safety_yr2_build + ela_final$resources_yr2_build
  552. #save yr2 data
  553. yr2_scores_final = ela_final[c("src_subject_id", "ela_plus_yr2", "abuse_phy_yr2_build", "abuse_sex_yr2_build", "abuse_emo_yr2_build", "neglect_phy_yr2_build", "neglect_emo_yr2_build", "divorce_yr2_build", "violence_yr2_build", "mi_yr2_build", "incar_yr2_build", "su_yr2_build", "exposure_yr2_build", "safety_yr2_build", "resources_yr2_build")]
  554. #prep for return to long format
  555. #empty column for family separation
  556. yr2_scores_final[,'fam_sep'] = NA
  557. yr2_scores_final$eventname="2_year_follow_up_y_arm_1"
  558. lookup = c(ela_plus = "ela_plus_yr2", abuse_phy = "abuse_phy_yr2_build", abuse_sex = "abuse_sex_yr2_build", abuse_emo = "abuse_emo_yr2_build", neglect_phy = "neglect_phy_yr2_build", neglect_emo = "neglect_emo_yr2_build", divorce = "divorce_yr2_build", violence = "violence_yr2_build", mental = "mi_yr2_build", incar = "incar_yr2_build", sud = "su_yr2_build", exposure = "exposure_yr2_build", safety = "safety_yr2_build", resources = "resources_yr2_build")
  559. yr2_scores_final=rename(yr2_scores_final, all_of(lookup))
  560. #yr3 by domain
  561. ela_final$abuse_phy_yr3_build = ifelse(ela_final$abuse_phy_bs == 0 & ela_final$abuse_phy_yr2 == 0, 0, 1)
  562. ela_final$abuse_sex_yr3_build = ifelse(ela_final$abuse_sex_bs == 0 & ela_final$abuse_sex_yr2 == 0, 0, 1)
  563. ela_final$abuse_emo_yr3_build = ifelse(ela_final$abuse_emo_bs == 0 & ela_final$abuse_emo_yr1 == 0 & ela_final$abuse_emo_yr2 == 0 & ela_final$abuse_emo_yr3 == 0, 0, 1)
  564. ela_final$neglect_phy_yr3_build = ifelse(ela_final$neglect_phy_bs == 0 & ela_final$neglect_phy_yr1 == 0 & ela_final$neglect_phy_yr2 == 0 & ela_final$neglect_phy_yr3 == 0, 0, 1)
  565. ela_final$neglect_emo_yr3_build = ifelse(ela_final$neglect_emo_bs == 0 & ela_final$neglect_emo_yr1 == 0 & ela_final$neglect_emo_yr3 == 0, 0, 1)
  566. ela_final$divorce_yr3_build = ifelse(ela_final$divorce_bs == 0 & ela_final$divorce_yr1 == 0 & ela_final$divorce_yr2 == 0 & ela_final$divorce_yr3 == 0, 0, 1)
  567. ela_final$mi_yr3_build = ifelse(ela_final$mi_bs == 0 & ela_final$mi_yr1 == 0 & ela_final$mi_yr2 == 0 & ela_final$mi_yr3 == 0, 0, 1)
  568. ela_final$incar_yr3_build = ifelse(ela_final$incar_bs == 0 & ela_final$incar_yr1 == 0 & ela_final$incar_yr2 == 0 & ela_final$incar_yr3 == 0, 0, 1)
  569. ela_final$su_yr3_build = ifelse(ela_final$su_bs == 0 & ela_final$su_yr1 == 0 & ela_final$su_yr2 == 0 & ela_final$su_yr3 == 0, 0, 1)
  570. ela_final$violence_yr3_build = ifelse(ela_final$violence_bs == 0 & ela_final$violence_yr2 == 0, 0, 1)
  571. ela_final$exposure_yr3_build = ifelse(ela_final$exposure_bs == 0 & ela_final$exposure_yr2 == 0, 0, 1)
  572. ela_final$safety_yr3_build = ifelse(ela_final$safety_bs == 0 & ela_final$safety_yr1 == 0 & ela_final$safety_yr2 == 0 & ela_final$safety_yr3 == 0, 0, 1)
  573. ela_final$resources_yr3_build = ifelse(ela_final$resources_bs == 0 & ela_final$resources_yr1 == 0 & ela_final$resources_yr2 == 0 & ela_final$resources_yr3 == 0, 0, 1)
  574. #yr3 sum score
  575. ela_final$ela_plus_yr3 = ela_final$abuse_phy_yr3_build + ela_final$abuse_sex_yr3_build + ela_final$abuse_emo_yr3_build + ela_final$neglect_phy_yr3_build + ela_final$neglect_emo_yr3_build + ela_final$divorce_yr3_build + ela_final$violence_yr3_build + ela_final$mi_yr3_build + ela_final$incar_yr3_build + ela_final$su_yr3_build + ela_final$exposure_yr3_build + ela_final$safety_yr3_build + ela_final$resources_yr3_build + ela_final$sep_yr3
  576. #save yr3 data
  577. yr3_scores_final = ela_final[c("src_subject_id", "ela_plus_yr3", "abuse_phy_yr3_build", "abuse_sex_yr3_build", "abuse_emo_yr3_build", "neglect_phy_yr3_build", "neglect_emo_yr3_build", "divorce_yr3_build", "violence_yr3_build", "mi_yr3_build", "incar_yr3_build", "su_yr3_build", "exposure_yr3_build", "safety_yr3_build", "resources_yr3_build","sep_yr3")]
  578. #prep for return to long format
  579. #empty column for family separation
  580. yr3_scores_final$eventname="3_year_follow_up_y_arm_1"
  581. lookup = c(ela_plus = "ela_plus_yr3", abuse_phy = "abuse_phy_yr3_build", abuse_sex = "abuse_sex_yr3_build", abuse_emo = "abuse_emo_yr3_build", neglect_phy = "neglect_phy_yr3_build", neglect_emo = "neglect_emo_yr3_build", divorce = "divorce_yr3_build", violence = "violence_yr3_build", mental = "mi_yr3_build", incar = "incar_yr3_build", sud = "su_yr3_build", exposure = "exposure_yr3_build", safety = "safety_yr3_build", resources = "resources_yr3_build", fam_sep = "sep_yr3")
  582. yr3_scores_final=rename(yr3_scores_final, all_of(lookup))
  583. #combine datasets
  584. step1 = rbind(bs_scores,yr1_scores_final)
  585. step2 = rbind(step1,yr2_scores_final)
  586. ela_plus_scores = rbind(step2,yr3_scores_final)
  587. #save with eventnames
  588. write.csv(ela_plus_scores, "ela_plus_abcd.csv")
  589. ```

ELAfromABCD_ELAplus.Rmd at commit dc8616b, under MIT · at the source

Overview

Authors: Alexis Brieant1, Natasha Chaku2, Dani Beck3, Niamh MacSweeney3,4, Divyangana Rakesh5, Christian K. Tamnes3,4
ORCID iDs: Alexis Brieant
  1. Department of Psychological Science, University of Vermont, Burlington, VT, USA
  2. Department of Psychological and Brain Sciences, Indiana University, Bloomington, IN, USA
  3. PROMENTA Research Center, Department of Psychology, University of Oslo, Oslo, Norway
  4. Division of Mental Health and Substance Abuse, Diakonhjemmet Hospital, Oslo, Norway
  5. Department of Neuroimaging, Institute of Psychology, Psychiatry and Neuroscience, King’s College London, London, UK
Institutions: University of Vermont (United States); Indiana University Bloomington (United States); Indiana University (United States); University of Oslo (Norway); Diakonhjemmet Hospital (Norway); King's College London (United Kingdom)
Journal: Developmental cognitive neuroscience, volume 79, article 101738
Dates: received 1 July 2025; accepted 4 May 2026; published online 7 May 2026; in print June 2026
Type: Research article · Language: English
License: CC BY-NC
Identifiers: DOI 10.1016/j.dcn.2026.101738 · PMID 42127658 · PMCID PMC13196395 · OpenAlex W4411977089
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: structural MRI / diffusion (modality), human (organism), developmental (subfield)
Methods: Statistics
Keywords: Adolescence, Adversity, Working memory, Puberty, Longitudinal, Neurodevelopment
MeSH: Adolescent Development*, Brain*, Memory, Short-Term*, Neurodevelopment*, Puberty*, Stress, Psychological*, Adolescent, Female, Gray Matter, Humans, Longitudinal Studies, Magnetic Resonance Imaging, Male (* major topic)
Journal subjects: Registered Report
Topic: Pregnancy-related medical research (Public Health, Environmental and Occupational Health, Medicine), according to OpenAlex
Funding: Brain & Behaviour Research Foundation (32908); New Investigator Research Grant; UKRI Medical Research Council (MR/Z506667/1); Norges Forskningsråd (288083, 323951); Helse Sør‐Øst RHF (2021070, 2023012, 500189); Livsvitenskap, Universitetet i Oslo
Citations: cited by 1 paper (Europe PMC); 113 references in the paper

Abstract

Stress exposure may influence the pace of pubertal and brain development; however, empirical findings are mixed, with evidence for both acceleration and deceleration. We used seven waves of data from the Adolescent Brain Cognitive Development (ABCD) Study (n = 5041) to examine associations between adversity and pubertal and structural brain development, as well as working memory. We hypothesized that higher adversity would predict more advanced puberty and brain structure at baseline, which would in turn be associated with better working memory performance. Pubertal timing and tempo was modeled using logistic growth curves, while subcortical and cortical gray matter volume (GMV) intercepts and slopes were estimated using latent growth curve models. We estimated effects separately for males and females. Earlier pubertal timing was associated with accelerated brain maturation, and adversity was associated with earlier pubertal timing (girls only), faster tempo, and differences in brain structure at baseline; adversity was also associated with lower working memory performance. There were significant indirect effects of higher adversity on lower working memory performance via lower initial GMV and slower pubertal tempo. These results demonstrate how adversity is linked to variation in the timing of brain development across multiple structural metrics.

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

Repositories

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

FERNLabUVM/pubertybrain

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 708dd4ac062c1416ad39fd421f9d683e28f481f2, 16 June 2026
Languages: Stata (7), R (6), SAS (4)
Size: 140 files, 17 scripts
Software Heritage: not archived
Found in: the text, “Method”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (6 files), ggplot2 (3 files), nlme (2 files), patchwork (2 files), cowplot (1 file), ggpubr (1 file), lme4 (1 file), psych (1 file), reshape2 (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
18 files, not copied: shown from their source

OSCR keeps no copy of these files: this repository has no license that allows it. The reader above shows each one from its source, fetched by your browser at commit 708dd4a, when its fingerprint is the one OSCR verified. How this works.

karalk07/abcd-ela

License: MIT
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: dc8616b9d26bddbe4266e66dae8bd351afef5fac, 22 May 2025
Languages: R (4)
Size: 6 files, 4 scripts
Software Heritage: not archived
Found in: the text, “Adversity exposure”
Holds: README, license file, 4 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (4 files)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
6 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:

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

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

Data

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

Data availability

Data are available to investigators with an active data use agreement for the Adolescent Brain Cognitive Development (ABCD) Study

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

Versions

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

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 6 authors, 6 keywords, 13 MeSH terms, 6 funders, 109 references.

Cite

This paper

Brieant, A., Chaku, N., Beck, D., MacSweeney, N., Rakesh, D., & Tamnes, C. K. (2026). Timing and tempo of puberty and neurodevelopment following adversity: A registered report. Developmental cognitive neuroscience, 79, 101738. https://doi.org/10.1016/j.dcn.2026.101738

BibTeX

@article{brieant2026timing,
author = {Brieant, Alexis and Chaku, Natasha and Beck, Dani and MacSweeney, Niamh and Rakesh, Divyangana and Tamnes, Christian K.},
title = {{Timing and tempo of puberty and neurodevelopment following adversity: A registered report}},
journal = {Developmental cognitive neuroscience},
year = {2026},
month = may,
volume = {79},
pages = {101738},
publisher = {Elsevier},
issn = {1878-9293},
doi = {10.1016/j.dcn.2026.101738},
url = {https://doi.org/10.1016/j.dcn.2026.101738},
pmid = {42127658},
pmcid = {PMC13196395}
}

RIS

TY - JOUR
AU - Brieant, Alexis
AU - Chaku, Natasha
AU - Beck, Dani
AU - MacSweeney, Niamh
AU - Rakesh, Divyangana
AU - Tamnes, Christian K.
TI - Timing and tempo of puberty and neurodevelopment following adversity: A registered report
T2 - Developmental cognitive neuroscience
J2 - Dev Cogn Neurosci
PY - 2026
DA - 2026/05/07
VL - 79
SP - 101738
SN - 1878-9293
PB - Elsevier
DO - 10.1016/j.dcn.2026.101738
UR - https://doi.org/10.1016/j.dcn.2026.101738
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.dcn.2026.101738",
"type": "article-journal",
"title": "Timing and tempo of puberty and neurodevelopment following adversity: A registered report",
"container-title": "Developmental cognitive neuroscience",
"author": [
{
"family": "Brieant",
"given": "Alexis"
},
{
"family": "Chaku",
"given": "Natasha"
},
{
"family": "Beck",
"given": "Dani"
},
{
"family": "MacSweeney",
"given": "Niamh"
},
{
"family": "Rakesh",
"given": "Divyangana"
},
{
"family": "Tamnes",
"given": "Christian K."
}
],
"container-title-short": "Dev Cogn Neurosci",
"volume": "79",
"page": "101738",
"DOI": "10.1016/j.dcn.2026.101738",
"PMID": "42127658",
"PMCID": "PMC13196395",
"ISSN": "1878-9293",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.dcn.2026.101738",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
7
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1093/cercor/bhag034 [code]
Individual differences in adolescent cortical development are associated with neighborhood characteristics: Longitudinal findings from the ABCD study.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: psych, cowplot, ggplot2, 1 other tool, developmental, structural MRI / diffusion, 16 references
[2] doi:10.1038/s41398-026-04010-9 [code]
Bullying victimization and brain development: a longitudinal structural magnetic resonance imaging study from adolescence to early adulthood.
Journal: Translational psychiatry
In common: nlme, psych, lme4, 4 other tools, developmental, structural MRI / diffusion, 2 references
[3] doi:10.1111/jcpp.70178 [code]
What makes a lonely child: environmental, health, and multimodal neuroimaging correlates of prospective loneliness in the ABCD study.
Journal: Journal of child psychology and psychiatry, and allied disciplines
In common: lme4, ggpubr, patchwork, 2 other tools, structural MRI / diffusion, 5 references
[4] doi:10.1073/pnas.2606871123 [code]
Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: nlme, psych, lme4, 6 other tools
[5] 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: psych, lme4, reshape2, 3 other tools, developmental, structural MRI / diffusion, 3 references
[6] doi:10.1126/sciadv.aec9291 [code]
Computational mechanisms of perception in autism revealed using games inspired by rodent operant tasks.
Journal: Science advances
In common: nlme, psych, lme4, 5 other tools
[7] doi:10.1038/s41467-026-74565-0 [code]
The functional neurobiology of dispositions towards negative emotions.
Journal: Nature communications
In common: nlme, psych, lme4, 4 other tools, 1 reference
[8] doi:10.1016/j.dcn.2026.101806 [code]
Same ages, different stages: Pubertal development in 9- and 10-year olds is associated with entropy of fMRI signals.
Journal: Developmental cognitive neuroscience
In common: developmental, 7 references
[9] doi:10.1002/jcv2.70135 [code]
Alterations in resting-state functional connectivity relate to psychopathology trajectories during emerging adolescence.
Journal: JCPP advances
In common: psych, lme4, patchwork, 2 other tools, developmental, 3 references
[10] doi:10.1016/j.nicl.2026.104012 [code]
Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.
Journal: NeuroImage. Clinical
In common: nlme, psych, lme4, 4 other tools, structural MRI / diffusion

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.