mr.raps {mr.raps} | R Documentation |
Main function
Description
mr.raps
is the main function.
mr.raps.all
: Quick analysis with all six methods
mr.raps.simple
: No overdispersion, l2 loss
mr.raps.overdispersed
: Overdispersion, l2 loss
mr.raps.simple.robust
: No overdispersion, robust loss
mr.raps.overdispersed.robust
: Overdispersed, robust loss
Usage
mr.raps(b_exp, b_out, se_exp, se_out, over.dispersion = FALSE,
loss.function = c("l2", "huber", "tukey"), diagnosis = FALSE,
se.method = c("sandwich", "bootstrap"), k = switch(loss.function[1], l2 =
NULL, huber = 1.345, tukey = 4.685), B = 1000, suppress.warning = FALSE)
mr.raps.all(b_exp, b_out, se_exp, se_out)
mr.raps.simple(b_exp, b_out, se_exp, se_out, diagnosis = FALSE)
mr.raps.overdispersed(b_exp, b_out, se_exp, se_out,
initialization = c("simple", "mode"), suppress.warning = FALSE,
diagnosis = FALSE, niter = 20, tol = .Machine$double.eps^0.5)
mr.raps.simple.robust(b_exp, b_out, se_exp, se_out, loss.function = c("huber",
"tukey"), k = switch(loss.function[1], huber = 1.345, tukey = 4.685),
diagnosis = FALSE)
mr.raps.overdispersed.robust(b_exp, b_out, se_exp, se_out,
loss.function = c("huber", "tukey"), k = switch(loss.function[1], huber =
1.345, tukey = 4.685), initialization = c("l2", "mode"),
suppress.warning = FALSE, diagnosis = FALSE, niter = 20,
tol = .Machine$double.eps^0.5)
Arguments
b_exp |
A vector of SNP effects on the exposure variable, usually obtained from a GWAS. |
b_out |
A vector of SNP effects on the outcome variable, usually obtained from a GWAS. |
se_exp |
A vector of standard errors of |
se_out |
A vector of standard errors of |
over.dispersion |
Should the model consider overdispersion (systematic pleiotropy)? Default is FALSE. |
loss.function |
Either the squared error loss ( |
diagnosis |
Should the function returns diagnostic plots and results? Default is FALSE |
se.method |
How should the standard error be estimated? Either by sandwich variance formula (default and recommended) or the bootstrap. |
k |
Threshold parameter in the Huber and Tukey loss functions. |
B |
Number of bootstrap resamples |
suppress.warning |
Should warning messages be suppressed? |
initialization |
Method to initialize the robust estimator. "Mode" is not supported currently. |
niter |
Maximum number of interations to solve the estimating equations. |
tol |
Numerical precision. |
Value
A list
- beta.hat
Estimated causal effect
- beta.se
Standard error of
beta.hat
- beta.p.value
Two-sided p-value of
beta.hat
- tau2.hat
Overdispersion parameter if
over.dispersion = TRUE
- tau2.se
Standard error of
tau2.hat
- std.resid
Standardized residuals of each SNP, returned if
diagnosis = TRUE
- beta.hat.loo
Leave-one-out estimates of
beta.hat
, returned ifdiagnosis = TRUE
- beta.hat.bootstrap
Median of the bootstrap estimates, returned if
se.method = "bootstrap"
- beta.se.bootstrap
Median absolute deviation of the bootstrap estimates, returned if
se.method = "bootstrap"
Functions
-
mr.raps.all
: -
mr.raps.simple
: -
mr.raps.overdispersed
: -
mr.raps.simple.robust
: -
mr.raps.overdispersed.robust
:
References
Qingyuan Zhao, Jingshu Wang, Jack Bowden, Dylan S. Small. Statistical inference in two-sample summary-data Mendelian randomization using robust adjusted profile score. https://arxiv.org/abs/1801.09652.
Examples
data(bmi.sbp)
attach(bmi.sbp)
## All estimators
mr.raps.all(beta.exposure, beta.outcome, se.exposure, se.outcome)
## Diagnostic plots
res <- mr.raps(beta.exposure, beta.outcome, se.exposure, se.outcome,
diagnosis = TRUE)
res <- mr.raps(beta.exposure, beta.outcome, se.exposure, se.outcome,
TRUE, diagnosis = TRUE)
res <- mr.raps(beta.exposure, beta.outcome, se.exposure, se.outcome,
TRUE, "tukey", diagnosis = TRUE)
detach(bmi.sbp)
data(bmi.bmi)
attach(bmi.bmi)
## Because both the exposure and the outcome are BMI, the true "causal" effect should be 1.
## All estimators
mr.raps.all(beta.exposure, beta.outcome, se.exposure, se.outcome)
detach(bmi.bmi)