Package 'MRCorge'

Title: Mendelian Randomization based on the core gene hypothesis for polygenic exposures
Description: This package performs Mendelian Randomization (MR) analyses based on the core gene hypothesis for polygenic exposures. MR CORGE identifies a small number of putative core instruments that are more likely to affect genes with a direct biological role in an exposure and obtains causal effect estimates based on these instruments, thereby reducing the risk of horizontal pleiotropy.
Authors: Wenmin Zhang [aut, cre], Tianyuan Lu [aut]
Maintainer: Wenmin Zhang <[email protected]>
License: CC-BY-NC-ND 4.0
Version: 0.1.0
Built: 2025-02-19 06:16:46 UTC
Source: https://github.com/zhwm/MRCorge

Help Index


Perform Mendelian Randomization based on the core gene hypothesis for polygenic exposures

Description

This function performs Mendelian Randomization (MR) analyses based on the core gene hypothesis for polygenic exposures. MR Corge identifies a small number of putative core instruments that are more likely to affect genes with a direct biological role in an exposure and obtains causal effect estimates based on these instruments, thereby reducing the risk of horizontal pleiotropy.

Usage

mrcorge(
  harmonized_data,
  rank = "beta",
  K = 5,
  method_list = c("mr_ivw", "mr_weighted_mode", "mr_weighted_median"),
  seed = 1
)

Arguments

harmonized_data

Data frame containing the harmonized data from the TwoSampleMR package.

rank

Character, method to rank instruments, one of 'beta' (absolute per-allele effect size), 'h2' (per-variant heritability), 'pval' (significance), or 'zscore' (sample size-normalized z-score). Default is 'beta'.

K

Integer, number of instrument groups. Default is 5.

method_list

Character vector, list of MR methods to apply. Default is c("mr_ivw", "mr_weighted_mode", "mr_weighted_median").

seed

Integer, seed for random number generation. Default is 1.

Value

A list containing:

mrcorge

The main MR results.

result

All MR results including group-specific and cumulative estimates.

instrument

Data frame of instruments with their respective groups.

Q

Q statistics for heterogeneity.

I2

I2 statistics for heterogeneity.

het_P

P-values for heterogeneity tests.

Examples

# Example usage:
library(MRCorge)
data("HDL_CAD")
res <- mrcorge(HDL_CAD, rank='beta', K=20, method_list = c("mr_ivw"))

Plot MR CORGE Results

Description

This function plots the results of MR CORGE.

Usage

plot_mrcorge(mrcorge_result, scale = "linear")

Arguments

mrcorge_result

List, result from the mrcorge function.

scale

Character, scale for the plot, either "linear" or "exp". Default is "linear".

Value

ggplot object, the plot of MR sensitivity analysis results.

Examples

# Example usage:
library(MRCorge)
data("HDL_CAD")
res <- mrcorge(HDL_CAD, rank='beta', K=20, method_list = c("mr_ivw"))
plot_mrcorge(res, scale='exp')

Calculate Q Statistic for Heterogeneity

Description

This function calculates the Q statistic for heterogeneity in Mendelian Randomization analysis.

Usage

Qstatistic(b_group, se_group, b_overall)

Arguments

b_group

Numeric vector, effect sizes for each group.

se_group

Numeric vector, standard errors for each group.

b_overall

Numeric, overall effect size.

Value

Numeric, Q statistic for heterogeneity.