| Title: | Bayesian multi-response Mendelian randomisation |
|---|---|
| Description: | This package performs two-sample summary-level data Bayesian multi-response Mendelian randomisation with the selection of important exposures shared or distinct across responses. Post-processing and selection of exposures based on an in-house FDR implementation are also provided. |
| Authors: | Leonardo Bottolo [aut, cre], Verena Zuber [aut, ctb] |
| Maintainer: | Leonardo Bottolo <[email protected]> |
| License: | GPL-2 | file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-05-13 08:24:11 UTC |
| Source: | https://github.com/lb664/MR2 |
Post-processing of MR2 Markov chain Monte Carlo output. Beta density finite mixture model of the marginal posterior probability of inclusion (mPPI) or edge marginal posterior of inclusion (ePPI)
BMM_EM( PPI, K = 2, iter_max = 1000, tol = 1e-06, plotting = 0, printing = FALSE, digits = 3, cex_list = list(cex = 1, cex.axis = 1.375, cex.lab = 1.375) )BMM_EM( PPI, K = 2, iter_max = 1000, tol = 1e-06, plotting = 0, printing = FALSE, digits = 3, cex_list = list(cex = 1, cex.axis = 1.375, cex.lab = 1.375) )
PPI |
Marginal posterior probability of inclusion (mPPI) or edge marginal posterior of inclusion (ePPI) return by MR2 |
K |
Number of components. Default values set at |
iter_max |
Max number of iterations of the EM algorithm. Default values set at |
tol |
Stopping criteria tolerance of the EM algorithm. Default values set at |
plotting |
|
printing |
Printing parameters value at each iteration of the EM algorithm. Default values set at |
digits |
Integer indicating the number of decimal places |
cex_list |
List of printing options used |
For details regarding the EM algorithm to classify posterior probabilities of inclusion, see in Zuber et al. (2023)
The value returned is a list object list(PPI, w, a, b, p, Llik, aStore, bStore, pStore, LlikStore, stopcode, opt)
PPI Ordered vector of the posterior probabilities of inclusion
w Matrix of allocation probabilities
a Vector of estimated first parameter of the beta components
b Vector of estimated second parameter of the beta components
Llik Final log-likelihood estimated by the EM algorithm
aStore Stored vectors of the estimated first parameter of the beta components for each iteration of the EM
algorithm
bStore Stored vectors of the estimated second parameter of the beta components for each iteration of the EM
algorithm
pStore Stored vectors of estimated probability of each beta component for each iteration of the EM algorithm
LlikStoreStore Stored value of the log-likelihood for each iteration of the EM algorithm
stopcode Message that describes how the EM algorithm has terminated
opt List of options used list(iter_max, tol, plotting, printing)
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023). “Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.” Am. J. Hum. Genet., 110(7), 1177–1199. doi:10.1016/j.ajhg.2023.06.005.
# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of # expected exposures directly associated with each response is set at 2 and its variance at 2, # with a priori range of direct causal association ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost) # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 2, # with a priori range of direct causal associations ranging between 0 and 7. A non- # decomposable graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat_Y <- Sim_Pleiotropy$betaHat_Y betaHat_X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost)# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of # expected exposures directly associated with each response is set at 2 and its variance at 2, # with a priori range of direct causal association ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost) # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 2, # with a priori range of direct causal associations ranging between 0 and 7. A non- # decomposable graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat_Y <- Sim_Pleiotropy$betaHat_Y betaHat_X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost)
Post-processing of MR2 Markov chain Monte Carlo output. Estimation of the posterior probability of inclusion cutoff for a given nominal False Discovery Rate level
FDR_BMM(PPI, w, FDR_nominal = 0.05, plotting = FALSE)FDR_BMM(PPI, w, FDR_nominal = 0.05, plotting = FALSE)
PPI |
Ordered marginal posterior probability of inclusion (mPPI) or edge marginal posterior of inclusion (ePPI) return by MBB_EM() |
w |
Matrix of allocation probabilities |
FDR_nominal |
Nominal level of False Discovery Rate to be controlled. Default values set at |
plotting |
Logical with no plots as default |
For details regarding the False Discovery Rate control based on the Beta densities finite mixture model, see in Zuber et al. (2023)
The value returned is a list object list(cutoff, cutoff_idx, FDR_est, FNR_est)
cutoff Posterior probability of inclusion cutoff for a given nominal FDR level
cutoff_idx Index of the ordered posterior probability of inclusion that corresponds to the estimated cutoff
FDR_est Estimated False Discovery Rate
FNR_est Estimated False Negative Rate
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023). “Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.” Am. J. Hum. Genet., 110(7), 1177–1199. doi:10.1016/j.ajhg.2023.06.005.
# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of # expected exposures directly associated with each response is set at 2 and its variance at 2, # with a priori range of direct causal association ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost) FDR_BMM_output <- FDR_BMM(BMM_EM_output$PPI, BMM_EM_output$w) PostProc_output$thetaPost * (PostProc_output$gammaPost > FDR_BMM_output$cutoff) * 1 # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 2, # with a priori range of direct causal associations ranging between 0 and 7. A non-decomposable # graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat__Y <- Sim_Pleiotropy$betaHat_Y betaHat__X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost) FDR_BMM_output <- FDR_BMM(BMM_EM_output$PPI, BMM_EM_output$w) PostProc_output$thetaPost * (PostProc_output$gammaPost > FDR_BMM_output$cutoff) * 1# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of # expected exposures directly associated with each response is set at 2 and its variance at 2, # with a priori range of direct causal association ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost) FDR_BMM_output <- FDR_BMM(BMM_EM_output$PPI, BMM_EM_output$w) PostProc_output$thetaPost * (PostProc_output$gammaPost > FDR_BMM_output$cutoff) * 1 # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 2, # with a priori range of direct causal associations ranging between 0 and 7. A non-decomposable # graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat__Y <- Sim_Pleiotropy$betaHat_Y betaHat__X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) BMM_EM_output <- BMM_EM(PostProc_output$gammaPost) FDR_BMM_output <- FDR_BMM(BMM_EM_output$PPI, BMM_EM_output$w) PostProc_output$thetaPost * (PostProc_output$gammaPost > FDR_BMM_output$cutoff) * 1
Markov chain Monte Carlo implementation of Bayesian Multi-response Mendelian randomization model for two-sample summary-level data
MR2( betaHat_Y, betaHat_X, EVgamma = c(2, 2), tau = 1, niter, burnin, thin, monitor, fullCov = FALSE, nonDecomp = FALSE, alpha = 0.05, probAddDel = 0.9, probAdd = 0.5, probMix = 0.25, geomMean = EVgamma[1], graphParNiter = max(16, dim(Y)[2] * dim(Y)[2]), seed = 31122021 )MR2( betaHat_Y, betaHat_X, EVgamma = c(2, 2), tau = 1, niter, burnin, thin, monitor, fullCov = FALSE, nonDecomp = FALSE, alpha = 0.05, probAddDel = 0.9, probAdd = 0.5, probMix = 0.25, geomMean = EVgamma[1], graphParNiter = max(16, dim(Y)[2] * dim(Y)[2]), seed = 31122021 )
betaHat_Y |
(number of IVs) times (number of responses) matrix of summary-level responses |
betaHat_X |
(number of IVs) times (number of exposures) matrix of summary-level exposures |
EVgamma |
A priori number of expected exposures directly associated with each response and its variance. For details, see
Kohn et al. (2001), Alexopoulos and Bottolo (2021) and Zuber et al. (2023). Default
value is |
tau |
Prior variance of the (direct causal effect) theta prior with the default value set at |
niter |
Number of Markov chain Monte Carlo iterations (including burn-in) |
burnin |
Number of Markov chain Monte Carlo iterations to be discarded as burn-in |
thin |
Store the Markov chain Monte Carlo output at every thin-th iteration |
monitor |
Display the monitored-th iteration |
fullCov |
Logical parameter to select full ( |
nonDecomp |
Logical, |
alpha |
Level of significance ( |
probAddDel |
Probability ( |
probAdd |
Probability ( |
probMix |
Probability ( |
geomMean |
Mean of the geometric proposal distribution that samples the index of the exposure being added/deleted. Default
value is the number of expected exposures directly associated with each response and specified in |
graphParNiter |
Number of Markov chain Monte Carlo internal iterations to sample the graphical model between responses. Default value is the max between 16 and the square of the number of responses |
seed |
Seed used to initialise the Markov chain Monte Carlo algorithm |
For details regarding the model and the algorithm, see Zuber et al. (2023) and Alexopoulos and Bottolo (2021), respectively
The value returned is a list object list(theta, G, R, D, postMean, hyperPar, samplerPar, opt)
theta Matrix of the (thinned) samples drawn from the posterior distribution of the direct causal effects
G 3D array of the (thinned) samples drawn from the posterior distribution of the graphs
R 3D array of the (thinned) samples drawn from the posterior distribution of the correlation matrix between the
responses
D Matrix of the (thinned) samples drawn from the posterior distribution of the standard deviations of each
responses
postMean List of the posterior means of list(gamma, theta, G, R, D)
timeMR2 Time in minutes employed by MR2 algorithm to analyse the data
hyperPar List of the hyper-parameters list(tau) and the parameters of the beta-binomial distribution
derived from EVgamma
samplerPar List of parameters used in the Markov chain Monte Carlo algorithm
list(alpha, probAddDel, probAdd, probMix, geomMean, graphParNiter)
opt List of options used list(std, seed)
Alexopoulos A, Bottolo L (2021).
“Bayesian Variable Selection for Gaussian copula regression models.”
J. Comput. Graph. Stat., 30(3), 578–593.
doi:10.1080/10618600.2020.1840997.
Kohn R, Smith M, Chan D (2001).
“Nonparametric regression using linear combinations of basis functions.”
Stat. Comput., 11(4), 313–322.
doi:10.1023/A:1011916902934.
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023).
“Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.”
Am. J. Hum. Genet., 110(7), 1177–1199.
doi:10.1016/j.ajhg.2023.06.005.
# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of expected # exposures directly associated with each response is set at 2 and its variance at 2, with a # priori range of direct causal associations ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) head(MR2_output$postMean$theta) # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 2, # with a priori range of direct causal associations ranging between 0 and 7. A non-decomposable # graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat_Y <- Sim_Pleiotropy$betaHat_Y betaHat_X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) head(MR2_output$postMean$theta)# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of expected # exposures directly associated with each response is set at 2 and its variance at 2, with a # priori range of direct causal associations ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) head(MR2_output$postMean$theta) # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 2, # with a priori range of direct causal associations ranging between 0 and 7. A non-decomposable # graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat_Y <- Sim_Pleiotropy$betaHat_Y betaHat_X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) head(MR2_output$postMean$theta)
Post-processing of MR2 Markov chain Monte Carlo output
PostProc(output, betaHat_Y, betaHat_X, alpha = 0.05, digits = 3)PostProc(output, betaHat_Y, betaHat_X, alpha = 0.05, digits = 3)
output |
Object returned by MR2 |
betaHat_Y |
(number of IVs) times (number of responses) matrix of summary-level responses |
betaHat_X |
(number of IVs) times (number of exposures) matrix of summary-level exposures |
alpha |
Area of the tails of a symmetric credible interval ( |
digits |
Integer indicating the number of decimal places |
For details regarding the post-processing of the Markov chain Monte Carlo output, see details in Zuber et al. (2023)
The value returned is a list object list(gammaPost, thetaPost, thetaPost_CI, DPost, GPost, SigmaPost, SigmaPost_CI,
RPost, RPost_CI, Rm1Post, Rm1Post_CI, decomposability_freq, CPO, scaleCPO, freq_ouliers, PLML, DIC, opt)
gammaPost Marginal posterior probability of inclusion (mPPI)
thetaPost Posterior mean of the direct causal effects
thetaPost_CI of the direct causal effects
DPost Posterior mean of the standard deviations of each response
GPost Edge posterior probability of inclusion (ePPI)
SigmaPost Posterior mean of the variance-covariance matrix between the responses after conditioning on the direct
causal effects
SigmaPost_CI (1 - ) credible interval of the variance-covariance matrix between the responses after
conditioning on the direct causal effects
RPost Posterior mean of the correlation matrix between the responses after conditioning on the direct causal
effects
RPost_CI (1 - ) credible interval of the correlation matrix between the responses after conditioning on the
direct causal effects
Rm1Post Posterior mean of the partial correlation matrix between the responses after conditioning on the direct
causal effects
Rm1Post_CI (1 - ) credible interval of the partial correlation matrix between the responses after
conditioning on the direct causal effects
decomposability_freq Frequency of visited decomposability models during the Markov chain Monte Carlo. If
nonDecomp = TRUE, frequency can be less than 1
CPO Conditional predictive ordinate for each instrumental variable, see Ntzoufras (2008)
scaleCPO Scaled conditional predictive ordinate for each instrumental variable, see
Congdon (2005)
PLML Pseudo log-marginal likelihood
scaleCPO Scaled conditional predictive ordinate for each instrumental variable, see
Congdon (2005)
freq_ouliers Frequency outliers or high-leverage and influential instrumental variables defined as the frequency
of scale CPO < 0.01, see Congdon (2005)
stability_PLML Variance Pseudo log-marginal likelihood
DIC Deviation Information Criteria, see Spiegelhalter et al. (2002)
timePostProc Time in minutes employed by PostProc to perform the analyse
opt List of options used list( , digits)
Congdon P (2005).
Bayesian Models for Categorical Data.
John Wiley & Sons, West Sussex, England.
doi:10.1002/0470092394.
Ntzoufras I (2008).
Bayesian Modeling Using WinBUGS.
John Wiley & Sons, West Sussex, England.
doi:10.1002/9780470434567.
Spiegelhalter DJ, Best NG, Carlin BP, van der Linde A (2002).
“Bayesian measures of model complexity and fit (with discussion).”
J. R. Stat. Soc. Ser. B. Stat. Methodol., 64(4), 583–639.
doi:10.1111/1467-9868.00353.
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023).
“Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.”
Am. J. Hum. Genet., 110(7), 1177–1199.
doi:10.1016/j.ajhg.2023.06.005.
# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of # expected exposures directly associated with each response is set at 2 and its variance at 2, # with a priori range of direct causal association ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 3, # with a priori range of direct causal associations ranging between 0 and 7. A non-decomposable # graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat_Y <- Sim_Pleiotropy$betaHat_Y betaHat_X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X)# Example 1: Analysis of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs. The number of # expected exposures directly associated with each response is set at 2 and its variance at 2, # with a priori range of direct causal association ranging between 0 and 8 Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) betaHat_Y <- Sim_Confounding$betaHat_Y betaHat_X <- Sim_Confounding$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(2, 2), niter = 7500, burnin = 2500, thin = 5, monitor = 1000, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X) # Example 2: Analysis of one replication of simulated Scenario IV-Directed pleiotropy with q = # 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect of # the shared pleiotropic pathway on the responses set as \code{2}. The number of expected # exposures directly associated with each response is set at 1 and its variance at 3, # with a priori range of direct causal associations ranging between 0 and 7. A non-decomposable # graph for the inverse of the residual correlation between responses is selected Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, seed = 280610971) betaHat_Y <- Sim_Pleiotropy$betaHat_Y betaHat_X <- Sim_Pleiotropy$betaHat_X MR2_output <- MR2(betaHat_Y, betaHat_X, EVgamma = c(1, 3), niter = 15000, burnin = 5000, thin = 10, monitor = 1000, nonDecomp = TRUE, seed = 280610971) PostProc_output <- PostProc(MR2_output, betaHat_Y, betaHat_X)
Simulator to generate multiple responses and multiple exposures two-sample summary-level data with confounding effects
Scenario_Confounding( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, thetaUY = 1, thetaUX = 2, seed = 31122021 )Scenario_Confounding( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, thetaUY = 1, thetaUX = 2, seed = 31122021 )
nRep |
Number of simulated replicates |
q |
Number of simulated summary-level responses |
p |
Number of simulated summary-level exposures |
nIV |
Number of genetic variants used as instrumental variables |
nSubject |
Number of individuals in each sample of individual-level data |
MAF |
Major allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value set
at |
thetaRange |
Sought range of the simulated direct causal effects. Default value set at |
thetaSparsness |
Proportion of simulated causal associations between exposures and responses. Default value set at |
heritY |
Heriditability of the responses. Default value set at |
betaHatRange_X |
Sought range of the simulated genetic effects on the exposures. Default value set at |
heritX |
Heriditability of the exposures. Default value set at |
rhoX |
Correlation between the exposures. Default value set at |
thetaUY |
Impact of the confounder on the responses. Default value set at |
thetaUX |
Impact of the confounder on the exposures. Default value set at |
seed |
Seed used to initialise the simulation |
For details regarding the simulated scenario, see details in Zuber et al. (2023)
The value returned is a list object list(betaHat_Y, betaHat_X, theta, par)
betaHat_Y 3D array (IVs times responses times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each response
betaHat_X 3D array (IVs times exposures times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each exposure
theta Matrix ((exposures times replicates) times replicates) of the simulated direct causal effects
par List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange,
thetaSparsness, heritY, betaHatRange_X, heritX, rhoX, thetaUY, thetaUX, seed)
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023). “Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.” Am. J. Hum. Genet., 110(7), 1177–1199. doi:10.1016/j.ajhg.2023.06.005.
# Example: Simulation of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) head(Sim_Confounding$theta) Sim_Confounding$par# Example: Simulation of one replication of simulated Scenario II-Confounding with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs Sim_Confounding <- Scenario_Confounding(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) head(Sim_Confounding$theta) Sim_Confounding$par
Simulator to generate multiple responses and multiple exposures two-sample summary-level data with confounding and dependence between the responses not due to any unmeasured pleiotropic pathway
Scenario_Dependence( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, rhoY = 0.6, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, thetaUY = 1, thetaUX = 2, seed = 31122021 )Scenario_Dependence( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, rhoY = 0.6, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, thetaUY = 1, thetaUX = 2, seed = 31122021 )
nRep |
Number of simulated replicates |
q |
Number of simulated summary-level responses |
p |
Number of simulated summary-level exposures |
nIV |
Number of genetic variants used as instrumental variables |
nSubject |
Number of individuals in each sample of individual-level data |
MAF |
Major allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value set
at |
thetaRange |
Sought range of the simulated direct causal effects. Default value set at |
thetaSparsness |
Proportion of simulated causal associations between exposures and responses. Default value set at |
heritY |
Heriditability of the responses. Default value set at |
rhoY |
Correlation between the responses not due to any unmeasured pleiotropic pathway. Default value set at |
betaHatRange_X |
Sought range of the simulated genetic effects on the exposures. Default value set at |
heritX |
Heriditability of the exposures. Default value set at |
rhoX |
Correlation between the exposures. Default value set at |
thetaUY |
Impact of the confounder on the responses. Default value set at |
thetaUX |
Impact of the confounder on the exposures. Default value set at |
seed |
Seed used to initialise the simulation |
For details regarding the simulated scenario, see details in Zuber et al. (2023)
The value returned is a list object list(betaHat_Y, betaHat_X, theta, par)
betaHat_Y 3D array (IVs times responses times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each response
betaHat_X 3D array (IVs times exposures times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each exposure
theta Matrix ((exposures times replicates) times replicates) of the simulated direct causal effects
par List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange,
thetaSparsness, heritY, rhoX, betaHatRange_X, heritX, rhoX, thetaUY, thetaUX, seed)
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023). “Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.” Am. J. Hum. Genet., 110(7), 1177–1199. doi:10.1016/j.ajhg.2023.06.005.
# Example: Simulation of one replication of simulated Scenario V-Dependence with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs Sim_Dependence <- Scenario_Dependence(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) head(Sim_Dependence$theta) Sim_Dependence$par# Example: Simulation of one replication of simulated Scenario V-Dependence with q = 5 # responses, p = 15 exposures and nIV = 100 genetic variants used as IVs Sim_Dependence <- Scenario_Dependence(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) head(Sim_Dependence$theta) Sim_Dependence$par
Simulator to generate multiple responses and multiple exposures two-sample summary-level data with confounding and pleiotropic effects as well as the effect of one response on another one
Scenario_Mediation( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, rhoY = 0.6, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, undirectedA = TRUE, thetaA = 1, thetaM = 1, thetaUY = 1, thetaUX = 2, seed = 31122021 )Scenario_Mediation( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, rhoY = 0.6, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, undirectedA = TRUE, thetaA = 1, thetaM = 1, thetaUY = 1, thetaUX = 2, seed = 31122021 )
nRep |
Number of simulated replicates |
q |
Number of simulated summary-level responses |
p |
Number of simulated summary-level exposures |
nIV |
Number of genetic variants used as instrumental variables |
nSubject |
Number of individuals in each sample of individual-level data |
MAF |
Major allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value set
at |
thetaRange |
Sought range of the simulated direct causal effects. Default value set at |
thetaSparsness |
Proportion of simulated causal associations between exposures and responses. Default value set at |
heritY |
Heriditability of the responses. Default value set at |
rhoY |
Correlation between the responses not due to any unmeasured pleiotropic pathway. Default value set at |
betaHatRange_X |
Sought range of the simulated genetic effects on the exposures. Default value set at |
heritX |
Heriditability of the exposures. Default value set at |
rhoX |
Correlation between the exposures. Default value set at |
undirectedA |
Logical parameter for simulating an undirected ( |
thetaA |
Effect of the shared pleiotropic pathway on the responses. Default value set at |
thetaM |
Effect of one response on another one, both selected at random. Default value set at |
thetaUY |
Impact of the confounder on the responses. Default value set at |
thetaUX |
Impact of the confounder on the exposures. Default value set at |
seed |
Seed used to initialise the simulation |
For details regarding the simulated scenario, see details in Zuber et al. (2023)
The value returned is a list object list(betaHat_Y, betaHat_X, theta, par)
betaHat_Y 3D array (IVs times responses times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each response
betaHat_X 3D array (IVs times exposures times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each exposure
theta Matrix ((exposures times replicates) times replicates) of the simulated direct causal effects
mediation Matrix (two times replicates) times replicates) of the selected responses to be the mediated response
and the mediator
par List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange,
thetaSparsness, heritY, rhoY, betaHatRange_X, heritX, rhoX, undirectedA, thetaA, thetaM, thetaUY, thetaUX, seed)
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023). “Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.” Am. J. Hum. Genet., 110(7), 1177–1199. doi:10.1016/j.ajhg.2023.06.005.
# Example 1: Simulation of one replication of simulated Scenario Undirected pleiotropy with # Mediation and with q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as # IVs Sim_Mediation <- Scenario_Mediation(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) Sim_Mediation$mediation head(Sim_Mediation$theta) Sim_Mediation$par # Example 2: Simulation of one replication of simulated Scenario Directed pleiotropy with # Mediation and with q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as # IVs and the effect of the shared pleiotropic pathway on the responses set as \code{2} Sim_Mediation <- Scenario_Mediation(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, thetaA = 2, seed = 280610971) Sim_Mediation$mediation head(Sim_Mediation$theta) Sim_Mediation$par# Example 1: Simulation of one replication of simulated Scenario Undirected pleiotropy with # Mediation and with q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as # IVs Sim_Mediation <- Scenario_Mediation(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) Sim_Mediation$mediation head(Sim_Mediation$theta) Sim_Mediation$par # Example 2: Simulation of one replication of simulated Scenario Directed pleiotropy with # Mediation and with q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as # IVs and the effect of the shared pleiotropic pathway on the responses set as \code{2} Sim_Mediation <- Scenario_Mediation(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, thetaA = 2, seed = 280610971) Sim_Mediation$mediation head(Sim_Mediation$theta) Sim_Mediation$par
Simulator to generate multiple responses and multiple exposures two-sample summary-level data with confounding and pleiotropic effects
Scenario_Pleiotropy( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, undirectedA = TRUE, thetaA = 1, thetaUY = 1, thetaUX = 2, seed = 31122021 )Scenario_Pleiotropy( nRep = 2, q = 5, p = 10, nIV = 100, nSubject = 50000, MAF = 0.05, thetaRange = c(-2, 2), thetaSparsness = 0.3, heritY = 0.25, betaHatRange_X = c(-2, 2), heritX = 0.1, rhoX = 0.6, undirectedA = TRUE, thetaA = 1, thetaUY = 1, thetaUX = 2, seed = 31122021 )
nRep |
Number of simulated replicates |
q |
Number of simulated summary-level responses |
p |
Number of simulated summary-level exposures |
nIV |
Number of genetic variants used as instrumental variables |
nSubject |
Number of individuals in each sample of individual-level data |
MAF |
Major allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value set
at |
thetaRange |
Sought range of the simulated direct causal effects. Default value set at |
thetaSparsness |
Proportion of simulated causal associations between exposures and responses. Default value set at |
heritY |
Heriditability of the responses. Default value set at |
betaHatRange_X |
Sought range of the simulated genetic effects on the exposures. Default value set at |
heritX |
Heriditability of the exposures. Default value set at |
rhoX |
Correlation between the exposures. Default value set at |
undirectedA |
Logical parameter for simulating an undirected ( |
thetaA |
Effect of the shared pleiotropic pathway on the responses. Default value set at |
thetaUY |
Impact of the confounder on the responses. Default value set at |
thetaUX |
Impact of the confounder on the exposures. Default value set at |
seed |
Seed used to initialise the simulation |
For details regarding the simulated scenario, see details in Zuber et al. (2023)
The value returned is a list object list(betaHat_Y, betaHat_X, theta, par)
betaHat_Y 3D array (IVs times responses times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each response
betaHat_X 3D array (IVs times exposures times replicates) of the simulated (summary-level) regression coefficients
of the genetic effects on each exposure
theta Matrix ((exposures times replicates) times replicates) of the simulated direct causal effects
par List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange,
thetaSparsness, heritY, betaHatRange_X, heritX, rhoX, undirectedA, thetaA, thetaUY, thetaUX, seed)
Zuber V, Lewin A, Levin MG, Haglund A, Ben-Aicha S, Emanueli C, Damrauer S, Burgess S, Gill D, Bottolo L (2023). “Multi-response Mendelian randomization: Identification of shared and distinct exposures for multimorbidity and multiple related disease outcomes.” Am. J. Hum. Genet., 110(7), 1177–1199. doi:10.1016/j.ajhg.2023.06.005.
# Example 1: Simulation of one replication of simulated Scenario III-Undirected pleiotropy with # q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) head(Sim_Pleiotropy$theta) Sim_Pleiotropy$par # Example 2: Simulation of one replication of simulated Scenario IV-Directed pleiotropy with # q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect # of the shared pleiotropic pathway on the responses set as \code{2} Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, thetaA = 2, seed = 280610971) head(Sim_Pleiotropy$theta) Sim_Pleiotropy$par# Example 1: Simulation of one replication of simulated Scenario III-Undirected pleiotropy with # q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, seed = 280610971) head(Sim_Pleiotropy$theta) Sim_Pleiotropy$par # Example 2: Simulation of one replication of simulated Scenario IV-Directed pleiotropy with # q = 5 responses, p = 15 exposures and nIV = 100 genetic variants used as IVs and the effect # of the shared pleiotropic pathway on the responses set as \code{2} Sim_Pleiotropy <- Scenario_Pleiotropy(nRep = 1, q = 5, p = 15, nIV = 100, undirectedA = FALSE, thetaA = 2, seed = 280610971) head(Sim_Pleiotropy$theta) Sim_Pleiotropy$par