Package 'MR2'

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. The graphical-model Markov chain Monte Carlo engine can be accelerated with a compiled Rcpp/RcppArmadillo implementation.
Authors: Leonardo Bottolo [aut, cre] (ORCID: <https://orcid.org/0000-0002-6381-2327>), Verena Zuber [aut, ctb] (ORCID: <https://orcid.org/0000-0001-9827-1877>)
Maintainer: Leonardo Bottolo <[email protected]>
License: GPL-2 | file LICENSE
Version: 0.2.0
Built: 2026-11-04 22:21:19 UTC
Source: https://github.com/lb664/MR2

Help Index


Beta density finite mixture model

Description

Post-processing of MR2 Markov chain Monte Carlo output. Beta density finite mixture model of the marginal posterior inclusion probability (mPIP) or posterior edge inclusion probability (PEIP)

Usage

BMM_EM(
  PIP,
  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)
)

Arguments

PIP

The mPIP or PEIP returned by PostProc()

K

Number of components. Default value set at 2

iter_max

Maximum number of iterations of the EM algorithm. Default value set at 1000

tol

Stopping criterion tolerance of the EM algorithm. Default value set at 1e-6

plotting
  • 0 (default) No plots

  • 1 Plot at each iteration of the EM algorithm

  • 2 Plot after convergence

printing

Print parameter values at each iteration of the EM algorithm. Default value set at FALSE

digits

Integer indicating the number of decimal places

cex_list

List of plotting options used list(cex, cex.axis, cex.lab)

Details

For details regarding the Beta density finite mixture model, see Broët et al. (2004). For details regarding its use to classify the mPIP and PEIP in MR2, see Zuber et al. (2023)

Value

The value returned is a list object list(PIP, w, a, b, p, Llik, aStore, bStore, pStore, LlikStore, stopcode, opt)

PIP

Ordered vector of the mPIP or PEIP

w

Matrix of allocation probabilities

a

Vector of estimated first parameters of the beta components

b

Vector of estimated second parameters of the beta components

p

Vector of estimated mixing proportions of the beta components

Llik

Final log-likelihood estimated by the EM algorithm

aStore

Stored vectors of the estimated first parameters of the beta components for each iteration

bStore

Stored vectors of the estimated second parameters of the beta components for each iteration

pStore

Stored vectors of estimated mixing probabilities for each iteration

LlikStore

Stored values of the log-likelihood for each iteration

stopcode

Message describing how the EM algorithm terminated

opt

List of options used list(iter_max, tol, plotting, printing)

References

Broët P, Lewin A, Richardson S, Dalmasso C, Magdelenat H (2004). “A mixture model-based strategy for selecting sets of genes in multiclass response microarray experiments.” Bioinformatics, 20(16), 2562–2571. doi:10.1093/bioinformatics/bth285.

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.

Examples

## Not run: 
# 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 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 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, undirected_A = 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)

## End(Not run)

False Discovery Rate based on Beta densities finite mixture model

Description

Post-processing of MR2 Markov chain Monte Carlo output. Estimation of the cutoff of the marginal posterior inclusion probability (mPIP) or posterior edge inclusion probability (PEIP) for a given nominal False Discovery Rate level

Usage

FDR_BMM(PIP, w, FDR_nominal = 0.05, plotting = FALSE)

Arguments

PIP

Ordered mPIP or PEIP returned by BMM_EM()

w

Matrix of allocation probabilities returned by BMM_EM()

FDR_nominal

Nominal level of False Discovery Rate to be controlled. Default value set at 0.05

plotting

Logical; whether to plot the estimated FDR curve. Default FALSE

Details

For details regarding the False Discovery Rate control based on the Beta densities finite mixture model, see Broët et al. (2004) and Zuber et al. (2023)

Value

The value returned is a list object list(cutoff, cutoff_idx, FDR_est, FNR_est, opt)

cutoff

Cutoff of the mPIP or PEIP for a given nominal FDR level

cutoff_idx

Index of the ordered mPIP or PEIP that corresponds to the estimated cutoff

FDR_est

Estimated False Discovery Rate

FNR_est

Estimated False Negative Rate

opt

List of options used list(FDR_nominal, plotting)

References

Broët P, Lewin A, Richardson S, Dalmasso C, Magdelenat H (2004). “A mixture model-based strategy for selecting sets of genes in multiclass response microarray experiments.” Bioinformatics, 20(16), 2562–2571. doi:10.1093/bioinformatics/bth285.

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.

