mr.raps.shrinkage | R Documentation |
Main function for RAPS (shrinkage weights)
mr.raps.shrinkage( b_exp, b_out, se_exp, se_out, over.dispersion = FALSE, loss.function = c("l2", "huber", "tukey"), k = switch(loss.function[1], l2 = 2, huber = 1.345, tukey = 4.685), shrinkage = FALSE, prior.param = NULL, diagnostics = FALSE, se.method = c("sandwich", "bootstrap"), num.init = 10, multiple.root.warning = 1 ) ## S3 method for class 'mr.raps' print(x, ...) ## S3 method for class 'mr.raps' plot(x, ...)
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 ( |
k |
Threshold parameter in the Huber and Tukey loss functions. |
shrinkage |
If shrinkage (empirical partially Bayes) should be used. Shrinkage does not affect the unbiasedness of the estimating equations and generally will increase the estimation accuracy. If TRUE, |
prior.param |
Parameters of the Gaussian spike-and-slab prior |
diagnostics |
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. |
num.init |
Number of initializations. |
multiple.root.warning |
How to handle multiple roots of the estimating equations? When this happens, the results of |
x |
a |
... |
further arguments (not supported) |
mr.raps.shrinkage
is the main function for RAPS in conjunction with empirical partially Bayes. It is more general than the first generation mr.raps.mle
function and should be preferred in practice. With the option shrinkage = TRUE
, it essentially reduces to mr.raps.mle
. In that case, the main difference is that the standard errors in mr.raps.shrinkage
are computed based on observed information (and also an empirical estimate of the variance of the score function). This is preferred over using the plugged-in Fisher information in mr.raps.mle
. See Efron and Hinkley (1978) referenced below.
Because the estimating equations are highly non-linear, it is possible that there are multiple roots. To overcome this issue, we use multiple initializations (controlled by num.init
) around the mr.raps.mle
point estimate. A warning is given if there seems to be another finite root, and no solution is returned if there are two roots close to the initialization. When the program does not find a finite solution, consider increasing the value of num.init
.
print
: Print
plot
: Diagnostic plots
Qingyuan Zhao, Q., Chen, Y., Wang, J., and Small, D. S. (2018). A genome-wide design and an empirical partially Bayes approach to increase the power of Mendelian randomization, with application to the effect of blood lipids on cardiovascular disease. <arXiv:1804.07371>. Efron, B. and Hinkley, D. V. (1978). Assessing the accuracy of the maximum likelihood estimator: Observed versus expected Fisher information. Biometrika, 65(3), 457–483.
require(mr.raps) data(lipid.cad) data <- subset(lipid.cad, lipid == "hdl" & restrict & gwas.selection == "teslovich_2010" & gwas.outcome == "cardiogramplusc4d_1000genome") z <- data$beta.exposure / data$se.exposure prior.param <- fit.mixture.model(z) ## Results mr.raps.shrinkage(data$beta.exposure, data$beta.outcome, data$se.exposure, data$se.outcome, TRUE, "huber", shrinkage = FALSE) mr.raps.shrinkage(data$beta.exposure, data$beta.outcome, data$se.exposure, data$se.outcome, TRUE, "huber", shrinkage = TRUE, prior.param = prior.param)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.