Title: | BayEsian Set IDEntification Mendelian randomization |
---|---|
Description: | The R package to perform BayEsian Set IDEntification Mendelian randomization (BESIDE-MR). |
Authors: | Chin Yang Shapland [aut, cre] , Qingyuan Zhao [aut], Jack Bowden [aut] |
Maintainer: | Chin Yang Shapland <[email protected]> |
License: | GPL v3 |
Version: | 1.2 |
Built: | 2024-11-06 06:12:30 UTC |
Source: | https://github.com/CYShapland/BESIDEMR |
We performed three-sample MR, where we selected instruments from The Metabolic Syndrome in Men (METSIM) GWAS, then extracted their summary data from MRChallenge2019
, where:
SNP-HDL:Kettunen et al. Available from: http://europepmc.org/articles/PMC4814583
SNP-AMD:International AMD Genomics Consortium (IAMDGC) Available from: http://europepmc.org/articles/PMC4745342
data(AMD_HDL)
data(AMD_HDL)
A data.frame
with 27 rows and 4 variables.
Fits BESIDE-MR model. NOTE: is the estimated causal effect and
is the heterogeneity variance modelled as precision (i.e.
)
BMA_MRanalysis( tau_estimate, N_Beta, BetaXG, BetaYG, seBetaXG, seBetaYG, N_Ins, N_Iter, Prior, tuning_para, gen_inits )
BMA_MRanalysis( tau_estimate, N_Beta, BetaXG, BetaYG, seBetaXG, seBetaYG, N_Ins, N_Iter, Prior, tuning_para, gen_inits )
tau_estimate |
Use DL estimate (="DL_approx") or Full Bayesian (="Full_Bayes") approach to analyse data. |
N_Beta |
one-parameter (=1) or two-parameter (=2) model. |
BetaXG |
Effect size for X-G association |
BetaYG |
Effect size for Y-G association |
seBetaXG |
Standard error for X-G association |
seBetaYG |
Standard error for Y-G association |
N_Ins |
Number of genetic instruments |
N_Iter |
Number of iterations |
Prior |
A list of hyper parameter for the prior distribution;
|
tuning_para |
Tuning parameter to ensure sufficient acceptance rate (recommended between 0.25 - 0.45);
|
gen_inits |
Initial values to start the iterations;
|
An object of class "beside"
containing the following components:
S
A matrix giving the results. ONE PARAMETER MODEL: columns gives sampled values of
for all iterations (rows). TWO PARAMETER MODEL: columns gives sampled values of
for all iterations (rows).
accept_rate
acceptance rate for each of the parameter from S
.
Chin Yang Shapland; Jack Bowden.
Shapland, C.Y., et al., Profile-likelihood Bayesian model averaging for two-sample summary data Mendelian randomization in the presence of horizontal pleiotropy.
# load data data(AMD_HDL) # Prior choice for beta, tau and inclusion of instruments L<-nrow(AMD_HDL) Ins_prior<-rep(0.5, L) Prior_DL<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, Ins_prob=Ins_prior) Prior_gamma<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, hyper_Prec_shape=2, hyper_Prec_rate=0.00005, Ins_prob=Ins_prior) # Tuning parameter for beta H_DL<-list(Beta=0.05) H_gamma<-list(Beta=0.05, Prec_LL=0, Prec_UL=1000000, Prec_gap=150000) # Generate initial values gen_inits_DL<-list(Beta=rnorm(1,0,10), Ins_L=randomS.initial.LI(L,Ins_prior)) gen_inits_gamma<-list(Beta=rnorm(1,0,10), UBPrec=1000000, LBPrec=0, Ins_L=randomS.initial.LI(L,Ins_prior)) # One-parameter model nIter<-50000 #res_DL<-BMA_MRanalysis("DL_approx", 1, AMD_HDL$BetaXG, AMD_HDL$BetaYG, AMD_HDL$seBetaXG, AMD_HDL$seBetaYG, L, nIter, Prior_DL, H_DL, gen_inits_DL) #res_gamma<-BMA_MRanalysis("Full_Bayes", 1, AMD_HDL$BetaXG, AMD_HDL$BetaYG, AMD_HDL$seBetaXG, AMD_HDL$seBetaYG, L, nIter, Prior_gamma, H_gamma, gen_inits_gamma)
# load data data(AMD_HDL) # Prior choice for beta, tau and inclusion of instruments L<-nrow(AMD_HDL) Ins_prior<-rep(0.5, L) Prior_DL<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, Ins_prob=Ins_prior) Prior_gamma<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, hyper_Prec_shape=2, hyper_Prec_rate=0.00005, Ins_prob=Ins_prior) # Tuning parameter for beta H_DL<-list(Beta=0.05) H_gamma<-list(Beta=0.05, Prec_LL=0, Prec_UL=1000000, Prec_gap=150000) # Generate initial values gen_inits_DL<-list(Beta=rnorm(1,0,10), Ins_L=randomS.initial.LI(L,Ins_prior)) gen_inits_gamma<-list(Beta=rnorm(1,0,10), UBPrec=1000000, LBPrec=0, Ins_L=randomS.initial.LI(L,Ins_prior)) # One-parameter model nIter<-50000 #res_DL<-BMA_MRanalysis("DL_approx", 1, AMD_HDL$BetaXG, AMD_HDL$BetaYG, AMD_HDL$seBetaXG, AMD_HDL$seBetaYG, L, nIter, Prior_DL, H_DL, gen_inits_DL) #res_gamma<-BMA_MRanalysis("Full_Bayes", 1, AMD_HDL$BetaXG, AMD_HDL$BetaYG, AMD_HDL$seBetaXG, AMD_HDL$seBetaYG, L, nIter, Prior_gamma, H_gamma, gen_inits_gamma)
Sensitivity analysis that fits BESIDE-MR model with penalisation term () for number of instruments.
BMA_MRanalysis_InsPen( tau_estimate, N_Beta, BetaXG, BetaYG, seBetaXG, seBetaYG, N_Ins, N_Iter, Prior, tuning_para, gen_inits, Penal_NoInst )
BMA_MRanalysis_InsPen( tau_estimate, N_Beta, BetaXG, BetaYG, seBetaXG, seBetaYG, N_Ins, N_Iter, Prior, tuning_para, gen_inits, Penal_NoInst )
tau_estimate |
Use DL estimate (="DL_approx") or Full Bayesian (="Full_Bayes") approach to analyse data. |
N_Beta |
one-parameter (=1) or two-parameter (=2) model. |
BetaXG |
Effect size for X-G association |
BetaYG |
Effect size for Y-G association |
seBetaXG |
Standard error for X-G association |
seBetaYG |
Standard error for Y-G association |
N_Ins |
Number of genetic instruments |
N_Iter |
Number of iterations |
Prior |
A list of hyper parameter for the prior distribution;
|
tuning_para |
Tuning parameter to ensure sufficient acceptance rate (recommended between 0.25 - 0.45);
|
gen_inits |
Initial values to start the iterations;
|
Penal_NoInst |
Penalisation term for number of instruments, positive and negative value favours models with many and few instruments respectively. Two values must be specified for the two-parameter model. |
An object of class "beside"
containing the following components:
S
A matrix giving the results. ONE PARAMETER MODEL: columns gives sampled values of
for all iterations (rows). TWO PARAMETER MODEL: columns gives sampled values of
for all iterations (rows).
accept_rate
acceptance rate for each of the parameter from S
.
Chin Yang Shapland; Jack Bowden.
Shapland, C.Y., et al., Profile-likelihood Bayesian model averaging for two-sample summary data Mendelian randomization in the presence of horizontal pleiotropy.
# load data data(AMD_HDL) # Prior choice for beta, tau and inclusion of instruments L<-nrow(AMD_HDL) Ins_prior<-rep(0.5, L) Prior_DL<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, Ins_prob=Ins_prior) Prior_gamma<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, hyper_Prec_shape=2, hyper_Prec_rate=0.00005, Ins_prob=Ins_prior) # Tuning parameter for beta H_DL<-list(Beta=0.05) H_gamma<-list(Beta=0.05, Prec_LL=0, Prec_UL=1000000, Prec_gap=150000) # Generate initial values gen_inits_DL<-list(Beta=rnorm(1,0,10), Ins_L=randomS.initial.LI(L,Ins_prior)) gen_inits_gamma<-list(Beta=rnorm(1,0,10), UBPrec=1000000, LBPrec=0, Ins_L=randomS.initial.LI(L,Ins_prior)) # One-parameter model with penalisation parameter eta_sense<-5 # penalisation value which favours models with many instruments nIter<-50000 #res_DL<-BMA_MRanalysis_InsPen("DL_approx",1, AMD_HDL$beta_XL.HDL.C, AMD_HDL$beta_amd, AMD_HDL$se_XL.HDL.C, AMD_HDL$se_amd, L, nIter, Prior_DL, H_DL, gen_inits_DL, eta_sense) #res_gamma<-BMA_MRanalysis_InsPen("Full_Bayes",1, AMD_HDL$beta_XL.HDL.C, AMD_HDL$beta_amd, AMD_HDL$se_XL.HDL.C, AMD_HDL$se_amd, L, nIter, Prior_gamma, H_gamma, gen_inits_gamma, eta_sense)
# load data data(AMD_HDL) # Prior choice for beta, tau and inclusion of instruments L<-nrow(AMD_HDL) Ins_prior<-rep(0.5, L) Prior_DL<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, Ins_prob=Ins_prior) Prior_gamma<-list(hyper_Beta_mean=0, hyper_Beta_sd=1, hyper_Prec_shape=2, hyper_Prec_rate=0.00005, Ins_prob=Ins_prior) # Tuning parameter for beta H_DL<-list(Beta=0.05) H_gamma<-list(Beta=0.05, Prec_LL=0, Prec_UL=1000000, Prec_gap=150000) # Generate initial values gen_inits_DL<-list(Beta=rnorm(1,0,10), Ins_L=randomS.initial.LI(L,Ins_prior)) gen_inits_gamma<-list(Beta=rnorm(1,0,10), UBPrec=1000000, LBPrec=0, Ins_L=randomS.initial.LI(L,Ins_prior)) # One-parameter model with penalisation parameter eta_sense<-5 # penalisation value which favours models with many instruments nIter<-50000 #res_DL<-BMA_MRanalysis_InsPen("DL_approx",1, AMD_HDL$beta_XL.HDL.C, AMD_HDL$beta_amd, AMD_HDL$se_XL.HDL.C, AMD_HDL$se_amd, L, nIter, Prior_DL, H_DL, gen_inits_DL, eta_sense) #res_gamma<-BMA_MRanalysis_InsPen("Full_Bayes",1, AMD_HDL$beta_XL.HDL.C, AMD_HDL$beta_amd, AMD_HDL$se_XL.HDL.C, AMD_HDL$se_amd, L, nIter, Prior_gamma, H_gamma, gen_inits_gamma, eta_sense)
Generate random initial model space that doesn't produce empty and 1 variable model space.
randomS.initial.LI(L, ins_prior)
randomS.initial.LI(L, ins_prior)
L |
Number of instruments. |
ins_prior |
prior for inclusion probability for each instrument. |
numeric sequence of L length as the indicator variable to initialise in BMA_MRanalysis()
.
#load data data(AMD_HDL) #Prior choice for beta, tau and inclusion of instruments L<-nrow(AMD_HDL) Ins_prior<-rep(0.5, L) randomS.initial.LI(L,Ins_prior)
#load data data(AMD_HDL) #Prior choice for beta, tau and inclusion of instruments L<-nrow(AMD_HDL) Ins_prior<-rep(0.5, L) randomS.initial.LI(L,Ins_prior)