Package 'mrbma'

Title: Mendelian Randomization Bayesian Model Averaging
Description: A set of functions designed to implement Mendelian Randomization Bayesian Model Averaging.
Authors: Michael Levin [aut, cre]
Maintainer: Michael Levin <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-05 02:42:50 UTC
Source: https://github.com/mglev1n/mrbma

Help Index


Perform Mendelian Randomization Bayesian Model Averaging

Description

This function takes harmonized exposure/outcome data and runs Mendelian Randomization Bayesian Model Averaging to identify and prioritize relationships between the exposures and outcome.

Usage

mr_bma(
  harmonized_data,
  prior_prob = 0.5,
  prior_sigma = 0.5,
  top = 10,
  kmin,
  kmax,
  remove_outliers = TRUE,
  remove_influential = TRUE,
  calculate_p = FALSE,
  nrepeat = 1e+05
)

Arguments

harmonized_data

(list) Harmonized data of exposures/outcomes of interest, generated using TwoSampleMR::mv_harmonise_data()

prior_prob

(numeric) Prior probability

prior_sigma

(numeric) Variance of the prior probability

top

(numeric) Number of top models to return in results

kmin

(numeric) Minimum model size. By default the model will consider all combinations of exposures (eg. kmin = kmax), but may become computationally infeasible with >12 exposures. If kmin < kmax, then a stochastic search is performed.

kmax

(numeric) Maximum model size. By default the model will consider all combinations of exposures (eg. kmin = kmax), but may become computationally infeasible with >12 exposures. If kmin < kmax, then a stochastic search is performed.

remove_outliers

(logical) Remove outlier variants based on Q-statistic

remove_influential

(logical) Remove influential variants based on Cook's distance

calculate_p

(logical) Use empirical permutation with Nyholt procedure of effective tests to estimate p-values

nrepeat

(numeric) Number of permutations used when estimating Nyholt-corrected False Discovery Rate

Value

A list containing the results of MR-BMA analyses. The list includes:

  • model_best = A tibble containing a list of the top models

  • mip_table = A tibble containing the marginal inclusion probabilities of each risk factor

  • mrbma_output = Raw output from the summarymvMR_SSS function

  • influential_res = Diagnostic plots representing the detection of influential variants

  • outlier_res = Diagnostic plot representing the detection of outlier variants

Examples

# Extract genetic instruments
lipid_exposures <- TwoSampleMR::mv_extract_exposures(id_exposure = c("ieu-a-299", "ieu-a-300", "ieu-a-302"))

# Extract corresponding outcome data
cad_outcome <- TwoSampleMR::extract_outcome_data(snps = lipid_exposures$SNP, outcomes = "ebi-a-GCST005195")

# Generate harmonized dataset
lipids_cad_harmonized <- TwoSampleMR::mv_harmonise_data(lipid_exposures, cad_outcome)

# Run MR-BMA
mr_bma_res <- mr_bma(lipids_cad_harmonized, calculate_p = TRUE, nrepeat = 1000)

# Output best models
mr_bma_res$model_best

# Output marginal inclusion probabilities for each risk factor
mr_bma_res$mip_table