-
Notifications
You must be signed in to change notification settings - Fork 0
/
MR_Practicical_Session_MB_2023.Rmd
1504 lines (1276 loc) · 80.2 KB
/
MR_Practicical_Session_MB_2023.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
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
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Mendelian Randomization course\nPractical Session"
author: "Mathilde Boissel"
date: "27/10/2023"
output:
html_document:
toc: true
toc_depth: 1
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
_It is highly recommanded to follow the theorical session before start this training._
The aim of this session will be explore several methods/packages to eval estimates usually wanted in MR studies.
---
# R environment
In the following session, under R 4.2.1, we will use following R packages :
- [{ivpack}](https://cran.r-project.org/web/packages/ivpack/index.html) v1.2
- [{meta}](https://cran.r-project.org/web/packages/meta/index.html) v6.1-0 (ou 6.2-1 aussi testé)
- [{MendelianRandomization}](https://cran.r-project.org/web/packages/MendelianRandomization/index.html) v0.7.0
- [{TwoSampleMR}](https://mrcieu.github.io/TwoSampleMR/articles/introduction.html) v0.5.6 (ou 0.5.7 aussi testé)
**Warning** : Loading `{TwoSampleMR}` leads to conflict with `{MendelianRandomization}` masking `mr_ivw` and `mr_median` functions.
It is also worth noting the function `dat_to_MRInput` in the `{TwoSampleMR}` package that will convert from the `TwoSampleMR` format to the `MendelianRandomization` format.
```{r packages, echo = TRUE, include = FALSE}
# install.packages(c("ivpack", "meta", "MendelianRandomization", "devtools"))
# # or with renv
# library(renv)
# renv::install("[email protected]")
# renv::install("[email protected]")
# renv::install("Rcpp")
# renv::install("meta")
# renv::update("htmltools")
# renv::install("[email protected]")
# renv::install("MRCIEU/TwoSampleMR")
# # or via devtools
# library(devtools) ## devtools only need to install from github
# install_github('MRCIEU/TwoSampleMR')
library(ivpack)
library(meta)
library(MendelianRandomization)
# library(TwoSampleMR) # to load later otherwise conflict :
# The following objects are masked from 'package:MendelianRandomization':
# mr_ivw, mr_median
```
---
# Dataset
You have to open the Rmd file `MR_Practical_Session.Rmd` to access to not-shown-chunk named `dataset`, so you will get the data by copy and past the objects (`coursedata`, `ratio.all` and `diabetes_data`) in your R Console.
**Warning**: the dataset we gave you was already **harmonised** - all the associations were matched up to be on the **same strand**, and **going in the same direction**. In reality, you will often need to check that these **alignments** are correct before using the data.
MR-Base web-app can do this for you automatically under certain set rules (e.g. **remove all palindromic snps with a MAF>=0.3**), but we highly highly recommend doing this by hand if you are unfamiliar with the process and the choices being made.
```{r dataset, echo = FALSE, eval = TRUE}
#### source data copied in an R script ####
source("load_data_MR.R")
## or copy the build obj bellow :
#### coursedata 1000 lignes ####
coursedata <- structure(
list(
ID = 1:1000,
g1 = c(
1L, 0L, 1L, 0L, 0L, 2L, 1L,
1L, 1L, 2L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L,
1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 2L, 0L, 0L, 0L, 2L, 0L, 0L, 0L,
0L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 2L, 2L, 1L,
0L, 2L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 2L, 0L, 1L, 0L, 1L, 0L,
0L, 1L, 0L, 0L, 1L, 1L, 2L, 1L, 2L, 0L, 0L, 0L, 0L, 0L, 2L, 1L,
1L, 1L, 0L, 0L, 2L, 1L, 0L, 0L, 0L, 1L, 1L, 2L, 1L, 0L, 0L, 1L,
0L, 1L, 0L, 2L, 1L, 1L, 0L, 2L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L,
1L, 1L, 0L, 1L, 0L, 1L, 2L, 0L, 1L, 0L, 1L, 2L, 1L, 0L, 0L, 1L,
1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L,
1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 2L, 0L,
1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L,
1L, 0L, 1L, 1L, 0L, 2L, 0L, 0L, 1L, 0L, 1L, 0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-0.6859939, -0.6415381, 0.1375836, -0.8205097, -0.9211929, -0.2890304,
2.804525, 1.226967, -0.9575722, -1.270487, -2.289114, 0.526536, 1.438994,
-0.3715216, 1.331559, 1.792797, 1.692925, 1.256187, 0.06991528, -0.6505202,
1.396369, -0.5114426, 0.2672284, 1.574073, 0.04566857, 0.4056919, 1.818845,
-2.555156, 2.999357, 1.600707, 2.371696, -0.7393405, -0.2391566, -1.39762,
-1.739929, 0.7721316, 1.411083, -1.757184, 0.5943157, -0.2505998, -0.1681945,
0.2570663, 3.30867, -1.116718, 0.5894963, 1.478647, -0.7417048, -1.319887,
1.584719, 1.15919, -0.8447209, 0.2667319, 1.18326, 0.02816468, 1.687759,
-1.199569, -0.6692825, 0.5739241, 2.120731, 0.8224431, 0.6210457, -2.017137,
-0.6241882, 2.268948, 1.805351, 0.397793, -0.7359586, -0.2063584, 0.1522673,
1.036336, 1.330475, 0.2612113, -0.9154014, -1.5377, -1.098441, 3.086792,
0.6043353, 1.170345, -3.111301, 0.2640477, 2.536658, -0.2510893, 1.401259,
0.1661447, 1.686695, -0.1609624, 0.1630675, 0.415674, -1.550273, 0.1489423,
-0.1576676, -0.5691448, -0.6539119, 0.4012272, -0.8691397, 0.7204053,
-0.7049306, -0.1225196, -1.265644, -0.8104727, 0.5801718, 0.2097785,
0.287809, -0.4992997, 1.801467, -2.634428, 0.8473001, -0.6796415,
-0.7637564, -1.097179, 0.4107748, 0.1740537, 1.315861, 0.6626521,
0.1578388, 3.80543, 0.7432005, -0.3357377, 1.604536, -1.176574, 2.478271,
-0.2291014, 0.4579258, 3.248699, 2.709125, 2.162149, -0.0405159, 0.9048444,
-1.348854, 0.8823482, 0.1021243, -3.259865, -1.067268, 0.2819568,
-0.6596893, -0.1807872, 2.515758, -0.17833, 1.469117, -0.7612572,
1.067393, 0.7137753, 1.316876, 0.8889861, -0.1705705, 0.930299,
2.178425, 1.040393, 0.2484525, 1.6969, -0.2385769, 1.215803,
-0.121749, 0.4517173, 2.711227, -1.034289, 1.360948, 0.3336845,
1.448049, 3.336718, -0.5653164, 1.116664, 1.71992, 2.103569, -0.676021,
0.734796, 1.041596, 1.132922, -1.65245, 0.01402473, 0.0465818, -1.975893,
1.67299, 2.275564, -0.2249914, 0.7790609, 3.159228, 1.638781, 1.436377,
-0.6704336, 1.45016, -0.6534693, 3.628212, 0.683499, -1.210783, 1.252596,
2.002806, 0.9677379, 1.181196, 1.100068, -2.424559, 1.123638, -1.586164,
1.083465, 0.0608369, 2.765038, 0.8396216, 1.458574, 0.1989703, 1.006285,
2.162564, -0.603887, -2.31755, 1.221963, 0.6493447, 2.953362, 0.5976394,
-0.3981365, -1.78078, -0.496523, 0.860883, -1.298076, -2.297513,
-0.09740282, 2.072371, -1.799149, 0.2757767, -0.5535889, 0.1776869,
0.1154027, -1.494918, -1.597056, -3.715302, 1.396965, 1.987818, 0.6799783,
-0.8720844, 2.98124, 1.782676, 2.107667, -0.7132319, -0.3419962,
-1.702036, -0.1761597, 3.431252, 3.155451, 0.9332177, 1.979404, -1.7355,
0.6880204, 1.051234, 1.89421, 0.4698883, -0.3932978, 0.3974729,
-0.9357116, -0.2343248, 0.2050391, -0.3535254, 0.4131892, -3.710254,
0.2160358, -1.364176, 1.031962, -0.3941657, 0.06128966, -0.9381835,
0.2668205, -0.04478533, 0.5474066, 0.8188285, 1.672575, 1.827346,
-1.142377, 0.1020187, -0.1820338, -1.706108, -2.439444, 1.259864,
-0.818278, 1.996407, -2.080284, 0.8619137, 0.8588534, 1.868601, 1.256401,
-2.316555, 0.3826919, -1.012581, 2.328252, 0.5380796, 0.7670646,
-0.05206852, -0.6185147, -1.53058, 0.7413501, 0.4799917, 1.671116,
1.326772, 0.261943, 1.871066, -1.371915, 1.57526, -1.715803, 2.569946,
2.241288, -0.8802445, -1.4776, 0.6931523, 0.8917982, 0.5523826, 1.245605,
1.833399, 2.667176, 1.468033, 1.628667, 0.8040985, -0.3787018, -0.4190084,
-0.6459137, -0.5960377, 0.2484855, -0.188875, 1.130984, -0.3331705,
-0.5551823, -1.085202, 1.318145, -0.7794812, -1.406285, 0.3070447,
-1.347552, 1.327245, 1.353192, -0.4580307, 1.521133, 0.6713348, 2.54509,
0.8640877, 1.292991, -0.7605298, -2.607158, 0.1165786, 1.868724, 4.348593,
-0.8815095, 0.2134438, 2.654003, 2.087685, 0.7539754, -2.478812, 0.1475988,
-0.3185559, 2.039761, -1.921362, 0.1643196, 2.863641, 0.4538039, -1.488915,
0.7972866, 0.2992142, -0.4384953, 0.3609048, 2.380255, -0.7507977,
-1.005004, 1.511704, 0.212741, 1.051822, 2.172525, 0.2150965, 0.007859951,
3.08277, -0.1235147, -0.03427866, 0.4004827, 1.078061, -1.7794, 1.075778,
-0.6072247, -0.967762, 0.981806, 0.1475147, 0.4808787, 3.378195, 2.025399,
0.6688863, -1.168664, -0.1568437, -0.9180457, 2.605212, -1.593265, 0.98979,
0.01580698, 0.4365025, 1.70158, -3.126756, 0.3794898, -0.9738259, 1.51162,
1.183319, 1.78529, -2.180121, 2.644923, 0.7142706, 1.596689, -0.04979899,
-1.145537, 2.004128, -0.4103615, 0.6109707, 2.594508, -0.1496966,
-0.04674715, 0.8188964, 1.336248, 2.439359, -0.3677339, 2.413043,
0.4204059, 2.313515, 0.5516722, 1.182627, 2.005792, 0.6471613, 1.191033,
-0.7593308, 1.312155, -0.01918644, 2.773911, -0.7054297, 2.077788,
3.032506, 1.555499, 0.5449735, -1.605809, 0.6228236, 0.4814637, -1.703889,
-1.062384, -0.928541, -1.340148, 0.8033869, 0.8372255, 0.523864, -1.727313,
-2.037824, 2.480378, 1.277025, 0.06959089, 0.7103159, 0.0544758,
0.04918631, 1.200866, -0.1781491, 1.393799, 0.4857543, 2.062313,
0.4625032, 0.8548801, 2.290427, -0.6700734, 1.015888, 0.406015,
-0.1304835, 1.654307, 0.8550958, 0.8739146, 0.8685721, 0.5063582,
0.5741245, 1.059833, 1.467772, 1.625952, 0.8276773, 3.897082, 1.25006,
1.953879, 2.316474, 1.871225, 1.033222, -1.669686, -0.4284651, 1.650718,
0.2943459, 0.3820478, -0.02761709, 0.7161967, 2.162615, -1.49055, 1.835309,
0.4648584, -0.3689162, 1.28846, -2.474529, -0.2868397, 0.9725849, 1.351514,
0.8235514, 1.115832, 0.7304918, 0.7038161, -0.04599639, -0.1842319,
0.9880401, 0.6816606, 1.676341, 1.681047, 1.287988, -0.2473534, 0.1101533,
-0.4479058, 1.388329, -0.06226135, 0.866314, -0.3548175, 0.3684719, 3.09362,
1.217263, 0.8063339, -0.1454105, -2.064785, 0.6777007, 0.7040506, 2.354807,
-1.757202, 0.1417371, 0.8313071, -0.08294621, 1.461676, -0.7696986,
0.9176681, 0.4585622, -0.183079, -0.6166589, -0.2914721, 1.208298,
3.138118, 3.275939, -0.7958458, 0.08404926, -0.333922, 0.5868141, 4.781683,
0.548061, -0.742325, 1.110375, 0.05913553, -1.124493, 2.898643, 1.558618,
0.1342576, 2.450453, 0.5646837, 0.6724151, 0.09240844, 0.207641, 0.3514267,
1.662844, 1.588986, 0.09323521, -0.4878737, -0.2112836, 0.08405748, -1.00925,
-0.5610551, 1.021182, -0.1391414, 0.9960078, 0.2599478, 2.682325, 0.04613867,
-0.204634, 2.130909, 0.9686498, -1.223563, 0.2744176, 1.85641, -1.281635,
0.9568742, -1.529689, -1.674259, -0.3343894, 1.8089, 1.445891, -1.229222,
-0.9118662, 2.544743, -0.8193703, 1.005783, 0.4901241, -2.692732,
-0.9205373, 2.066589, 1.775053, -0.3033699, -0.6572719, -0.2016148,
0.4539527, 3.44007, 2.667011, -0.4534455, 1.541283, -2.217782, 0.7781816,
2.370952, -0.3569825, 1.635673, 0.5236256, 2.627279, 0.449129, -0.7842804,
0.3728755, 3.483306, -0.3741839, 0.0356962, 0.8522949, 2.924808, 0.9009428,
0.6442211, 0.4875439, -1.147957, 1.913263, -0.6915845, -0.1429951, 2.213266,
0.4237737, -0.3518183, -1.061589, -0.2981658, -1.247853, -0.231374,
-0.8824362, 0.6206775, 0.08903667, 0.8444898, 1.034736, 0.8028528,
0.6717759, 0.08211324, 3.398746, -0.2540745, 0.2478199, 1.861341,
-2.490341, -1.344672, -0.5838419, 2.34272, 1.763571, -2.024463,
-1.236073, -0.2419368, -1.630901, 0.7460867, -0.6292611, 2.096136,
-2.65242, 2.140336, -1.507524, 0.3395588, -0.05928033, 2.274768,
0.3861841, 0.5085077, -1.845912, 0.3248442, 0.4216029, 1.258335,
1.138112, 0.760768, 0.1332479, -0.6665008, 1.751383, -2.802195,
0.1859044, 0.4986566, 2.609326, 0.1801544, -0.5944885, -0.7516257,
2.67056, -0.4474156, 2.388389, 0.2167237, -2.322889, -0.4146484,
-0.399023, 0.08343873, 1.010352, 2.013957, 0.3069364, 1.536467,
0.9511184, -0.2019756, 0.3665186, -1.230914, -0.2192904, -3.563968,
2.30786, 1.767987, -1.285055, 1.946752, 1.651966, -0.0147004, 0.07518035,
1.519261, 0.1353215, 2.384335, 2.40277, 1.177133, 1.848385, 2.962562,
2.538202, -1.129364, -0.4316437, 2.227212, -1.562209, 1.009215, 0.7393541,
-1.453501, 1.414301, 0.5735626, 1.040577, -0.2106342, 0.3212164, 0.1065836,
-1.97112, 1.375393, 2.093986, 0.2135787, 2.190607, 0.5236311, -1.605053,
-1.367444, -2.755395, -3.671523, 0.4569495, 0.8198935, 1.767523,
-0.02109057, -0.6288153, 1.541511, -0.4063458, -1.252025, -1.394938,
-0.253524, 0.2050073, 0.9811099, -0.144743, 2.494582, -0.8237758,
0.8003133, 1.927059, -1.62744, -2.810295, -0.9012763, 0.1959343, 0.1912168,
0.2099924, 0.4692265, 1.599251, 0.1018631, 0.2383751, -2.480882, 1.411594,
-3.085389, 1.352404, 2.24788, 3.068772, 0.4020698, 2.813595, -1.460714,
-0.5061603, 1.812019, 3.225705, 1.470923,
-0.1067867, 1.060649, -0.3755217, 1.835892, 0.007699769, 0.472185,
-0.3891861, -0.8200396, 0.7980844, -0.5565764, 0.4594529, -1.418611,
-1.130325, 3.643348, 0.745943, -2.376944, 0.4900954, 0.7044373, 2.716719,
-2.92701, 3.055366, 0.4678358,-0.2200195, -1.538858, -0.7042396,
0.2906986, -0.4556325, -0.3156468, -0.9867677, -2.462476, 0.8334548,
0.01256107, 1.296663, 1.656972, 0.1890857, 0.4274917, -0.4149058,
0.7939621, 2.420778, 0.4551494, 0.5609379, 2.07608, -0.5984361,
-0.6234383, -0.7619428, 1.714608, 1.774031, 0.8078578, 2.493211,
-0.6436673, 0.8056096, 1.415049, 2.088208, -2.553487, 0.1474035,
2.468832, 0.3629936, 1.559848, -1.419344, 1.252219, 1.00223, 0.3505569,
-0.197483, 0.001481658, -1.154208, 0.07563953, 0.1254035, 2.082003,
3.085859, 0.2444306, -1.378354, 1.53788, 0.4830868, 0.5343908, 0.7835163,
0.1420364, -1.121353, 3.21487, 0.5545919, -1.23395, 2.29826, 2.087456,
-0.303342, -0.2842832, -1.959754, 0.2571105, 1.064723, -0.3268089,
-1.569037, -0.5811946, -0.5284372,
0.5773191, 2.896395, 0.7914887, -0.9262041, 1.074102, 1.987871,
-1.079295, -0.1175151, 1.119606, 2.646193, 1.150491, 0.1853689,
1.98902, 0.799424, 1.538916, 1.178183, 0.6577383, 1.175756, -1.728385,
1.996503, 1.06901, -0.1754592, 0.3988977, 1.51455, 3.310073, -0.08595954,
-1.317394, -0.4080714, 0.4559075,
-3.0631, -0.08753106, -1.545354, 2.032355, 1.775365, -2.556603,
0.8813956, -1.401756, 1.229163, 0.5330363, -1.161257, -0.4621782,
1.873578, -0.7765205, -0.3791675, 0.6822012, 0.3912565, 1.841402,
2.811005, 3.004356, 2.584023, 1.848531, 0.1702569, 0.8882989,
-0.9669123, 1.957959, 1.919071, 1.93756, 2.707397, -0.9161889,
0.9598898, 4.295957, 1.211699, -1.564695, 2.043878, -1.518748, 1.703412,
-1.963833, -2.188571, -2.581456, 3.29993, 2.085054, -2.430913, 0.593098,
1.179482, 1.515169, -1.377529, 0.06186947, -0.2119809, -1.20841, -0.05268589,
0.06202861, -0.3546809, 2.147835, 1.887589, -0.1841871, -0.5982248, 1.681687,
-1.242911, -0.9954123, 1.949604, -0.6246139, -2.056978, 1.190597, -0.5249918,
0.1899234, 1.444077, -0.2541717, -0.7115349, 0.05174258, -1.035978,
-0.2042441, -0.2449599, 0.8080922, -2.864996, 1.513828, 1.492188,
0.7552077, 0.1392787, -1.013541, -0.7631178, 0.7518061, 1.016008,
2.354008, 1.684694, -0.06316109, 1.92555, 2.981978, -1.2718, -0.1326985,
1.590285, 1.08895, 0.3074903, 1.238415, 1.578384, 0.3906198, -1.016455,
-0.1633113
),
y = c(
-1.297072, 0.9117613, 1.279106, -1.437861, 2.719283, 1.641577, 0.1372039,
-0.6868724, 1.763126, 3.530604, -1.776288, -3.704411, -2.15922, 2.390482,
0.9078989, 1.457612, -2.5354, -0.7839378, 0.2931226, -2.514011, 0.8324345,
0.1803356, -2.627092, 1.392182, -0.1179993, -0.2397086, -0.5089098, 2.452173,
0.3445466, -0.1147959, -0.8782663, -1.475184, 0.1268025, -1.296637, -0.9219598,
1.457447, 2.712058, -0.2403082, -0.3362178, -1.16605, -0.1455909, 1.876059,
-1.196383, 1.952799, 2.229562, -0.5173621, 0.04081391,
0.3159111, 0.2771666, -1.466228, 1.059278, 0.2178863, 0.2802811, 0.5816525,
-0.03047942, 0.2096255, -2.174504, 0.3895296, 5.434577, 1.139556, 0.8995658,
1.780634, -1.641323, -3.408731, -0.9886556, 0.3586492, 1.586885, 2.956389,
-0.3612072, 2.174704, -0.6647597, 0.7924472, -1.639424, 1.243475, -1.937213,
-0.8079536, 1.450924, -2.185047, 1.874988, 3.515306, 2.223285, -0.8352127,
-1.158314, 1.098762, -2.40215, 0.562364, 0.8520029, 0.7603164, 0.3739408,
1.980913, 3.435924, 2.148309, 0.07220071, 0.9115155, -0.9434633, -1.997795,
-1.199361, -1.991908, 1.41731, 1.688763, -0.7399537, 3.594597, -0.8912589,
3.31706, -2.563767, -1.231889, -0.8260225, -1.827058, -2.083749, -1.619199,
-1.505666, 1.122614, 1.37307, 2.845691, 1.666477, -4.840879, -0.8916903,
-2.625775, 0.8515742, 1.450746, -1.771652, -0.3089336, -0.5002624, -0.8376659,
-0.2661357, -1.550792, -1.056343, -1.866597, 1.318071, 1.630335,
3.51618, -3.200802, 1.613618, -0.09738592, -0.08220293, -1.228466, -4.895998,
1.288101, 2.999581, 0.6010791, -1.35872, -1.009735, 3.595655, -0.696191,
-1.647676, -0.2122697, -0.1542393, 1.330621, 0.619606, 0.02486573, -1.862943,
1.135191, 0.5034097, 2.694835, -3.049492, 1.657665, 0.7483125, -0.7797151,
1.623093, -0.9901533, 2.341229, -1.801243, -0.4487274, 0.8553533, 1.0432,
-1.602102, -0.4828578, 1.915774, -0.846937, 0.1909276, 0.1201127, 1.474225,
-0.9189022, 0.8339751, 3.568813, 1.724976, 2.026143, -0.2581951,
0.8177481, 1.818852, -1.950052, 2.766235, -0.6688099, 2.132523, 1.89528,
1.211928, 2.103461, -0.3882409, 0.7919592, -0.216504, 0.1471576, 0.3763451,
3.014243, -1.838766, -3.044297, 1.035752, -2.061596, 0.3800839, 4.293113,
0.2292164, 2.313781, -0.5342362, -1.546178, -1.358477, -2.176706, 0.09548934,
1.206587, 1.019914, -0.88546, -0.9232568, 0.4852478, -0.4462238, 1.473709,
-0.2479962, -1.862545, 1.710585, 1.468105, 0.6644033, 2.947413, 0.1245262,
-2.813953, -1.138678, 1.786227, 0.09648943, 2.484386, 0.3980274,
0.8681383, -0.5805977, -0.5574775, 0.4712878, -2.553728, -0.5068035, -2.501172,
0.1815485, -1.0391, -0.03237067, 3.905505,
-1.415132, 3.789165, -0.6592731, -1.109884, -0.1010615, 1.410681, -1.025576,
1.938327, -0.8710343, 0.5155115, 2.547861, -0.3252792, -1.432461, 3.42322,
-0.437066, 1.601819, 1.172772, 3.186108, -1.15913, 2.673156, -4.242705,
0.1049355, 5.333529, 3.487854, -1.208598, 1.3392, -0.5293056, 3.131975,
-4.112833, 0.2985849, 0.8239669, 2.312194, -0.04577797, 1.731471, 3.506173,
-0.4203622, 2.734129, 0.6528237, -0.2181468, 0.7391488, -0.1645155, 2.228466,
0.5099651, -0.5402671, 0.9668658, 0.532482, 2.365494, 2.586804, 1.096655,
1.434472, 0.4557704, 0.8270838, 1.979468, -2.519408, 3.833076, -0.2701323,
-0.3079676, 0.5646647, 0.9736392, 1.864035, -0.8577106, -0.5974015, -0.4026833,
-1.308658, -1.478439, 0.9152936, -1.610319, 0.165853, -0.2140009, -0.5571598,
-1.115241, 1.49002, 0.6857229, 0.9242503, 0.006742284, -1.253691, 1.063618,
0.3842779, -0.7491645, -0.5111115, -0.5890841, 0.2981145, -0.2901057,
-5.136036, -1.190684, -2.171541, 0.7413332, 0.6624883, 3.592136, 1.750455,
4.155144, 0.9303485, -3.775481, 3.010553, 0.9652359, 1.271609, 1.553288,
0.5034295, -0.3058398, -2.393372, -1.04571, 0.8994073, -0.0613773, 1.212335,
-0.7637795, 0.2232571, -2.032509, 2.428238, 0.1705675, -0.8589246, 1.045394,
-0.7519072, 1.068513, 0.1313686, -3.481534, -2.156314, -1.283435, 1.558469,
3.074581, 0.6738994, 0.9269587, -0.6726298, 1.106851, 0.6548576, 0.6021877,
0.2328829, -1.696733, 0.001950964, 2.42843, 0.7105897, -0.200992, -0.8885304,
-1.376161, 0.5739822, -2.84595, -2.00422, 3.441533, -0.8145059, 0.383012,
0.5317786, 0.7806527, -1.277649, -2.542617, -1.099493, 1.299876, -0.649675,
-0.9916656, 0.5226757, 1.136623, 0.8771475, 4.736876, -0.6505406, -0.5549814,
-1.314471, -1.903293, -3.778264, 1.106321, 0.06545885, 2.539837, -1.06134,
0.5230748, -2.678604, -2.19456, -1.162164, -3.797525, 2.159599, 0.9742172,
-0.4883031, -1.148317, -1.358942, 0.4640018, -2.592791, -1.805195, -0.1784542,
2.436532, -0.4772702, -3.234046, 0.505515, 0.1118433, 1.134079, -0.4186441,
2.329794, 0.1495391, 0.04944964, -1.268197, 3.226894, -0.4745375, 1.105713,
3.727459, 2.77338, 0.1968587, -0.401224, -0.6441628, -1.806816, 0.7094849,
1.358274, -0.01584602, 0.2643645, -0.8160273, -2.335523, -2.37906, -2.968954,
1.718047, 0.9886214, -1.00837, 2.09903, -4.124383, -1.124029, 0.3174282,
0.2451848, -0.1853319, -0.1566696, 1.595733, 1.528088, -0.2099921, -1.475919,
1.810811, -1.86103, -2.994764, 2.424202, 3.313308, -1.775062, 0.08801812,
3.979799, -1.732554, -2.956473, 1.129052, -0.9055571, 0.420211, -0.3806662,
-1.310246, -0.4003909, -0.5263157, -0.5395929, -2.067244, 2.519137, 0.987695,
2.94068, -0.1472779, -0.4341866, 4.879304, -3.005802, -1.451556, -2.894339,
-0.817777, -3.262525, 0.5567723, 2.346963, -1.777998, -1.192673, 3.206967,
1.03797, -1.858315, 2.203863, 0.8761411, 2.435167, -0.6522977, -0.9546567,
-0.9432435, 1.912181, 3.858334, 1.813218, -1.118825, -0.565377, 3.353497,
-1.278236, -2.965795, 2.397942, 1.899554, -2.672923, 1.957407, -0.3157224,
1.23961, -0.6048306, 0.9230331, -1.787249, 0.4097821, 0.09028572, -0.5184538,
-1.192254, 0.9913544, 0.6483606, 2.330492, 2.688374, 0.5224347, 0.4053256,
-1.633775, 2.844522, 0.1935147, 0.6546435, 1.903234, 2.915302, -1.889206,
-0.9273601, 1.276983, -0.8439995, -1.100108, -3.071373, -2.496586, -1.696816,
3.435101, -0.7540203, 0.5101385, 1.445763, -0.7359659, -2.045965, 0.7243661,
1.452332, 2.630013, 1.713096, -0.7206121, -0.6721612, -1.476733, -2.371951,
3.020894, 0.2238902, -2.128584, -0.6320923, 0.5283405, -0.287014, 3.136973,
0.5168739, -1.205074, -1.708031, -3.105938, 1.595207, -0.5889416, -1.729334,
3.204298, 1.637491, 0.8954808, -1.081477, -0.5963145, -2.323483, 1.643121,
-2.185676, -3.903028, 0.1084022, 0.6813996, -1.556301, -0.6524738, 1.391916,
0.5442081, 0.6822028, 1.164888, 1.403344, -3.600247, -0.6193016, 2.825851,
0.7537513, -0.6740361, -0.2777376, -2.17442, 0.8907217,
-2.307656, -1.150493, 1.357446, -1.929826, -1.645104, -1.85063, -3.267665,
-0.2610669, -0.8300774, 0.373345, 2.692029, 0.45409, 1.740001, 1.208295,
-1.276411, 1.56279, -1.50495, -0.3010204, -0.5426, 2.114791, -1.505532,
1.307418, 0.1162454, 0.5800834, 1.383771, 2.105981, 1.803984, -0.7959005,
-3.432108, 2.349824, 0.3958728, 0.04141039, -0.4027986, -0.7765254, -0.4745213,
-0.1534974, -0.3190094, 0.4909818, 2.862934, 0.1336271, 0.5517147, 2.24282,
2.213441, 0.2989297, -2.009752, 0.3551271, -0.02431642, 2.094968, 1.356528,
-0.7472504, 1.941206, 2.387321, 1.562175, 1.894276, 0.1489348, 2.333475,
2.021549, 0.4508228, 1.981679, 1.867534, -2.459769, 0.9343178, -1.95079,
-1.766148, -0.8376166, 2.210979, 1.986757, 1.705749, -1.741875, -1.439016,
0.502064, -2.061434, -0.1357869, -0.0529518, -1.759707, 2.972078, -3.422064,
1.43987, 1.053583, 0.7288201, 3.494691, -1.374059, -0.39817, 0.4391482,
-0.9257753, 2.986769, -0.4965726, -4.043136, 1.14208,
-1.827841, 1.834094, 1.677595, 0.7719105, -0.4487642, 1.140205, 1.113409,
-1.705945, 1.449865, -3.267134, 2.290203, 0.6598387, 1.764245, 1.67444,
2.743025, 2.188549, -3.243509, -2.744508, 1.713203, -0.6755554, 6.656218,
0.1727545, 3.142803, -1.11081, 2.089643, 1.729117, 0.4941321, 1.044005,
4.183635, -3.5658, 1.734435, 1.365244, 0.4670934, -1.065233, -0.6855184,
-0.5124081, 0.2909302, -2.065583, 0.2470032, -1.423861, 2.095053, -2.43692,
-3.20875, -2.311235, 1.796066, 3.705977, 1.827399, -0.9702383, -3.103777,
-2.649287, 3.328561, 1.055854, -4.279731, -1.656355, -0.7038255, -3.637907,
0.102058, -0.623692, -0.571385, 1.549346, -0.2030001, 0.6191256, 0.7658912,
0.5164842, -0.5712328, -0.6645896, -2.63578, 1.460631, 3.890186, 0.7928721,
-1.8941, 2.687498, 0.6810473, 0.257769, -0.9895752, -2.955544, -1.250909,
-1.091675, 2.008528, 1.851008, -0.6482937, 3.753871, -1.364445,
0.4389835, -1.708692, -0.7237899, 2.419719, -1.324188, 0.3005976, 0.8039126,
1.196656, 0.327436, -0.4655098, -0.0534501, -1.373693,
1.733233, 0.2786331, -0.9302797, -1.064924, 0.3578646, 4.154351, -0.7283608,
0.1046476, 0.05090167, 0.836884, 0.08501087, 1.171237, 0.05000058, -1.488934,
-1.144216, 0.338948, 0.8359208, -1.126187, 2.52773, -0.2655283, -1.186645,
2.905234, 1.551092, 0.1926397, 4.086467, -0.8054595, -0.8778155, -1.098665,
1.920162, -1.918333, 0.454345, 0.5365621, 3.698098, -1.939578, -0.1384997,
-1.297537, 1.128888, 3.768424, 2.54267, 1.371815, -0.08951324, -0.7729162,
0.01425637, 0.6696119, 1.012081, 2.050462, 0.2986467, -2.577331, 0.4878643,
-0.5317166, 1.372649, -0.9562814, -4.229527, -1.071209, 2.137822, -1.033006,
-0.9082982, 0.3867311, 2.241141, -2.454778, 2.798949, -1.745728, 0.9931758,
2.366452, -0.6201528, 3.439426, 0.4753967, 1.810608, 0.1043708, -0.03511904,
0.7166418, -1.157993, -2.839015, 0.3600449, 0.2053961, 0.3930251, 1.269351,
2.801867, 1.74993, 2.381777, -1.058229, 1.682195, 1.356864, -2.560255,
-3.977373, 0.4274099, -0.8654187, -0.996709, 0.6377153, -2.677485, 1.66142,
1.419046, -2.014556, 0.7547082, 2.339849, -0.7181829, 1.793267, 1.405987,
0.2150371, -0.3493765, -0.8274315,
1.118334, 0.5263226, 1.057045, -2.9521, 0.7543956, -1.193395,
-3.028134, -0.315206, 2.198253, -0.8341428, 3.254571, 0.8427312, -1.334399,
2.028403, -5.140767, 1.339629, -0.8969904, 2.031176, 1.354597, -0.2102458,
-1.377664, -2.525493, 2.026373, 0.266136, 4.426814, -0.8328339, 5.310274,
-1.609096, 1.37289, -2.231546, -0.4904951, 0.2584112, -1.790483, 0.379628,
0.2075021, 1.125921, 1.521864, 2.828776, 0.8750123, 1.314686, -2.355387,
-1.044481, -3.915485, 0.8773479, -1.265936, 0.3901045, 0.138542, -1.317603,
-1.022673, -0.5757283, 3.429993, 0.07420402, -1.343391, 2.117585, -0.49569,
-0.7121495, 1.652924, 0.3174849, 3.137772, -1.901317,
-2.128594, 1.072246, -1.303093, 0.3549786, 1.181707, -0.1651396, -0.01438534,
-0.3903766, -0.9392477, 4.038452, -0.3938813, 2.567142, -1.508204, -0.01048495,
2.08455, 0.6121453, 0.07625828, 0.848407, 0.5045909, -2.339868, -0.6066959,
4.853239, -1.553128, -3.285689, 1.383927, 2.059451, 3.295784, 0.8911305,
3.06801, -0.2650091, 2.167248, -0.9294436, -0.8055286, -1.592408, 1.371601,
0.1150432, -1.409401, 0.5189055, 0.642676, 2.198996, -1.112739, -0.1275275,
-0.4095775, -1.959702, 2.425934, -0.6420147,
0.02264201, 2.51283, 0.4966984, -1.377757, -4.044517, 2.027884, -0.7271768,
-1.605764, 0.1093462, -0.9711054, 2.85959, -1.0539, -2.076666, 1.050419,
1.53327, -2.342538, 1.203777, -2.215551
),
y.bin = c(
1L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L,
1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L,
0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L,
1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L,
0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L,
0L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 1L,
1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L,
0L, 0L, 1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L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L,
1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L,
1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 1L,
1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L,
0L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L,
0L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 1L,
1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L,
0L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L,
1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L
)
),
class = "data.frame", row.names = c(NA, -1000L)
)
#### ratio.all ####
ratio.all <- structure(list(
g1 = c(
-0.00855060462516681, 0.0875322740300148,
0.135667161280393, 0.0675975772297497, -0.0630263399371546,
0.645198684809995, 0.645962479273306, 4.02797915540405, 0.3015
),
g2 = c(
0.256555129434397,
0.132507603823373, 0.493832589516168, 0.101532062423273, 0.519518425638448,
0.268324947839505, 0.288803238447459, 23.6566409119085, 0.101
),
g3 = c(
0.27784327303136, 0.131612923350767, 0.347578603049143,
0.101476089250621, 0.799368173397245, 0.378656574933523, 0.444798266157455,
11.7321774560372, 0.103
),
g4 = c(
0.171885629396363, 0.126538070268258,
0.0678804291494841, 0.0979836040168433, 2.5321824206185, 1.86413185440533,
4.10305056109213, 0.479934908102205, 0.1115
)
), class = "data.frame", row.names = c(
"by",
"byse", "bx", "bxse", "beta.ratio", "se.ratio.first", "se.ratio.second",
"fstat", "MAF"
))
#### diabetes_data ####
diabetes_data <- structure(list(
X = 1:38,
SNP = c(
"rs10184004", "rs10487796", "rs10748582", "rs10830963", "rs10965247",
"rs11671304", "rs11720108", "rs1215470", "rs1260326", "rs12910361",
"rs1317548", "rs1421085", "rs1496653", "rs1515110", "rs1800961",
"rs1801212", "rs2206277", "rs231361", "rs340882", "rs34872471",
"rs3802177", "rs3887925", "rs4239217", "rs464605", "rs4688760", "rs5213",
"rs697239", "rs7183842", "rs7258722", "rs72802365", "rs75199135",
"rs7646519", "rs7766070", "rs849142", "rs9267659", "rs9273363",
"rs9379084", "rs9667947"
),
beta.exposure = c(
-0.00340017, -0.00364702, -0.00471516, 0.00441241,
-0.00718076, 0.00319588, -0.00373061, -0.00439561, 0.00381735,
0.00317776, 0.00371348, 0.00519347, -0.00404417, 0.00355524,
0.00902729, 0.00497091, 0.00377017, 0.00352503, 0.00322908, 0.015002,
-0.00507762, 0.00306657, -0.00432418, 0.00334759, 0.00323006,
-0.00361201, -0.00360684, -0.00332443, -0.00293831, -0.00649326,
0.00311012, 0.00601842, 0.00623272, -0.00409952, 0.00493063,
0.00839501, -0.00605019, -0.00473778
),
beta.outcome = c(
-0.0121, -0.0237, -0.0029, 0.0105, -0.0246, -0.0094, -0.0313, 0.0191,
0.012, 0.021, 0.0049, -0.0094, -0.0144, -0.006, -0.0368, 0.0209,
0.0035, 0.0037, -0.0173, -0.0028, 0.0069, 0.004, -0.0185, 0.0233,
-0.0202, -0.0667, 0.0036, 0.019, -0.0272, 0.0531, 0.0084, 0.0285,
-0.0146, -5e-04, 0.0185, -0.0322, 0.0242, -0.0318
),
se.exposure = c(
0.000530106, 0.000523323, 0.000536941, 0.000582103, 0.000682275, 0.000558102,
0.000601993, 0.000575354, 0.000532551, 0.000575436, 0.000651396,
0.000530962, 0.0006452, 0.000541878, 0.00149065, 0.000578707,
0.00068194, 0.000601712, 0.000539394, 0.000572849, 0.000562996,
0.000524092, 0.000534239, 0.00059726, 0.000564126, 0.000547748,
0.000522317, 0.000582474, 0.000532197, 0.00097088, 0.000566935,
0.000560668, 0.000589995, 0.000520331, 0.000629621, 0.000566459,
0.000840322, 0.000710268
),
se.outcome = c(
0.0165, 0.0165, 0.0164,
0.0201, 0.0223, 0.0184, 0.0209, 0.0181, 0.0162, 0.018, 0.0198,
0.0165, 0.0198, 0.0168, 0.044, 0.0174, 0.0214, 0.0189, 0.0166,
0.0172, 0.0172, 0.016, 0.0176, 0.0188, 0.0174, 0.0164, 0.0162,
0.0176, 0.0173, 0.029, 0.017, 0.0169, 0.0187, 0.0161, 0.0216,
0.0199, 0.0279, 0.022
)
), class = "data.frame", row.names = c(NA, -38L))
```
---
# Ratio Method
To apply the ratio method, we will use the dataset `coursedata` (individual level data) providing phenotypes (`x`and `y`) and genotypes (`g` columns).
```{r head_dataset1}
head(coursedata)
```
## Ratio estimates for variant j
$$\theta_{Y_j} = \frac{\hat{\beta}_{Y_j}}{\hat{\beta}_{X_j}}$$
Where `j = 1` in this example.
```{r ratio-method-beta}
# Genetic association with the outcome
by1 <- lm(formula = y ~ g1, data = coursedata)$coef[2]
# Genetic association with the exposure
bx1 <- lm(formula = x ~ g1, data = coursedata)$coef[2]
beta.ratio1 <- by1 / bx1
cat("Ratio estimate for g1 =", beta.ratio1)
```
## Standard error of ratio estimate (first order)
$$se_{first}(\theta_{Y_j}) = \frac{se(\hat{\beta}_{Y_j})}{|\hat{\beta}_{X_j}|}$$
```{r ratio-method-se-first}
# Standard error of the G-Y association
byse1 <- summary(lm(formula = y ~ g1, data = coursedata))$coef[2, 2]
se.ratio1first <- byse1 / sqrt(bx1^2)
## sqrt(bx1^2) => because se is always positive.
cat("Standard error (first order) of the ratio estimate g1 =", se.ratio1first)
```
## Standard error of ratio estimate (second order)
$$se_{second}(\theta_{Y_j}) = \sqrt{\frac{se(\hat{\beta}_{Y_j})^2}{\hat{\beta}_{X_j}^2} + \frac{\hat{\beta}_{Y_j}^2 se(\hat{\beta}_{X_j})^2}{\hat{\beta}_{X_j}^4}}$$
```{r ratio-method-se-second}
# Standard error of the G-X association
bxse1 <- summary(lm(formula = x ~ g1, data = coursedata))$coef[2, 2]
se.ratio1second <- sqrt(byse1^2 / bx1^2 + by1^2 * bxse1^2 / bx1^4)
cat("Standard error (second order) of the ratio estimate g1 =", se.ratio1second)
```
## F-statistic
The F-statistic from the regression of the risk factor on the genetic variant(s) is used as a measure of 'weak instrument bias', with smaller values suggesting that the estimate may suffer from weak instrument bias.
For instance, some studies recommend excluding genetic variants if they have a F-statistic less than 10.
```{r ratio-method-Fstat}
fstat1 <- summary(lm(formula = x ~ g1, data = coursedata))$f[1]
cat("F-stat =", fstat1)
```
## Ratio estimates for a Binary Outcome
In a case control setting, it is usual to regress the risk factor on the genetic variant in controls only because the case-control sample is generally unrepresentative of the population and if measurements of the risk factor are made post-disease = Avoid possible reverse causation.
```{r bin-ratio-g1}
# logistic regression for gene-outcome association
by1.bin <- glm(formula = y.bin ~ g1, data = coursedata, family = binomial)$coef[2]
byse1.bin <- summary(glm(formula = y.bin ~ g1, data = coursedata, family = binomial))$coef[2, 2]
# linear regression in the controls only
# bx1.bin <- lm(coursedata$x[coursedata$y.bin==0]~coursedata$g1[coursedata$y.bin ==0])$coef[2]
bx1.bin <- lm(x ~ g1, data = coursedata[coursedata$y.bin == 0, ])$coef[2]
beta.ratio1.bin <- by1.bin / bx1.bin
# beta.ratio1.bin #ratio estimate for g1
cat("Ratio estimate for g1 with binary outcome =", beta.ratio1.bin, "\n")
se.ratio1.bin <- byse1.bin / bx1.bin
# se.ratio1.bin #standard error of the ratio estimate for g1
cat("Standard error of the ratio estimate for g1 with binary outcome =", se.ratio1.bin)
```
---
# Two-Stage Least Squares Method (TSLS) Method
When multiple variants G as Instrumental Variables, **TSLS** (or **2SLS**) is performed by:
$$X \sim G_1 + G_{.\ .\ .} + G_j$$
_i.e._ regressing the risk factor on all the genetic variants in the same model, and storing the fitted values of the risk factor. And
$$Y \sim \hat{X}$$
_i.e._ a regression is then performed with the outcome on the fitted values of the risk factor.
## Estimates
**By hand** we can make the computation as follow (but it is not recommanded !)
```{r TSLS-byhand}
by.hand.fitted.values <- lm(x ~ g1 + g2 + g3 + g4, data = coursedata)$fitted
by.hand <- lm(coursedata$y ~ by.hand.fitted.values)
cat("TSLS estimate =", summary(by.hand)$coef[2], "\n")
cat("TSLS standard error =", summary(by.hand)$coef[2, 2])
```
Performing two-stage least squares by hand is generally discouraged, as the standard error in the second-stage of the regression does not take into account uncertainty in the first-stage regression. The R package `{ivpack}` performs the **two-stage least squares method** using the `ivreg` function:
```{r TSLS-ivreg}
# library(ivpack) ## Depends AER for ivreg
ivmodel.all <- ivreg(y ~ x | g1 + g2 + g3 + g4, x = TRUE, data = coursedata)
# 2SLS estimates
cat("TSLS estimate =", summary(ivmodel.all)$coef[2], "\n")
cat("TSLS standard error =", summary(ivmodel.all)$coef[2, 2])
```
## F-statistic
```{r TSLS-fstat}
cat("F-stat =", summary(lm(x ~ g1 + g2 + g3 + g4, data = coursedata))$f[1])
```
## TSLS Estimates for a Binary Outcome with g1
First stage with a binary outcome is only conducted on controls, second step is done with a logistic regression.
```{r TSLS-bin-g1}
# values for g1 in the controls only
g1.con <- coursedata$g1[coursedata$y.bin == 0]
# values for the risk factor in the controls only
x.con <- coursedata$x[coursedata$y.bin == 0]
# Generate predicted values for all participants based on the linear regression in the controls only :
predict.con.g1 <- predict(lm(x.con ~ g1.con), newdata = list(g1.con = coursedata$g1))
# Fit a logistic regression model on all the participants
tsls1.con <- glm(coursedata$y.bin ~ predict.con.g1, family = binomial)
cat("TSLS estimate for a binary outcome =", summary(tsls1.con)$coef[2], "\n")
cat("TSLS standard error for a binary outcome =", summary(tsls1.con)$coef[2, 2])
```
Observation : With a single instrumental genetic variation, TSLS and Ratio method give identical estimates.
`beta.ratio1.bin = summary(tsls1.con)$coef[2]`
## TSLS Estimates for a Binary Outcome with all G
With multi genetic variants as IV, the TSLS estimate is a weighted average of the ratio estimates.
```{r TSLS-bin-allg}
# g1.con <- coursedata$g1[coursedata$y.bin == 0] # values for g2 in the controls only
g2.con <- coursedata$g2[coursedata$y.bin == 0] # values for g2 in the controls only
g3.con <- coursedata$g3[coursedata$y.bin == 0] # values for g3 in the controls only
g4.con <- coursedata$g4[coursedata$y.bin == 0] # values for g4 in the controls only
predict.con <- predict(
lm(x.con ~ g1.con + g2.con + g3.con + g4.con), # Predicted values
newdata = c(
list(g1.con = coursedata$g1),
list(g2.con = coursedata$g2),
list(g3.con = coursedata$g3),
list(g4.con = coursedata$g4)
)
)
# Logistic regression
tsls1.con.all <- glm(coursedata$y.bin ~ predict.con, family = binomial)
cat("TSLS estimate for a binary outcome =", summary(tsls1.con.all)$coef[2], "\n")
cat("TSLS standard error for a binary outcome =", summary(tsls1.con.all)$coef[2, 2])
```
+ Questions ?
Does ivreg function work for binary outcome ? like `ivmodel.all.bin = ivreg(y.bin~x|g1+g2+g3+g4, x = TRUE)`
Answer : So the function works with a binary trait, in that it will run and give you an answer. But it doesn't treat the trait as special because it is binary and the estimate just represents the absolute change in the exposure as it is a continuous variable. Hence if you want an odds ratio or a relative risk estimate, we suggest to use the two-stage method. Provided that genetic instruments are strong, the overprecision due to not accounting for uncertainty in the first-stage regression is typically small, even negligible.
---
# Inverse Variance Weighted (IVW) Method
We can use **summarized data** (the genetic associations with the risk factor and with the outcome, with their standard errors) to estimate the causal effect of the risk factor on the outcome via the **inverse-variance weighted (IVW) method**.
## IVW Estimates (by hand)
To do so, we will use the dataset `ratio.all`,
```{r ratio-all-data}
ratio.all
bx <- ratio.all["bx", ]
by <- ratio.all["by", ]
bxse <- ratio.all["bxse", ]
byse <- ratio.all["byse", ]
```
and apply following formulas :
$$\hat{\theta}_{IVW} = \frac{\sum_{j=1}^{n} \hat{\theta}_j /var(\hat{\theta}_j)}{\sum_{j=1}^{n} 1 / var(\hat{\theta}_j)}$$
$$var(\hat{\theta}_j) = \frac{var(\beta_{Y_j})}{\beta^2_{X_j}} = \frac{\sigma^2_{Y_j}}{\beta^2_{X_j}}$$
```{r ivw-estimate}
beta.ivw <- sum(bx * by * byse^-2) / sum(bx^2 * byse^-2)