OSCR

Associations of dementia polyexposure scores to Alzheimer's disease endophenotypes in a diverse population.

Code ↔ Paper

13 matches 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 13 matches
  1. [1] § METHODS › Clinical risk scores › Cognitive Health and Dementia Risk Reduction ↔ workflow/scripts/imputation.qmd, lines 55–114 · score 0.78 · atrial fibrillation, cognitive engagement, social support, insomnia, SD, obesity
  2. [2] § METHODS › Clinical risk scores › Cognitive Health and Dementia Risk Reduction ↔ workflow/scripts/crs_analysis.qmd, lines 77–136 · score 0.77 · atrial fibrillation, cognitive engagement, social support, insomnia, obesity, stroke
  3. [3] § METHODS › Statistical analysis › AD Endophenotypes ↔ workflow/scripts/crs_analysis.qmd, lines 1797–1943 · score 0.69 · cognitive function, plasma biomarkers, CogDrisk, ratio, hippocampal, executive
  4. [4] § RESULTS › Higher clinical risk burden was associated with worsening AD endophenotypes › CogDRisk ↔ workflow/scripts/crs_analysis.qmd, lines 1758–1795 · score 0.68 · cortical thickness, hippocampal volume, verbal ability, executive function, CogDRisk
  5. [5] § METHODS › Health and Aging Brain Study–Health Disparities › Endophenotype standardization ↔ workflow/scripts/crs_standardization.qmd, lines 199–252 · score 0.66 · composite scores, delayed, WMS, Animal, Digit, FAS
  6. [6] § RESULTS › Higher clinical risk burden was associated with worsening AD endophenotypes › mCAIDE ↔ workflow/scripts/crs_analysis.qmd, lines 1758–1795 · score 0.58 · cortical thickness, hippocampal volumes, verbal ability, mCAIDE, race
  7. [7] § METHODS › Health and Aging Brain Study–Health Disparities › Endophenotype standardization ↔ workflow/scripts/crs_standardization.qmd, lines 254–371 · score 0.57 · log transformed, raw, outliers, HABS, Plasma, NfL
  8. [8] § METHODS › Statistical analysis › Prediction of pTau217/Aβ42 amyloid positivity by CRS ↔ workflow/scripts/cutoff_analysis.qmd, lines 25–44 · score 0.57 · optimal cutpoint, Youden, bootstrapping, pTau217, threshold
  9. [9] § METHODS › Clinical risk scores › Lifestyle for Brain Health ↔ workflow/scripts/crs_analysis.qmd, lines 186–256 · score 0.56 · heart diseases, AUDIT, alcohol, renal, physical, RAPA
  10. [10] § METHODS › Clinical risk scores › Lifestyle for Brain Health ↔ workflow/scripts/imputation.qmd, lines 164–233 · score 0.56 · heart diseases, AUDIT, alcohol, renal, physical, RAPA
  11. [11] § METHODS › Statistical analysis › Cognitive impairment ↔ workflow/scripts/crs_analysis.qmd, lines 2227–2312 · score 0.54 · Logistic regression, CogDRisk, squared, Nagelkerke, mCAIDE, MCI
  12. [12] § METHODS › Health and Aging Brain Study–Health Disparities › Endophenotype standardization ↔ workflow/scripts/crs_standardization.qmd, lines 376–438 · score 0.54 · Cortical thickness, entorhinal, fusiform, inferior, Hippocampal, AD
  13. [13] § RESULTS › Higher clinical risk burden was associated with worsening AD endophenotypes › Lifestyle for Brain Health ↔ workflow/scripts/crs_analysis.qmd, lines 1797–1943 · score 0.53 · plasma biomarkers, hyperintensity, population, hippocampal, executive, neuroimaging

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

