MRAPSS: A function for implementing MR-APSS.

View source: R/MRAPSS.R

MRAPSSR Documentation

A function for implementing MR-APSS.

Description

MR-APSS: a unified approach to Mendelian Randomization accounting for pleiotropy and sample structure 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

MRAPSS(
  MRdat = NULL,
  exposure = "exposure",
  outcome = "outcome",
  pi0 = NULL,
  sigma.sq = NULL,
  tau.sq = NULL,
  C = matrix(c(1, 0, 0, 1), 2, 2),
  Omega = matrix(0, 2, 2),
  Cor.SelectionBias = T,
  tol = 1e-08,
  ELBO = F
)

Arguments

MRdat

data frame at least contain the following varaibles: b.exp b.out se.exp se.out L2 Threshold. L2:LD score, Threshold: modified IV selection threshold for correction of selection bias

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.

C

the estimated C matrix capturing the effects of sample structure. default 'diag(2)'.

Omega

the estimated variance-covariance matrix of polygenic effects. default 'matrix(0,2,2)'.

Cor.SelectionBias

Whether use the selection Threshold for correction of selection bias. If FALSE, the model won't correct for selection bias.

tol

tolerence, default '1e-08'

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

library(MRAPSS)
exposure = "BMI"
outcome = "T2D"
Threshold = 5e-05  # IV selection Threshold
data(C)
data(Omega)
data(MRdat)
MRres = MRAPSS(MRdat,
               exposure = "BMI",
               outcome = "T2D",
               C = C,
               Omega =  Omega ,
               Cor.SelectionBias = T)
MRplot(MRres, exposure = "BMI", outcome = "T2D")

YangLabHKUST/MR-APSS documentation built on April 13, 2025, 7:56 p.m.