MRAPSS: A function for implementing MR-APSS.

Description Usage Arguments Value Examples

View source: R/MRAPSS.R

Description

MR-APSS: a unified approach to Mendelian Randomization accounting for pleiotropy, sample overlap and selection bias using genome wide summary statistics. MA-APSS uses a variantional EM algorithm for estimation of parameters. MR-APSS uses likelihood ratio test for inference.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
MRAPSS(
  MRdat = NULL,
  exposure = "exposure",
  outcome = "outcome",
  pi0 = NULL,
  sigma.sq = NULL,
  tau.sq = NULL,
  Sigma_err = matrix(c(1, 0, 0, 1), 2, 2),
  Omega = matrix(0, 2, 2),
  tol = 1e-08,
  Threshold = 1,
  ELBO = F
)

Arguments

MRdat

data frame at least contain the following varaibles: b.exp b.out se.exp se.out L2. L2:LD score

exposure

exposure name

outcome

outcome name

pi0

initial value for pi0, default 'NULL' will use the default initialize procedure.

sigma.sq

initial value for sigma.sq , default 'NULL'will use the default initialize procedure.

tau.sq

initial value for tau.sq , default 'NULL' will use the default initialize procedure.

Sigma_err

the error term correlation matrix. default 'diag(2)'.

Omega

the background varaince component. default 'matrix(0,2,2)'.

tol

tolerence, default '1e-08'

Threshold

The selection Threshold for correction of selection bias. If Threshold=1, the model won't correct for selection bias.

ELBO

Whether check the evidence lower bound or not, if 'FALSE', check the maximum likelihood instead. default 'FALSE'.

Value

a list with the following elements:

MRdat:

Input data frame

exposure:

exposure of interest

outcome:

outcome of interest

beta:

causal effect estimate

beta.se:

standard error

pval:

p-value

sigma.sq:

variance of forground exposure effect

tau.sq:

variance of forground outcome effect

pi0:

The probability of a SNP with forground signal after selection

post:

Posterior estimates of latent varaibles

method:

"MR-APSS"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(MRAPSS)
exposure = "BMI"
outcome = "T2D"
Threshold = 5e-05  # IV selection Threshold
data(Sigma_err)
data(Omega)
data(MRdat)
MRres = MRAPSS(MRdat,
               exposure="BMI",
               outcome= "T2D",
               Sigma_err = Sigma_err,
               Omega =  Omega ,
               Threshold =  Threshold)
MRplot(MRres, exposure="BMI", outcome="T2D")

YangLabHKUST/MRAPSS documentation built on Dec. 12, 2020, 11:36 p.m.