Quarto · 2,407 lines · 113 KB · MIT · 7 matches

  1. ---
  2. title: "CRS analysis"
  3. author: "Meri Okorie"
  4. date: "2025-12-10"
  5. output: html_document
  6. ---
  7. ### Setup
  8. ```{r}
  9. library(ggplot2)
  10. library(dplyr)
  11. library(tidyr)
  12. library(pROC)
  13. library(PRROC)
  14. library(readr)
  15. library(Metrics)
  16. library(r2redux)
  17. library(ggalluvial)
  18. library(glue)
  19. library(broom)
  20. library(purrr)
  21. library(tidyverse)
  22. library(scales)
  23. library(rcompanion)
  24. library(plotgardener)
  25. library(cowplot)
  26. library(parameters)
  27. library(mice)
  28. library(missForest)
  29. library(rcompanion)
  30. library(forcats)
  31. ```
  32. ### Imputation
  33. ```{r}
  34. #former smoker
  35. data_org$smoke_former = ifelse(data_org$substance_use_smoke_end_age < data_org$age, 1, 0)
  36. data_org$smoke_former[is.na(data_org$smoke_former)] = 0
  37. new_data_cols = c("age", "sex", "id_education", "id_income", "id_language_primary", "bmi", "imh_diabetes", "imh_stroke", "imh_tbi",
  38. "cdx_hypertension", "cdx_depression", "rapa_1_1", "rapa_1_2", "rapa_1_6", "rapa_1_7", "smoke_ever", "smoke_former", "smoke_currently",
  39. "social_support_total", "audit_1", "eGFR", "imh_high_cholesterol", "bw_hdl_chol", "bw_chol_total", "om_bp1_sys", "om_bp2_sys",
  40. "rapa_1_total", "rapa_2_total", "race", "cdr", "hc_insurance_no_insurance", "health_status", "prs_z_prscsx", "PC1", "PC2", "PC3", "PC4")
  41. vars = c("bmi", "imh_diabetes", "imh_tbi", "rapa_1_1", "rapa_1_2", "rapa_1_6", "rapa_1_total", "rapa_2_total",
  42. "rapa_1_7", "smoke_ever", "smoke_currently", "social_support_total", "audit_1",
  43. "eGFR", "bw_hdl_chol", "om_bp1_sys", "om_bp2_sys", "bw_chol_total")
  44. data_for_imp_fixed = data_org %>%
  45. select(all_of(new_data_cols)) %>%
  46. mutate(across(where(is.character), as.factor)) %>%
  47. mutate(across(where(~ is.numeric(.) && n_distinct(., na.rm = TRUE) == 2), ~ as.factor(.))) %>%
  48. as.data.frame()
  49. set.seed(123)
  50. imp_mf = missForest(data_for_imp_fixed, maxiter = 10, ntree = 100)
  51. data_imp = imp_mf$ximp
  52. data_imp_values = imp_mf$ximp
  53. data_imputed = data_org
  54. data_imputed[vars] = data_imp_values[vars]
  55. plot(density(data_org$rapa_2_total, na.rm = T), xlab = "BMI", lwd = 2, col = "black")
  56. lines(density(data_imputed$rapa_2_total), col = "red", lty = 3, lwd = 2)
  57. # CogD
  58. threshold_ss = quantile(data_imputed$social_support_total, 0.15, na.rm = TRUE)
  59. habs_imp = data_imputed %>%
  60. mutate(
  61. bw_chol_total_mmoll = bw_chol_total / 38.67
  62. )
  63. data.cogd_imp = habs_imp %>% # insomnia, fish consumption, atrial fibrillation, and cognitive engagement not measured
  64. mutate(
  65. cogd_age = case_when(
  66. sex == 0 & age < 60 ~ 0,
  67. sex == 0 & age >= 60 & age <= 64 ~ 0,
  68. sex == 0 & age >= 65 & age <= 69 ~ 5,
  69. sex == 0 & age >= 70 & age <= 74 ~ 8,
  70. sex == 0 & age >= 75 & age <= 79 ~ 12,
  71. sex == 0 & age >= 80 & age <= 84 ~ 17,
  72. sex == 0 & age >= 85 & age <= 89 ~ 20,
  73. sex == 0 & age >= 90 ~ 22,
  74. sex == 1 & age < 60 ~ 0,
  75. sex == 1 & age >= 60 & age <= 64 ~ 0,
  76. sex == 1 & age >= 65 & age <= 69 ~ 5,
  77. sex == 1 & age >= 70 & age <= 74 ~ 7,
  78. sex == 1 & age >= 75 & age <= 79 ~ 13,
  79. sex == 1 & age >= 80 & age <= 84 ~ 16,
  80. sex == 1 & age >= 85 & age <= 89 ~ 19,
  81. sex == 1 & age >= 90 ~ 23,
  82. TRUE ~ NA_real_
  83. ),
  84. cogd_edu = case_when(
  85. id_education > 11 ~ 0,
  86. id_education >= 8 & id_education <= 11 ~ 2,
  87. id_education < 8 ~ 4,
  88. TRUE ~ NA_real_
  89. ),
  90. cogd_obesity = case_when( # only assigned for patients under the age of 65
  91. bmi >= 18.5 & bmi <= 25 ~ 0, # normal
  92. bmi > 25 & bmi <= 30 ~ 1, # overweight
  93. bmi < 18.5 ~ 3, # underweight
  94. bmi > 30 ~ 2, # obese
  95. TRUE ~ NA_real_
  96. ),
  97. cogd_chol = case_when(
  98. bw_chol_total_mmoll < 6.5 ~ 0,
  99. bw_chol_total_mmoll >= 6.5 ~ 3,
  100. TRUE ~ NA_real_
  101. ),
  102. cogd_diabetes = case_when(
  103. imh_diabetes == 0 ~ 0,
  104. sex == 0 & imh_diabetes == 1 ~ 2,
  105. sex == 1 & imh_diabetes == 1 ~ 3,
  106. TRUE ~ NA_real_
  107. ),
  108. cogd_stroke = case_when(
  109. imh_stroke == 0 ~ 0,
  110. imh_stroke == 1 ~ 2,
  111. TRUE ~ NA_real_
  112. ),
  113. cogd_tbi = case_when(
  114. imh_tbi == 0 ~ 0,
  115. imh_tbi == 1 ~ 1,
  116. TRUE ~ NA_real_
  117. ),
  118. cogd_hypertension = case_when(
  119. cdx_hypertension == 0 ~ 0,
  120. cdx_hypertension == 1 ~ 1,
  121. TRUE ~ NA_real_
  122. ),
  123. cogd_depression = case_when(
  124. cdx_depression == 0 ~ 0,
  125. cdx_depression == 1 ~ 4,
  126. TRUE ~ NA_real_
  127. ),
  128. cogd_physical = case_when(
  129. rapa_1_6 == 1 | rapa_1_7 == 1 ~ -3,
  130. is.na(rapa_1_6) & is.na(rapa_1_7) ~ NA_real_,
  131. TRUE ~ 0
  132. ),
  133. cogd_smoke = case_when(
  134. smoke_ever == 0 ~ 0,
  135. smoke_former == 0 ~ 0,
  136. smoke_former == 1 ~ 0.2,
  137. smoke_currently == 0 ~ 0,
  138. smoke_currently == 1 ~ 2,
  139. TRUE ~ NA_real_
  140. ),
  141. cogd_social = case_when(
  142. social_support_total >= threshold_ss ~ 2,
  143. social_support_total < threshold_ss ~ 0,
  144. TRUE ~ NA_real_
  145. )
  146. ) %>%
  147. rowwise() %>%
  148. mutate(
  149. # Compute cogd score (else condition) and set it to NA if any variable is NA (if condition)
  150. cogd = if(any(is.na(c(cogd_age, cogd_edu, cogd_obesity, cogd_chol, cogd_diabetes, cogd_stroke, cogd_tbi,
  151. cogd_hypertension, cogd_depression, cogd_physical, cogd_smoke, cogd_social)))) {
  152. NA_real_
  153. } else {
  154. sum(c(cogd_age, cogd_edu, cogd_obesity, cogd_chol, cogd_diabetes, cogd_stroke, cogd_tbi,
  155. cogd_hypertension, cogd_depression, cogd_physical, cogd_smoke, cogd_social), na.rm = TRUE)
  156. }
  157. ) %>%
  158. ungroup()
  159. # mutate(cogd_noedu = ifelse(!is.na(cogd) & !is.na(cogd_edu), cogd - cogd_edu, NA_real_))
  160. # Libra
  161. data.libra_imp = data.cogd_imp %>%
  162. mutate(
  163. libra_obesity = case_when( # only assigned for patients under the age of 65
  164. bmi < 18.5 ~ 0,
  165. bmi >= 18.5 & bmi < 25 ~ 0, # normal
  166. bmi >= 25 & bmi < 30 ~ 1.6, # overweight
  167. bmi >= 30 ~ 1.6, # obese
  168. TRUE ~ NA_real_
  169. ),
  170. libra_chol = case_when(
  171. bw_chol_total_mmoll < 6.5 ~ 0,
  172. bw_chol_total_mmoll >= 6.5 ~ 1.4,
  173. TRUE ~ NA_real_
  174. ),
  175. libra_diabetes = case_when(
  176. imh_diabetes == 0 ~ 0,
  177. imh_diabetes == 1 ~ 1.3,
  178. TRUE ~ NA_real_
  179. ),
  180. libra_hypertension = case_when(
  181. cdx_hypertension == 0 ~ 0,
  182. cdx_hypertension == 1 ~ 1.6,
  183. TRUE ~ NA_real_
  184. ),
  185. libra_depression = case_when(
  186. cdx_depression == 0 ~ 0,
  187. cdx_depression == 1 ~ 2.1,
  188. TRUE ~ NA_real_
  189. ),
  190. libra_physical = case_when( # 0.27% missigness
  191. rapa_1_1 == 1 | rapa_1_2 == 1 ~ 1.1,
  192. is.na(rapa_1_1) & is.na(rapa_1_2) ~ NA_real_,
  193. TRUE ~ 0
  194. ),
  195. libra_smoke = case_when(
  196. smoke_currently == 1 ~ 1.5,
  197. smoke_currently == 0 ~ 0,
  198. TRUE ~ NA_real_
  199. ),
  200. libra_alcohol = case_when(
  201. audit_1 == 3 ~ -1.0,
  202. !is.na(audit_1) ~ 0, # for all other non-missing values
  203. TRUE ~ NA_real_
  204. ),
  205. libra_renal = case_when(
  206. eGFR < 60 ~ 1.1,
  207. eGFR >= 60 ~ 0,
  208. TRUE ~ NA_real_
  209. ),
  210. libra_heart = case_when(
  211. cdp_heart_disease == 1 | imh_stroke == 1 | cdp_myocardial == 1 ~ 1.0,
  212. is.na(cdp_heart_disease) & is.na(imh_stroke) & is.na(cdp_myocardial) ~ NA_real_,
  213. TRUE ~ 0.0
  214. )) %>%
  215. rowwise() %>%
  216. mutate(
  217. libra = if (any(is.na(c_across(c(
  218. libra_obesity, libra_chol, libra_diabetes, libra_hypertension, libra_depression,
  219. libra_physical, libra_smoke, libra_alcohol, libra_renal, libra_heart
  220. ))))) {
  221. NA_real_
  222. } else {
  223. sum(c_across(c(
  224. libra_obesity, libra_chol, libra_diabetes, libra_hypertension, libra_depression,
  225. libra_physical, libra_smoke, libra_alcohol, libra_renal, libra_heart
  226. )))
  227. }
  228. ) %>%
  229. ungroup()
  230. #mCaide
  231. data.libra_imp = data.libra_imp %>%
  232. mutate(rapa_total = rapa_1_total + rapa_2_total)
  233. threshold_rapa = quantile(data.libra_imp$rapa_total, probs = 1/3, na.rm = TRUE)
  234. data.libra_imp$om_bp_sys_avg = (data.libra_imp$om_bp1_sys + data.libra_imp$om_bp2_sys) / 2
  235. data.caide_imp = data.libra_imp %>%
  236. mutate(
  237. mcaide_age = case_when(
  238. age <= 64 ~ 0,
  239. age >= 65 & age < 73 ~ 1,
  240. age >= 73 ~ 2,
  241. TRUE ~ NA_real_
  242. ),
  243. mcaide_educ = case_when(
  244. id_education < 12 ~ 2,
  245. id_education >= 12 & id_education <= 16 ~ 1,
  246. id_education > 16 ~ 0,
  247. TRUE ~ NA_real_
  248. ),
  249. mcaide_sex = case_when(
  250. sex == 0 ~ 1,
  251. sex == 1 ~ 0,
  252. TRUE ~ NA_real_
  253. ),
  254. mcaide_bmi = case_when(
  255. bmi <= 30 ~ 0,
  256. bmi > 30 ~ 2,
  257. TRUE ~ NA_real_
  258. ),
  259. mcaide_sbp = case_when(
  260. om_bp_sys_avg < 140 ~ 0,
  261. om_bp_sys_avg >= 140 ~ 2,
  262. TRUE ~ NA_real_
  263. ),
  264. mcaide_chol = case_when(
  265. imh_high_cholesterol == 0 ~ 0,
  266. imh_high_cholesterol == 1 ~ 2,
  267. TRUE ~ NA_real_
  268. ),
  269. mcaide_phy = case_when(
  270. rapa_total < threshold_rapa ~ 2,
  271. rapa_total >= threshold_rapa ~ 0,
  272. TRUE ~ NA_real_
  273. ),
  274. ) %>%
  275. rowwise() %>%
  276. mutate(
  277. mcaide = if(any(is.na(c(mcaide_age, mcaide_educ, mcaide_sex, mcaide_bmi, mcaide_sbp, mcaide_chol, mcaide_phy)))) {
  278. NA_real_
  279. } else {
  280. sum(c(mcaide_age, mcaide_educ, mcaide_sex, mcaide_bmi, mcaide_sbp, mcaide_chol, mcaide_phy), na.rm = TRUE)
  281. }
  282. ) %>%
  283. ungroup()
  284. # WHICAP
  285. data_all_imp = data.caide_imp %>%
  286. mutate(
  287. whicap_sex = case_when(
  288. sex == 0 ~ 0,
  289. sex == 1 ~ 1,
  290. TRUE ~ NA_real_
  291. ),
  292. whicap_age = case_when(
  293. age <= 70 ~ 0,
  294. age > 70 & age <= 75 ~ 6,
  295. age > 75 & age <= 80 ~ 8,
  296. age > 80 & age <= 85 ~ 13,
  297. age > 85 ~ 21,
  298. TRUE ~ NA_real_
  299. ),
  300. whichap_diabetes = case_when(
  301. cdx_diabetes == 0 ~ 0,
  302. cdx_diabetes ==1 ~ 3,
  303. TRUE ~ NA_real_
  304. ),
  305. whicap_hypertension = case_when(
  306. cdx_hypertension == 0 ~ 0,
  307. cdx_hypertension == 1 ~ 1,
  308. TRUE ~ NA_real_
  309. ),
  310. whicap_smoker = case_when(
  311. smoke_currently == 0 ~ 0,
  312. smoke_currently == 1 ~ 5,
  313. TRUE ~ NA_real_
  314. ),
  315. whicap_cholesterol = case_when(
  316. sex == 1 & bw_hdl_chol < 50 ~ 3,
  317. sex == 1 & bw_hdl_chol >= 50 ~ 0,
  318. sex == 0 & bw_hdl_chol < 40 ~ 3,
  319. sex == 0 & bw_hdl_chol >= 40 ~ 0,
  320. TRUE ~ NA_real_
  321. ),
  322. whicap_bmi = case_when(
  323. bmi > 25 ~ 7,
  324. bmi <= 25 ~ 0,
  325. TRUE ~ NA_real_
  326. ),
  327. whicap_edu = case_when(
  328. id_education > 9 ~ 0,
  329. id_education >= 7 & id_education <= 9 ~ 8,
  330. id_education <= 6 ~ 11,
  331. TRUE ~ NA_real_
  332. ),
  333. whicap_race = case_when(
  334. race == "NHW" ~ 0,
  335. race == "Hispanic" ~ 4,
  336. race == "Black" ~ 5,
  337. TRUE ~ NA_real_
  338. )) %>%
  339. rowwise() %>%
  340. mutate(
  341. whicap = if(any(is.na(c(whicap_sex, whicap_age, whichap_diabetes, whicap_hypertension, whicap_smoker,
  342. whicap_cholesterol, whicap_bmi, whicap_edu, whicap_race)))) {
  343. NA_real_
  344. } else {
  345. sum(c(whicap_sex, whicap_age, whichap_diabetes, whicap_hypertension, whicap_smoker,
  346. whicap_cholesterol, whicap_bmi, whicap_edu, whicap_race), na.rm = TRUE)
  347. }
  348. ) %>%
  349. ungroup()
  350. ```
  351. ```{r}
  352. dat = data_all_imp %>%
  353. as.data.frame() %>%
  354. mutate(
  355. cdx_cn_vs_ci = case_when(
  356. cdx_cog == 0 ~ 1,
  357. cdx_cog %in% c(1, 2) ~ 0
  358. ),
  359. cdx_mci_vs_cn = case_when(
  360. cdx_cog == 0 ~ 0,
  361. cdx_cog == 1 ~ 1,
  362. TRUE ~ NA # drop dementia
  363. ),
  364. cdx_dem_vs_cn = case_when(
  365. cdx_cog == 0 ~ 0,
  366. cdx_cog == 2 ~ 1,
  367. TRUE ~ NA # drop MCI
  368. ),
  369. cdx_ci_vs_cn = case_when(
  370. cdx_cog == 0 ~ 0,
  371. cdx_cog %in% c(1, 2) ~ 1, # MCI + dementia
  372. TRUE ~ NA
  373. )
  374. )
  375. data = dat %>%
  376. rowwise() %>%
  377. mutate(
  378. cogd_sva = if (any(is.na(c_across(c(
  379. cogd_obesity, cogd_chol, cogd_diabetes, cogd_stroke, cogd_tbi, cogd_hypertension, cogd_depression, cogd_physical, cogd_smoke, cogd_social
  380. ))))) {
  381. NA_real_
  382. } else {
  383. sum(c_across(c(
  384. cogd_obesity, cogd_chol, cogd_diabetes, cogd_stroke, cogd_tbi, cogd_hypertension, cogd_depression, cogd_physical, cogd_smoke, cogd_social
  385. )))
  386. },
  387. mcaide_sva = if (any(is.na(c_across(c(mcaide_bmi, mcaide_sbp, mcaide_chol, mcaide_phy))))) {
  388. NA_real_
  389. } else {
  390. sum(c_across(c(mcaide_bmi, mcaide_sbp, mcaide_chol, mcaide_phy)))
  391. },
  392. whicap_sva = if (any(is.na(c_across(c(
  393. whichap_diabetes, whicap_hypertension, whicap_smoker, whicap_cholesterol, whicap_bmi, whicap_race
  394. ))))) {
  395. NA_real_
  396. } else {
  397. sum(c_across(c(
  398. whichap_diabetes, whicap_hypertension, whicap_smoker, whicap_cholesterol, whicap_bmi, whicap_race
  399. )))
  400. }
  401. ) %>%
  402. mutate(
  403. libra_age_sva = case_when(
  404. sex == 0 & age < 65 ~ 0,
  405. sex == 0 & age >= 65 & age < 69 ~ 0.13,
  406. sex == 0 & age >= 70 & age <= 74 ~ 1.57,
  407. sex == 0 & age >= 75 & age <= 79 ~ 2.04,
  408. sex == 0 & age >= 80 & age <= 84 ~ 3.37,
  409. sex == 0 & age >= 85 & age <= 89 ~ 4.24,
  410. sex == 0 & age >= 90 ~ 4.93,
  411. sex == 1 & age < 65 ~ 0,
  412. sex == 1 & age >= 65 & age <= 69 ~ 0.64,
  413. sex == 1 & age >= 70 & age <= 74 ~ 1.87,
  414. sex == 1 & age >= 75 & age <= 79 ~ 2.75,
  415. sex == 1 & age >= 80 & age <= 84 ~ 3.71,
  416. sex == 1 & age >= 85 & age <= 89 ~ 4.58,
  417. sex == 1 & age >= 90 ~ 5.28,
  418. TRUE ~ NA_real_
  419. ),
  420. libra_edu_sva = case_when(
  421. id_education > 11 ~ 0,
  422. id_education >= 8 & id_education >= 11 ~ 0.42,
  423. id_education < 8 ~ 0.80,
  424. TRUE ~ NA_real_
  425. )) %>%
  426. rowwise() %>%
  427. mutate(
  428. libra_sva = if (any(is.na(c_across(c(
  429. libra_age_sva, libra_edu_sva, libra_obesity, libra_chol, libra_diabetes, libra_hypertension,
  430. libra_depression, libra_physical, libra_smoke, libra_alcohol, libra_renal, libra_heart
  431. ))))) {
  432. NA_real_
  433. } else {
  434. sum(c_across(c(
  435. libra_age_sva, libra_edu_sva, libra_obesity, libra_chol, libra_diabetes, libra_hypertension,
  436. libra_depression, libra_physical, libra_smoke, libra_alcohol, libra_renal, libra_heart
  437. )))
  438. }
  439. ) %>%
  440. ungroup() %>%
  441. rename_with(~ paste0(.x, "_org"),
  442. .cols = c(cogd, mcaide, libra, whicap,
  443. cogd_sva, mcaide_sva, libra_sva, whicap_sva)) %>%
  444. mutate(across(ends_with("_org"),
  445. ~ as.numeric(scale(.)),
  446. .names = "{sub('_org$', '', .col)}"))
  447. ```
  448. ## Regression
  449. ### Linear - All
  450. ```{r}
  451. all_num_prs = tribble(~outcome, ~pop, ~model, ~predictors,
  452. #Demographics
  453. 'ef', 'all', 'base', 'interview_language + age + sex + id_education + apoe',
  454. 'em', 'all', 'base', 'interview_language + age + sex + id_education + apoe',
  455. 'va', 'all', 'base', 'interview_language + age + sex + id_education + apoe',
  456. 'mmse_total', 'all', 'base', 'apoe + age + sex + id_education + interview_language',
  457. 'cdr', 'all', 'base', 'apoe + age + sex + id_education + interview_language',
  458. 'ab40', 'all', 'base', 'apoe + age + sex + bmi + eGFR',
  459. 'ab42', 'all', 'base', 'apoe + age + sex + bmi + eGFR',
  460. 'ab42_ab40', 'all', 'base', 'apoe + age + sex + bmi + eGFR',
  461. 'tau', 'all', 'base', 'apoe + age + sex + bmi + eGFR',
  462. 'ptau', 'all', 'base', 'apoe + age + sex + bmi + eGFR',
  463. 'nfl', 'all', 'base', 'apoe + age + sex + bmi + eGFR',
  464. 'meta_roi', 'all', 'base', 'apoe + age + sex + icv',
  465. 'z_hippcampul_vol', 'all', 'base', 'apoe + age + sex + icv',
  466. 'wmh_volume_log', 'all', 'base', 'apoe + age + sex + icv',
  467. #Demographics - apoe
  468. 'ef', 'all', 'base_noapoe', 'interview_language + age + sex + id_education',
  469. 'em', 'all', 'base_noapoe', 'interview_language + age + sex + id_education',
  470. 'va', 'all', 'base_noapoe', 'interview_language + age + sex + id_education',
  471. 'mmse_total', 'all', 'base_noapoe', 'age + sex + id_education + interview_language',
  472. 'cdr', 'all', 'base_noapoe', 'age + sex + id_education + interview_language',
  473. 'ab40', 'all', 'base_noapoe', 'age + sex + bmi + eGFR',
  474. 'ab42', 'all', 'base_noapoe', 'age + sex + bmi + eGFR',
  475. 'ab42_ab40', 'all', 'base_noapoe', 'age + sex + bmi + eGFR',
  476. 'tau', 'all', 'base_noapoe', 'age + sex + bmi + eGFR',
  477. 'ptau', 'all', 'base_noapoe', 'age + sex + bmi + eGFR',
  478. 'nfl', 'all', 'base_noapoe', 'age + sex + bmi + eGFR',
  479. 'meta_roi', 'all', 'base_noapoe', 'age + sex + icv',
  480. 'z_hippcampul_vol', 'all', 'base_noapoe', 'age + sex + icv',
  481. 'wmh_volume_log', 'all', 'base_noapoe', 'age + sex + icv',
  482. #mCAIDE
  483. 'ef', 'all', 'mcaide', 'interview_language + apoe + mcaide',
  484. 'em', 'all', 'mcaide', 'interview_language + apoe + mcaide',
  485. 'va', 'all', 'mcaide', 'interview_language + apoe + mcaide',
  486. 'mmse_total', 'all', 'mcaide', 'interview_language + apoe + mcaide',
  487. 'cdr', 'all', 'mcaide', 'interview_language + apoe + mcaide',
  488. 'ab40', 'all', 'mcaide', 'apoe + eGFR + mcaide',
  489. 'ab42', 'all', 'mcaide', 'apoe + eGFR + mcaide',
  490. 'ab42_ab40', 'all', 'mcaide', 'apoe + eGFR + mcaide',
  491. 'tau', 'all', 'mcaide', 'apoe + eGFR + mcaide',
  492. 'ptau', 'all', 'mcaide', 'apoe + eGFR + mcaide',
  493. 'nfl', 'all', 'mcaide', 'apoe + eGFR + mcaide',
  494. 'meta_roi', 'all', 'mcaide', 'apoe + icv + mcaide',
  495. 'z_hippcampul_vol', 'all', 'mcaide', 'apoe + icv + mcaide',
  496. 'wmh_volume_log', 'all', 'mcaide', 'apoe + icv + mcaide',
  497. # LIBRA
  498. 'ef', 'all', 'libra', 'interview_language + apoe + libra',
  499. 'em', 'all', 'libra', 'interview_language + apoe + libra',
  500. 'va', 'all', 'libra', 'interview_language + apoe + libra',
  501. 'mmse_total', 'all', 'libra', 'interview_language + apoe + libra',
  502. 'cdr', 'all', 'libra', 'interview_language + apoe + libra',
  503. 'ab40', 'all', 'libra', 'apoe + libra',
  504. 'ab42', 'all', 'libra', 'apoe + libra',
  505. 'ab42_ab40', 'all', 'libra', 'apoe + libra',
  506. 'tau', 'all', 'libra', 'apoe + libra',
  507. 'ptau', 'all', 'libra', 'apoe + libra',
  508. 'nfl', 'all', 'libra', 'apoe + libra',
  509. 'meta_roi', 'all', 'libra', 'apoe + icv + libra',
  510. 'z_hippcampul_vol', 'all', 'libra', 'apoe + icv + libra',
  511. 'wmh_volume_log', 'all', 'libra', 'apoe + icv + libra',
  512. # WHICAP
  513. 'ef', 'all', 'whicap', 'interview_language + apoe + whicap',
  514. 'em', 'all', 'whicap', 'interview_language + apoe + whicap',
  515. 'va', 'all', 'whicap', 'interview_language + apoe + whicap',
  516. 'mmse_total', 'all', 'whicap', 'interview_language + apoe + whicap',
  517. 'cdr', 'all', 'whicap', 'interview_language + apoe + whicap',
  518. 'ab40', 'all', 'whicap', 'apoe + eGFR + whicap',
  519. 'ab42', 'all', 'whicap', 'apoe + eGFR + whicap',
  520. 'ab42_ab40', 'all', 'whicap', 'apoe + eGFR + whicap',
  521. 'tau', 'all', 'whicap', 'apoe + eGFR + whicap',
  522. 'ptau', 'all', 'whicap', 'apoe + eGFR + whicap',
  523. 'nfl', 'all', 'whicap', 'apoe + eGFR + whicap',
  524. 'meta_roi', 'all', 'whicap', 'apoe + icv + whicap',
  525. 'z_hippcampul_vol', 'all', 'whicap', 'apoe + icv + whicap',
  526. 'wmh_volume_log', 'all', 'whicap', 'apoe + icv + whicap',
  527. # CogD
  528. 'ef', 'all', 'cogd', 'interview_language + apoe + cogd',
  529. 'em', 'all', 'cogd', 'interview_language + apoe + cogd',
  530. 'va', 'all', 'cogd', 'interview_language + apoe + cogd',
  531. 'mmse_total', 'all', 'cogd', 'interview_language + apoe + cogd',
  532. 'cdr', 'all', 'cogd', 'interview_language + apoe + cogd',
  533. 'ab40', 'all', 'cogd', 'apoe + bmi + eGFR + cogd',
  534. 'ab42', 'all', 'cogd', 'apoe + bmi + eGFR + cogd',
  535. 'ab42_ab40', 'all', 'cogd', 'apoe + bmi + eGFR + cogd',
  536. 'tau', 'all', 'cogd', 'apoe + bmi + eGFR + cogd',
  537. 'ptau', 'all', 'cogd', 'apoe + bmi + eGFR + cogd',
  538. 'nfl', 'all', 'cogd', 'apoe + bmi + eGFR + cogd',
  539. 'meta_roi', 'all', 'cogd', 'apoe + icv + cogd',
  540. 'z_hippcampul_vol', 'all', 'cogd', 'apoe + icv + cogd',
  541. 'wmh_volume_log', 'all', 'cogd', 'apoe + icv + cogd',
  542. # Sensitivity analysis
  543. #LIBRA
  544. 'ef', 'all', 'libra_sva', 'interview_language + apoe + libra_sva',
  545. 'em', 'all', 'libra_sva', 'interview_language + apoe + libra_sva',
  546. 'va', 'all', 'libra_sva', 'interview_language + apoe + libra_sva',
  547. 'mmse_total', 'all', 'libra_sva', 'interview_language + apoe + libra_sva',
  548. 'cdr', 'all', 'libra_sva', 'interview_language + apoe + libra_sva',
  549. 'ab40', 'all', 'libra_sva', 'apoe + libra_sva',
  550. 'ab42', 'all', 'libra_sva', 'apoe + libra_sva',
  551. 'ab42_ab40', 'all', 'libra_sva', 'apoe + libra_sva',
  552. 'tau', 'all', 'libra_sva', 'apoe + libra_sva',
  553. 'ptau', 'all', 'libra_sva', 'apoe + libra_sva',
  554. 'nfl', 'all', 'libra_sva', 'apoe + libra_sva',
  555. 'meta_roi', 'all', 'libra_sva', 'apoe + icv + libra_sva',
  556. 'z_hippcampul_vol', 'all', 'libra_sva', 'apoe + icv + libra_sva',
  557. 'wmh_volume_log', 'all', 'libra_sva', 'apoe + icv + libra_sva',
  558. #mCAIDE
  559. 'ef', 'all', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  560. 'em', 'all', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  561. 'va', 'all', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  562. 'mmse_total', 'all', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  563. 'cdr', 'all', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  564. 'ab40', 'all', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  565. 'ab42', 'all', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  566. 'ab42_ab40', 'all', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  567. 'tau', 'all', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  568. 'ptau', 'all', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  569. 'nfl', 'all', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  570. 'meta_roi', 'all', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  571. 'z_hippcampul_vol', 'all', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  572. 'wmh_volume_log', 'all', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  573. #WHICAP
  574. 'ef', 'all', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  575. 'em', 'all', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  576. 'va', 'all', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  577. 'mmse_total', 'all', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  578. 'cdr', 'all', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  579. 'ab40', 'all', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  580. 'ab42', 'all', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  581. 'ab42_ab40', 'all', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  582. 'tau', 'all', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  583. 'ptau', 'all', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  584. 'nfl', 'all', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  585. 'meta_roi', 'all', 'whicap_sva', 'apoe + icv + whicap_sva',
  586. 'z_hippcampul_vol', 'all', 'whicap_sva', 'apoe + icv + whicap_sva',
  587. 'wmh_volume_log', 'all', 'whicap_sva', 'apoe + icv + whicap_sva',
  588. #CogD
  589. 'ef', 'all', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  590. 'em', 'all', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  591. 'va', 'all', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  592. 'mmse_total', 'all', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  593. 'cdr', 'all', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  594. 'ab40', 'all', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  595. 'ab42', 'all', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  596. 'ab42_ab40', 'all', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  597. 'tau', 'all', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  598. 'ptau', 'all', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  599. 'nfl', 'all', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  600. 'meta_roi', 'all', 'cogd_sva', 'apoe + icv + cogd_sva',
  601. 'z_hippcampul_vol', 'all', 'cogd_sva', 'apoe + icv + cogd_sva',
  602. 'wmh_volume_log', 'all', 'cogd_sva', 'apoe + icv + cogd_sva'
  603. ) %>%
  604. mutate(eq = glue('{outcome} ~ {predictors}'),
  605. res = map(eq, lm, data = data),
  606. dataf = map(res, tidy),
  607. mod = map(res, glance),
  608. r2 = map_dbl(mod, ~ .x$r.squared),
  609. r2.adj = map_dbl(mod, ~ .x$adj.r.squared),
  610. n = map_int(res, nobs))
  611. ```
  612. ### CDX - All
  613. ```{r}
  614. all_cdx_prs = tribble(~outcome, ~pop, ~model, ~predictors,
  615. #Demographics
  616. 'cdx_cn_vs_ci', 'all', 'base', 'age + sex + apoe + id_education',
  617. 'cdx_mci_vs_cn', 'all', 'base', 'age + sex + apoe + id_education',
  618. 'cdx_dem_vs_cn', 'all', 'base', 'age + sex + apoe + id_education',
  619. 'cdx_ci_vs_cn', 'all', 'base', 'age + sex + apoe + id_education',
  620. #Demographics
  621. 'cdx_cn_vs_ci', 'all', 'base_noapoe', 'age + sex + id_education',
  622. 'cdx_mci_vs_cn', 'all', 'base_noapoe', 'age + sex + id_education',
  623. 'cdx_dem_vs_cn', 'all', 'base_noapoe', 'age + sex + id_education',
  624. 'cdx_ci_vs_cn', 'all', 'base_noapoe', 'age + sex + id_education',
  625. #LIBRA
  626. 'cdx_cn_vs_ci', 'all', 'libra', 'apoe + libra',
  627. 'cdx_mci_vs_cn', 'all', 'libra', 'apoe + libra',
  628. 'cdx_dem_vs_cn', 'all', 'libra', 'apoe + libra',
  629. 'cdx_ci_vs_cn', 'all', 'libra', 'apoe + libra',
  630. #mCAIDE
  631. 'cdx_cn_vs_ci', 'all', 'mcaide', 'apoe + mcaide',
  632. 'cdx_mci_vs_cn', 'all', 'mcaide', 'apoe + mcaide',
  633. 'cdx_dem_vs_cn', 'all', 'mcaide', 'apoe + mcaide',
  634. 'cdx_ci_vs_cn', 'all', 'mcaide', 'apoe + mcaide',
  635. #WHICAP
  636. 'cdx_cn_vs_ci', 'all', 'whicap', 'apoe + whicap',
  637. 'cdx_mci_vs_cn', 'all', 'whicap', 'apoe + whicap',
  638. 'cdx_dem_vs_cn', 'all', 'whicap', 'apoe + whicap',
  639. 'cdx_ci_vs_cn', 'all', 'whicap', 'apoe + whicap',
  640. #CogD
  641. 'cdx_cn_vs_ci', 'all', 'cogd', 'apoe + cogd',
  642. 'cdx_mci_vs_cn', 'all', 'cogd', 'apoe + cogd',
  643. 'cdx_dem_vs_cn', 'all', 'cogd', 'apoe + cogd',
  644. 'cdx_ci_vs_cn', 'all', 'cogd', 'apoe + cogd',
  645. # Sensitivity analysis
  646. #LIBRA
  647. 'cdx_cn_vs_ci', 'all', 'libra_sva', 'apoe + libra_sva',
  648. 'cdx_mci_vs_cn', 'all', 'libra_sva', 'apoe + libra_sva',
  649. 'cdx_dem_vs_cn', 'all', 'libra_sva', 'apoe + libra_sva',
  650. 'cdx_ci_vs_cn', 'all', 'libra_sva', 'apoe + libra_sva',
  651. #mCAIDE
  652. 'cdx_cn_vs_ci', 'all', 'mcaide_sva', 'apoe + mcaide_sva',
  653. 'cdx_mci_vs_cn', 'all', 'mcaide_sva', 'apoe + mcaide_sva',
  654. 'cdx_dem_vs_cn', 'all', 'mcaide_sva', 'apoe + mcaide_sva',
  655. 'cdx_ci_vs_cn', 'all', 'mcaide_sva', 'apoe + mcaide_sva',
  656. #WHICAP
  657. 'cdx_cn_vs_ci', 'all', 'whicap_sva', 'apoe + whicap_sva',
  658. 'cdx_mci_vs_cn', 'all', 'whicap_sva', 'apoe + whicap_sva',
  659. 'cdx_dem_vs_cn', 'all', 'whicap_sva', 'apoe + whicap_sva',
  660. 'cdx_ci_vs_cn', 'all', 'whicap_sva', 'apoe + whicap_sva',
  661. #CogD
  662. 'cdx_cn_vs_ci', 'all', 'cogd_sva', 'apoe + cogd_sva',
  663. 'cdx_mci_vs_cn', 'all', 'cogd_sva', 'apoe + cogd_sva',
  664. 'cdx_dem_vs_cn', 'all', 'cogd_sva', 'apoe + cogd_sva',
  665. 'cdx_ci_vs_cn', 'all', 'cogd_sva', 'apoe + cogd_sva'
  666. ) %>%
  667. mutate(
  668. eq = glue("{outcome} ~ {predictors}"),
  669. res = map(eq, ~ glm(.x, data = data, family = "binomial")),
  670. auc = map_dbl(res, ~ {
  671. y = model.response(model.frame(.x)) # create model.frame(x) which is the exact same data as res
  672. p = predict(.x, type = "response") # predict fitted probabilities for each outcome
  673. if (length(unique(y)) > 1) { # if outcome is all 0s or 1s, skip
  674. as.numeric(pROC::auc(pROC::roc(y, p))) # compute ROC curve then AUC and return numeric number (as.numeric)
  675. } else {NA_real_}}), # if the outcome has only one class, return NA
  676. nagelkerke_r2 = map_dbl(res, ~ {
  677. out = tryCatch(performance::r2_nagelkerke(.x), error = function(e) NA_real_)
  678. as.numeric(out)}),
  679. dataf = map(res, tidy),
  680. mod = map(res, glance),
  681. n = map_int(res, nobs))
  682. ```
  683. ### Linear - Ancestry
  684. ```{r}
  685. eur_num_prs = tribble(~outcome, ~pop, ~model, ~predictors,
  686. #Demographics
  687. 'ef', 'NHW', 'base', 'interview_language + age + sex + id_education + apoe',
  688. 'em', 'NHW', 'base', 'interview_language + age + sex + id_education + apoe',
  689. 'va', 'NHW', 'base', 'interview_language + age + sex + id_education + apoe',
  690. 'mmse_total', 'NHW', 'base', 'apoe + age + sex + id_education + interview_language',
  691. 'cdr', 'NHW', 'base', 'apoe + age + sex + id_education + interview_language',
  692. 'ab40', 'NHW', 'base', 'apoe + age + sex + bmi + eGFR',
  693. 'ab42', 'NHW', 'base', 'apoe + age + sex + bmi + eGFR',
  694. 'ab42_ab40', 'NHW', 'base', 'apoe + age + sex + bmi + eGFR',
  695. 'tau', 'NHW', 'base', 'apoe + age + sex + bmi + eGFR',
  696. 'ptau', 'NHW', 'base', 'apoe + age + sex + bmi + eGFR',
  697. 'nfl', 'NHW', 'base', 'apoe + age + sex + bmi + eGFR',
  698. 'meta_roi', 'NHW', 'base', 'apoe + age + sex + icv',
  699. 'z_hippcampul_vol', 'NHW', 'base', 'apoe + age + sex + icv',
  700. 'wmh_volume_log', 'NHW', 'base', 'apoe + age + sex + icv',
  701. #Demographics - apoe
  702. 'ef', 'NHW', 'base_noapoe', 'interview_language + age + sex + id_education',
  703. 'em', 'NHW', 'base_noapoe', 'interview_language + age + sex + id_education',
  704. 'va', 'NHW', 'base_noapoe', 'interview_language + age + sex + id_education',
  705. 'mmse_total', 'NHW', 'base_noapoe', 'age + sex + id_education + interview_language',
  706. 'cdr', 'NHW', 'base_noapoe', 'age + sex + id_education + interview_language',
  707. 'ab40', 'NHW', 'base_noapoe', 'age + sex + bmi + eGFR',
  708. 'ab42', 'NHW', 'base_noapoe', 'age + sex + bmi + eGFR',
  709. 'ab42_ab40', 'NHW', 'base_noapoe', 'age + sex + bmi + eGFR',
  710. 'tau', 'NHW', 'base_noapoe', 'age + sex + bmi + eGFR',
  711. 'ptau', 'NHW', 'base_noapoe', 'age + sex + bmi + eGFR',
  712. 'nfl', 'NHW', 'base_noapoe', 'age + sex + bmi + eGFR',
  713. 'meta_roi', 'NHW', 'base_noapoe', 'age + sex + icv',
  714. 'z_hippcampul_vol', 'NHW', 'base_noapoe', 'age + sex + icv',
  715. 'wmh_volume_log', 'NHW', 'base_noapoe', 'age + sex + icv',
  716. #mCAIDE
  717. 'ef', 'NHW', 'mcaide', 'interview_language + apoe + mcaide',
  718. 'em', 'NHW', 'mcaide', 'interview_language + apoe + mcaide',
  719. 'va', 'NHW', 'mcaide', 'interview_language + apoe + mcaide',
  720. 'mmse_total', 'NHW', 'mcaide', 'interview_language + apoe + mcaide',
  721. 'cdr', 'NHW', 'mcaide', 'interview_language + apoe + mcaide',
  722. 'ab40', 'NHW', 'mcaide', 'apoe + eGFR + mcaide',
  723. 'ab42', 'NHW', 'mcaide', 'apoe + eGFR + mcaide',
  724. 'ab42_ab40', 'NHW', 'mcaide', 'apoe + eGFR + mcaide',
  725. 'tau', 'NHW', 'mcaide', 'apoe + eGFR + mcaide',
  726. 'ptau', 'NHW', 'mcaide', 'apoe + eGFR + mcaide',
  727. 'nfl', 'NHW', 'mcaide', 'apoe + eGFR + mcaide',
  728. 'meta_roi', 'NHW', 'mcaide', 'apoe + icv + mcaide',
  729. 'z_hippcampul_vol', 'NHW', 'mcaide', 'apoe + icv + mcaide',
  730. 'wmh_volume_log', 'NHW', 'mcaide', 'apoe + icv + mcaide',
  731. # LIBRA
  732. 'ef', 'NHW', 'libra', 'interview_language + apoe + libra',
  733. 'em', 'NHW', 'libra', 'interview_language + apoe + libra',
  734. 'va', 'NHW', 'libra', 'interview_language + apoe + libra',
  735. 'mmse_total', 'NHW', 'libra', 'interview_language + apoe + libra',
  736. 'cdr', 'NHW', 'libra', 'interview_language + apoe + libra',
  737. 'ab40', 'NHW', 'libra', 'apoe + libra',
  738. 'ab42', 'NHW', 'libra', 'apoe + libra',
  739. 'ab42_ab40', 'NHW', 'libra', 'apoe + libra',
  740. 'tau', 'NHW', 'libra', 'apoe + libra',
  741. 'ptau', 'NHW', 'libra', 'apoe + libra',
  742. 'nfl', 'NHW', 'libra', 'apoe + libra',
  743. 'meta_roi', 'NHW', 'libra', 'apoe + icv + libra',
  744. 'z_hippcampul_vol', 'NHW', 'libra', 'apoe + icv + libra',
  745. 'wmh_volume_log', 'NHW', 'libra', 'apoe + icv + libra',
  746. # WHICAP
  747. 'ef', 'NHW', 'whicap', 'interview_language + apoe + whicap',
  748. 'em', 'NHW', 'whicap', 'interview_language + apoe + whicap',
  749. 'va', 'NHW', 'whicap', 'interview_language + apoe + whicap',
  750. 'mmse_total', 'NHW', 'whicap', 'interview_language + apoe + whicap',
  751. 'cdr', 'NHW', 'whicap', 'interview_language + apoe + whicap',
  752. 'ab40', 'NHW', 'whicap', 'apoe + eGFR + whicap',
  753. 'ab42', 'NHW', 'whicap', 'apoe + eGFR + whicap',
  754. 'ab42_ab40', 'NHW', 'whicap', 'apoe + eGFR + whicap',
  755. 'tau', 'NHW', 'whicap', 'apoe + eGFR + whicap',
  756. 'ptau', 'NHW', 'whicap', 'apoe + eGFR + whicap',
  757. 'nfl', 'NHW', 'whicap', 'apoe + eGFR + whicap',
  758. 'meta_roi', 'NHW', 'whicap', 'apoe + icv + whicap',
  759. 'z_hippcampul_vol', 'NHW', 'whicap', 'apoe + icv + whicap',
  760. 'wmh_volume_log', 'NHW', 'whicap', 'apoe + icv + whicap',
  761. # CogD
  762. 'ef', 'NHW', 'cogd', 'interview_language + apoe + cogd',
  763. 'em', 'NHW', 'cogd', 'interview_language + apoe + cogd',
  764. 'va', 'NHW', 'cogd', 'interview_language + apoe + cogd',
  765. 'mmse_total', 'NHW', 'cogd', 'interview_language + apoe + cogd',
  766. 'cdr', 'NHW', 'cogd', 'interview_language + apoe + cogd',
  767. 'ab40', 'NHW', 'cogd', 'apoe + bmi + eGFR + cogd',
  768. 'ab42', 'NHW', 'cogd', 'apoe + bmi + eGFR + cogd',
  769. 'ab42_ab40', 'NHW', 'cogd', 'apoe + bmi + eGFR + cogd',
  770. 'tau', 'NHW', 'cogd', 'apoe + bmi + eGFR + cogd',
  771. 'ptau', 'NHW', 'cogd', 'apoe + bmi + eGFR + cogd',
  772. 'nfl', 'NHW', 'cogd', 'apoe + bmi + eGFR + cogd',
  773. 'meta_roi', 'NHW', 'cogd', 'apoe + icv + cogd',
  774. 'z_hippcampul_vol', 'NHW', 'cogd', 'apoe + icv + cogd',
  775. 'wmh_volume_log', 'NHW', 'cogd', 'apoe + icv + cogd',
  776. # Sensitivity analysis
  777. #LIBRA
  778. 'ef', 'NHW', 'libra_sva', 'interview_language + apoe + libra_sva',
  779. 'em', 'NHW', 'libra_sva', 'interview_language + apoe + libra_sva',
  780. 'va', 'NHW', 'libra_sva', 'interview_language + apoe + libra_sva',
  781. 'mmse_total', 'NHW', 'libra_sva', 'interview_language + apoe + libra_sva',
  782. 'cdr', 'NHW', 'libra_sva', 'interview_language + apoe + libra_sva',
  783. 'ab40', 'NHW', 'libra_sva', 'apoe + libra_sva',
  784. 'ab42', 'NHW', 'libra_sva', 'apoe + libra_sva',
  785. 'ab42_ab40', 'NHW', 'libra_sva', 'apoe + libra_sva',
  786. 'tau', 'NHW', 'libra_sva', 'apoe + libra_sva',
  787. 'ptau', 'NHW', 'libra_sva', 'apoe + libra_sva',
  788. 'nfl', 'NHW', 'libra_sva', 'apoe + libra_sva',
  789. 'meta_roi', 'NHW', 'libra_sva', 'apoe + icv + libra_sva',
  790. 'z_hippcampul_vol', 'NHW', 'libra_sva', 'apoe + icv + libra_sva',
  791. 'wmh_volume_log', 'NHW', 'libra_sva', 'apoe + icv + libra_sva',
  792. #mCAIDE
  793. 'ef', 'NHW', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  794. 'em', 'NHW', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  795. 'va', 'NHW', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  796. 'mmse_total', 'NHW', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  797. 'cdr', 'NHW', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  798. 'ab40', 'NHW', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  799. 'ab42', 'NHW', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  800. 'ab42_ab40', 'NHW', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  801. 'tau', 'NHW', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  802. 'ptau', 'NHW', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  803. 'nfl', 'NHW', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  804. 'meta_roi', 'NHW', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  805. 'z_hippcampul_vol', 'NHW', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  806. 'wmh_volume_log', 'NHW', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  807. #WHICAP
  808. 'ef', 'NHW', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  809. 'em', 'NHW', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  810. 'va', 'NHW', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  811. 'mmse_total', 'NHW', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  812. 'cdr', 'NHW', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  813. 'ab40', 'NHW', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  814. 'ab42', 'NHW', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  815. 'ab42_ab40', 'NHW', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  816. 'tau', 'NHW', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  817. 'ptau', 'NHW', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  818. 'nfl', 'NHW', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  819. 'meta_roi', 'NHW', 'whicap_sva', 'apoe + icv + whicap_sva',
  820. 'z_hippcampul_vol', 'NHW', 'whicap_sva', 'apoe + icv + whicap_sva',
  821. 'wmh_volume_log', 'NHW', 'whicap_sva', 'apoe + icv + whicap_sva',
  822. #CogD
  823. 'ef', 'NHW', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  824. 'em', 'NHW', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  825. 'va', 'NHW', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  826. 'mmse_total', 'NHW', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  827. 'cdr', 'NHW', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  828. 'ab40', 'NHW', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  829. 'ab42', 'NHW', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  830. 'ab42_ab40', 'NHW', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  831. 'tau', 'NHW', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  832. 'ptau', 'NHW', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  833. 'nfl', 'NHW', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  834. 'meta_roi', 'NHW', 'cogd_sva', 'apoe + icv + cogd_sva',
  835. 'z_hippcampul_vol', 'NHW', 'cogd_sva', 'apoe + icv + cogd_sva',
  836. 'wmh_volume_log', 'NHW', 'cogd_sva', 'apoe + icv + cogd_sva'
  837. ) %>%
  838. mutate(eq = glue('{outcome} ~ {predictors}'),
  839. res = map(eq, lm, data = filter(data, race == "NHW")),
  840. dataf = map(res, tidy),
  841. mod = map(res, glance),
  842. r2 = map_dbl(mod, ~ .x$r.squared),
  843. r2.adj = map_dbl(mod, ~ .x$adj.r.squared),
  844. n = map_int(res, nobs))
  845. amr_num_prs = tribble(~outcome, ~pop, ~model, ~predictors,
  846. #Demographics
  847. 'ef', 'Hispanic', 'base', 'interview_language + age + sex + id_education + apoe',
  848. 'em', 'Hispanic', 'base', 'interview_language + age + sex + id_education + apoe',
  849. 'va', 'Hispanic', 'base', 'interview_language + age + sex + id_education + apoe',
  850. 'mmse_total', 'Hispanic', 'base', 'apoe + age + sex + id_education + interview_language',
  851. 'cdr', 'Hispanic', 'base', 'apoe + age + sex + id_education + interview_language',
  852. 'ab40', 'Hispanic', 'base', 'apoe + age + sex + bmi + eGFR',
  853. 'ab42', 'Hispanic', 'base', 'apoe + age + sex + bmi + eGFR',
  854. 'ab42_ab40', 'Hispanic', 'base', 'apoe + age + sex + bmi + eGFR',
  855. 'tau', 'Hispanic', 'base', 'apoe + age + sex + bmi + eGFR',
  856. 'ptau', 'Hispanic', 'base', 'apoe + age + sex + bmi + eGFR',
  857. 'nfl', 'Hispanic', 'base', 'apoe + age + sex + bmi + eGFR',
  858. 'meta_roi', 'Hispanic', 'base', 'apoe + age + sex + icv',
  859. 'z_hippcampul_vol', 'Hispanic', 'base', 'apoe + age + sex + icv',
  860. 'wmh_volume_log', 'Hispanic', 'base', 'apoe + age + sex + icv',
  861. #Demographics - apoe
  862. 'ef', 'Hispanic', 'noapoe', 'interview_language + age + sex + id_education',
  863. 'em', 'Hispanic', 'noapoe', 'interview_language + age + sex + id_education',
  864. 'va', 'Hispanic', 'noapoe', 'interview_language + age + sex + id_education',
  865. 'mmse_total', 'Hispanic', 'noapoe', 'age + sex + id_education + interview_language',
  866. 'cdr', 'Hispanic', 'noapoe', 'age + sex + id_education + interview_language',
  867. 'ab40', 'Hispanic', 'noapoe', 'age + sex + bmi + eGFR',
  868. 'ab42', 'Hispanic', 'noapoe', 'age + sex + bmi + eGFR',
  869. 'ab42_ab40', 'Hispanic', 'noapoe', 'age + sex + bmi + eGFR',
  870. 'tau', 'Hispanic', 'noapoe', 'age + sex + bmi + eGFR',
  871. 'ptau', 'Hispanic', 'noapoe', 'age + sex + bmi + eGFR',
  872. 'nfl', 'Hispanic', 'noapoe', 'age + sex + bmi + eGFR',
  873. 'meta_roi', 'Hispanic', 'noapoe', 'age + sex + icv',
  874. 'z_hippcampul_vol', 'Hispanic', 'noapoe', 'age + sex + icv',
  875. 'wmh_volume_log', 'Hispanic', 'noapoe', 'age + sex + icv',
  876. #mCAIDE
  877. 'ef', 'Hispanic', 'mcaide', 'interview_language + apoe + mcaide',
  878. 'em', 'Hispanic', 'mcaide', 'interview_language + apoe + mcaide',
  879. 'va', 'Hispanic', 'mcaide', 'interview_language + apoe + mcaide',
  880. 'mmse_total', 'Hispanic', 'mcaide', 'interview_language + apoe + mcaide',
  881. 'cdr', 'Hispanic', 'mcaide', 'interview_language + apoe + mcaide',
  882. 'ab40', 'Hispanic', 'mcaide', 'apoe + eGFR + mcaide',
  883. 'ab42', 'Hispanic', 'mcaide', 'apoe + eGFR + mcaide',
  884. 'ab42_ab40', 'Hispanic', 'mcaide', 'apoe + eGFR + mcaide',
  885. 'tau', 'Hispanic', 'mcaide', 'apoe + eGFR + mcaide',
  886. 'ptau', 'Hispanic', 'mcaide', 'apoe + eGFR + mcaide',
  887. 'nfl', 'Hispanic', 'mcaide', 'apoe + eGFR + mcaide',
  888. 'meta_roi', 'Hispanic', 'mcaide', 'apoe + icv + mcaide',
  889. 'z_hippcampul_vol', 'Hispanic', 'mcaide', 'apoe + icv + mcaide',
  890. 'wmh_volume_log', 'Hispanic', 'mcaide', 'apoe + icv + mcaide',
  891. # LIBRA
  892. 'ef', 'Hispanic', 'libra', 'interview_language + apoe + libra',
  893. 'em', 'Hispanic', 'libra', 'interview_language + apoe + libra',
  894. 'va', 'Hispanic', 'libra', 'interview_language + apoe + libra',
  895. 'mmse_total', 'Hispanic', 'libra', 'interview_language + apoe + libra',
  896. 'cdr', 'Hispanic', 'libra', 'interview_language + apoe + libra',
  897. 'ab40', 'Hispanic', 'libra', 'apoe + libra',
  898. 'ab42', 'Hispanic', 'libra', 'apoe + libra',
  899. 'ab42_ab40', 'Hispanic', 'libra', 'apoe + libra',
  900. 'tau', 'Hispanic', 'libra', 'apoe + libra',
  901. 'ptau', 'Hispanic', 'libra', 'apoe + libra',
  902. 'nfl', 'Hispanic', 'libra', 'apoe + libra',
  903. 'meta_roi', 'Hispanic', 'libra', 'apoe + icv + libra',
  904. 'z_hippcampul_vol', 'Hispanic', 'libra', 'apoe + icv + libra',
  905. 'wmh_volume_log', 'Hispanic', 'libra', 'apoe + icv + libra',
  906. # WHICAP
  907. 'ef', 'Hispanic', 'whicap', 'interview_language + apoe + whicap',
  908. 'em', 'Hispanic', 'whicap', 'interview_language + apoe + whicap',
  909. 'va', 'Hispanic', 'whicap', 'interview_language + apoe + whicap',
  910. 'mmse_total', 'Hispanic', 'whicap', 'interview_language + apoe + whicap',
  911. 'cdr', 'Hispanic', 'whicap', 'interview_language + apoe + whicap',
  912. 'ab40', 'Hispanic', 'whicap', 'apoe + eGFR + whicap',
  913. 'ab42', 'Hispanic', 'whicap', 'apoe + eGFR + whicap',
  914. 'ab42_ab40', 'Hispanic', 'whicap', 'apoe + eGFR + whicap',
  915. 'tau', 'Hispanic', 'whicap', 'apoe + eGFR + whicap',
  916. 'ptau', 'Hispanic', 'whicap', 'apoe + eGFR + whicap',
  917. 'nfl', 'Hispanic', 'whicap', 'apoe + eGFR + whicap',
  918. 'meta_roi', 'Hispanic', 'whicap', 'apoe + icv + whicap',
  919. 'z_hippcampul_vol', 'Hispanic', 'whicap', 'apoe + icv + whicap',
  920. 'wmh_volume_log', 'Hispanic', 'whicap', 'apoe + icv + whicap',
  921. # CogD
  922. 'ef', 'Hispanic', 'cogd', 'interview_language + apoe + cogd',
  923. 'em', 'Hispanic', 'cogd', 'interview_language + apoe + cogd',
  924. 'va', 'Hispanic', 'cogd', 'interview_language + apoe + cogd',
  925. 'mmse_total', 'Hispanic', 'cogd', 'interview_language + apoe + cogd',
  926. 'cdr', 'Hispanic', 'cogd', 'interview_language + apoe + cogd',
  927. 'ab40', 'Hispanic', 'cogd', 'apoe + bmi + eGFR + cogd',
  928. 'ab42', 'Hispanic', 'cogd', 'apoe + bmi + eGFR + cogd',
  929. 'ab42_ab40', 'Hispanic', 'cogd', 'apoe + bmi + eGFR + cogd',
  930. 'tau', 'Hispanic', 'cogd', 'apoe + bmi + eGFR + cogd',
  931. 'ptau', 'Hispanic', 'cogd', 'apoe + bmi + eGFR + cogd',
  932. 'nfl', 'Hispanic', 'cogd', 'apoe + bmi + eGFR + cogd',
  933. 'meta_roi', 'Hispanic', 'cogd', 'apoe + icv + cogd',
  934. 'z_hippcampul_vol', 'Hispanic', 'cogd', 'apoe + icv + cogd',
  935. 'wmh_volume_log', 'Hispanic', 'cogd', 'apoe + icv + cogd',
  936. # Sensitivity analysis
  937. #LIBRA
  938. 'ef', 'Hispanic', 'libra_sva', 'interview_language + apoe + libra_sva',
  939. 'em', 'Hispanic', 'libra_sva', 'interview_language + apoe + libra_sva',
  940. 'va', 'Hispanic', 'libra_sva', 'interview_language + apoe + libra_sva',
  941. 'mmse_total', 'Hispanic', 'libra_sva', 'interview_language + apoe + libra_sva',
  942. 'cdr', 'Hispanic', 'libra_sva', 'interview_language + apoe + libra_sva',
  943. 'ab40', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  944. 'ab42', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  945. 'ab42_ab40', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  946. 'tau', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  947. 'ptau', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  948. 'nfl', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  949. 'meta_roi', 'Hispanic', 'libra_sva', 'apoe + icv + libra_sva',
  950. 'z_hippcampul_vol', 'Hispanic', 'libra_sva', 'apoe + icv + libra_sva',
  951. 'wmh_volume_log', 'Hispanic', 'libra_sva', 'apoe + icv + libra_sva',
  952. #mCAIDE
  953. 'ef', 'Hispanic', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  954. 'em', 'Hispanic', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  955. 'va', 'Hispanic', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  956. 'mmse_total', 'Hispanic', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  957. 'cdr', 'Hispanic', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  958. 'ab40', 'Hispanic', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  959. 'ab42', 'Hispanic', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  960. 'ab42_ab40', 'Hispanic', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  961. 'tau', 'Hispanic', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  962. 'ptau', 'Hispanic', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  963. 'nfl', 'Hispanic', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  964. 'meta_roi', 'Hispanic', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  965. 'z_hippcampul_vol', 'Hispanic', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  966. 'wmh_volume_log', 'Hispanic', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  967. #WHICAP
  968. 'ef', 'Hispanic', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  969. 'em', 'Hispanic', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  970. 'va', 'Hispanic', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  971. 'mmse_total', 'Hispanic', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  972. 'cdr', 'Hispanic', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  973. 'ab40', 'Hispanic', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  974. 'ab42', 'Hispanic', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  975. 'ab42_ab40', 'Hispanic', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  976. 'tau', 'Hispanic', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  977. 'ptau', 'Hispanic', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  978. 'nfl', 'Hispanic', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  979. 'meta_roi', 'Hispanic', 'whicap_sva', 'apoe + icv + whicap_sva',
  980. 'z_hippcampul_vol', 'Hispanic', 'whicap_sva', 'apoe + icv + whicap_sva',
  981. 'wmh_volume_log', 'Hispanic', 'whicap_sva', 'apoe + icv + whicap_sva',
  982. #CogD
  983. 'ef', 'Hispanic', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  984. 'em', 'Hispanic', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  985. 'va', 'Hispanic', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  986. 'mmse_total', 'Hispanic', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  987. 'cdr', 'Hispanic', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  988. 'ab40', 'Hispanic', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  989. 'ab42', 'Hispanic', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  990. 'ab42_ab40', 'Hispanic', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  991. 'tau', 'Hispanic', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  992. 'ptau', 'Hispanic', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  993. 'nfl', 'Hispanic', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  994. 'meta_roi', 'Hispanic', 'cogd_sva', 'apoe + icv + cogd_sva',
  995. 'z_hippcampul_vol', 'Hispanic', 'cogd_sva', 'apoe + icv + cogd_sva',
  996. 'wmh_volume_log', 'Hispanic', 'cogd_sva', 'apoe + icv + cogd_sva'
  997. ) %>%
  998. mutate(eq = glue('{outcome} ~ {predictors}'),
  999. res = map(eq, lm, data = filter(data, race == "Hispanic")),
  1000. dataf = map(res, tidy),
  1001. mod = map(res, glance),
  1002. r2 = map_dbl(mod, ~ .x$r.squared),
  1003. r2.adj = map_dbl(mod, ~ .x$adj.r.squared),
  1004. n = map_int(res, nobs))
  1005. afr_num_prs = tribble(~outcome, ~pop, ~model, ~predictors,
  1006. #Demographics
  1007. 'ef', 'Black', 'base', 'interview_language + age + sex + id_education + apoe',
  1008. 'em', 'Black', 'base', 'interview_language + age + sex + id_education + apoe',
  1009. 'va', 'Black', 'base', 'interview_language + age + sex + id_education + apoe',
  1010. 'mmse_total', 'Black', 'base', 'apoe + age + sex + id_education + interview_language',
  1011. 'cdr', 'Black', 'base', 'apoe + age + sex + id_education + interview_language',
  1012. 'ab40', 'Black', 'base', 'apoe + age + sex + bmi + eGFR',
  1013. 'ab42', 'Black', 'base', 'apoe + age + sex + bmi + eGFR',
  1014. 'ab42_ab40', 'Black', 'base', 'apoe + age + sex + bmi + eGFR',
  1015. 'tau', 'Black', 'base', 'apoe + age + sex + bmi + eGFR',
  1016. 'ptau', 'Black', 'base', 'apoe + age + sex + bmi + eGFR',
  1017. 'nfl', 'Black', 'base', 'apoe + age + sex + bmi + eGFR',
  1018. 'meta_roi', 'Black', 'base', 'apoe + age + sex + icv',
  1019. 'z_hippcampul_vol', 'Black', 'base', 'apoe + age + sex + icv',
  1020. 'wmh_volume_log', 'Black', 'base', 'apoe + age + sex + icv',
  1021. #Demographics - apoe
  1022. 'ef', 'Black', 'noapoe', 'interview_language + age + sex + id_education',
  1023. 'em', 'Black', 'noapoe', 'interview_language + age + sex + id_education',
  1024. 'va', 'Black', 'noapoe', 'interview_language + age + sex + id_education',
  1025. 'mmse_total', 'Black', 'noapoe', 'age + sex + id_education + interview_language',
  1026. 'cdr', 'Black', 'noapoe', 'age + sex + id_education + interview_language',
  1027. 'ab40', 'Black', 'noapoe', 'age + sex + bmi + eGFR',
  1028. 'ab42', 'Black', 'noapoe', 'age + sex + bmi + eGFR',
  1029. 'ab42_ab40', 'Black', 'noapoe', 'age + sex + bmi + eGFR',
  1030. 'tau', 'Black', 'noapoe', 'age + sex + bmi + eGFR',
  1031. 'ptau', 'Black', 'noapoe', 'age + sex + bmi + eGFR',
  1032. 'nfl', 'Black', 'noapoe', 'age + sex + bmi + eGFR',
  1033. 'meta_roi', 'Black', 'noapoe', 'age + sex + icv',
  1034. 'z_hippcampul_vol', 'Black', 'noapoe', 'age + sex + icv',
  1035. 'wmh_volume_log', 'Black', 'noapoe', 'age + sex + icv',
  1036. #mCAIDE
  1037. 'ef', 'Black', 'mcaide', 'interview_language + apoe + mcaide',
  1038. 'em', 'Black', 'mcaide', 'interview_language + apoe + mcaide',
  1039. 'va', 'Black', 'mcaide', 'interview_language + apoe + mcaide',
  1040. 'mmse_total', 'Black', 'mcaide', 'interview_language + apoe + mcaide',
  1041. 'cdr', 'Black', 'mcaide', 'interview_language + apoe + mcaide',
  1042. 'ab40', 'Black', 'mcaide', 'apoe + eGFR + mcaide',
  1043. 'ab42', 'Black', 'mcaide', 'apoe + eGFR + mcaide',
  1044. 'ab42_ab40', 'Black', 'mcaide', 'apoe + eGFR + mcaide',
  1045. 'tau', 'Black', 'mcaide', 'apoe + eGFR + mcaide',
  1046. 'ptau', 'Black', 'mcaide', 'apoe + eGFR + mcaide',
  1047. 'nfl', 'Black', 'mcaide', 'apoe + eGFR + mcaide',
  1048. 'meta_roi', 'Black', 'mcaide', 'apoe + icv + mcaide',
  1049. 'z_hippcampul_vol', 'Black', 'mcaide', 'apoe + icv + mcaide',
  1050. 'wmh_volume_log', 'Black', 'mcaide', 'apoe + icv + mcaide',
  1051. # LIBRA
  1052. 'ef', 'Black', 'libra', 'interview_language + apoe + libra',
  1053. 'em', 'Black', 'libra', 'interview_language + apoe + libra',
  1054. 'va', 'Black', 'libra', 'interview_language + apoe + libra',
  1055. 'mmse_total', 'Black', 'libra', 'interview_language + apoe + libra',
  1056. 'cdr', 'Black', 'libra', 'interview_language + apoe + libra',
  1057. 'ab40', 'Black', 'libra', 'apoe + libra',
  1058. 'ab42', 'Black', 'libra', 'apoe + libra',
  1059. 'ab42_ab40', 'Black', 'libra', 'apoe + libra',
  1060. 'tau', 'Black', 'libra', 'apoe + libra',
  1061. 'ptau', 'Black', 'libra', 'apoe + libra',
  1062. 'nfl', 'Black', 'libra', 'apoe + libra',
  1063. 'meta_roi', 'Black', 'libra', 'apoe + icv + libra',
  1064. 'z_hippcampul_vol', 'Black', 'libra', 'apoe + icv + libra',
  1065. 'wmh_volume_log', 'Black', 'libra', 'apoe + icv + libra',
  1066. # WHICAP
  1067. 'ef', 'Black', 'whicap', 'interview_language + apoe + whicap',
  1068. 'em', 'Black', 'whicap', 'interview_language + apoe + whicap',
  1069. 'va', 'Black', 'whicap', 'interview_language + apoe + whicap',
  1070. 'mmse_total', 'Black', 'whicap', 'interview_language + apoe + whicap',
  1071. 'cdr', 'Black', 'whicap', 'interview_language + apoe + whicap',
  1072. 'ab40', 'Black', 'whicap', 'apoe + eGFR + whicap',
  1073. 'ab42', 'Black', 'whicap', 'apoe + eGFR + whicap',
  1074. 'ab42_ab40', 'Black', 'whicap', 'apoe + eGFR + whicap',
  1075. 'tau', 'Black', 'whicap', 'apoe + eGFR + whicap',
  1076. 'ptau', 'Black', 'whicap', 'apoe + eGFR + whicap',
  1077. 'nfl', 'Black', 'whicap', 'apoe + eGFR + whicap',
  1078. 'meta_roi', 'Black', 'whicap', 'apoe + icv + whicap',
  1079. 'z_hippcampul_vol', 'Black', 'whicap', 'apoe + icv + whicap',
  1080. 'wmh_volume_log', 'Black', 'whicap', 'apoe + icv + whicap',
  1081. # CogD
  1082. 'ef', 'Black', 'cogd', 'interview_language + apoe + cogd',
  1083. 'em', 'Black', 'cogd', 'interview_language + apoe + cogd',
  1084. 'va', 'Black', 'cogd', 'interview_language + apoe + cogd',
  1085. 'mmse_total', 'Black', 'cogd', 'interview_language + apoe + cogd',
  1086. 'cdr', 'Black', 'cogd', 'interview_language + apoe + cogd',
  1087. 'ab40', 'Black', 'cogd', 'apoe + bmi + eGFR + cogd',
  1088. 'ab42', 'Black', 'cogd', 'apoe + bmi + eGFR + cogd',
  1089. 'ab42_ab40', 'Black', 'cogd', 'apoe + bmi + eGFR + cogd',
  1090. 'tau', 'Black', 'cogd', 'apoe + bmi + eGFR + cogd',
  1091. 'ptau', 'Black', 'cogd', 'apoe + bmi + eGFR + cogd',
  1092. 'nfl', 'Black', 'cogd', 'apoe + bmi + eGFR + cogd',
  1093. 'meta_roi', 'Black', 'cogd', 'apoe + icv + cogd',
  1094. 'z_hippcampul_vol', 'Black', 'cogd', 'apoe + icv + cogd',
  1095. 'wmh_volume_log', 'Black', 'cogd', 'apoe + icv + cogd',
  1096. # Sensitivity analysis
  1097. #LIBRA
  1098. 'ef', 'Black', 'libra_sva', 'interview_language + apoe + libra_sva',
  1099. 'em', 'Black', 'libra_sva', 'interview_language + apoe + libra_sva',
  1100. 'va', 'Black', 'libra_sva', 'interview_language + apoe + libra_sva',
  1101. 'mmse_total', 'Black', 'libra_sva', 'interview_language + apoe + libra_sva',
  1102. 'cdr', 'Black', 'libra_sva', 'interview_language + apoe + libra_sva',
  1103. 'ab40', 'Black', 'libra_sva', 'apoe + libra_sva',
  1104. 'ab42', 'Black', 'libra_sva', 'apoe + libra_sva',
  1105. 'ab42_ab40', 'Black', 'libra_sva', 'apoe + libra_sva',
  1106. 'tau', 'Black', 'libra_sva', 'apoe + libra_sva',
  1107. 'ptau', 'Black', 'libra_sva', 'apoe + libra_sva',
  1108. 'nfl', 'Black', 'libra_sva', 'apoe + libra_sva',
  1109. 'meta_roi', 'Black', 'libra_sva', 'apoe + icv + libra_sva',
  1110. 'z_hippcampul_vol', 'Black', 'libra_sva', 'apoe + icv + libra_sva',
  1111. 'wmh_volume_log', 'Black', 'libra_sva', 'apoe + icv + libra_sva',
  1112. #mCAIDE
  1113. 'ef', 'Black', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  1114. 'em', 'Black', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  1115. 'va', 'Black', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  1116. 'mmse_total', 'Black', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  1117. 'cdr', 'Black', 'mcaide_sva', 'interview_language + apoe + mcaide_sva',
  1118. 'ab40', 'Black', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  1119. 'ab42', 'Black', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  1120. 'ab42_ab40', 'Black', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  1121. 'tau', 'Black', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  1122. 'ptau', 'Black', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  1123. 'nfl', 'Black', 'mcaide_sva', 'apoe + eGFR + mcaide_sva',
  1124. 'meta_roi', 'Black', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  1125. 'z_hippcampul_vol', 'Black', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  1126. 'wmh_volume_log', 'Black', 'mcaide_sva', 'apoe + icv + mcaide_sva',
  1127. #WHICAP
  1128. 'ef', 'Black', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  1129. 'em', 'Black', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  1130. 'va', 'Black', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  1131. 'mmse_total', 'Black', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  1132. 'cdr', 'Black', 'whicap_sva', 'interview_language + apoe + whicap_sva',
  1133. 'ab40', 'Black', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  1134. 'ab42', 'Black', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  1135. 'ab42_ab40', 'Black', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  1136. 'tau', 'Black', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  1137. 'ptau', 'Black', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  1138. 'nfl', 'Black', 'whicap_sva', 'apoe + eGFR + whicap_sva',
  1139. 'meta_roi', 'Black', 'whicap_sva', 'apoe + icv + whicap_sva',
  1140. 'z_hippcampul_vol', 'Black', 'whicap_sva', 'apoe + icv + whicap_sva',
  1141. 'wmh_volume_log', 'Black', 'whicap_sva', 'apoe + icv + whicap_sva',
  1142. #CogD
  1143. 'ef', 'Black', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  1144. 'em', 'Black', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  1145. 'va', 'Black', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  1146. 'mmse_total', 'Black', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  1147. 'cdr', 'Black', 'cogd_sva', 'interview_language + apoe + cogd_sva',
  1148. 'ab40', 'Black', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  1149. 'ab42', 'Black', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  1150. 'ab42_ab40', 'Black', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  1151. 'tau', 'Black', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  1152. 'ptau', 'Black', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  1153. 'nfl', 'Black', 'cogd_sva', 'apoe + eGFR + cogd_sva',
  1154. 'meta_roi', 'Black', 'cogd_sva', 'apoe + icv + cogd_sva',
  1155. 'z_hippcampul_vol', 'Black', 'cogd_sva', 'apoe + icv + cogd_sva',
  1156. 'wmh_volume_log', 'Black', 'cogd_sva', 'apoe + icv + cogd_sva'
  1157. ) %>%
  1158. mutate(eq = glue('{outcome} ~ {predictors}'),
  1159. res = map(eq, lm, data = filter(data, race == "Black")),
  1160. dataf = map(res, tidy),
  1161. mod = map(res, glance),
  1162. r2 = map_dbl(mod, ~ .x$r.squared),
  1163. r2.adj = map_dbl(mod, ~ .x$adj.r.squared),
  1164. n = map_int(res, nobs))
  1165. ```
  1166. ### CDX - Ancestry
  1167. ```{r}
  1168. eur_cdx_prs = tribble( ~outcome, ~pop, ~model, ~predictors,
  1169. #Demographics
  1170. 'cdx_cn_vs_ci', 'NHW', 'base', 'age + sex + apoe + id_education',
  1171. 'cdx_mci_vs_cn', 'NHW', 'base', 'age + sex + apoe + id_education',
  1172. 'cdx_dem_vs_cn', 'NHW', 'base', 'age + sex + apoe + id_education',
  1173. 'cdx_ci_vs_cn', 'NHW', 'base', 'age + sex + apoe + id_education',
  1174. #Demographics
  1175. 'cdx_cn_vs_ci', 'NHW', 'base_noapoe', 'age + sex + id_education',
  1176. 'cdx_mci_vs_cn', 'NHW', 'base_noapoe', 'age + sex + id_education',
  1177. 'cdx_dem_vs_cn', 'NHW', 'base_noapoe', 'age + sex + id_education',
  1178. 'cdx_ci_vs_cn', 'NHW', 'base_noapoe', 'age + sex + id_education',
  1179. #LIBRA
  1180. 'cdx_cn_vs_ci', 'NHW', 'libra', 'apoe + libra',
  1181. 'cdx_mci_vs_cn', 'NHW', 'libra', 'apoe + libra',
  1182. 'cdx_dem_vs_cn', 'NHW', 'libra', 'apoe + libra',
  1183. 'cdx_ci_vs_cn', 'NHW', 'libra', 'apoe + libra',
  1184. #mCAIDE
  1185. 'cdx_cn_vs_ci', 'NHW', 'mcaide', 'apoe + mcaide',
  1186. 'cdx_mci_vs_cn', 'NHW', 'mcaide', 'apoe + mcaide',
  1187. 'cdx_dem_vs_cn', 'NHW', 'mcaide', 'apoe + mcaide',
  1188. 'cdx_ci_vs_cn', 'NHW', 'mcaide', 'apoe + mcaide',
  1189. #WHICAP
  1190. 'cdx_cn_vs_ci', 'NHW', 'whicap', 'apoe + whicap',
  1191. 'cdx_mci_vs_cn', 'NHW', 'whicap', 'apoe + whicap',
  1192. 'cdx_dem_vs_cn', 'NHW', 'whicap', 'apoe + whicap',
  1193. 'cdx_ci_vs_cn', 'NHW', 'whicap', 'apoe + whicap',
  1194. #CogD
  1195. 'cdx_cn_vs_ci', 'NHW', 'cogd', 'apoe + cogd',
  1196. 'cdx_mci_vs_cn', 'NHW', 'cogd', 'apoe + cogd',
  1197. 'cdx_dem_vs_cn', 'NHW', 'cogd', 'apoe + cogd',
  1198. 'cdx_ci_vs_cn', 'NHW', 'cogd', 'apoe + cogd',
  1199. # Sensitivity analysis
  1200. #LIBRA
  1201. 'cdx_cn_vs_ci', 'NHW', 'libra_sva', 'apoe + libra_sva',
  1202. 'cdx_mci_vs_cn', 'NHW', 'libra_sva', 'apoe + libra_sva',
  1203. 'cdx_dem_vs_cn', 'NHW', 'libra_sva', 'apoe + libra_sva',
  1204. 'cdx_ci_vs_cn', 'NHW', 'libra_sva', 'apoe + libra_sva',
  1205. #mCAIDE
  1206. 'cdx_cn_vs_ci', 'NHW', 'mcaide_sva', 'apoe + mcaide_sva',
  1207. 'cdx_mci_vs_cn', 'NHW', 'mcaide_sva', 'apoe + mcaide_sva',
  1208. 'cdx_dem_vs_cn', 'NHW', 'mcaide_sva', 'apoe + mcaide_sva',
  1209. 'cdx_ci_vs_cn', 'NHW', 'mcaide_sva', 'apoe + mcaide_sva',
  1210. #WHICAP
  1211. 'cdx_cn_vs_ci', 'NHW', 'whicap_sva', 'apoe + whicap_sva',
  1212. 'cdx_mci_vs_cn', 'NHW', 'whicap_sva', 'apoe + whicap_sva',
  1213. 'cdx_dem_vs_cn', 'NHW', 'whicap_sva', 'apoe + whicap_sva',
  1214. 'cdx_ci_vs_cn', 'NHW', 'whicap_sva', 'apoe + whicap_sva',
  1215. #CogD
  1216. 'cdx_cn_vs_ci', 'NHW', 'cogd_sva', 'apoe + cogd_sva',
  1217. 'cdx_mci_vs_cn', 'NHW', 'cogd_sva', 'apoe + cogd_sva',
  1218. 'cdx_dem_vs_cn', 'NHW', 'cogd_sva', 'apoe + cogd_sva',
  1219. 'cdx_ci_vs_cn', 'NHW', 'cogd_sva', 'apoe + cogd_sva'
  1220. ) %>%
  1221. mutate(
  1222. eq = glue("{outcome} ~ {predictors}"),
  1223. res = map(eq, glm, data = filter(data, race == "NHW"), family = "binomial"),
  1224. auc = map_dbl(res, ~ {
  1225. y = model.response(model.frame(.x)) # create model.frame(x) which is the exact same data as res
  1226. p = predict(.x, type = "response") # predict fitted probabilities for each outcome
  1227. if (length(unique(y)) > 1) { # if outcome is all 0s or 1s, skip
  1228. as.numeric(pROC::auc(pROC::roc(y, p))) # compute ROC curve then AUC and return numeric number (as.numeric)
  1229. } else {NA_real_}}), # if the outcome has only one class, return NA
  1230. nagelkerke_r2 = map_dbl(res, ~ {
  1231. out = tryCatch(performance::r2_nagelkerke(.x), error = function(e) NA_real_)
  1232. as.numeric(out)}),
  1233. dataf = map(res, tidy),
  1234. mod = map(res, glance),
  1235. n = map_int(res, nobs))
  1236. amr_cdx_prs = tribble( ~outcome, ~pop, ~model, ~predictors,
  1237. #Demographics
  1238. 'cdx_cn_vs_ci', 'Hispanic', 'base', 'age + sex + apoe + id_education',
  1239. 'cdx_mci_vs_cn', 'Hispanic', 'base', 'age + sex + apoe + id_education',
  1240. 'cdx_dem_vs_cn', 'Hispanic', 'base', 'age + sex + apoe + id_education',
  1241. 'cdx_ci_vs_cn', 'Hispanic', 'base', 'age + sex + apoe + id_education',
  1242. #Demographics
  1243. 'cdx_cn_vs_ci', 'Hispanic', 'base_noapoe', 'age + sex + id_education',
  1244. 'cdx_mci_vs_cn', 'Hispanic', 'base_noapoe', 'age + sex + id_education',
  1245. 'cdx_dem_vs_cn', 'Hispanic', 'base_noapoe', 'age + sex + id_education',
  1246. 'cdx_ci_vs_cn', 'Hispanic', 'base_noapoe', 'age + sex + id_education',
  1247. #LIBRA
  1248. 'cdx_cn_vs_ci', 'Hispanic', 'libra', 'apoe + libra',
  1249. 'cdx_mci_vs_cn', 'Hispanic', 'libra', 'apoe + libra',
  1250. 'cdx_dem_vs_cn', 'Hispanic', 'libra', 'apoe + libra',
  1251. 'cdx_ci_vs_cn', 'Hispanic', 'libra', 'apoe + libra',
  1252. #mCAIDE
  1253. 'cdx_cn_vs_ci', 'Hispanic', 'mcaide', 'apoe + mcaide',
  1254. 'cdx_mci_vs_cn', 'Hispanic', 'mcaide', 'apoe + mcaide',
  1255. 'cdx_dem_vs_cn', 'Hispanic', 'mcaide', 'apoe + mcaide',
  1256. 'cdx_ci_vs_cn', 'Hispanic', 'mcaide', 'apoe + mcaide',
  1257. #WHICAP
  1258. 'cdx_cn_vs_ci', 'Hispanic', 'whicap', 'apoe + whicap',
  1259. 'cdx_mci_vs_cn', 'Hispanic', 'whicap', 'apoe + whicap',
  1260. 'cdx_dem_vs_cn', 'Hispanic', 'whicap', 'apoe + whicap',
  1261. 'cdx_ci_vs_cn', 'Hispanic', 'whicap', 'apoe + whicap',
  1262. #CogD
  1263. 'cdx_cn_vs_ci', 'Hispanic', 'cogd', 'apoe + cogd',
  1264. 'cdx_mci_vs_cn', 'Hispanic', 'cogd', 'apoe + cogd',
  1265. 'cdx_dem_vs_cn', 'Hispanic', 'cogd', 'apoe + cogd',
  1266. 'cdx_ci_vs_cn', 'Hispanic', 'cogd', 'apoe + cogd',
  1267. # Sensitivity analysis
  1268. #LIBRA
  1269. 'cdx_cn_vs_ci', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  1270. 'cdx_mci_vs_cn', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  1271. 'cdx_dem_vs_cn', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  1272. 'cdx_ci_vs_cn', 'Hispanic', 'libra_sva', 'apoe + libra_sva',
  1273. #mCAIDE
  1274. 'cdx_cn_vs_ci', 'Hispanic', 'mcaide_sva', 'apoe + mcaide_sva',
  1275. 'cdx_mci_vs_cn', 'Hispanic', 'mcaide_sva', 'apoe + mcaide_sva',
  1276. 'cdx_dem_vs_cn', 'Hispanic', 'mcaide_sva', 'apoe + mcaide_sva',
  1277. 'cdx_ci_vs_cn', 'Hispanic', 'mcaide_sva', 'apoe + mcaide_sva',
  1278. #WHICAP
  1279. 'cdx_cn_vs_ci', 'Hispanic', 'whicap_sva', 'apoe + whicap_sva',
  1280. 'cdx_mci_vs_cn', 'Hispanic', 'whicap_sva', 'apoe + whicap_sva',
  1281. 'cdx_dem_vs_cn', 'Hispanic', 'whicap_sva', 'apoe + whicap_sva',
  1282. 'cdx_ci_vs_cn', 'Hispanic', 'whicap_sva', 'apoe + whicap_sva',
  1283. #CogD
  1284. 'cdx_cn_vs_ci', 'Hispanic', 'cogd_sva', 'apoe + cogd_sva',
  1285. 'cdx_mci_vs_cn', 'Hispanic', 'cogd_sva', 'apoe + cogd_sva',
  1286. 'cdx_dem_vs_cn', 'Hispanic', 'cogd_sva', 'apoe + cogd_sva',
  1287. 'cdx_ci_vs_cn', 'Hispanic', 'cogd_sva', 'apoe + cogd_sva'
  1288. ) %>%
  1289. mutate(
  1290. eq = glue("{outcome} ~ {predictors}"),
  1291. res = map(eq, glm, data = filter(data, race == "Hispanic"), family = "binomial"),
  1292. auc = map_dbl(res, ~ {
  1293. y = model.response(model.frame(.x)) # create model.frame(x) which is the exact same data as res
  1294. p = predict(.x, type = "response") # predict fitted probabilities for each outcome
  1295. if (length(unique(y)) > 1) { # if outcome is all 0s or 1s, skip
  1296. as.numeric(pROC::auc(pROC::roc(y, p))) # compute ROC curve then AUC and return numeric number (as.numeric)
  1297. } else {NA_real_}}), # if the outcome has only one class, return NA
  1298. nagelkerke_r2 = map_dbl(res, ~ {
  1299. out = tryCatch(performance::r2_nagelkerke(.x), error = function(e) NA_real_)
  1300. as.numeric(out)}),
  1301. dataf = map(res, tidy),
  1302. mod = map(res, glance),
  1303. n = map_int(res, nobs))
  1304. afr_cdx_prs = tribble(~outcome, ~pop, ~model, ~predictors,
  1305. #Demographics
  1306. 'cdx_cn_vs_ci', 'Black', 'base', 'age + sex + apoe + id_education',
  1307. 'cdx_mci_vs_cn', 'Black', 'base', 'age + sex + apoe + id_education',
  1308. 'cdx_dem_vs_cn', 'Black', 'base', 'age + sex + apoe + id_education',
  1309. 'cdx_ci_vs_cn', 'Black', 'base', 'age + sex + apoe + id_education',
  1310. #Demographics
  1311. 'cdx_cn_vs_ci', 'Black', 'base_noapoe', 'age + sex + id_education',
  1312. 'cdx_mci_vs_cn', 'Black', 'base_noapoe', 'age + sex + id_education',
  1313. 'cdx_dem_vs_cn', 'Black', 'base_noapoe', 'age + sex + id_education',
  1314. 'cdx_ci_vs_cn', 'Black', 'base_noapoe', 'age + sex + id_education',
  1315. #LIBRA
  1316. 'cdx_cn_vs_ci', 'Black', 'libra', 'apoe + libra',
  1317. 'cdx_mci_vs_cn', 'Black', 'libra', 'apoe + libra',
  1318. 'cdx_dem_vs_cn', 'Black', 'libra', 'apoe + libra',
  1319. 'cdx_ci_vs_cn', 'Black', 'libra', 'apoe + libra',
  1320. #mCAIDE
  1321. 'cdx_cn_vs_ci', 'Black', 'mcaide', 'apoe + mcaide',
  1322. 'cdx_mci_vs_cn', 'Black', 'mcaide', 'apoe + mcaide',
  1323. 'cdx_dem_vs_cn', 'Black', 'mcaide', 'apoe + mcaide',
  1324. 'cdx_ci_vs_cn', 'Black', 'mcaide', 'apoe + mcaide',
  1325. #WHICAP
  1326. 'cdx_cn_vs_ci', 'Black', 'whicap', 'apoe + whicap',
  1327. 'cdx_mci_vs_cn', 'Black', 'whicap', 'apoe + whicap',
  1328. 'cdx_dem_vs_cn', 'Black', 'whicap', 'apoe + whicap',
  1329. 'cdx_ci_vs_cn', 'Black', 'whicap', 'apoe + whicap',
  1330. #CogD
  1331. 'cdx_cn_vs_ci', 'Black', 'cogd', 'apoe + cogd',
  1332. 'cdx_mci_vs_cn', 'Black', 'cogd', 'apoe + cogd',
  1333. 'cdx_dem_vs_cn', 'Black', 'cogd', 'apoe + cogd',
  1334. 'cdx_ci_vs_cn', 'Black', 'cogd', 'apoe + cogd',
  1335. # Sensitivity analysis
  1336. #LIBRA
  1337. 'cdx_cn_vs_ci', 'Black', 'libra_sva', 'apoe + libra_sva',
  1338. 'cdx_mci_vs_cn', 'Black', 'libra_sva', 'apoe + libra_sva',
  1339. 'cdx_dem_vs_cn', 'Black', 'libra_sva', 'apoe + libra_sva',
  1340. 'cdx_ci_vs_cn', 'Black', 'libra_sva', 'apoe + libra_sva',
  1341. #mCAIDE
  1342. 'cdx_cn_vs_ci', 'Black', 'mcaide_sva', 'apoe + mcaide_sva',
  1343. 'cdx_mci_vs_cn', 'Black', 'mcaide_sva', 'apoe + mcaide_sva',
  1344. 'cdx_dem_vs_cn', 'Black', 'mcaide_sva', 'apoe + mcaide_sva',
  1345. 'cdx_ci_vs_cn', 'Black', 'mcaide_sva', 'apoe + mcaide_sva',
  1346. #WHICAP
  1347. 'cdx_cn_vs_ci', 'Black', 'whicap_sva', 'apoe + whicap_sva',
  1348. 'cdx_mci_vs_cn', 'Black', 'whicap_sva', 'apoe + whicap_sva',
  1349. 'cdx_dem_vs_cn', 'Black', 'whicap_sva', 'apoe + whicap_sva',
  1350. 'cdx_ci_vs_cn', 'Black', 'whicap_sva', 'apoe + whicap_sva',
  1351. #CogD
  1352. 'cdx_cn_vs_ci', 'Black', 'cogd_sva', 'apoe + cogd_sva',
  1353. 'cdx_mci_vs_cn', 'Black', 'cogd_sva', 'apoe + cogd_sva',
  1354. 'cdx_dem_vs_cn', 'Black', 'cogd_sva', 'apoe + cogd_sva',
  1355. 'cdx_ci_vs_cn', 'Black', 'cogd_sva', 'apoe + cogd_sva'
  1356. ) %>%
  1357. mutate(
  1358. eq = glue("{outcome} ~ {predictors}"),
  1359. res = map(eq, glm, data = filter(data, race == "Black"), family = "binomial"),
  1360. auc = map_dbl(res, ~ {
  1361. y = model.response(model.frame(.x)) # create model.frame(x) which is the exact same data as res
  1362. p = predict(.x, type = "response") # predict fitted probabilities for each outcome
  1363. if (length(unique(y)) > 1) { # if outcome is all 0s or 1s, skip
  1364. as.numeric(pROC::auc(pROC::roc(y, p))) # compute ROC curve then AUC and return numeric number (as.numeric)
  1365. } else {NA_real_}}), # if the outcome has only one class, return NA
  1366. nagelkerke_r2 = map_dbl(res, ~ {
  1367. out = tryCatch(performance::r2_nagelkerke(.x), error = function(e) NA_real_)
  1368. as.numeric(out)}),
  1369. dataf = map(res, tidy),
  1370. mod = map(res, glance),
  1371. n = map_int(res, nobs))
  1372. ```
  1373. ### Coefficients
  1374. ```{r}
  1375. res_crs = bind_rows(
  1376. select(all_num_prs, model, pop, outcome, dataf, res),
  1377. select(all_cdx_prs, model, pop, outcome, dataf, res),
  1378. select(eur_num_prs, model, outcome, pop, dataf, res),
  1379. select(amr_num_prs, model, outcome, pop, dataf, res),
  1380. select(afr_num_prs, model, outcome, pop, dataf, res),
  1381. select(eur_cdx_prs, model, outcome, pop, dataf, res),
  1382. select(amr_cdx_prs, model, outcome, pop, dataf, res),
  1383. select(afr_cdx_prs, model, outcome, pop, dataf, res)
  1384. ) %>%
  1385. unnest(dataf) %>%
  1386. mutate(std_params = map(res, ~ standardize_parameters(.x, method = "posthoc"))) %>%
  1387. unnest(std_params) %>%
  1388. select(-c(res, CI)) %>%
  1389. filter(term %in% c("cogd", "libra", "whicap", "mcaide")) %>%
  1390. filter(!outcome %in% c("cdx_hypertension", "cdx_dyslipidemia", "cdx_diabetes", "bmi", "cdx_anxiety", "cdx_depression", "cdx_cvd", "wmh_volume_log")) %>%
  1391. arrange(pop, term, Std_Coefficient) %>%
  1392. mutate(
  1393. p.fdr = p.adjust(p.value, method = "fdr"),
  1394. sig_fdr = ifelse(p.fdr < 0.05, TRUE, FALSE),
  1395. sig = ifelse(p.value < 0.05, TRUE, FALSE),
  1396. conf.low = estimate - (std.error * 1.96),
  1397. conf.high = estimate + (std.error * 1.96),
  1398. lci = exp(conf.low),
  1399. uci = exp(conf.high),
  1400. or = exp(estimate),
  1401. category = case_when(
  1402. outcome %in% c("va", "em", "ef", "mmse_total", "cdr") ~ "Cognitive \nFunction",
  1403. outcome %in% c("tau", "ptau", "nfl", "ab42", "ab40", "ab42_ab40") ~ "Plasma \nBiomarkers",
  1404. outcome %in% c("meta_roi", "z_hippcampul_vol") ~ "Neuroimaging",
  1405. outcome %in% c("cdx_cn_vs_ci", "cdx_mci_vs_cn", "cdx_dem_vs_cn", "cdx_ci_vs_cn") ~ "Medical \nHistory"),
  1406. lab = fct_recode(
  1407. outcome,
  1408. MMSE = "mmse_total",
  1409. CDR = "cdr",
  1410. "Executive\n Function" = "ef",
  1411. "Verbal\n Ability" = "va",
  1412. Memory = "em",
  1413. "Cortical \nThickness" = "meta_roi",
  1414. "Hippo. \nVolume" = "z_hippcampul_vol",
  1415. "Aβ40" = "ab40",
  1416. "Aβ42" = "ab42",
  1417. "Aβ42/Aβ40" = "ab42_ab40",
  1418. "Total Tau" = "tau",
  1419. "pTau" = "ptau",
  1420. NfL = "nfl",
  1421. Healthy = "cdx_cn_vs_ci",
  1422. MCI = "cdx_mci_vs_cn",
  1423. Dementia = "cdx_dem_vs_cn",
  1424. "Cog. Impair." = "cdx_ci_vs_cn"
  1425. ),
  1426. lab = fct_inorder(lab))
  1427. res_crs_sva = bind_rows(
  1428. select(all_num_prs, model, pop, outcome, dataf, res),
  1429. select(all_cdx_prs, model, pop, outcome, dataf, res),
  1430. select(eur_num_prs, model, outcome, pop, dataf, res),
  1431. select(amr_num_prs, model, outcome, pop, dataf, res),
  1432. select(afr_num_prs, model, outcome, pop, dataf, res),
  1433. select(eur_cdx_prs, model, outcome, pop, dataf, res),
  1434. select(amr_cdx_prs, model, outcome, pop, dataf, res),
  1435. select(afr_cdx_prs, model, outcome, pop, dataf, res)
  1436. ) %>%
  1437. unnest(dataf) %>%
  1438. mutate(std_params = map(res, ~ standardize_parameters(.x, method = "posthoc"))) %>%
  1439. unnest(std_params) %>%
  1440. select(-c(res, CI)) %>%
  1441. filter(term %in% c("cogd_sva", "whicap_sva", "mcaide_sva")) %>%
  1442. filter(!outcome %in% c("cdx_hypertension", "cdx_dyslipidemia", "cdx_diabetes", "bmi", "cdx_anxiety", "cdx_depression", "cdx_cvd", "wmh_volume_log")) %>%
  1443. arrange(pop, term, estimate) %>%
  1444. mutate(
  1445. p.fdr = p.adjust(p.value, method = "fdr"),
  1446. sig_fdr = ifelse(p.fdr < 0.05, TRUE, FALSE),
  1447. sig = ifelse(p.value < 0.05, TRUE, FALSE),
  1448. conf.low = estimate - (std.error * 1.96),
  1449. conf.high = estimate + (std.error * 1.96),
  1450. lci = exp(conf.low),
  1451. uci = exp(conf.high),
  1452. or = exp(estimate),
  1453. category = case_when(
  1454. outcome %in% c("va", "em", "ef", "mmse_total", "cdr") ~ "Cognitive \nFunction",
  1455. outcome %in% c("tau", "ptau", "nfl", "ab42", "ab40", "ab42_ab40") ~ "Plasma \nBiomarkers",
  1456. outcome %in% c("meta_roi", "z_hippcampul_vol") ~ "Neuroimaging",
  1457. outcome %in% c("cdx_cn_vs_ci", "cdx_mci_vs_cn", "cdx_dem_vs_cn", "cdx_ci_vs_cn") ~ "Medical \nHistory"),
  1458. outcome = factor(outcome, levels = c(
  1459. "cdx_hypertension", "cdx_dyslipidemia", "cdx_diabetes", "cdx_cvd",
  1460. "cdx_anxiety", "cdx_depression", "bmi",
  1461. "mmse_total", "cdr", "ef", "va", "em",
  1462. "meta_roi", "z_hippcampul_vol",
  1463. "ab40", "ab42", "ab42_ab40", "tau", "ptau", "nfl",
  1464. "cdx_mci_vs_cn", "cdx_dem_vs_cn", "cdx_ci_vs_cn")),
  1465. lab = fct_recode(
  1466. outcome,
  1467. MMSE = "mmse_total",
  1468. CDR = "cdr",
  1469. "Executive\n Function" = "ef",
  1470. "Verbal\n Ability" = "va",
  1471. Memory = "em",
  1472. "Cortical \nThickness" = "meta_roi",
  1473. "Hippo. \nVolume" = "z_hippcampul_vol",
  1474. "Aβ40" = "ab40",
  1475. "Aβ42" = "ab42",
  1476. "Aβ42/Aβ40" = "ab42_ab40",
  1477. "Total Tau" = "tau",
  1478. "pTau" = "ptau",
  1479. NfL = "nfl",
  1480. Healthy = "cdx_cn_vs_ci",
  1481. MCI = "cdx_mci_vs_cn",
  1482. Dementia = "cdx_dem_vs_cn",
  1483. "Cog. Impair." = "cdx_ci_vs_cn"
  1484. ),
  1485. lab = fct_inorder(lab))
  1486. ```
  1487. ### Z-test
  1488. ```{r}
  1489. compare_coefs = function(b1, b2, se1, se2, return_pval = FALSE) {
  1490. z = (b1 - b2) / sqrt(se1^2 + se2^2)
  1491. if (return_pval) {
  1492. return(2 * (1 - pnorm(abs(z))))
  1493. } else {
  1494. return(z)
  1495. }
  1496. }
  1497. res_diff = res_crs %>%
  1498. filter(Parameter %in% c("mcaide", "cogd", "libra", "whicap")) %>%
  1499. select(term, lab, pop, Std_Coefficient, std.error, category) %>%
  1500. filter(!lab %in% c("Aβ42", "Aβ40")) %>%
  1501. group_by(term, lab, category) %>%
  1502. group_modify(~ {
  1503. pops = unique(.x$pop[.x$pop != "all"])
  1504. if(length(pops) < 2) return(tibble())
  1505. pairs = t(combn(pops, 2)) %>% as.data.frame()
  1506. colnames(pairs) = c("pop1", "pop2")
  1507. map_dfr(1:nrow(pairs), function(i) {
  1508. p1 = pairs$pop1[i]
  1509. p2 = pairs$pop2[i]
  1510. b1 = .x$Std_Coefficient[.x$pop == p1]
  1511. b2 = .x$Std_Coefficient[.x$pop == p2]
  1512. se1 = .x$std.error[.x$pop == p1]
  1513. se2 = .x$std.error[.x$pop == p2]
  1514. z = compare_coefs(b1, b2, se1, se2)
  1515. p = compare_coefs(b1, b2, se1, se2, return_pval = TRUE)
  1516. tibble(
  1517. pop1 = p1,
  1518. pop2 = p2,
  1519. z_score = z,
  1520. p_diff = p
  1521. )
  1522. })
  1523. }) %>%
  1524. ungroup() %>%
  1525. mutate(p_diff_fdr = p.adjust(p_diff, method = "fdr")) %>%
  1526. mutate(
  1527. term = recode(term, mcaide = "mCAIDE", whicap = "WHICAP", libra = "LIBRA", cogd = "CogDrisk"),
  1528. term = factor(term, levels = c("mCAIDE", "WHICAP", "LIBRA", "CogDrisk")),
  1529. pop1 = recode(pop1, "Black" = "AA", "Hispanic" = "LA", "NHW" = "NHW"),
  1530. pop2 = recode(pop2, "Black" = "AA", "Hispanic" = "LA", "NHW" = "NHW"),
  1531. pop1 = factor(pop1, levels = c("NHW", "LA", "AA")),
  1532. pop2 = factor(pop2, levels = c("NHW", "LA", "AA"))) %>%
  1533. droplevels()
  1534. res_diff = res_diff %>%
  1535. mutate(label = case_when(p_diff_fdr < 0.001 ~ "***", p_diff_fdr < 0.01 ~ "**", p_diff_fdr < 0.05 ~ "*")) %>%
  1536. rename(
  1537. Model = term,
  1538. Outcome = lab,
  1539. Category = category,
  1540. Pop1 = pop1,
  1541. Pop2 = pop2,
  1542. `Z-score` = z_score,
  1543. `P-Value` = p_diff,
  1544. `P-Value FDR. adj.` = p_diff_fdr,
  1545. Significance = label
  1546. )
  1547. res_sig = res_diff %>%
  1548. filter(p_diff_fdr < 0.05, (pop1 == "NHW" | pop2 == "NHW"))
  1549. res_diff_all = res_all %>%
  1550. select(term, outcome, pop, Std_Coefficient, std.error) %>%
  1551. filter(outcome != "cdx_cn_vs_ci") %>%
  1552. group_by(term, outcome) %>%
  1553. group_modify(~ {
  1554. pops = unique(.x$pop)
  1555. pairs = t(combn(pops, 2)) %>% as.data.frame()
  1556. colnames(pairs) = c("pop1", "pop2")
  1557. map_dfr(1:nrow(pairs), function(i) {
  1558. p1 = pairs$pop1[i]
  1559. p2 = pairs$pop2[i]
  1560. b1 = .x$Std_Coefficient[.x$pop == p1]
  1561. b2 = .x$Std_Coefficient[.x$pop == p2]
  1562. se1 = .x$std.error[.x$pop == p1]
  1563. se2 = .x$std.error[.x$pop == p2]
  1564. z = compare_coefs(b1, b2, se1, se2)
  1565. p = compare_coefs(b1, b2, se1, se2, return_pval = TRUE)
  1566. tibble(
  1567. pop1 = p1,
  1568. pop2 = p2,
  1569. z_score = z,
  1570. p_diff = p)
  1571. })
  1572. }) %>%
  1573. ungroup() %>%
  1574. mutate(p_diff_fdr = p.adjust(p_diff, method = "fdr"))
  1575. ```
  1576. ```{r}
  1577. # publication table - main + sensitivity analysis
  1578. coef_table_pred = bind_rows(res_crs, res_crs_sva) %>%
  1579. select(pop, term, category, lab, p.value, p.fdr, Parameter, Std_Coefficient, CI_low, CI_high) %>%
  1580. filter(Parameter %in% c("cogd", "libra", "whicap", "mcaide", "cogd_sva", "whicap_sva", "mcaide_sva")) %>%
  1581. filter(!lab %in% c("Healthy", "Aβ42", "Aβ40")) %>%
  1582. mutate(term = recode(term,
  1583. "cogd" = "CogDRisk",
  1584. "libra" = "LIBRA",
  1585. "whicap" = "WHICAP",
  1586. "mcaide" = "mCAIDE",
  1587. "cogd_sva" = "CogDRisk (sensitivity)",
  1588. "libra_sva" = "LIBRA (sensitivity)",
  1589. "whicap_sva" = "WHICAP (sensitivity)",
  1590. "mcaide_sva" = "mCAIDE (sensitivity)"),
  1591. lab = fct_recode(lab,
  1592. "Executive Function" = "Executive\n Function",
  1593. "Verbal Ability" = "Verbal\n Ability",
  1594. "Cortical Thickness" = "Cortical \nThickness",
  1595. "Hippocampal Volume" = "Hippo. \nVolume")
  1596. ) %>%
  1597. rename(
  1598. Race = pop,
  1599. CRS = term,
  1600. Category = category,
  1601. Outcome = lab,
  1602. `P-value` = p.value,
  1603. `P-value, FDR adj.` = p.fdr,
  1604. β = Std_Coefficient,
  1605. `Lower Conf. Interval` = CI_low,
  1606. `Upper Conf. Interval` = CI_high
  1607. ) %>%
  1608. select(-Parameter)
  1609. ```
  1610. ### OR
  1611. ```{r}
  1612. # diagnosis only
  1613. color = c(AA = "#E41A1C", LA = "#377EB8", NHW = "#984EA3", all = "black")
  1614. diagnosis = ggplot(res_crs %>%
  1615. filter(
  1616. pop == "all",
  1617. outcome %in% c("cdx_mci_vs_cn", "cdx_dem_vs_cn", "cdx_ci_vs_cn"),
  1618. term %in% c("mcaide", "whicap", "libra", "cogd")) %>%
  1619. mutate(
  1620. outcome = recode(outcome,
  1621. cdx_mci_vs_cn = "MCI",
  1622. cdx_dem_vs_cn = "Dementia",
  1623. cdx_ci_vs_cn = "MCI + Dementia"),
  1624. term = recode(term,
  1625. mcaide = "mCAIDE",
  1626. whicap = "WHICAP",
  1627. libra = "LIBRA",
  1628. cogd = "CogDrisk"),
  1629. outcome = factor(outcome, levels = c("MCI", "Dementia", "MCI + Dementia")),
  1630. term = factor(term, levels = c("mCAIDE", "WHICAP", "LIBRA", "CogDrisk")),
  1631. sig_fdr = factor(sig_fdr, levels = c(TRUE, FALSE))
  1632. ),
  1633. aes(x = outcome, y = or, color = term, group = term, alpha = sig_fdr)) +
  1634. geom_point(position = position_dodge(width = 0.5), size = 1.5) +
  1635. geom_errorbar(aes(ymin = lci, ymax = uci),
  1636. position = position_dodge(width = 0.5),
  1637. width = 0, size = 0.8) +
  1638. geom_hline(yintercept = 1, linetype = 2) +
  1639. scale_alpha_manual(values = c(`TRUE` = 1, `FALSE` = 0.1)) +
  1640. scale_color_manual(values = c("mCAIDE" = "#003DE6",
  1641. "WHICAP" = "#d95f02",
  1642. "LIBRA" = "#F22424",
  1643. "CogDrisk" = "#005713")) +
  1644. ggtitle("All") +
  1645. labs(x = "", y = "Odds Ratio", color = "CRS", alpha = "FDR p < 0.05") +
  1646. theme_bw() +
  1647. theme(
  1648. axis.text.x = element_text(size = 8, angle = 0, hjust = 0.5),
  1649. axis.text.y = element_text(size = 8),
  1650. axis.title = element_text(size = 8),
  1651. plot.title = element_text(size = 10, face = "bold", hjust = 0.5),
  1652. legend.title = element_text(size = 8),
  1653. legend.position = "none",
  1654. strip.background = element_blank(),
  1655. strip.text = element_text(face = "bold", size = 10)
  1656. )
  1657. diagnosis_race = ggplot(res_crs %>%
  1658. filter(outcome %in% c("cdx_mci_vs_cn", "cdx_dem_vs_cn", "cdx_ci_vs_cn"),
  1659. term %in% c("mcaide", "whicap", "libra", "cogd")) %>%
  1660. mutate(
  1661. outcome = recode(outcome,
  1662. cdx_mci_vs_cn = "MCI",
  1663. cdx_dem_vs_cn = "Dementia",
  1664. cdx_ci_vs_cn = "MCI + Dementia"),
  1665. outcome = factor(outcome, levels = c("MCI", "Dementia", "MCI + Dementia")),
  1666. term = recode(term,
  1667. mcaide = "mCAIDE",
  1668. whicap = "WHICAP",
  1669. libra = "LIBRA",
  1670. cogd = "CogDrisk"),
  1671. term = factor(term, levels = c("mCAIDE", "WHICAP", "LIBRA", "CogDrisk")),
  1672. pop = recode(pop, "Black" = "AA", "Hispanic" = "LA", "NHW" = "NHW", "all" = "all"),
  1673. pop = factor(pop, levels = c("NHW", "LA", "AA", "all")),
  1674. sig_fdr = factor(sig_fdr, levels = c(TRUE, FALSE))
  1675. ),
  1676. aes(x = outcome, y = or, color = pop, alpha = sig_fdr)) +
  1677. geom_point(aes(group = interaction(term, pop)),
  1678. position = position_dodge(width = 0.6), size = 1.5) +
  1679. geom_errorbar(aes(ymin = lci, ymax = uci, group = interaction(term, pop)),
  1680. position = position_dodge(width = 0.6), width = 0, size = 0.8) +
  1681. geom_hline(yintercept = 1, linetype = 2) +
  1682. scale_alpha_manual(values = c(`TRUE` = 1, `FALSE` = 0.1)) +
  1683. scale_color_manual(values = color) +
  1684. labs(x = "", y = "OR (95% CI)", color = "Population", alpha = "FDR p < 0.05") +
  1685. facet_wrap(~term, nrow = 1) +
  1686. theme_bw() +
  1687. theme(
  1688. axis.text.x = element_text(size = 6, angle = 0, hjust = 0.5),
  1689. axis.text.y = element_text(size = 8),
  1690. axis.title = element_text(size = 8),
  1691. plot.title = element_text(size = 8, hjust = 0.5),
  1692. legend.position = "bottom",
  1693. strip.background = element_blank(),
  1694. strip.text = element_text(face = "bold", size = 10)
  1695. )
  1696. plot_all = res_crs %>%
  1697. filter(Parameter %in% c("mcaide", "whicap", "libra", "cogd"),
  1698. category %in% c("Neuroimaging", "Plasma \nBiomarkers", "Cognitive \nFunction")) %>%
  1699. filter(lab != "Aβ42", lab != "Aβ40") %>%
  1700. mutate(
  1701. pop = recode(pop, "Black" = "AA", "Hispanic" = "LA", "NHW" = "NHW", "all" = "all"),
  1702. pop = factor(pop, levels = c("NHW", "LA", "AA", "all")),
  1703. sig_fdr = factor(sig_fdr, levels = c(TRUE, FALSE)),
  1704. Parameter = recode(Parameter,
  1705. "mcaide" = "mCAIDE",
  1706. "whicap" = "WHICAP",
  1707. "libra" = "LIBRA",
  1708. "cogd" = "CogDRisk"),
  1709. Parameter = factor(Parameter, levels = c(
  1710. "mCAIDE", "WHICAP", "LIBRA", "CogDRisk")),
  1711. category = recode(category,
  1712. "Neuroimaging" = "Neuroimaging",
  1713. "Plasma \nBiomarkers" = "Plasma Biomarkers",
  1714. "Cognitive \nFunction" = "Cognitive Function"),
  1715. lab = recode(lab, "Hippo. \nVolume" = "Hippocampal \nVolume",
  1716. "WMH" = "White Matter \nHyperintensity"),
  1717. lab = factor(lab, levels = c(
  1718. "MMSE", "CDR", "Memory", "Verbal\n Ability", "Executive\n Function",
  1719. "Hippocampal \nVolume", "Cortical \nThickness",
  1720. "NfL", "Total Tau", "pTau", "Aβ42/Aβ40"))) %>%
  1721. ggplot(aes(x = lab, y = Std_Coefficient, color = pop, alpha = sig_fdr)) +
  1722. geom_hline(yintercept = 0, linetype = 2) +
  1723. geom_point(position = position_dodge(width = 0.6), size = 1.5) +
  1724. geom_errorbar(aes(ymin = CI_low, ymax = CI_high),
  1725. position = position_dodge(width = 0.6), width = 0, size = 0.8) +
  1726. facet_grid(Parameter ~ category, scales = "free", space = "free_x") +
  1727. scale_color_manual(values = color) +
  1728. scale_alpha_manual(values = c(`TRUE` = 1, `FALSE` = 0.3)) +
  1729. #scale_y_continuous(limits = c(-0.52, 0.48), breaks = seq(-0.5, 0.5, 0.25)) +
  1730. labs(
  1731. x = "",
  1732. y = "Beta (95% CI)",
  1733. color = "Population",
  1734. alpha = "FDR p < 0.05"
  1735. ) +
  1736. theme_bw() +
  1737. theme(
  1738. axis.text.x = element_text(size = 8, angle = 45, hjust = 1),
  1739. axis.text.y = element_text(size = 8),
  1740. axis.title = element_text(size = 8),
  1741. strip.background = element_blank(),
  1742. strip.text = element_text(face = "bold", size = 10),
  1743. legend.text = element_text(size = 10),
  1744. legend.title = element_text(size = 10),
  1745. legend.position = "bottom")
  1746. ```
  1747. ### AUC + R2
  1748. ```{r}
  1749. adjust_crs = function(df_models, pop_label = NULL) {
  1750. df_data = if (!is.null(pop_label)) data %>% filter(pop == pop_label) else data
  1751. df_models %>%
  1752. mutate(
  1753. pop = ifelse(is.null(pop_label), "ALL", pop_label),
  1754. eq_crs_only = case_when(
  1755. model %in% c("base", "base_noapoe") ~ eq,
  1756. TRUE ~ str_replace(eq, "apoe \\+ ", "")
  1757. ),
  1758. res_crs_only = map(eq_crs_only, ~ glm(.x, data = df_data, family = binomial)),
  1759. auc_crs_only = map_dbl(res_crs_only, ~ {
  1760. y = model.response(model.frame(.x))
  1761. p = predict(.x, type = "response")
  1762. if (length(unique(y)) > 1) pROC::auc(pROC::roc(y, p)) else NA_real_
  1763. }),
  1764. nagelkerker2_crs_only = map_dbl(res_crs_only, ~ {
  1765. if (length(unique(model.response(model.frame(.x)))) > 1)
  1766. pscl::pR2(.x)[["McFadden"]]
  1767. else NA_real_
  1768. })
  1769. )
  1770. }
  1771. afr_cdx_prs2 = adjust_crs(afr_cdx_prs, pop_label = "AFR") %>% mutate(pop = "Black")
  1772. amr_cdx_prs2 = adjust_crs(amr_cdx_prs, pop_label = "AMR") %>% mutate(pop = "Hispanic")
  1773. eur_cdx_prs2 = adjust_crs(eur_cdx_prs, pop_label = "EUR") %>% mutate(pop = "NHW")
  1774. all_cdx_prs2 = adjust_crs(all_cdx_prs) %>% mutate(pop = "all")
  1775. all_comb_cdx2 = bind_rows(all_cdx_prs2, afr_cdx_prs2, amr_cdx_prs2, eur_cdx_prs2)
  1776. plot_roc_outcome = function(df, outcome_name, crs_type = "CRS", pop_filter = NULL) {
  1777. crs_colors = c(
  1778. "Demographics+APOE" = "#7A3900",
  1779. "Demographics" = "#7A1100",
  1780. "mCAIDE" = "#003DE6",
  1781. "mCAIDE-" = "#003DE6",
  1782. "WHICAP" = "#d95f02",
  1783. "WHICAP-" = "#d95f02",
  1784. "LIBRA" = "#F22424",
  1785. "LIBRA-" = "#F22424",
  1786. "CogDRisk" = "#005713",
  1787. "CogDRisk-" = "#005713"
  1788. )
  1789. df_out = df %>% filter(outcome == outcome_name)
  1790. if (!is.null(pop_filter)) df_out = df_out %>% filter(pop == pop_filter)
  1791. df_out = df_out %>%
  1792. mutate(
  1793. outcome = recode(outcome,
  1794. "cdx_mci_vs_cn" = "MCI",
  1795. "cdx_dem_vs_cn" = "Dementia",
  1796. "cdx_ci_vs_cn" = "MCI + Dementia"),
  1797. model = recode(model,
  1798. "base" = "Demographics+APOE",
  1799. "base_noapoe" = "Demographics",
  1800. "libra" = "LIBRA",
  1801. "mcaide" = "mCAIDE",
  1802. "whicap" = "WHICAP",
  1803. "cogd" = "CogDRisk",
  1804. "libra_sva" = "LIBRA-",
  1805. "mcaide_sva" = "mCAIDE-",
  1806. "whicap_sva" = "WHICAP-",
  1807. "cogd_sva" = "CogDRisk-")) %>%
  1808. mutate(model = factor(model, levels = c(
  1809. "CogDRisk", "LIBRA", "WHICAP", "mCAIDE", "Demographics", "Demographics+APOE",
  1810. "mCAIDE-", "WHICAP-", "LIBRA-", "CogDRisk-")))
  1811. if (crs_type == "CRS") {
  1812. df_out = df_out %>% filter(!grepl("-$", model) | model %in% c("Demographics+APOE", "Demographics"))
  1813. } else if (crs_type == "CRS-") {
  1814. df_out = df_out %>% filter(grepl("-$", model) | model %in% c("Demographics+APOE", "Demographics"))
  1815. }
  1816. desired_order = c(
  1817. "CogDRisk", "LIBRA", "WHICAP", "mCAIDE", "Demographics", "Demographics+APOE")
  1818. df_out$model = factor(df_out$model, levels = desired_order)
  1819. # compute ROC curves
  1820. df_out = df_out %>%
  1821. mutate(
  1822. roc_obj = map(res_crs_only, ~ {
  1823. y = model.response(model.frame(.x))
  1824. p = predict(.x, type = "response")
  1825. if (length(unique(y)) > 1) pROC::roc(y, p) else NULL
  1826. }),
  1827. auc_val = map_dbl(roc_obj, ~ if (!is.null(.x)) as.numeric(pROC::auc(.x)) else NA_real_),
  1828. auc_label = paste0(model, ": AUC = ", round(auc_val, 2)),
  1829. roc_df = map(roc_obj, ~ if (!is.null(.x)) tibble(fpr = 1 - .x$specificities,
  1830. tpr = .x$sensitivities) else NULL)
  1831. )
  1832. roc_plot_df = df_out %>%
  1833. select(model, auc_val, auc_label, roc_df) %>%
  1834. tidyr::unnest(roc_df)
  1835. format_r2 = function(x) {
  1836. ifelse(x < 0.01, formatC(x, format = "f", digits = 4), formatC(x, format = "f", digits = 3))
  1837. }
  1838. auc_labels_df = df_out %>%
  1839. select(model, auc_val, nagelkerker2_crs_only) %>%
  1840. distinct(model, auc_val, nagelkerker2_crs_only) %>%
  1841. arrange(factor(model, levels = desired_order)) %>%
  1842. mutate(
  1843. auc_label = paste0(model, ": ", round(auc_val, 2),
  1844. "; ", format_r2(nagelkerker2_crs_only)),
  1845. fpr = 0.98, tpr = 0.02 + 0.05 * (row_number())
  1846. )
  1847. ggplot(roc_plot_df, aes(x = fpr, y = tpr, color = model)) +
  1848. geom_line(size = 0.5) +
  1849. geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "gray50") +
  1850. geom_text(
  1851. data = auc_labels_df,
  1852. aes(x = fpr, y = tpr, label = auc_label),
  1853. inherit.aes = FALSE, hjust = 1, vjust = 0, size = 2
  1854. ) +
  1855. scale_color_manual(values = crs_colors[levels(df_out$model)]) +
  1856. labs(x = "False Positive Rate",
  1857. y = "True Positive Rate",
  1858. color = NULL,
  1859. title = unique(df_out$outcome)) +
  1860. theme_bw() +
  1861. theme(
  1862. axis.title = element_text(size = 6),
  1863. legend.position = "none",
  1864. plot.title = element_text(hjust = 0.5, size = 8, face = "bold")
  1865. )
  1866. }
  1867. #MCI
  1868. roc_mci_all = plot_roc_outcome(all_comb_cdx2, "cdx_mci_vs_cn", crs_type = "CRS", pop_filter = "all")
  1869. roc_mci_aa = plot_roc_outcome(all_comb_cdx2, "cdx_mci_vs_cn", crs_type = "CRS", pop_filter = "Black")
  1870. roc_mci_la = plot_roc_outcome(all_comb_cdx2, "cdx_mci_vs_cn", crs_type = "CRS", pop_filter = "Hispanic")
  1871. roc_mci_nhw = plot_roc_outcome(all_comb_cdx2, "cdx_mci_vs_cn", crs_type = "CRS", pop_filter = "NHW")
  1872. #Dementia
  1873. roc_dem_all = plot_roc_outcome(all_comb_cdx2, "cdx_dem_vs_cn", crs_type = "CRS", pop_filter = "all")
  1874. roc_dem_aa = plot_roc_outcome(all_comb_cdx2, "cdx_dem_vs_cn", crs_type = "CRS", pop_filter = "Black")
  1875. roc_dem_la = plot_roc_outcome(all_comb_cdx2, "cdx_dem_vs_cn", crs_type = "CRS", pop_filter = "Hispanic")
  1876. roc_dem_nhw = plot_roc_outcome(all_comb_cdx2, "cdx_dem_vs_cn", crs_type = "CRS", pop_filter = "NHW")
  1877. #MCI+Dementia
  1878. roc_ci_all = plot_roc_outcome(all_comb_cdx2, "cdx_ci_vs_cn", crs_type = "CRS", pop_filter = "all")
  1879. roc_ci_aa = plot_roc_outcome(all_comb_cdx2, "cdx_ci_vs_cn", crs_type = "CRS", pop_filter = "Black")
  1880. roc_ci_la = plot_roc_outcome(all_comb_cdx2, "cdx_ci_vs_cn", crs_type = "CRS", pop_filter = "Hispanic")
  1881. roc_ci_nhw = plot_roc_outcome(all_comb_cdx2, "cdx_ci_vs_cn", crs_type = "CRS", pop_filter = "NHW")
  1882. shared_legend = get_legend(
  1883. roc_mci_all +
  1884. theme(
  1885. legend.position = "bottom",
  1886. legend.title = element_text(size = 8, face = "bold"),
  1887. legend.text = element_text(size = 6)) +
  1888. guides(color = guide_legend(nrow = 1)))
  1889. pageCreate(width = 9, height = 12.5, default.units = "inches")
  1890. plotGG(
  1891. plot = roc_mci_all,
  1892. x = 0, y = 0, width = 3, height = 3,
  1893. just = c("left", "top"), default.units = "inches"
  1894. )
  1895. plotText(
  1896. label = "A)", x = 0.1, y = 0.1,
  1897. just = c("left", "top"), fontface = "bold",
  1898. fontsize = 12, default.units = "inches"
  1899. )
  1900. plotGG(
  1901. plot = roc_dem_all,
  1902. x = 3, y = 0, width = 3, height = 3,
  1903. just = c("left", "top"), default.units = "inches"
  1904. )
  1905. plotGG(
  1906. plot = roc_ci_all,
  1907. x = 6, y = 0, width = 3, height = 3,
  1908. just = c("left", "top"), default.units = "inches"
  1909. )
  1910. plotGG(
  1911. plot = roc_mci_aa,
  1912. x = 0, y = 3, width = 3, height = 3,
  1913. just = c("left", "top"), default.units = "inches"
  1914. )
  1915. plotText(
  1916. label = "B)", x = 0.1, y = 3.1,
  1917. just = c("left", "top"), fontface = "bold",
  1918. fontsize = 12, default.units = "inches"
  1919. )
  1920. plotGG(
  1921. plot = roc_dem_aa,
  1922. x = 3, y = 3, width = 3, height = 3,
  1923. just = c("left", "top"), default.units = "inches"
  1924. )
  1925. plotGG(
  1926. plot = roc_ci_aa,
  1927. x = 6, y = 3, width = 3, height = 3,
  1928. just = c("left", "top"), default.units = "inches"
  1929. )
  1930. plotGG(
  1931. plot = roc_mci_la,
  1932. x = 0, y = 6, width = 3, height = 3,
  1933. just = c("left", "top"), default.units = "inches"
  1934. )
  1935. plotText(
  1936. label = "C)", x = 0.1, y = 6.1,
  1937. just = c("left", "top"), fontface = "bold",
  1938. fontsize = 12, default.units = "inches"
  1939. )
  1940. plotGG(
  1941. plot = roc_dem_la,
  1942. x = 3, y = 6, width = 3, height = 3,
  1943. just = c("left", "top"), default.units = "inches"
  1944. )
  1945. plotGG(
  1946. plot = roc_ci_la,
  1947. x = 6, y = 6, width = 3, height = 3,
  1948. just = c("left", "top"), default.units = "inches"
  1949. )
  1950. plotGG(
  1951. plot = roc_mci_nhw,
  1952. x = 0, y = 9, width = 3, height = 3,
  1953. just = c("left", "top"), default.units = "inches"
  1954. )
  1955. plotText(
  1956. label = "D)", x = 0.1, y = 9.1,
  1957. just = c("left", "top"), fontface = "bold",
  1958. fontsize = 12, default.units = "inches"
  1959. )
  1960. plotGG(
  1961. plot = roc_dem_nhw,
  1962. x = 3, y = 9, width = 3, height = 3,
  1963. just = c("left", "top"), default.units = "inches"
  1964. )
  1965. plotGG(
  1966. plot = roc_ci_nhw,
  1967. x = 6, y = 9, width = 3, height = 3,
  1968. just = c("left", "top"), default.units = "inches"
  1969. )
  1970. plotGG(
  1971. shared_legend,
  1972. x = 2, y = 12, width = 6, height = 0.5,
  1973. just = c("left", "top")
  1974. )
  1975. pageGuideHide()
  1976. ```
  1977. ```{r}
  1978. # publication table for AUC & R2 for linear and logistic regression
  1979. adjust_crs_linear = function(df_models, pop_label = NULL) {
  1980. df_data = if (!is.null(pop_label)) data %>% filter(pop == pop_label) else data
  1981. df_models %>%
  1982. mutate(
  1983. pop = ifelse(is.null(pop_label), "ALL", pop_label),
  1984. eq_crs_only = case_when(
  1985. model %in% c("base", "base_noapoe") ~ eq,
  1986. TRUE ~ str_replace(eq, "apoe \\+ ", "")
  1987. ),
  1988. res_crs_only = map(eq_crs_only, ~ lm(as.formula(.x), data = df_data)),
  1989. r2_crs_only = map_dbl(res_crs_only, ~ {
  1990. summ <- summary(.x)
  1991. if (!is.null(summ$r.squared)) summ$r.squared else NA_real_
  1992. })
  1993. )
  1994. }
  1995. afr_num_prs2 = adjust_crs_linear(afr_num_prs, pop_label = "AFR") %>% mutate(pop = "Black")
  1996. amr_num_prs2 = adjust_crs_linear(amr_num_prs, pop_label = "AMR") %>% mutate(pop = "Hispanic")
  1997. eur_num_prs2 = adjust_crs_linear(eur_num_prs, pop_label = "EUR") %>% mutate(pop = "NHW")
  1998. all_num_prs2 = adjust_crs_linear(all_num_prs) %>% mutate(pop = "all")
  1999. all_comb_num2 = bind_rows(all_num_prs2, afr_num_prs2, amr_num_prs2, eur_num_prs2)
  2000. res_pfm = bind_rows(
  2001. select(all_comb_cdx2, model, pop, outcome, auc_crs_only, nagelkerker2_crs_only),
  2002. select(all_comb_num2, model, pop, outcome, r2_crs_only)) %>%
  2003. filter(model %in% c("base", "base_noapoe", "cogd", "libra", "whicap", "mcaide", "cogd_sva", "libra_sva", "whicap_sva", "mcaide_sva")) %>%
  2004. filter(!outcome %in% c("cdx_hypertension", "cdx_dyslipidemia", "cdx_diabetes", "bmi", "cdx_anxiety", "cdx_depression", "cdx_cvd", "wmh_volume_log",
  2005. "ab40", "ab42", "cdx_cn_vs_ci")) %>%
  2006. arrange(pop, model) %>%
  2007. mutate(
  2008. model = recode(model,
  2009. "base_noapoe" = "Demographics",
  2010. "base" = "Demographics + APOE",
  2011. "cogd" = "CogDRisk",
  2012. "libra" = "LIBRA",
  2013. "whicap" = "WHICAP",
  2014. "mcaide" = "mCAIDE",
  2015. "cogd_sva" = "CogDRisk (sensitivity)",
  2016. "libra_sva" = "LIBRA (sensitivity)",
  2017. "whicap_sva" = "WHICAP (sensitivity)",
  2018. "mcaide_sva" = "mCAIDE (sensitivity)"),
  2019. category = case_when(
  2020. outcome %in% c("va", "em", "ef", "mmse_total", "cdr") ~ "Cognitive \nFunction",
  2021. outcome %in% c("tau", "ptau", "nfl", "ab42_ab40") ~ "Plasma \nBiomarkers",
  2022. outcome %in% c("meta_roi", "z_hippcampul_vol") ~ "Neuroimaging",
  2023. outcome %in% c("cdx_mci_vs_cn", "cdx_dem_vs_cn", "cdx_ci_vs_cn") ~ "Medical \nHistory"),
  2024. lab = fct_recode(
  2025. outcome,
  2026. MMSE = "mmse_total",
  2027. CDR = "cdr",
  2028. "Executive\n Function" = "ef",
  2029. "Verbal\n Ability" = "va",
  2030. Memory = "em",
  2031. "Cortical \nThickness" = "meta_roi",
  2032. "Hippo. \nVolume" = "z_hippcampul_vol",
  2033. "Aβ42/Aβ40" = "ab42_ab40",
  2034. "Total Tau" = "tau",
  2035. "pTau" = "ptau",
  2036. NfL = "nfl",
  2037. MCI = "cdx_mci_vs_cn",
  2038. Dementia = "cdx_dem_vs_cn",
  2039. "Cog. Impair." = "cdx_ci_vs_cn"),
  2040. lab = fct_inorder(lab)
  2041. ) %>%
  2042. rename(
  2043. Model = model,
  2044. Race = pop,
  2045. Outcome = lab,
  2046. Category = category,
  2047. AUC = auc_crs_only,
  2048. `Nagelkerke R2` = nagelkerker2_crs_only,
  2049. R2 = r2_crs_only
  2050. ) %>%
  2051. select(-outcome) %>%
  2052. select(Model, Race, Outcome, Category, AUC, `Nagelkerke R2`, R2)
  2053. ```
  2054. ### Demographics
  2055. ```{r}
  2056. # table 1
  2057. summary_df = data %>%
  2058. filter(!is.na(cdx_cog)) %>%
  2059. group_by(cdx_cog) %>%
  2060. summarise(
  2061. Total = n(),
  2062. Age = sprintf("%.1f (± %.1f)", mean(age, na.rm = TRUE), sd(age, na.rm = TRUE)),
  2063. Female = sprintf("%d (%.1f%%)", sum(sex == 1, na.rm = TRUE), 100 * mean(sex == 1, na.rm = TRUE)),
  2064. Male = sprintf("%d (%.1f%%)", sum(sex == 0, na.rm = TRUE), 100 * mean(sex == 0, na.rm = TRUE)),
  2065. `ε4 Carrier` = sprintf("%d (%.1f%%)", sum(apoe4 == 1, na.rm = TRUE), 100 * mean(apoe4 == 1, na.rm = TRUE)),
  2066. `ε4 Noncarrier` = sprintf("%d (%.1f%%)", sum(apoe4 == 0, na.rm = TRUE), 100 * mean(apoe4 == 0, na.rm = TRUE)),
  2067. mCAIDE = sprintf("%.3f (± %.2f)", mean(mcaide, na.rm = TRUE), sd(mcaide, na.rm = TRUE)),
  2068. WHICAP = sprintf("%.3f (± %.2f)", mean(whicap, na.rm = TRUE), sd(whicap, na.rm = TRUE)),
  2069. LIBRA = sprintf("%.3f (± %.2f)", mean(libra, na.rm = TRUE), sd(libra, na.rm = TRUE)),
  2070. CogDRisk = sprintf("%.3f (± %.2f)", mean(cogd, na.rm = TRUE), sd(cogd, na.rm = TRUE)),
  2071. MMSE = sprintf("%.2f (± %.2f)", mean(mmse_total, na.rm = TRUE), sd(mmse_total, na.rm = TRUE)),
  2072. CDR = sprintf("%.4f (± %.2f)", mean(cdr, na.rm = TRUE), sd(cdr, na.rm = TRUE)),
  2073. `Executive\n Function` = sprintf("%.2f (± %.2f)", mean(ef, na.rm = TRUE), sd(ef, na.rm = TRUE)),
  2074. `Verbal\n Ability` = sprintf("%.2f (± %.2f)", mean(va, na.rm = TRUE), sd(va, na.rm = TRUE)),
  2075. Memory = sprintf("%.2f (± %.2f)", mean(em, na.rm = TRUE), sd(em, na.rm = TRUE)),
  2076. `Cortical \nThickness` = sprintf("%.2f (± %.2f)", mean(meta_roi, na.rm = TRUE), sd(meta_roi, na.rm = TRUE)),
  2077. `Hippo. \nVolume` = sprintf("%.2f (± %.2f)", mean(z_hippcampul_vol, na.rm = TRUE), sd(z_hippcampul_vol, na.rm = TRUE)),
  2078. `Aβ42/Aβ40` = sprintf("%.3f (± %.2f)", mean(ab42_ab40, na.rm = TRUE), sd(ab42_ab40, na.rm = TRUE)),
  2079. `Total Tau` = sprintf("%.3f (± %.2f)", mean(tau, na.rm = TRUE), sd(tau, na.rm = TRUE)),
  2080. pTau = sprintf("%.2f (± %.2f)", mean(ptau, na.rm = TRUE), sd(ptau, na.rm = TRUE)),
  2081. NfL = sprintf("%.3f (± %.2f)", mean(nfl, na.rm = TRUE), sd(nfl, na.rm = TRUE))
  2082. ) %>%
  2083. tibble::column_to_rownames("cdx_cog") %>%
  2084. t() %>%
  2085. as.data.frame() %>%
  2086. tibble::rownames_to_column("Variable")
  2087. # racial breakdown rows
  2088. race_summary = data %>%
  2089. filter(!is.na(cdx_cog), race %in% c("NHW", "Hispanic", "Black")) %>%
  2090. group_by(cdx_cog, race) %>%
  2091. summarise(n = n(), .groups = "drop_last") %>%
  2092. mutate(
  2093. perc = round(100 * n / sum(n), 1),
  2094. value = sprintf("%d (%.1f%%)", n, perc)
  2095. ) %>%
  2096. select(cdx_cog, Variable = race, value) %>%
  2097. tidyr::pivot_wider(names_from = cdx_cog, values_from = value)
  2098. summary_df = bind_rows(summary_df, race_summary)
  2099. summary_df = summary_df %>%
  2100. mutate(
  2101. Group = case_when(
  2102. Variable %in% c("Total", "Case", "Control") ~ "AD",
  2103. Variable == "Age" ~ "Age",
  2104. Variable %in% c("Female", "Male") ~ "Sex",
  2105. Variable %in% c("NHW", "Hispanic", "Black") ~ "Race",
  2106. Variable %in% c("ε4 Carrier", "ε4 Noncarrier") ~ "APOE",
  2107. Variable %in% c("mCAIDE", "WHICAP", "LIBRA", "CogDRisk") ~ "CRS",
  2108. Variable %in% c("MMSE", "CDR", "Executive\n Function", "Verbal\n Ability", "Memory") ~ "Cognition",
  2109. Variable %in% c("Cortical \nThickness", "Hippo. \nVolume") ~ "Imaging",
  2110. Variable %in% c("Aβ40", "Aβ42", "Aβ42/Aβ40", "Total Tau", "pTau", "NfL") ~ "Biomarker",
  2111. TRUE ~ NA_character_
  2112. )) %>%
  2113. rename(
  2114. Characteristics = Variable,
  2115. `Cognitively Normal` = "0",
  2116. `Mild Cognitive Impairment` = "1",
  2117. Dementia = "2"
  2118. ) %>%
  2119. select(-Group)
  2120. ```

