-
Notifications
You must be signed in to change notification settings - Fork 0
/
sim1_whack_a_node.Rmd
624 lines (484 loc) · 27.1 KB
/
sim1_whack_a_node.Rmd
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
---
title: "Sim 1 - Whack a Node"
author:
- Michael Hallquist
- Frank Hillary
date: "9/11/2017"
output:
html_document:
code_folding: hide
df_print: kable
mathjax: default
number_sections: yes
theme: spacelab
toc: yes
html_notebook: null
---
```{r setup, include=FALSE}
#setwd(file.path(getMainDir(), "clinical_brainnetwork_sim")) #should be where this script lives already
source("simulate_clingraph.R")
suppressMessages(library(tidyverse))
suppressMessages(library(igraph))
suppressMessages(library(knitr))
suppressMessages(library(broom))
suppressMessages(library(parallel))
knitr::opts_chunk$set(echo = TRUE)
options(dplyr.show_progress=FALSE) #do not output massive progress bar garbage to html
```
#Premise of proportional thresholding
Proportional thresholding is commonly applied to binary graphs, typically with the argument that it helps to rule out the possibility that group differences in nodal statistics are not attributable to density. That is, if one group has a denser network structure than another at a given edge definition threshold (e.g., *r* = 0.3), then one might find significant differences in nodal statistics that reflect global structure, not nodal structure.
#Does proportional thresholding rule out density differences?
Let's test this idea by simulating two groups, one with systematically stronger connectivity than the other (*r* + .2), but no other substantive changes in the graph details.
```{r simglobal, cache=TRUE}
#updated thinking about whack: need some nodal stats that are in the opposite direction, but would be marginal
#if a pure r thresholding perspective were applied. But then with density, it will tend to push those opposite effects toward significance
global_increase <- simulate_clingraph(
g_positive, npergroup=50, edgenoise=list(sd=0.05, dist="gaussian"),
groupmanipulation=list(
controls=list(
group_name="controls",
edgeshift_weight_bw_mean=0, edgeshift_weight_wi_sd=0.1, edgeshift_weight_bw_sd=0.2 #add variability to global shifts in weights (needed for b/w subs variability)
),
patients=list(
group_name="patients",
edgeshift_weight_bw_mean=0.2, edgeshift_weight_wi_sd=0.1, edgeshift_weight_bw_sd=0.2 #global mean shifts in weights, but identical b/w variability
)
)
)
```
##Density thresholding
Densities between 5% and 25%.
First, sanity check one graph at 5% to ensure that that `target_density` attribute matches the observed density.
```{r dthresh, cache=FALSE}
#density threshold both groups
densities_desired <- seq(.05, .25, .01)
allg_density <- threshold_glist(global_increase, densities_desired, method="density")
#sanity checks
x <- allg_density[["density_0.05"]][["patients"]][[2]]
graph.density(x)
x$target_density
```
Now examine the distribution of correlations in this sample graph:
```{r}
lattice::histogram(E(x)$w_hidden)
summary(E(x)$w_hidden)
```
Now compute *t*-tests at each density to ensure that the *r* threshold is consistently higher in 'patients', who were simulated with hyperconnectivity (higher correlations).
```{r}
threshold_weights <- lapply(allg_density, function(dlist) {
lapply(dlist, function(group) {
sapply(group, function(g) { g$wthresh })
})
})
allstats <- bind_rows(lapply(threshold_weights, function(d) {
tidy(t.test(d$controls, d$patients))
})) %>%
rename(meandiff=estimate, mcontrol=estimate1, mpatient=estimate2, tstat=statistic) %>%
mutate(density=names(allg_density)) %>%
select(density, mcontrol, mpatient, meandiff, tstat, p.value)
kable(allstats)
```
Conclusion: We have achieved a consistent difference in mean connectivity strength between groups such that the connectivity threshold is systematically higher in patients to achieve the same density in both groups.
##Are there differences in nodal statistics?
If density thresholding has succeeded, we should see essentially no group differences in nodal statistics because we only simulated global, not nodal, shifts in connectivity. Thus, if the premise of proportional thresholding is correct, this simulation should validate the use of this approach for ruling out density-related explanations.
Plot *t*-statistics for group comparisons at every density.
```{r densdegree, cache=TRUE}
nodal <- nodal_measures_glist(allg_density)
nodal_summaries <- summarize_nodal_measures(nodal)
nodal_combined <- bind_nodal_measures(nodal)
#xtabs(~thresh + group + nodeNum, nodal_combined) #verify frequencies in combined dataset
toprint <- arrange(nodal_summaries, thresh, node, group) %>% select(thresh, node, group, degree_mean, degree_sd) %>% head(n=15)
kable(toprint)
degree_effects <- nodal_combined %>% group_by(thresh, nodeNum) %>%
do({
mm <- lm(degree ~ group, .)
partab <- tidy(mm)
pfilt <- filter(partab, term=="grouppatients")
pfilt
}) %>% ungroup()
#critical t-test value at n=100 (~96 df on average)
critval <- qt(.025, 96)
#filter out 5% to make the graph prettier (fits on 4 rows)
ggplot(filter(degree_effects, thresh!="density_0.05")) +
aes(x=nodeNum, y=statistic) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Nodal differences by group in global strength simulation (dens. threshold)")
```
We would expect 5% of them to be significant by chance due to Type I error.
```{r}
sum(degree_effects$p.value < .05)/nrow(degree_effects)
```
So, we are in the range of the nominal .05 error rate, suggesting that proportional thresholding eliminates group differences in degree that are attributable to global differences in connectivity strength.
##Strength thresholding
But what happens when we set a specific strength-based threshold that is enforced equally across groups? Will patients have greater centrality than controls in general?
Use *r*s in the range of .2 - .5 since that is close to where the density thresholds fell... rather than evenly spacing, we should probably look at edges retained by r to linearize this... okay for now.
```{r}
#strength threshold both groups
#placed in separate chunk to avoid caching below (since allg_bystrength is a huge object)
rs_desired <- seq(.2, .5, .02)
allg_bystrength <- threshold_glist(global_increase, rs_desired, method="strength")
```
```{r diffbystrength, cache=TRUE}
nodal_bystrength <- nodal_measures_glist(allg_bystrength)
nodal_summaries_bystrength <- summarize_nodal_measures(nodal_bystrength)
nodal_combined_bystrength <- bind_nodal_measures(nodal_bystrength)
#xtabs(~thresh + group + nodeNum, nodal_combined) #verify frequencies in combined dataset
degree_effects_bystrength <- nodal_combined_bystrength %>% group_by(thresh, nodeNum) %>%
do({
mm <- lm(degree ~ group, .)
partab <- tidy(mm)
pfilt <- filter(partab, term=="grouppatients")
pfilt
}) %>% ungroup()
#critical t-test value at n=100 (~96 df on average)
critval <- qt(.025, 96)
#filter out 5% to make the graph prettier (fits on 4 rows)
ggplot(filter(degree_effects_bystrength, thresh!="density_0.05")) +
aes(x=nodeNum, y=statistic) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Nodal differences by group in global strength simulation (fixed r threshold)")
```
Here, all nodes are significantly different between groups, consistent with the problem of global shifts in strength leading to spurious group differences.
```{r}
sum(degree_effects_bystrength$p.value < .05)/nrow(degree_effects_bystrength)
```
Thus, we have provided a proof of concept for a scenario in which global connectivity differences induce widespread group differences in nodal statistics.
However, what if we take the *r*-thresholded graphs and include observed density as a covariate in the models?
```{r denscov, cache=TRUE}
degree_effects_bystrength_dcov <- nodal_combined_bystrength %>% group_by(thresh, nodeNum) %>%
do({
mm <- lm(degree ~ group + density, .)
partab <- tidy(mm)
pfilt <- filter(partab, term=="grouppatients")
pfilt
}) %>% ungroup()
#critical t-test value at n=100 (~96 df on average)
critval <- qt(.025, 96)
#filter out 5% to make the graph prettier (fits on 4 rows)
ggplot(filter(degree_effects_bystrength_dcov, thresh!="density_0.05")) +
aes(x=nodeNum, y=statistic) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Nodal differences by group in global strength sim (fixed r threshold, adj. by dens)")
```
We have restored the nominal type I error rate.
```{r}
sum(degree_effects_bystrength_dcov$p.value < .05)/nrow(degree_effects_bystrength_dcov)
```
#Whack a node
The idea that there would be global connectivity differences between groups is implausible for most clinical studies (might MS be an exception? not sure of lesion distribution). The pathophysiology of brain disorders is likely to affect specific nodes or modules (networks). Under such a scenario, how might proportional thresholding affect conclusions about group differences? From a conceptual standpoint, for a given graph order (i.e., fixed $k$ nodes), proportional thresholding sets a limit on the number of edges, thereby having a consistent effect on degree.
$$
D = \frac{2E}{N(N-1)}, \enspace \implies E = D \times N(N-1)
$$
Furthermore, the average degree is related to the density of the graph:
$$
D = \frac{2E}{N(N-1)}, \enspace \langle k \rangle = \frac{2E}{N} , \enspace \implies \langle k \rangle = D(N-1)
$$
Thus, proportional thresholding has a direct effect on the degree distribution of the graph. In the plausible case of group differences in the strength of some nodes, how would this play out?
Our broad conception is that proportional thresholding will tend to be sensitive to simulated nodal differences between groups, but that smaller changes in the opposite direction will be spuriously magnified by this procedure.
## Setup of nodal shift simulation
- Simulate *N*=50 in two groups
- Add Gaussian noise to edges for each subject, *M*=0, *SD*=.05
- Add between-subject variability in overall strength: *M*=0, nodes w/i subject shift *SD* = 0.1, b/w subject shift *SD* = 0.2
- Increase connectivity strength of dorsal ACC (node 215), L IFG (node 208), and R IFG (node 209): *M*=0.14, w/i *SD* = .04, b/w *SD* = .04
- Decrease connectivity slightly in R Postcentral (node 19), R STG (node 63), and L Precuneus (node 77): *M*=-.02, w/i *SD* = .02, b/w *SD* = .02
Thus decreases are 1/7th the size of increases
```{r}
whack_increase <- .14
whack_decrease <- -.02
poswhack <- c(208, 209, 215)
negwhack <- c(19, 63, 77)
whack <- simulate_clingraph(
g_positive, npergroup=50, edgenoise=list(sd=0.05, dist="gaussian"),
groupmanipulation=list(
controls=list(
group_name="controls",
edgeshift_weight_bw_mean=0,
edgeshift_weight_wi_sd=0.1,
edgeshift_weight_bw_sd=0.2 #global shifts in weights (needed to get reasonable b/w subs variability)
),
patients=list(
group_name="patients",
edgeshift_weight_bw_mean=0.0,
edgeshift_weight_wi_sd=0.1,
edgeshift_weight_bw_sd=0.2, #global shifts in weights
nodemanipulation=list( #nodal shifts in (weighted) edges incident to a node
list(name="V215", edgeshift_weight_bw_mean=whack_increase, #D ACC
edgeshift_weight_wi_sd=.04,
edgeshift_weight_bw_sd=.04),
list(name="V208", #L IFG
edgeshift_weight_bw_mean=whack_increase,
edgeshift_weight_wi_sd=.04,
edgeshift_weight_bw_sd=.04),
list(name="V209", #R IFG
edgeshift_weight_bw_mean=whack_increase,
edgeshift_weight_wi_sd=.04,
edgeshift_weight_bw_sd=.04),
list(name="V19", #R Postcentral
edgeshift_weight_bw_mean=whack_decrease,
edgeshift_weight_wi_sd=.02,
edgeshift_weight_bw_sd=.02),
list(name="V63", #R STG
edgeshift_weight_bw_mean=whack_decrease,
edgeshift_weight_wi_sd=.02,
edgeshift_weight_bw_sd=.02),
list(name="V77", #L Precuneus
edgeshift_weight_bw_mean=whack_decrease,
edgeshift_weight_wi_sd=.02,
edgeshift_weight_bw_sd=.02)
)
)
)
)
```
## Recap of van den Heuvel
Proportional thresholding will tend to lead to the inclusion of more spurious connections in individuals with lower overall functional connectivity (FC) strength. By enforcing the same number of edges, weaker correlations will be preserved in low-FC subjects and these edges are unreliable (correlations of time series of a given length). They demonstrate this in part by looking at the consistency of the top 100 and bottom 100 connections across subjects, with the top 100 being represented consistently in most subjects (high b/w subjects consistency), whereas the bottom 100 are very heterogeneous (i.e., unreliable).
## Predictions
- Increasing the mean edge strength in a handful of nodes will increase degree in those nodes, but lead to a diffuse removal of weaker edges that were on the cusp (bottom end) of the threshold. By definition, to maintain a constant $\langle k \rangle$, the sum of positive shifts in degree for increased nodes will equal the sum of negative shifts in all other nodes. This will hold true for binary graphs.
- If there are marginal, non-significant *decreases* in some nodes in the *increased* group, these will become significant under proportional thresholding because these weaker edges will tend to be deleted by proportional thresholding.
- If there is a global shift in connectivity, but also some nodes that are selectively different, both proportional and fixed-strength thresholding will work.
## Test 1: diffuse removal of edges
### Subtest 1: equal increases and decreases in degree under global connectivity
The increases in degree for the patient group under global connectivity will equal the decreases to maintain proportional thresholding.
```{r}
degree_effects %>% mutate(degchange=ifelse(estimate < 0, "negative", "positive")) %>%
group_by(thresh, degchange) %>% summarize(sum(estimate))
#sum(filter(degree_effects, estimate < 0)$estimate)
#sum(filter(degree_effects, estimate > 0)$estimate)
```
So, at each density, the sum of higher degree values in patients (hyperconnected) plus lower degree values equals zero.
This is not true under strength-based thresholding, where all shifts were positive by definition:
```{r}
degree_effects_bystrength %>% mutate(degchange=ifelse(estimate < 0, "negative", "positive")) %>%
group_by(thresh, degchange) %>% summarize(sum(estimate))
```
The equality of positive/negative shifts are restored when density is included as a covariate in the analysis of a strength-thresholded graph.
```{r}
degree_effects_bystrength_dcov %>% mutate(degchange=ifelse(estimate < 0, "negative", "positive")) %>%
group_by(thresh, degchange) %>% summarize(sum(estimate))
```
Note that under proportional thresholding on the global shift data, the positive and negative changes don't appear to isolate to specific nodes at first glance:
```{r}
ggplot(filter(degree_effects, thresh!="density_0.05")) + aes(x=nodeNum, y=estimate, ymin=estimate-std.error, ymax=estimate+std.error) + geom_pointrange(size=0.1) + facet_wrap(~thresh)
```
### Subtest 2: Equal and opposing changes in degree under selective nodal shifts in connectivity
The same logic about average degree should hold for selective nodal shifts.
```{r}
allg_selective_bydensity <- threshold_glist(whack, densities_desired, method="density")
nodal_selective_bydensity <- nodal_measures_glist(allg_selective_bydensity)
nodal_selective_summaries_bydensity <- summarize_nodal_measures(nodal_selective_bydensity)
nodal_selective_combined_bydensity <- bind_nodal_measures(nodal_selective_bydensity)
#xtabs(~thresh + group + nodeNum, nodal_combined) #verify frequencies in combined dataset
```
## Test 2: induction of 'significant' negative degree changes when some nodes are increased
```{r dens_selective, cache=TRUE}
comparator_nodes <- sample(78:207, 10) #consistent random 10 nodes not targeted
degree_effects_selective_bydensity <- group_lm(nodal_selective_combined_bydensity) %>%
flag_nodes(pos=poswhack, neg=negwhack)
#critical t-test value at n=100 (~96 df on average)
critval <- qt(.025, 96)
#look at target nodes and a random set of unselected
#filter out 5% to make the graph prettier (fits on 4 rows)
deg_subset <- filter(degree_effects_selective_bydensity,
nodeNum %in% c(poswhack, negwhack, comparator_nodes) & thresh != "density_0.05")
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in selective simulation (density threshold)") +
scale_x_discrete("Node", labels=NULL)
```
This plot makes evident that the negative targets are significantly different between groups despite representing a small change in strength.
###Would the same thing happen under strength thresholding?
```{r}
#strength threshold both groups
#placed in separate chunk to avoid caching below (since allg_selective_bystrength is a huge object)
allg_selective_bystrength <- threshold_glist(whack, rs_desired, method="strength")
```
```{r diffbystrength_selective, cache=TRUE}
nodal_selective_bystrength <- nodal_measures_glist(allg_selective_bystrength)
nodal_selective_summaries_bystrength <- summarize_nodal_measures(nodal_selective_bystrength)
nodal_selective_combined_bystrength <- bind_nodal_measures(nodal_selective_bystrength)
#xtabs(~thresh + group + nodeNum, nodal_selective_combined) #verify frequencies in combined dataset
degree_effects_selective_bystrength <- group_lm(nodal_selective_combined_bystrength) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(degree_effects_selective_bystrength,
nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in selective simulation (fixed r threshold)") +
scale_x_discrete("Node", labels=NULL)
```
So, in general, strength-based thresholding does not induce significant negative statistics, while preserving the increased nodes. TODO: look into why t-stats for positive targets are higher under proportional thresholding.
###What about controlling for density in *r*-thresholded nodal statistics?
```{r}
degree_effects_selective_bystrength_dcov <- group_lm(nodal_selective_combined_bystrength,
f=formula(degree ~ group + density)) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(degree_effects_selective_bystrength_dcov,
nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in selective simulation (fixed r threshold)") +
scale_x_discrete("Node", labels=NULL)
```
Thus, although perhaps imperfect, strength thresholding with per-subject density included as a covariate tends to result in less of the spurious negative effects.
### What about weighted analysis?
Perhaps all of this silliness can be avoided by maintaining edge weights and focusing on *strength* instead of *degree*.
```{r}
#zero negative edges, but otherwise leave things alone
weighted_whack <- threshold_glist(whack, thresholds = 0, method="weight", rmweights=FALSE)
nodal_selective_weighted <- nodal_measures_glist(weighted_whack)
#nodal_selective_summaries_bydensity <- summarize_nodal_measures(nodal_selective_bydensity)
nodal_selective_combined_weighted <- bind_nodal_measures(nodal_selective_weighted)
weighted_analysis <- group_lm(nodal_selective_combined_weighted) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(weighted_analysis, nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in selective simulation (weighted)") +
scale_x_discrete("Node", labels=NULL)
```
```{r}
weighted_analysis <- group_lm(nodal_selective_combined_weighted, f=formula(strength ~ group)) %>%
flag_nodes(pos=poswhack, neg=negwhack)
strength_subset <- filter(weighted_analysis, nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(strength_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Strength differences by group in selective simulation (weighted)") +
scale_x_discrete("Node", labels=NULL)
```
As expected, a weighted analysis of strength does not appear to induce negative nodal differences.
## Test 3: global and selective differences
```{r}
#simulation with both global and specific differences in patient group
whack_global_nodal <- simulate_clingraph(
g_positive, npergroup=50, edgenoise=list(sd=0.05, dist="gaussian"),
groupmanipulation=list(
controls=list(
group_name="controls",
edgeshift_weight_bw_mean=0,
edgeshift_weight_wi_sd=0.1,
edgeshift_weight_bw_sd=0.2 #between-person global variation in weights (needed to get reasonable b/w subs variability)
),
patients=list(
group_name="patients",
edgeshift_weight_bw_mean=0.2, #0.2 shift in patient group globally
edgeshift_weight_wi_sd=0.1,
edgeshift_weight_bw_sd=0.2, #global shifts in weights
nodemanipulation=list( #nodal shifts in (weighted) edges incident to a node
list(name="V215", edgeshift_weight_bw_mean=whack_increase, #D ACC
edgeshift_weight_wi_sd=.04,
edgeshift_weight_bw_sd=.04),
list(name="V208", #L IFG
edgeshift_weight_bw_mean=whack_increase,
edgeshift_weight_wi_sd=.04,
edgeshift_weight_bw_sd=.04),
list(name="V209", #R IFG
edgeshift_weight_bw_mean=whack_increase,
edgeshift_weight_wi_sd=.04,
edgeshift_weight_bw_sd=.04),
list(name="V19", #R Postcentral
edgeshift_weight_bw_mean=whack_decrease,
edgeshift_weight_wi_sd=.02,
edgeshift_weight_bw_sd=.02),
list(name="V63", #R STG
edgeshift_weight_bw_mean=whack_decrease,
edgeshift_weight_wi_sd=.02,
edgeshift_weight_bw_sd=.02),
list(name="V77", #L Precuneus
edgeshift_weight_bw_mean=whack_decrease,
edgeshift_weight_wi_sd=.02,
edgeshift_weight_bw_sd=.02)
)
)
)
)
```
```{r}
allg_both_bydensity <- threshold_glist(whack_global_nodal, densities_desired, method="density")
nodal_both_bydensity <- nodal_measures_glist(allg_both_bydensity)
nodal_both_summaries_bydensity <- summarize_nodal_measures(nodal_both_bydensity)
nodal_both_combined_bydensity <- bind_nodal_measures(nodal_both_bydensity)
degree_effects_both_bystrength <- group_lm(nodal_both_combined_bydensity) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(degree_effects_both_bystrength,
nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in glob + selective sim. (dens. threshold)") +
scale_x_discrete("Node", labels=NULL)
```
Same qualitative pattern as previous findings. Proportional thresholding maintains sensitivity to nodal differences even in the presence of global shifts in the patient group.
```{r}
allg_both_bystrength <- threshold_glist(whack_global_nodal, rs_desired, method="strength")
nodal_both_bystrength <- nodal_measures_glist(allg_both_bystrength)
nodal_both_summaries_bystrength <- summarize_nodal_measures(nodal_both_bystrength)
nodal_both_combined_bystrength <- bind_nodal_measures(nodal_both_bystrength)
degree_effects_both_bystrength <- group_lm(nodal_both_combined_bystrength) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(degree_effects_both_bystrength,
nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in glob + selective sim. (strength threshold)") +
scale_x_discrete("Node", labels=NULL)
```
As one might expect, the nodes that have been selectively enhanced have especially high t-statistics. But the problem with global connectivity 'significance' inheres in the use of an equal-strength thresholding. What if we return to the inclusion of density as a covariate?
```{r}
degree_effects_both_bystrength_dcov <- group_lm(nodal_both_combined_bystrength,
f=formula(degree ~ group + density)) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(degree_effects_both_bystrength_dcov,
nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Degree differences by group in glob + selective simulation (fixed r threshold)") +
scale_x_discrete("Node", labels=NULL)
```
This puts us largely back in 'good' territory in terms of not creating spurious negative effects.
Likewise, if we adopt a weighted analysis, we see 'significance' everywhere.
```{r}
#zero negative edges, but otherwise leave things alone
weighted_whack_both <- threshold_glist(whack_global_nodal, thresholds=0, method="weight", rmweights=FALSE)
nodal_selective_weighted <- nodal_measures_glist(weighted_whack_both)
#nodal_selective_summaries_bydensity <- summarize_nodal_measures(nodal_selective_bydensity)
nodal_selective_combined_weighted <- bind_nodal_measures(nodal_selective_weighted)
weighted_analysis <- group_lm(nodal_selective_combined_weighted, f=formula(strength ~ group)) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(weighted_analysis, nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Strength differences by group in glob + selective sim. (weighted)") +
scale_x_discrete("Node", labels=NULL)
```
How would weighted analysis with mean FC as a covariate work for us?
```{r}
weighted_analysis <- group_lm(nodal_selective_combined_weighted, f=formula(strength ~ group + meanFC)) %>%
flag_nodes(pos=poswhack, neg=negwhack)
deg_subset <- filter(weighted_analysis, nodeNum %in% c(poswhack, negwhack, comparator_nodes))
ggplot(deg_subset) +
aes(x=factor(nodeNum), y=statistic, fill=nodeType) +
geom_bar(stat="identity") +
geom_hline(yintercept=c(-critval,critval)) +
facet_wrap(~thresh) + ggtitle("Strength differences by group in glob + selective sim. (weighted meanFC)") +
scale_x_discrete("Node", labels=NULL)
```