fdr.bama: Bayesian Mediation Analysis Controlling For False Discovery

Description Usage Arguments Value Author(s) References Examples

View source: R/fdr.bama.R

Description

fdr.bama uses the permutation test to estimate the null PIP distribution for each mediator and determines a threshold (based off of the fdr parameter) for significance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
fdr.bama(
  Y,
  A,
  M,
  C1,
  C2,
  beta.m,
  alpha.a,
  burnin,
  ndraws,
  weights = NULL,
  npermutations = 200,
  fdr = 0.1,
  k = 2,
  lm0 = 1e-04,
  lm1 = 1,
  l = 1,
  mc.cores = 1,
  type = "PSOCK"
)

Arguments

Y

Length n numeric outcome vector

A

Length n numeric exposure vector

M

n x p numeric matrix of mediators of Y and A

C1

n x nc1 numeric matrix of extra covariates to include in the outcome model

C2

n x nc2 numeric matrix of extra covariates to include in the mediator model

beta.m

Length p numeric vector of initial beta.m in the outcome model

alpha.a

Length p numeric vector of initial alpha.a in the mediator model

burnin

Number of iterations to run the MCMC before sampling

ndraws

Number of draws to take from MCMC after the burnin period

weights

Length n numeric vector of weights

npermutations

The number of permutations to generate while estimating the null pip distribution. Default is 200

fdr

False discovery rate. Default is 0.1

k

Shape parameter prior for inverse gamma. Default is 2.0

lm0

Scale parameter prior for inverse gamma for the small normal components. Default is 1e-4

lm1

Scale parameter prior for inverse gamma for the large normal components. Default is 1.0

l

Scale parameter prior for the other inverse gamma distributions. Default is 1.0

mc.cores

The number of cores to use while running fdr.bama. fdr.bama uses the parallel package for parallelization, so see that for more information. Default is 1 core

type

Type of cluster to make when mc.cores > 1. See makeCluster in the parallel package for more details. Default is "PSOCK"

Value

fdr.bama returns a object of type "fdr.bama" with 5 elements:

bama.out

Output from the bama run.

pip.null

A p x npermutations matrices containing the estimated null PIP distribution for each mediator.

threshold

The cutoff significance threshold for each PIP controlling for the false discovery rate.

fdr

The false discovery rate used to calculate threshold.

call

The R call that generated the output.

Author(s)

Alexander Rix

References

Song, Y, Zhou, X, Zhang, M, et al. Bayesian shrinkage estimation of high dimensional causal mediation effects in omics studies. Biometrics. 2019; 1-11. doi: 10.1111/biom.13189

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(bama)

Y <- bama.data$y
A <- bama.data$a

# grab the mediators from the example data.frame
M <- as.matrix(bama.data[, paste0("m", 1:100)], nrow(bama.data))

# We just include the intercept term in this example as we have no covariates
C1 <- matrix(1, 1000, 1)
C2 <- matrix(1, 1000, 1)
beta.m  <- rep(0, 100)
alpha.a <- rep(0, 100)

set.seed(12345)

out <- fdr.bama(Y, A, M, C1, C2, beta.m, alpha.a, burnin = 100,
                ndraws = 120, npermutations = 10)

# The package includes a function to summarise output from 'fdr.bama'
summary(out)

bama documentation built on Jan. 21, 2021, 5:07 p.m.