crs_analysis.qmd at commit aea67ca, under MIT · at the source

Overview

Authors: Meri Okorie1,2, Xiaqing Jiang2, Kristine Yaffe1,2,3,4,5, Jennifer S Yokoyama1,3,6, Shea J Andrews1,2, for the Health and Aging Brain Study–Health Disparities
  1. Edward and Pearl Fein Memory and Aging Center, University of California, San Francisco, San Francisco, California, USA
  2. Department of Psychiatry and Behavioural Sciences, University of California, San Francisco, San Francisco, California, USA
  3. Department of Neurology and Weill Institute for Neurosciences, University of California, San Francisco, San Francisco, California, USA
  4. Department of Epidemiology and Biostatistics, University of California, San Francisco, San Francisco, California, USA
  5. San Francisco Veterans Affairs Health Care System, San Francisco, California, USA
  6. Department of Radiology and Biomedical Imaging, University of California, San Francisco, San Francisco, California, USA
Journal: Alzheimer's & dementia : the journal of the Alzheimer's Association, volume 22, issue 8, article e71567
Dates: received 4 February 2026; accepted 4 May 2026; published online 28 July 2026; in print August 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1002/alz.71567 · PMID 42522069 · PMCID PMC13415752 · OpenAlex W7171670744
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: PET / SPECT (modality), human (organism), Alzheimer's / dementia (population), clinical / translational (subfield)
Methods: Statistics, Machine learning, Physiology & signal measures, Preprocessing
Keywords: Alzheimer's disease, biomarkers, clinical risk score, health disparities, modifiable risk factors
MeSH: Alzheimer Disease*, Dementia*, Endophenotypes*, Aged, Aged, 80 and over, Amyloid beta-Peptides, Female, Humans, Male, Peptide Fragments, Positron-Emission Tomography, Risk Factors, tau Proteins (* major topic)
Topic: Dementia and Cognitive Impairment Research (Psychiatry and Mental health, Medicine), according to OpenAlex
Funding: NIA NIH HHS (R01 AG057234, U24 AG072122, P30AG062422, U19 AG078109, R01 AG062588, U19 AG079774, U19AG079774, R01 AG054073, R01 AG058533, P01 AG019724, P01AG019724, R01AG057234, P30 AG062422, R01 AG070862); Alzheimer&apos;s Association; Genentech; NIBIB NIH HHS (P41 EB015922); Global Brain Health Institute; National Institute on Aging (R01AG057234, P30AG062422, U19AG079774, P01AG019724); Alzheimer’s Association; National Alzheimer&apos;s Coordinating Center (U24AG072122); National Alzheimer’s Coordinating Center (U24AG072122); NINDS NIH HHS (U54 NS123985, U54NS123985); French Foundation; National Institute of Neurological Disorders and Stroke (U54NS123985); Rainwater Charitable Foundation; Mary Oakley Foundation
Citations: not cited yet (Europe PMC); 56 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, with 13 matches between paragraphs and lines of code.

