mr.raps: Main function

Description Usage Arguments Value Functions References Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 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).

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 if diagnosis = 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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)

mr.raps documentation built on May 2, 2019, 8:42 a.m.