Examples

## Not run: 
# 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 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$PIP, 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 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, undirected_A = 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$PIP, BMM_EM_output$w)
PostProc_output$thetaPost * (PostProc_output$gammaPost > FDR_BMM_output$cutoff) * 1

## End(Not run)

MR2: Multi-response Mendelian randomisation

Description

Markov chain Monte Carlo implementation of Bayesian Multi-response Mendelian randomisation model for two-sample summary-level data

Usage

MR2(
  betaHat_Y,
  betaHat_X,
  EVgamma = c(2, 2),
  tau = NULL,
  tauPar = c(alpha = 2, g = 0.2, h = 10),
  niter,
  burnin,
  thin,
  monitor,
  nonDecomp = FALSE,
  alpha = 0.05,
  probAddDel = 0.9,
  probAdd = 0.5,
  probMix = 0.25,
  geomMean = EVgamma[1],
  graphParNiter = NULL,
  seed = 31122021
)

Arguments

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

tau

Prior variance of the direct effects theta. Default NULL: the prior variance is estimated, one value per response, with the hyperprior τk∼Inverse-Gamma(α,η)\tau_k \sim \mathrm{Inverse\text{-}Gamma}(\alpha, \eta), η∼Gamma(g,h)\eta \sim \mathrm{Gamma}(g, h) (see tauPar). A single positive number fixes the prior variance at that value for every response

tauPar

Hyperparameters c(alpha, g, h) of the hyperprior on tau, used when tau = NULL. Default c(alpha = 2, g = 0.2, h = 10)

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

Refresh the console progress bar every monitored-th iteration

nonDecomp

Logical, TRUE for a non-decomposable graphical model for the inverse correlation matrix

alpha

Level of significance (0.05 default) used to construct the proposal distribution of gamma

probAddDel

Probability (0.9 default) of adding/deleting one exposure during MCMC exploration

probAdd

Probability (0.5 default) of adding one exposure during MCMC exploration

probMix

Probability (0.25 default) of a geometric proposal for the exposure index being added/deleted

geomMean

Mean of the geometric proposal distribution. Default is EVgamma[1]

graphParNiter

Number of MCMC internal iterations for the graphical model. Default max(16, m^2)

seed

Seed used to initialise the Markov chain Monte Carlo algorithm

Details

Alexopoulos and Bottolo (2021)

Value

A list list(theta, G, R, D, postMean, timeMR2, hyperPar, samplerPar, opt); see package documentation for details of each element

References

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.


Post-processing of MR2 output

Description

Post-processing of MR2 Markov chain Monte Carlo output

Usage

PostProc(output, betaHat_Y, betaHat_X, alpha = 0.05, digits = 3)

Arguments

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 (0.05 default) centred around the estimated direct effects and the estimated covariance and (partial) residual correlation matrices

digits

Integer indicating the number of decimal places

Details

For details regarding the post-processing of the Markov chain Monte Carlo output, see Zuber et al. (2023)

Value

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_outliers, PLML, stability_PLML, DIC, timePostProc, opt)

gammaPost

Marginal posterior inclusion probability (mPIP)

thetaPost

Posterior mean of the direct effects

thetaPost_CI

Credible interval of the direct effects

DPost

Posterior mean of the standard deviations of each response

GPost

Posterior edge inclusion probability (PEIP)

SigmaPost

Posterior mean of the variance-covariance matrix between the responses after conditioning on the direct effects

SigmaPost_CI

(1 - α\alpha) credible interval of the variance-covariance matrix

RPost

Posterior mean of the correlation matrix between the responses

RPost_CI

(1 - α\alpha) credible interval of the correlation matrix

Rm1Post

Posterior mean of the partial correlation matrix between the responses

Rm1Post_CI

(1 - α\alpha) credible interval of the partial correlation matrix

decomposability_freq

Frequency of visited decomposable models during the Markov chain Monte Carlo

CPO

Conditional predictive ordinate for each instrumental variable

scaleCPO

Scaled conditional predictive ordinate for each instrumental variable

PLML

Pseudo log-marginal likelihood

freq_outliers

Frequency of outlier or high-leverage instrumental variables (scaleCPO < 0.01)

stability_PLML

Stability of the pseudo log-marginal likelihood

DIC

Deviance Information Criterion

timePostProc

Time in minutes employed by PostProc