AndrewsLabUCSF/CRS-analysis

License: MIT
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Commit: aea67caca4b114ff2aa32bb4bf5d244127574e7b, 25 March 2026
Languages: Quarto (4)
Size: 11 files, 4 scripts
Software Heritage: not archived
Found in: “CODE AVAILABILITY”
Holds: README, license file, documentation, 4 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration
Tools: tidyverse (4 files), broom (3 files), ggplot2 (2 files), pROC (2 files), cowplot (1 file), data.table (1 file), easystats (1 file), patchwork (1 file), randomForest (1 file)
Availability: 1 check, the latest on 26 September 2026: the link answers
  • 26 September 2026: the link answers
6 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1002/alz.71567.

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;
  • 4 scripts, each with its path and the digest of its content;
  • 13 matches 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.

Versions

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

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 5 keywords, 13 MeSH terms, 14 funders, 51 references.

Cite

This paper

Okorie, M., Jiang, X., Yaffe, K., Yokoyama, J. S., Andrews, S. J., & for the Health and Aging Brain Study–Health Disparities. (2026). Associations of dementia polyexposure scores to Alzheimer's disease endophenotypes in a diverse population. Alzheimer's & dementia : the journal of the Alzheimer's Association, 22(8), e71567. https://doi.org/10.1002/alz.71567

