Causal Mediation Analysis with Multiple Mediators Using Mendelian Randomization based on Summarized Genetic Data
devtools::install_github("hhoulei/PSEMR")
Input data include genetic summary statisics for exposure (betaXG,sebetaXG), outcome (betaYG,sebetaYG) and mediators (betaMG,sebetaMG)). An example for betaMG is (seven mediators):
M1 M2 M3 M4 M5 M6 M7 [1,] -0.002949350 -0.005556150 0.005039 0.006054 0.002677 0.002756 -0.0025 [2,] -0.003175460 -0.005193060 -0.002442 0.001894 -0.001481 -0.013152 0.0016 [3,] 0.006180780 0.005698620 0.000275 0.006301 -0.001176 -0.001040 -0.0011 [4,] 0.008151290 0.005820530 -0.002485 0.006454 0.003178 -0.004202 0.0140 [5,] 0.005976490 0.002349630 0.004917 -0.019362 0.012267 0.007372 0.0028 ...
ivw_result <- Multi_IVW(betaYG=Y_cvd$log_odds,sebetaYG=Y_cvd$log_odds_se, betaXG=exposure_dat3$beta.bmi,sebetaXG= exposure_dat3$se.bmi, betaMG=M_beta,sebetaMG=M_se, straps = 1000)
ivw_result
$M_effect X M1 M2 M3 M4 M5 M6 M7 Y X 0 0.09937684 0.08452755 -0.01622315 -0.173632760 -0.02316877 0.248231194 -0.013121660 0.100020095 M1 0 0.00000000 0.77368298 0.10245463 -0.010431997 -0.10288264 -0.040027347 0.069337762 -0.262498824 M2 0 0.00000000 0.00000000 0.04435747 0.007325699 -0.02857524 -0.009230296 0.077087744 0.786391401 M3 0 0.00000000 0.00000000 0.00000000 0.374331983 0.81983695 0.323647677 0.009944686 0.004688061 M4 0 0.00000000 0.00000000 0.00000000 0.000000000 -0.08900115 -0.326985845 0.007391906 -0.290310332 M5 0 0.00000000 0.00000000 0.00000000 0.000000000 0.00000000 0.054559035 -0.016785404 0.243652141 M6 0 0.00000000 0.00000000 0.00000000 0.000000000 0.00000000 0.000000000 0.413753829 0.198518357 M7 0 0.00000000 0.00000000 0.00000000 0.000000000 0.00000000 0.000000000 0.000000000 -0.125033425 Y 0 0.00000000 0.00000000 0.00000000 0.000000000 0.00000000 0.000000000 0.000000000 0.000000000 $M_se X M1 M2 M3 M4 M5 M6 M7 Y X 0 0.01590578 0.02140299 0.02676203 0.03521057 0.05870054 0.04872475 0.02187178 0.08714377 M1 0 0.00000000 0.04389952 0.08928578 0.04178629 0.07453557 0.03478172 0.03978957 0.30985884 M2 0 0.00000000 0.00000000 0.12351674 0.05781882 0.10312100 0.04812594 0.05486113 0.32064146 M3 0 0.00000000 0.00000000 0.00000000 0.04407670 0.02673074 0.03366018 0.06880250 0.45650580 M4 0 0.00000000 0.00000000 0.00000000 0.00000000 0.03626268 0.04170654 0.09448371 0.21296366 M5 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.06946579 0.15743778 0.38960192 M6 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.13451105 0.17957240 M7 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.20142719 Y 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 $M_pvalue X M1 M2 M3 M4 M5 M6 M7 Y X 0 1.613162e-09 9.997986e-05 0.1226399 1.420767e-06 6.933755e-01 6.503126e-07 0.549041421 0.25208755 M1 0 0.000000e+00 8.524219e-47 0.2521945 8.030469e-01 1.686311e-01 2.508262e-01 0.082540037 0.39766115 M2 0 0.000000e+00 0.000000e+00 0.7197841 8.992711e-01 7.819115e-01 8.480467e-01 0.161123995 0.01481998 M3 0 0.000000e+00 0.000000e+00 0.0000000 2.839300e-61 1.135736e-188 5.369272e-71 0.712234910 0.99181392 M4 0 0.000000e+00 0.000000e+00 0.0000000 0.000000e+00 1.473874e-02 1.014723e-13 0.937698660 0.17396194 M5 0 0.000000e+00 0.000000e+00 0.0000000 0.000000e+00 0.000000e+00 4.328926e-01 0.915171553 0.53224700 M6 0 0.000000e+00 0.000000e+00 0.0000000 0.000000e+00 0.000000e+00 0.000000e+00 0.002309501 0.26992818 M7 0 0.000000e+00 0.000000e+00 0.0000000 0.000000e+00 0.000000e+00 0.000000e+00 0.000000000 0.53529788 Y 0 0.000000e+00 0.000000e+00 0.0000000 0.000000e+00 0.000000e+00 0.000000e+00 0.000000000 0.00000000 $M_low X M1 M2 M3 M4 M5 M6 M7 Y X 0 0.06806119 0.04238959 -0.06891106 -0.24295265 -0.1387320 0.15230874 -0.056179061 -0.07155337 M1 0 0.00000000 0.68725264 -0.07333318 -0.09270176 -0.2496299 -0.10850635 -0.009000816 -0.87256600 M2 0 0.00000000 0.00000000 -0.19882093 -0.10650736 -0.2315987 -0.10398011 -0.030922252 0.15509480 M3 0 0.00000000 0.00000000 0.00000000 0.28755569 0.7672106 0.25737898 -0.125510661 -0.89410574 M4 0 0.00000000 0.00000000 0.00000000 0.00000000 -0.1603924 -0.40909450 -0.178620433 -0.70960494 M5 0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000 -0.08219769 -0.326731835 -0.52341761 M6 0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000 0.00000000 0.148947349 -0.15503370 M7 0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000 0.00000000 0.000000000 -0.52161440 Y 0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000 0.00000000 0.000000000 0.00000000 $M_up X M1 M2 M3 M4 M5 M6 M7 Y X 0 0.1306925 0.1266655 0.03646476 -0.10431287 0.09239448 0.34415364 0.02993574 0.2715936 M1 0 0.0000000 0.8601133 0.27824244 0.07183777 0.04386463 0.02845166 0.14767634 0.3475684 M2 0 0.0000000 0.0000000 0.28753587 0.12115875 0.17444825 0.08551952 0.18509774 1.4176880 M3 0 0.0000000 0.0000000 0.00000000 0.46110827 0.87246326 0.38991637 0.14540003 0.9034819 M4 0 0.0000000 0.0000000 0.00000000 0.00000000 -0.01760995 -0.24487719 0.19340425 0.1289843 M5 0 0.0000000 0.0000000 0.00000000 0.00000000 0.00000000 0.19131576 0.29316103 1.0107219 M6 0 0.0000000 0.0000000 0.00000000 0.00000000 0.00000000 0.00000000 0.67856031 0.5520704 M7 0 0.0000000 0.0000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.2715475 Y 0 0.0000000 0.0000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000 $Total total_effect se_total_effect ci_lower_total ci_upper_total 0.23792928 0.07567117 0.08896329 0.38689526
e.g.Estimate the PSE for pathway X-M1-M3-Y
X_2M_Y <- matrix(0,nrow = 9,ncol=9)
X_2M_Y[1,2] <- X_2M_Y[2,4] <-X_2M_Y[4,9] <- 1
Path_effect(coef_m=X_2M_Y,effect_m=ivw_result$M_effect,se_m=ivw_result$M_se,straps = 1000)
Results
indirect_effect se ci_lower ci_upper 4.773205e-05 6.228396e-03 -1.203217e-02 1.346569e-02
plot DAG
va <- c('BMI','CVD','TG','HDL','LDL') pl_ivw <- DAG_plot(va,pse_result=ivw_result,ylow=0.6,yup=3.2,tt='(l)') png('Applied_example-DAG.png',units="px",bg = "transparent") p_ivw[[2]] dev.off() logo <- readPNG("Applied_example-DAG.png") tiff(filename = "Applied_example-DAG.tif",bg = "transparent") grid.newpage() p_ivw[[1]] grid.raster(logo) dev.off()