mr.raps.shrinkage: Main function for RAPS (shrinkage weights)

View source: R/shrinkage.R

mr.raps.shrinkageR Documentation

Main function for RAPS (shrinkage weights)

Description

Main function for RAPS (shrinkage weights)

Usage

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, ...)

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 b_exp.

se_out

A vector of standard errors of b_out.

over.dispersion

Should the model consider overdispersion (systematic pleiotropy)? Default is FALSE.

loss.function

Either the squared error loss (l2) or robust loss functions/scores (huber or tukey).

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 must be provided.

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 mr.raps.shrinkage are less reliable. This parameter can take three values: 0—nothing will be done; 1—a warning is given; 2—an error is given. Default is 1.

x

a mr.raps object

...

further arguments (not supported)

Details

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.

Methods (by generic)

  • print: Print

  • plot: Diagnostic plots

References

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.

Examples


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)



qingyuanzhao/mr.raps documentation built on June 4, 2022, 3:04 a.m.