-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_02-09_adhd_adult.qmd
361 lines (309 loc) · 9.1 KB
/
_02-09_adhd_adult.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
## ADHD/Executive Functioning {#sec-adhd}
```{r}
#| label: setup-adhd
#| include: false
# Suppress warnings from being converted to errors
options(warn = 1) # Set warn to 1 to make warnings not halt execution
# domain
domains <- c("ADHD")
# target phenotype
pheno <- "adhd"
```
```{r}
#| label: export-adhd
#| include: false
#| eval: true
# Read the CSV file into a data frame
adhd <- vroom::vroom("neurobehav.csv")
# Filter the data frame based on certain conditions
# Keep only the rows where 'domain' equals 'domains' and 'z_mean_domain' is not NA
adhd <- adhd |>
dplyr::filter(domain %in% domains)
# Select specific columns from the data frame
adhd <- adhd |>
dplyr::select(
test,
test_name,
scale,
raw_score,
score,
ci_95,
percentile,
range,
domain,
subdomain,
narrow,
pass,
verbal,
timed,
description,
result,
z,
z_mean_domain,
z_sd_domain,
z_mean_subdomain,
z_sd_subdomain,
z_mean_narrow,
z_sd_narrow
)
# Write the 'adhd' data frame to a CSV file
# The file name is derived from the 'pheno' variable
readr::write_excel_csv(adhd, paste0(pheno, ".csv"), na = "", col_names = TRUE, append = FALSE)
```
```{r}
#| label: data-adhd
#| include: false
scales <- c(
"Activation",
"Focus",
"Effort",
"Emotion",
"Memory",
"Action",
"Total Composite",
"Inattention/Memory Problems",
"Hyperactivity/Restlessness",
"Impulsivity/Emotional Lability",
"Problems with Self-Concept",
"DSM-5 Inattentive Symptoms",
"DSM-5 Hyperactive-Impulsive Symptoms",
"DSM-5 ADHD Symptoms Total",
"ADHD Index",
# CEFI
"Full Scale",
"Attention",
"Emotion Regulation",
"Flexibility",
"Inhibitory Control",
"Initiation",
"Organization",
"Planning",
"Self-Monitoring",
"Working Memory",
"Inattention/Executive Dysfunction",
"Hyperactivity",
"Impulsivity",
"Emotional Dysregulation",
"Negative Self-Concept",
"ADHD Inattentive Symptoms",
"ADHD Hyperactive/Impulsive Symptoms",
"Total ADHD Symptoms",
"ADHD Index",
"CAARS-OR Inattention/Memory Problems",
"CAARS-OR Hyperactivity/Restlessness",
"CAARS-OR Impulsivity/Emotional Lability",
"CAARS-OR Problems with Self-Concept",
"CAARS-OR DSM-5 Inattentive Symptoms",
"CAARS-OR DSM-5 Hyperactive-Impulsive Symptoms",
"CAARS-OR DSM-5 ADHD Symptoms Total",
"CAARS-OR ADHD Index",
"CAARS-SR Inattention/Memory Problems",
"CAARS-SR Hyperactivity/Restlessness",
"CAARS-SR Impulsivity/Emotional Lability",
"CAARS-SR Problems with Self-Concept",
"CAARS-SR DSM-5 Inattentive Symptoms",
"CAARS-SR DSM-5 Hyperactive-Impulsive Symptoms",
"CAARS-SR DSM-5 ADHD Symptoms Total",
"CAARS-SR ADHD Index",
"CEFI-OR Full Scale",
"CEFI-OR Attention",
"CEFI-OR Emotion Regulation",
"CEFI-OR Flexibility",
"CEFI-OR Inhibitory Control",
"CEFI-OR Initiation",
"CEFI-OR Organization",
"CEFI-OR Planning",
"CEFI-OR Self-Monitoring",
"CEFI-OR Working Memory",
"CEFI-SR Full Scale",
"CEFI-SR Attention",
"CEFI-SR Emotion Regulation",
"CEFI-SR Flexibility",
"CEFI-SR Inhibitory Control",
"CEFI-SR Initiation",
"CEFI-SR Organization",
"CEFI-SR Planning",
"CEFI-SR Self-Monitoring",
"CEFI-SR Working Memory",
"Inattention (INATTN) Index"
)
# Filter the data using the filter_data function from the bwu library
data_adhd <- bwu::filter_data(data = adhd, domain = domains, scale = scales)
```
```{r}
#| label: text-adhd-self
#| cache: true
#| eval: true
#| include: false
# Self-report
data_adhd_self <-
data_adhd |>
dplyr::filter(test == "caars_sr" | test == "cefi_sr" | test == "caars2_sr" | test == "brown_efa_self" | test == "pai") |>
dplyr::arrange(dplyr::desc(percentile)) |>
dplyr::distinct(.keep_all = FALSE)
# Flatten the text
bwu::cat_neuropsych_results(data = data_adhd_self, file = "_02-09_adhd_adult_text_self.qmd")
```
```{r}
#| label: qtbl-adhd-self
#| dev: tikz
#| fig-process: pdf2png
#| eval: true
#| include: false
# Set the default engine for tikz to "xetex"
options(tikzDefaultEngine = "xetex")
# table arguments
pheno <- "adhd_self"
table_name <- "table_adhd_self"
vertical_padding <- 0
multiline <- TRUE
# variables
data_adhd_self <-
dplyr::mutate(data_adhd_self, scale = stringr::str_remove_all(scale, "CAARS-SR |CEFI-SR |CAARS2 Self |Brown EF/A |PAI "))
# footnotes
# fn_standard_score <- gt::md("Standard score: Mean = 100 [50th‰], SD ± 15
# [16th‰, 84th‰].
# Lower scores reflect reduced functioning.")
fn_t_score <- gt::md("T-score: Mean = 50 [50th‰], SD ± 10 [16th‰, 84th‰].
Higher scores reflect reduced functioning.")
# fn_t_score <- gt::md("Brown EF/A T-score: Mean = 50 [50th‰], SD ± 10 [16th‰, 84th‰].
# Higher scores reflect reduced functioning.")
source_note <- gt::md("T-score: Mean = 50 [50th‰], SD ± 10 [16th‰, 84th‰].
Higher scores reflect reduced functioning.")
# source_note <- gt::md("CEFI Standard score: Mean = 100 [50th‰], SD ± 15 [16th‰, 84th‰].
# Lower scores reflect reduced functioning in the given area.")
# groupings
grp_adhd <- list(
standard_score = c("CEFI Self-Report", "CEFI Observer-Report", "CEFI Self", "CEFI Observer"),
t_score = c("CAARS Self-Report", "CAARS Observer-Report", "CAARS-2 Self-Report", "CAARS-2 Observer-Report", "CAARS2 Self", "CAARS2 Observer", "CAARS Self", "Brown EF/A Self-Report", "PAI")
)
grp_caars <- list(
t_score = c("CAARS Self-Report", "CAARS Observer-Report", "CAARS-2 Self-Report", "CAARS-2 Observer-Report", "CAARS2 Self", "CAARS2 Observer", "CAARS Self")
)
grp_cefi <- list(
standard_score = c("CEFI Self-Report", "CEFI Observer-Report", "CEFI Self", "CEFI Observer")
)
grp_self <- list(
standard_score = c("CEFI Self-Report", "CEFI Self"),
t_score = c("CAARS Self-Report", "CAARS-2 Self-Report", "CAARS2 Self", "CAARS Self", "Brown EF/A Self-Report", "PAI")
)
# make `gt` table
bwu::tbl_gt(
data = data_adhd_self,
pheno = pheno,
table_name = table_name,
vertical_padding = vertical_padding,
source_note = source_note,
# fn_standard_score = fn_standard_score,
# fn_t_score = fn_t_score,
# grp_standard_score = grp_self[["standard_score"]],
# grp_t_score = grp_self[["t_score"]],
dynamic_grp = grp_self,
multiline = multiline
)
```
```{r}
#| label: fig-adhd-self
#| include: false
#| fig-hight: 5
#| out-height: 100%
#| fig-cap: "Attention and executive functions are multidimensional concepts that contain several related processes. Both concepts require self-regulatory skills and have some common subprocesses; therefore, it is common to treat them together, or even to refer to both processes when talking about one or the other."
# dotplot variables to plot (x, y)
x <- data_adhd_self$z
y <- data_adhd_self$scale
# dotplot arguments
filename <- "fig_adhd_self.svg"
colors <- NULL
return_plot <- TRUE
# Suppress warnings from being converted to errors
options(warn = 1) # Set warn to 1 to make warnings not halt execution
bwu::dotplot(
data = data_adhd_self,
x = x,
y = y,
colors = colors,
return_plot = return_plot,
filename = filename,
na.rm = TRUE
)
# Reset warning options to default if needed
options(warn = 0) # Reset to default behavior
```
### SELF-REPORT
{{< include _02-09_adhd_adult_text_self.qmd >}}
```{=typst}
#let domain(title: none, file_qtbl, file_fig) = {
let font = (font: "Roboto Slab", size: 0.7em)
set text(..font)
pad(top: 0.5em)[]
grid(
columns: (50%, 50%),
gutter: 8pt,
figure(
[#image(file_qtbl)],
caption: figure.caption(position: top, [#title]),
kind: "qtbl",
supplement: [*Table*],
),
figure(
[#image(file_fig)],
caption: figure.caption(
position: bottom,
[Attention and executive functions are multidimensional concepts that contain several related processes. Both concepts require self-regulatory skills and have some common subprocesses; therefore, it is common to treat them together, or even to refer to both processes when talking about one or the other.],
),
placement: none,
kind: "image",
supplement: [*Figure*],
gap: 0.5em,
),
)
}
```
```{=typst}
#let title = "ADHD/Executive Function Self Ratings"
#let file_qtbl = "table_adhd_self.png"
#let file_fig = "fig_adhd_self.svg"
#domain(
title: [#title],
file_qtbl,
file_fig
)
```
<!-- ### OBSERVER RATINGS -->
<!-- {{< include _02-09_adhd_adult_text_observer.qmd >}} -->
<!-- ```{=typst}
#let domain(title: none, file_qtbl, file_fig) = {
let font = (font: "Roboto Slab", size: 0.7em)
set text(..font)
pad(top: 0.5em)[]
grid(
columns: (50%, 50%),
gutter: 8pt,
figure(
[#image(file_qtbl)],
caption: figure.caption(position: top, [#title]),
kind: "qtbl",
supplement: [Table],
),
figure(
[#image(file_fig)],
caption: figure.caption(
position: bottom,
[
Observer-report of the patient's ADHD symptoms and executive functioning in daily life.
],
),
placement: none,
kind: "image",
supplement: [Figure],
gap: 0.5em,
),
)
}
``` -->
<!-- ```{=typst}
#let title = "ADHD Observer Ratings"
#let file_qtbl = "table_adhd_observer.png"
#let file_fig = "fig_adhd_observer.svg"
#domain(title: [#title], file_qtbl, file_fig)
``` -->