BibTeX

@article{okorie2026associations,
author = {Okorie, Meri and Jiang, Xiaqing and Yaffe, Kristine and Yokoyama, Jennifer S and Andrews, Shea J and {for the Health and Aging Brain Study–Health Disparities}},
title = {{Associations of dementia polyexposure scores to Alzheimer's disease endophenotypes in a diverse population}},
journal = {Alzheimer's \& dementia : the journal of the Alzheimer's Association},
year = {2026},
month = aug,
volume = {22},
number = {8},
pages = {e71567},
publisher = {Wiley},
issn = {1552-5260},
doi = {10.1002/alz.71567},
url = {https://doi.org/10.1002/alz.71567},
pmid = {42522069},
pmcid = {PMC13415752}
}

RIS

TY - JOUR
AU - Okorie, Meri
AU - Jiang, Xiaqing
AU - Yaffe, Kristine
AU - Yokoyama, Jennifer S
AU - Andrews, Shea J
AU - for the Health and Aging Brain Study–Health Disparities
TI - Associations of dementia polyexposure scores to Alzheimer's disease endophenotypes in a diverse population
T2 - Alzheimer's & dementia : the journal of the Alzheimer's Association
J2 - Alzheimers Dement
PY - 2026
DA - 2026/08/01
VL - 22
IS - 8
SP - e71567
SN - 1552-5260
PB - Wiley
DO - 10.1002/alz.71567
UR - https://doi.org/10.1002/alz.71567
LA - en
ER -

CSL-JSON

{
"id": "10.1002/alz.71567",
"type": "article-journal",
"title": "Associations of dementia polyexposure scores to Alzheimer's disease endophenotypes in a diverse population",
"container-title": "Alzheimer's & dementia : the journal of the Alzheimer's Association",
"author": [
{
"family": "Okorie",
"given": "Meri"
},
{
"family": "Jiang",
"given": "Xiaqing"
},
{
"family": "Yaffe",
"given": "Kristine"
},
{
"family": "Yokoyama",
"given": "Jennifer S"
},
{
"family": "Andrews",
"given": "Shea J"
},
{
"literal": "for the Health and Aging Brain Study–Health Disparities"
}
],
"container-title-short": "Alzheimers Dement",
"volume": "22",
"issue": "8",
"page": "e71567",
"DOI": "10.1002/alz.71567",
"PMID": "42522069",
"PMCID": "PMC13415752",
"ISSN": "1552-5260",
"publisher": "Wiley",
"URL": "https://doi.org/10.1002/alz.71567",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
1
]
]
}
}

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

