-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplots.R
More file actions
927 lines (830 loc) · 47.5 KB
/
Copy pathplots.R
File metadata and controls
927 lines (830 loc) · 47.5 KB
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
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
if (!file.exists("figure")) {
dir.create("figure")
}
source("setup.R")
source("input.R")
library(ggpubr)
colSes = function(m) {apply(m, 2, sd)/sqrt(nrow(m))} #standard error
plot_df = function(mean_power, compare_methods,
legend_name, pos = c(0.75, 0.6), legend_size = 8){
df_power = data.frame(mu_seq = rep(as.numeric(colnames(mean_power)),
each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = pos, legend.text = element_text(size = legend_size)) +
guides(fill=guide_legend(nrow=2, byrow=TRUE)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
return(p)
}
############## Figure 2
mode = "server_linear_bell"
load(paste(dirname(getwd()), "/result/",mode,".Rdata", sep = ""))
mean_power = sapply(p_val, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
colnames(mean_power) = (0:5)*0.4
sd_power = sapply(p_val, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = methods_interactive; legend_name[c(1, 3, 10, 11, 12)] = c("CovAdj-Wilcoxon", "CovAdj-Wilcoxon-robust-quadratic", "i-bet", "i-bet-robust-linear", "i-bet-robust-quadratic")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("linear-CATE-test", "CovAdj-Wilcoxon", "i-bet")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = c(0.28, 0.6), legend_size = 6)
ggsave(filename = paste(dirname(getwd()), "/figure/i_bet_",mode,".png", sep = ""),
plot = p, width = 4, height = 3.6)
############## Figure 3
mode = "server_linear_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
colnames(mean_power) = (0:5)*0.4
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = methods_interactive; legend_name[c(1, 3, 10, 11, 12)] = c("CovAdj-Wilcoxon", "CovAdj-Wilcoxon-robust-quadratic", "i-bet-original", "i-bet-robust", "i-bet-robust-quadratic")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("linear-CATE-test", "CovAdj-Wilcoxon-robust", "i-bet-original", "i-bet-robust")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = c(0.7, 0.6))
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
############## Figure 4
mode = "server_linear_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = methods_interactive; legend_name[c(1, 3, 10, 11, 12)] = c("CovAdj-Wilcoxon", "CovAdj-Wilcoxon-robust-quadratic", "i-bet-original", "i-bet-robust", "i-bet-robust-quadratic")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("linear-CATE-test", "CovAdj-Wilcoxon-robust", "i-bet-original", "i-bet-robust")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = c(0.75, 0.5), legend_size = 6)
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
############## Figure 5
mode = "server_quadratic_bell"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = methods_interactive; legend_name[c(1, 3, 10, 11, 12)] = c("CovAdj-Wilcoxon", "CovAdj-Wilcoxon-robust-quadratic", "i-bet-original", "i-bet-robust-linear", "i-bet-robust-quadratic")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("linear-CATE-test", "CovAdj-Wilcoxon-robust-quadratic", "i-bet-robust-linear", "i-bet-robust-quadratic")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = c(0.75, 0.5), legend_size = 6)
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
if(0){
############### Figure 5(a)
mode = "dense_weak"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
mode = "dense_weak_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power_cauchy = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
compare_methods = c("R(x)-Gaussian", "R(X)-Cauchy", "R(X, 1-A)-Gaussian", "R(X, 1-A)-Cauchy")
legend_name = factor(compare_methods, levels = compare_methods)
df_combine = data.frame(mu_seq = rep(0:5, each = 4),
power = as.vector(rbind(mean_power[c(1,2),],
mean_power_cauchy[c(1,2),])[c(1,3,2,4),]),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = df_combine,
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 21, 24, 24)) +
scale_color_manual(values = c("red1", "pink1", "green3", "yellow4")) +
scale_fill_manual(values = c("red1", "pink1", "green3", "yellow4")) +
scale_linetype_manual(values = c("solid", "dashed", "solid", "dashed")) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = c(0.77, 0.21), legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
ggsave(filename = paste("figure/outcome_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
legend_name = factor(methods_var_Wilcoxon, levels = methods_var_Wilcoxon)
############### Figure 5(b)
mode = "sparse_strong"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
compare_methods = c("R(X)", "R(X, 1-A)")
df_power = data.frame(mu_seq = rep(0:5, each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 24)) +
scale_color_manual(values = c("red1", "green3")) +
scale_fill_manual(values = c("red1", "green3")) +
scale_linetype_manual(values = c("solid", "dashed")) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = c(0.16, 0.86), legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
ggsave(filename = paste("figure/outcome_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
############### Figure 5(c)
mode = "dense_weak_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
compare_methods = c("R(X)", "R(X, 1-A)")
df_power = data.frame(mu_seq = rep(0:5, each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 24)) +
scale_color_manual(values = c("red1", "green3")) +
scale_fill_manual(values = c("red1", "green3")) +
scale_linetype_manual(values = c("solid", "dashed")) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = c(0.16, 0.86), legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
ggsave(filename = paste("figure/outcome_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
############### Figure 6(a)
mode = "dense_weak_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
compare_methods = c("R(X, 1-A)", "R - hat(R)(X, 1 - A)")
names = expression(R(X, 1-A), R - hat(R)(X, 1 - A))
df_power = data.frame(mu_seq = rep(0:5, each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 24), labels = names) +
scale_color_manual(values = c("green3", "green4"), labels = names) +
scale_fill_manual(values = c("green3", "green4"), labels = names) +
scale_linetype_manual(values = c("solid", "dashed"), labels = names) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = c(0.2, 0.85), legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
ggsave(filename = paste("figure/outcome_compare_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
############### Figure 6(b)
mode = "sparse_strong_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
compare_methods = c("R(X, 1-A)", "R - hat(R)(X, 1 - A)")
names = expression(R(X, 1-A), R - hat(R)(X, 1 - A))
df_power = data.frame(mu_seq = rep(0:5, each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 24), labels = names) +
scale_color_manual(values = c("green3", "green4"), labels = names) +
scale_fill_manual(values = c("green3", "green4"), labels = names) +
scale_linetype_manual(values = c("solid", "dashed"), labels = names) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = c(0.2, 0.85), legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
ggsave(filename = paste("figure/outcome_compare_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
plot_df_var = function(mean_power, compare_methods, label_names) {
legend_name = factor(methods_var_Wilcoxon, levels = methods_var_Wilcoxon)
df_power = data.frame(mu_seq = rep(0:5, each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 24, 22, 3), labels = label_names) +
scale_color_manual(values = c("red1", "green4", "deepskyblue2", "purple"), labels = label_names) +
scale_fill_manual(values = c("red1", "green4", "deepskyblue2", "purple"), labels = label_names) +
scale_linetype_manual(values = c("solid", "22", "42", "44"), labels = label_names) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = "none", legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
return(p)
}
################ Figure 7
compare_methods = c("R(X)", "R - hat(R)(X, 1 - A)", "|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|")
label_names = expression(R(X), R - hat(R)(X, 1 - A),
abs( R - hat(R)(X, 1 - A)) - abs( R - hat(R)(X, A)))
mode = "sparse_strong"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/ranks_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/ranks_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/ranks_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
################### Figure 8
compare_methods = c("R(X)", "R - hat(R)(X, 1 - A)", "|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|")
label_names = expression(R(X), R - hat(R)(X, 1 - A),
abs( R - hat(R)(X, 1 - A)) - abs( R - hat(R)(X, A)))
mode = "dense_weak"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/ranks_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "dense_weak_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/ranks_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "dense_weak_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/ranks_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
################### Figure 9
compare_methods = c("R(X)", "R - hat(R)(X, 1 - A)",
"|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|",
"S(|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|)")
label_names = expression(R(X), R - hat(R)(X, 1 - A),
paste("|", R - hat(R)(X, 1 - A), "|") - paste("|", R - hat(R)(X, A), "|"),
S %.% (paste("|", R - hat(R)(X, 1 - A), "|") - paste("|", R - hat(R)(X, A), "|")))
mode = "both_pos_strong"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/signed_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_sparse_strong"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/signed_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_dense_weak"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/signed_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/signed_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/signed_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_var(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/signed_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
#########################################################################
########################### Appendix ###################################
#########################################################################
########################### Figure 12 ###################################
mode = "linear_adapt"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "linear_control_skewed_adapt"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "linear_cauchy_adapt"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "quadratic_adapt"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original weights)", "i-Wilcoxon (new weights)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
#########################################################################
########################### Figure 13 ###################################
#########################################################################
legend_name = c("R(X)", "Bonferroni", "|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|", "Geometric",
"S(|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|)", "Harmonic")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = legend_name
label_names = expression(R(X), "Bonferroni",
paste("|", R - hat(R)(X, 1 - A), "|") - paste("|", R - hat(R)(X, A), "|"),
"Geometric",
S %.% (paste("|", R - hat(R)(X, 1 - A), "|") - paste("|", R - hat(R)(X, A), "|")),
"Harmonic")
add_meta = function(result) {
meta_result = lapply(result, function(x) {
lapply(x, function(y) {
y = y[c(1, 4, 5)]
add_meta_result = c(3*min(y),
exp(1)*prod(y)^(1/3),
exp(1)*log(3)*3/sum(1/y))
return(c(y, add_meta_result))
})
})
return(meta_result)
}
plot_meta = function(mean_power, legend_name, compare_methods, label_names) {
mean_power = mean_power[c(1,4,2,5,3,6),]
df_power = data.frame(mu_seq = rep(0:5, each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 7, 22, 8, 3, 10), labels = label_names) +
scale_color_manual(values = c("red1", "yellow4", "deepskyblue2", "tan1", "purple", "deeppink"),
labels = label_names) +
scale_fill_manual(values = c("red1", "yellow4", "deepskyblue2", "tan1", "purple", "deeppink"),
labels = label_names) +
scale_linetype_manual(values = rep(c("dashed", "solid"),3), labels = label_names) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = c("none"), legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
return(p)
}
mode = "dense_weak"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "dense_weak_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "dense_weak_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_control_skewed"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_cauchy"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_dense_weak"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_sparse_strong"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_pos_strong"
load(paste("result/",mode,".Rdata", sep = ""))
meta_result = add_meta(result)
mean_power = sapply(meta_result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_meta(mean_power = mean_power, legend_name = legend_name,
compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/meta_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
########################### Figure 14 ###################################
mode = "linear_cauchy_updated"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = names(result[[1]][[1]]);
legend_name[c(6, 8, 9)] = c("i-Wilcoxon-robust_old", "i-Wilcoxon-original",
"i-Wilcoxon-robust")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("CovAdj-Wilcoxon-robust", "linear-CATE-test",
"i-Wilcoxon-original", "i-Wilcoxon-robust")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = c(0.25, 0.85))
ggsave(filename = paste("figure/interactive_",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
#########################################################################
########################### small sample size ##########################
#########################################################################
#########################################################################
########################### Figure 15 ###################################
#########################################################################
add_meta_small = function(result1, result2, robust = TRUE) {
result = list()
if(robust) {
for(i in 1:length(result1)) {
result[[i]] = list()
for(j in 1:length(result1[[i]])){
result[[i]][[j]] = c(result1[[i]][[j]][c("CovAdj-Wilcoxon-robust","linear-CATE-test","i-Wilcoxon-robust-signedA")],
3*min(result2[[i]][[j]][c(1,4,5)]),
4*min(result1[[i]][[j]]["i-Wilcoxon-robust-signedA"], c(result2[[i]][[j]][c(1,4,5)])))
}
}
} else {
for(i in 1:length(result1)) {
result[[i]] = list()
for(j in 1:length(result1[[i]])){
result[[i]][[j]] = c(result1[[i]][[j]][c("CovAdj-Wilcoxon-quadratic","linear-CATE-test","i-Wilcoxon-quadratic-signedA")],
3*min(result2[[i]][[j]][c(1,4,5)]),
4*min(result1[[i]][[j]]["i-Wilcoxon-quadratic-signedA"], c(result2[[i]][[j]][c(1,4,5)])))
}
}
}
return(result)
}
mode = "linear_control_skewed"
load(paste("result/",mode,"_updated_small.Rdata", sep = ""))
i_result = result
load(paste("result/",mode,"_permutation.Rdata", sep = ""))
meta_result = result
result = add_meta_small(i_result, meta_result)
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
colnames(mean_power) = 0:5
legend_name = c("CovAdj-Wilcoxon", "linear-CATE-test",
"i-Wilcoxon", "Wilcoxon-Bonferroni", "i-Wilcoxon-Bonferroni")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("CovAdj-Wilcoxon", "linear-CATE-test",
"i-Wilcoxon", "Wilcoxon-Bonferroni", "i-Wilcoxon-Bonferroni")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none", legend_size = 6)
ggsave(filename = paste("figure/interactive_",mode,"_small.eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "linear_cauchy"
load(paste("result/",mode,"_updated_small.Rdata", sep = ""))
i_result = result
load(paste("result/",mode,"_permutation.Rdata", sep = ""))
meta_result = result
result = add_meta_small(i_result, meta_result)
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
colnames(mean_power) = 0:5
legend_name = c("CovAdj-Wilcoxon", "linear-CATE-test",
"i-Wilcoxon", "Wilcoxon-Bonferroni", "i-Wilcoxon-Bonferroni")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("CovAdj-Wilcoxon", "linear-CATE-test",
"i-Wilcoxon", "Wilcoxon-Bonferroni", "i-Wilcoxon-Bonferroni")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none", legend_size = 6)
ggsave(filename = paste("figure/interactive_",mode,"_small.eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "quadratic"
load(paste("result/",mode,"_updated_small.Rdata", sep = ""))
i_result = result
load(paste("result/",mode,"_permutation.Rdata", sep = ""))
meta_result = result
result = add_meta_small(i_result, meta_result, robust = FALSE)
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
colnames(mean_power) = 0:5
legend_name = c("CovAdj-Wilcoxon", "linear-CATE-test",
"i-Wilcoxon", "Wilcoxon-Bonferroni", "i-Wilcoxon-Bonferroni")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("CovAdj-Wilcoxon", "linear-CATE-test",
"i-Wilcoxon", "Wilcoxon-Bonferroni", "i-Wilcoxon-Bonferroni")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none", legend_size = 6)
ggsave(filename = paste("figure/interactive_",mode,"_small.eps", sep = ""),
plot = p, width = 4, height = 3.6)
########################### Figure 16 ###################################
mode = "linear_cauchy_oracle_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = names(result[[1]][[1]]); legend_name[1] = "i-Wilcoxon-robust"
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon-robust", "i-Wilcoxon-oracle")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = c(0.25, 0.85), legend_size = 10)
ggsave(filename = "figure/oracle_power_cauchy.eps",
plot = p, width = 4, height = 3.6)
#########################################################################
########################### Figure 17 ###################################
#########################################################################
plot_df_small = function(mean_power, compare_methods, label_names) {
legend_name = factor(methods_var_Wilcoxon, levels = methods_var_Wilcoxon)
df_power = data.frame(mu_seq = rep(as.numeric(colnames(mean_power)), each = nrow(mean_power)),
power = as.vector(mean_power),
grp = rep(legend_name,
ncol(mean_power)))
p = ggplot(data = subset(df_power, (grp %in% compare_methods)),
aes(x = mu_seq, y = power, group = grp, fill = grp)) +
geom_line(aes(linetype = grp, color = grp), size = 0.8) +
geom_hline(yintercept=0.05) +
geom_point(aes(shape = grp, color = grp), size = 2.5) +
scale_shape_manual(values = c(21, 22, 3), labels = label_names) +
scale_color_manual(values = c("red1", "deepskyblue2", "purple"), labels = label_names) +
scale_fill_manual(values = c("red1", "deepskyblue2", "purple"), labels = label_names) +
scale_linetype_manual(values = c("solid", "42", "44"), labels = label_names) +
theme(legend.title = element_blank(),
panel.background = element_rect(fill = "white", colour = "black"),
panel.grid.major = element_line(colour = "grey", linetype = "dotted"),
panel.grid.minor = element_line(colour = "grey"),
text = element_text(size = 15),
legend.position = "none", legend.text = element_text(size = 8)) +
xlab("Scale of treatment effect") + ylab("power") +
scale_y_continuous(breaks = seq(0,1,0.2), limits = c(0,1))
plot(p)
return(p)
}
compare_methods = c("R(X)", "|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|",
"S(|R - hat(R)(X, 1 - A)| - |R - hat(R)(X, A)|)")
label_names = expression(R(X),
paste("|", R - hat(R)(X, 1 - A), "|") - paste("|", R - hat(R)(X, A), "|"),
S %.% (paste("|", R - hat(R)(X, 1 - A), "|") - paste("|", R - hat(R)(X, A), "|")))
mode = "dense_weak_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "dense_weak_cauchy_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "dense_weak_control_skewed_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_smallN_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_smallN_cauchy_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "sparse_strong_smallN_control_skewed_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_dense_weak_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_sparse_strong_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "both_pos_strong_smallN_small"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){
colMeans(matrix(unlist(x) < alpha, byrow = TRUE, nrow = length(x)), na.rm = TRUE)})
p = plot_df_small(mean_power = mean_power, compare_methods = compare_methods, label_names = label_names)
ggsave(filename = paste("figure/",mode,".eps", sep = ""),
plot = p, width = 4, height = 3.6)
############################ rebuttal Figure 1 ####################################
mode = "linear_updated"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = names(result[[1]][[1]])
legend_name[c(5,8)] = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,"_compare.eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "linear_control_skewed_updated"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = names(result[[1]][[1]])
legend_name[c(6,9)] = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,"_compare.eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "linear_cauchy_updated"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = names(result[[1]][[1]])
legend_name[c(6,9)] = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,"_compare.eps", sep = ""),
plot = p, width = 4, height = 3.6)
mode = "quadratic_updated"
load(paste("result/",mode,".Rdata", sep = ""))
mean_power = sapply(result, function(x){colMeans(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
sd_power = sapply(result, function(x){colSes(matrix(unlist(x) < alpha,
byrow = TRUE, nrow = length(x)))})
legend_name = names(result[[1]][[1]])
legend_name[c(7,10)] = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
legend_name = factor(legend_name, levels = legend_name)
compare_methods = c("i-Wilcoxon (original)", "i-Wilcoxon (weighted)")
p = plot_df(mean_power = mean_power, compare_methods = compare_methods,
legend_name = legend_name, pos = "none")
ggsave(filename = paste("figure/interactive_",mode,"_compare.eps", sep = ""),
plot = p, width = 4, height = 3.6)
}