| Title: | GENIUS-MAWII: For Robust Mendelian Randomization with Many Weak Invalid Instruments |
|---|---|
| Description: | Mendelian randomization (MR) has become a popular approach to study causal effects by using genetic variants as instrumental variables. This package implements GENIUS-MAWII. Reference: Ting Ye, Zhonghua Liu, Baoluo Sun, and Eric Tchetgen Tchetgen (2021). GENIUS-MAWII: For Robust Mendelian Randomization with Many Weak Invalid Instruments. Available at https://arxiv.org/abs/2107.06238. |
| Authors: | Ting Ye [aut, cre] |
| Maintainer: | Ting Ye <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.1.0 |
| Built: | 2026-05-19 09:04:40 UTC |
| Source: | https://github.com/remlapmot/mr.genius |
Simulate dataset
data_gen(m, n, beta0, gamma, case = "case2")data_gen(m, n, beta0, gamma, case = "case2")
m |
Number of SNPs |
n |
Sample size |
beta0 |
True causal effect |
gamma |
A parameter that controls the magnitude of heteroscedasticity, i.e., the identification strength |
case |
Simulation scenarios used in Table 1 in Ye et al., (2021) |
A list
A n*m matrix of SNPs.
A n-dimentional vector for the exposure.
A n-dimentional vector for the outcome.
Ting Ye, Zhonghua Liu, Baoluo Sun, and Eric Tchetgen Tchetgen (2021). GENIUS-MAWII: For Robust Mendelian Randomization with Many Weak Invalid Instruments.https://arxiv.org/abs/2107.06238.
df<-data_gen(m=100,n=1e5,beta=0.4,gamma=0.1)df<-data_gen(m=100,n=1e5,beta=0.4,gamma=0.1)
Simulate a dataset with covariates
data_gen_x(m, n, beta0, gamma)data_gen_x(m, n, beta0, gamma)
m |
Number of SNPs |
n |
Sample size |
beta0 |
True causal effect |
gamma |
A parameter that controls the magnitude of heteroscedasticity, i.e., the identification strength |
A list
A n*m matrix of SNPs.
A n-dimentional vector for the exposure.
A n-dimentional vector for the outcome.
A n*2 matrix for the covariate.
Ting Ye, Zhonghua Liu, Baoluo Sun, and Eric Tchetgen Tchetgen (2021). GENIUS-MAWII: For Robust Mendelian Randomization with Many Weak Invalid Instruments.https://arxiv.org/abs/2107.06238.
df<-data_gen_x(m=100,n=1e5,beta=0.4,gamma=0.1)df<-data_gen_x(m=100,n=1e5,beta=0.4,gamma=0.1)
Main function for GENIUS-MAWII
mr.genius(z, a, y, x = NULL, alpha = 0.05, diagnostics = FALSE)mr.genius(z, a, y, x = NULL, alpha = 0.05, diagnostics = FALSE)
z |
A n*m matrix of SNPs, where n is the sample size, m is the number of SNPs |
a |
A n-dimentional vector for the exposure |
y |
A n-dimentional vector for the outcome |
x |
A n*p matrix for the covariate, where p is the number of covariates. Default is NULL, when there is no covariates |
alpha |
Confidence interval has level 1-alpha. Default is 0.05 |
diagnostics |
Should the function returns the residual plot for assumption diagnosis. Default is FALSE |
A list
Estimated causal effect
Standard error of beta.hat
A 1-alpha confidence interval
J statistic, which is often used to test overidentification. J statistic larger than 1-alpha quantile of chi-square distribution (df=dim(Z)-1) indicates that not all SNPs satisfy our assumptions.
F-statistic as a measure of weak identification. It is recommended to be larger than 2.
Ting Ye, Zhonghua Liu, Baoluo Sun, and Eric Tchetgen Tchetgen (2021). GENIUS-MAWII: For Robust Mendelian Randomization with Many Weak Invalid Instruments.https://arxiv.org/abs/2107.06238.
df<-data_gen(m=20,n=1e5,beta=0.4,gamma=0.1) mr.genius(df$z,df$a,df$y,diagnostics=TRUE) df<-data_gen_x(m=10,n=2e3,beta=0.4,gamma=1) mr.genius(df$z,df$a,df$y,df$x)df<-data_gen(m=20,n=1e5,beta=0.4,gamma=0.1) mr.genius(df$z,df$a,df$y,diagnostics=TRUE) df<-data_gen_x(m=10,n=2e3,beta=0.4,gamma=1) mr.genius(df$z,df$a,df$y,df$x)