Similar papers

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

[1] doi:10.1038/s41593-026-02363-4 [code]
Cortical thickness changes precede high levels of amyloid by at least 7 years.
Journal: Nature neuroscience
In common: easystats, broom, cowplot, 4 other tools, PET / SPECT, Alzheimer's / dementia, 4 references
[2] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: randomForest, pROC, broom, 5 other tools
[3] doi:10.1093/braincomms/fcag236 [code]
Dynamic, state-dependent characteristics of cognitive fluctuations in Lewy body dementia: a magnetoencephalography study.
Journal: Brain communications
In common: randomForest, pROC, easystats, 4 other tools, Alzheimer's / dementia
[4] doi:10.1186/s40168-026-02342-8 [code]
Impacts of host genetics on gut microbiome composition in Alzheimer's disease.
Journal: Microbiome
In common: randomForest, pROC, cowplot, 3 other tools, Alzheimer's / dementia, 1 reference
[5] doi:10.3390/ijms27156925 [code]
XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis.
Journal: International journal of molecular sciences
In common: randomForest, pROC, cowplot, 4 other tools
[6] doi:10.7717/peerj.21426 [code]
Integrated transcriptomic identification and validation reveal key autophagy-associated biomarkers in sleep deprivation.
Journal: PeerJ
In common: randomForest, pROC, cowplot, 4 other tools
[7] doi:10.1093/neuonc/noag128 [code]
Spatially-resolved single-cell imaging of melanoma brain metastases identifies localized immune patterns predictive of immune checkpoint blockade response.
Journal: Neuro-oncology
In common: pROC, easystats, cowplot, 4 other tools, clinical / translational
[8] doi:10.1016/j.isci.2026.115657 [code]
Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug.
Journal: iScience
In common: pROC, broom, cowplot, 4 other tools, clinical / translational
[9] 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: pROC, easystats, broom, 4 other tools
[10] doi:10.1016/j.xcrm.2026.102682 [code]
TET CpG sequence-context-specific DNA demethylation shapes progression of IDH-mutant gliomas.
Journal: Cell reports. Medicine
In common: pROC, broom, cowplot, 4 other tools

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.