opt

List of options used list(alpha, digits)

References

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.

Examples

## Not run: 
# 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 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 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, undirected_A = 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)

## End(Not run)

Simulated scenario: Confounding

Description

Simulator to generate multiple responses and multiple exposures two-sample summary-level data with confounding effects

Usage

Scenario_Confounding(
  nRep = 2,
  q = 5,
  p = 10,
  nIV = 100,
  nSubject = 50000,
  MAF = 0.05,
  thetaRange = c(-2, 2),
  thetaSparsness = 0.3,
  herit_Y = 0.25,
  betaHatRange_X = c(-2, 2),
  herit_X = 0.1,
  rho_X = 0.6,
  psi_Y = 1,
  psi_X = 2,
  seed = 31122021
)

Arguments

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

Minor allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value sets at 0.05

thetaRange

Sought range of the simulated direct effects. Default value sets at (-2,2)

thetaSparsness

Proportion of simulated direct associations between exposures and responses. Default value sets at 0.3

herit_Y

Heritability of the responses. Default value sets at 0.25

betaHatRange_X

Sought range of the simulated genetic effects on the exposures. Default value sets at (-2,2)

herit_X

Heritability of the exposures. Default value sets at 0.1

rho_X

Correlation between the exposures. Default value sets at 0.6

psi_Y

Impact of the confounder on the responses. Default value sets at 1

psi_X

Impact of the confounder on the exposures. Default value sets at 2

seed

Seed used to initialise the simulation

Details

For details regarding the simulated scenario, see details in Zuber et al. (2023)

Value

The value returned is a list object list(betaHat_Y, betaHat_X, theta, parSim)

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 (exposure-response pairs times replicates) of the simulated direct effects

parSim

List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange, thetaSparsness, herit_Y, betaHatRange_X, herit_X, rho_X, psi_Y, psi_X, seed)

References

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.

Examples

## Not run: 
# 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$parSim

## End(Not run)

Simulated scenario: Dependence

Description

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

Usage

Scenario_Dependence(
  nRep = 2,
  q = 5,
  p = 10,
  nIV = 100,
  nSubject = 50000,
  MAF = 0.05,
  thetaRange = c(-2, 2),
  thetaSparsness = 0.3,
  herit_Y = 0.25,
  rho_Y = 0.6,
  betaHatRange_X = c(-2, 2),
  herit_X = 0.1,
  rho_X = 0.6,
  psi_Y = 1,
  psi_X = 2,
  seed = 31122021
)

Arguments

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

Minor allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value sets at 0.05

thetaRange

Sought range of the simulated direct effects. Default value sets at (-2,2)

thetaSparsness

Proportion of simulated direct associations between exposures and responses. Default value sets at 0.3

herit_Y

Heritability of the responses. Default value sets at 0.25

rho_Y

Correlation between the responses not due to any unmeasured pleiotropic pathway. Default value sets at 0.6

betaHatRange_X

Sought range of the simulated genetic effects on the exposures. Default value sets at (-2,2)

herit_X

Heritability of the exposures. Default value sets at 0.1

rho_X

Correlation between the exposures. Default value sets at 0.6

psi_Y

Impact of the confounder on the responses. Default value sets at 1

psi_X

Impact of the confounder on the exposures. Default value sets at 2

seed

Seed used to initialise the simulation

Details

For details regarding the simulated scenario, see details in Zuber et al. (2023)

Value

The value returned is a list object list(betaHat_Y, betaHat_X, theta, parSim)

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 (exposure-response pairs times replicates) of the simulated direct effects

parSim

List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange, thetaSparsness, herit_Y, rho_Y, betaHatRange_X, herit_X, rho_X, psi_Y, psi_X, seed)

References

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.

Examples

## Not run: 
# 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$parSim

## End(Not run)

Simulated scenario: Mediation

Description

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

Usage

Scenario_Mediation(
  nRep = 2,
  q = 5,
  p = 10,
  nIV = 100,
  nSubject = 50000,
  MAF = 0.05,
  thetaRange = c(-2, 2),
  thetaSparsness = 0.3,
  herit_Y = 0.25,
  rho_Y = 0.6,
  betaHatRange_X = c(-2, 2),
  herit_X = 0.1,
  rho_X = 0.6,
  undirected_A = TRUE,
  delta_A = 1,
  gamma_Y = 1,
  psi_Y = 1,
  psi_X = 2,
  seed = 31122021
)

Arguments

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

Minor allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value sets at 0.05

thetaRange

Sought range of the simulated direct effects. Default value sets at (-2,2)

thetaSparsness

Proportion of simulated direct associations between exposures and responses. Default value sets at 0.3

herit_Y

Heritability of the responses. Default value sets at 0.25

rho_Y

Correlation between the responses not due to any unmeasured pleiotropic pathway. Default value sets at 0.6

betaHatRange_X

Sought range of the simulated genetic effects on the exposures. Default value sets at (-2,2)

herit_X

Heritability of the exposures. Default value sets at 0.1

rho_X

Correlation between the exposures. Default value sets at 0.6

undirected_A

Logical parameter for simulating an undirected (TRUE, default) or directed pleiotropic pathway

delta_A

Effect of the shared pleiotropic pathway on the responses. Default value sets at 1

gamma_Y

Effect of one response on another one, both selected at random. Default value sets at 1

psi_Y

Impact of the confounder on the responses. Default value sets at 1

psi_X

Impact of the confounder on the exposures. Default value sets at 2

seed

Seed used to initialise the simulation

Details

For details regarding the simulated scenario, see details in Zuber et al. (2023)

Value

The value returned is a list object list(betaHat_Y, betaHat_X, theta, mediation, parSim)

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 (exposure-response pairs times replicates) of the simulated direct effects

mediation

Matrix (mediator-mediated times replicates) of the selected responses to be the mediated response and the mediator

parSim

List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange, thetaSparsness, herit_Y, rho_Y, betaHatRange_X, herit_X, rho_X, undirected_A, delta_A, gamma_Y, psi_Y, psi_X, seed)

References

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.

Examples

## Not run: 
# 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$parSim


# 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, undirected_A = FALSE,
                                    delta_A = 2, seed = 280610971)
Sim_Mediation$mediation
head(Sim_Mediation$theta)
Sim_Mediation$parSim

## End(Not run)

Simulated scenario: Pleiotropy

Description

Simulator to generate multiple responses and multiple exposures two-sample summary-level data with confounding and pleiotropic effects

Usage

Scenario_Pleiotropy(
  nRep = 2,
  q = 5,
  p = 10,
  nIV = 100,
  nSubject = 50000,
  MAF = 0.05,
  thetaRange = c(-2, 2),
  thetaSparsness = 0.3,
  herit_Y = 0.25,
  betaHatRange_X = c(-2, 2),
  herit_X = 0.1,
  rho_X = 0.6,
  undirected_A = TRUE,
  delta_A = 1,
  psi_Y = 1,
  psi_X = 2,
  seed = 31122021
)

Arguments

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

Minor allele frequency used in the simulation of the genotypes in each sample individual-level data. Default value sets at 0.05

thetaRange

Sought range of the simulated direct effects. Default value sets at (-2,2)

thetaSparsness

Proportion of simulated direct associations between exposures and responses. Default value sets at 0.3

herit_Y

Heritability of the responses. Default value sets at 0.25

betaHatRange_X

Sought range of the simulated genetic effects on the exposures. Default value sets at (-2,2)

herit_X

Heritability of the exposures. Default value sets at 0.1

rho_X

Correlation between the exposures. Default value sets at 0.6

undirected_A

Logical parameter for simulating an undirected (TRUE, default) or directed pleiotropic pathway

delta_A

Effect of the shared pleiotropic pathway on the responses. Default value sets at 1

psi_Y

Impact of the confounder on the responses. Default value sets at 1

psi_X

Impact of the confounder on the exposures. Default value sets at 2

seed

Seed used to initialise the simulation

Details

For details regarding the simulated scenario, see details in Zuber et al. (2023)

Value

The value returned is a list object list(betaHat_Y, betaHat_X, theta, parSim)

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 (exposure-response pairs times replicates) of the simulated direct effects

parSim

List of all parameters used in the simulation list(nRep, q, p, nIV, nSubject, MAF, thetaRange, thetaSparsness, herit_Y, betaHatRange_X, herit_X, rho_X, undirected_A, delta_A, psi_Y, psi_X, seed)

References

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.

Examples

## Not run: 
# 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$parSim


# 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, undirected_A = FALSE,
                                      delta_A = 2, seed = 280610971)
head(Sim_Pleiotropy$theta)
Sim_Pleiotropy$parSim

## End(Not run)