Package 'hdbm'

Title: High Dimensional Bayesian Mediation Analysis
Description: Perform mediation analysis in the presence of high-dimensional mediators based on the potential outcome framework. High dimensional Bayesian mediation (HDBM), developed by Song et al (2018) <doi:10.1101/467399>, relies on two Bayesian sparse linear mixed models to simultaneously analyze a relatively large number of mediators for a continuous exposure and outcome assuming a small number of mediators are truly active. This sparsity assumption also allows the extension of univariate mediator analysis by casting the identification of active mediators as a variable selection problem and applying Bayesian methods with continuous shrinkage priors on the effects.
Authors: Alexander Rix [aut, cre], Yanyi Song [aut]
Maintainer: Alexander Rix <[email protected]>
License: GPL-3
Version: 0.9.0
Built: 2024-12-16 06:52:36 UTC
Source: CRAN

Help Index


High Dimensional Bayesian Mediation

Description

hdbm is a Bayesian inference method that uses continuous shrinkage priors for high-dimensional mediation analysis, developed by Song et al (2018). hdbm provides estimates for the regression coefficients as well as the posterior inclusion probability for ranking mediators.

Usage

hdbm(Y, A, M, C1, C2, beta.m, alpha.a, burnin, ndraws)

Arguments

Y

numeric outcome vector.

A

numeric exposure vector.

M

numeric matrix of mediators of Y and A.

C1

numeric matrix of extra covariates in the outcome model

C2

numeric matrix of extra covariates in the mediator model

beta.m

numeric vector of initial beta.m in the outcome model

alpha.a

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

Details

hdbm uses two regression models for the two conditional relationships, YA,M,C1Y | A, M, C1 and MA,C2M | A, C2. For the outcome model, hdbm uses

Y=MβM+AβA+C1βCY+ϵYY = M \beta_M + A * \beta_A + C1* \beta_CY + \epsilon_Y

For the mediator model, hdbm uses the model

M=AαA+C2αC2+ϵMM = A * \alpha_A + C2 * \alpha_C2 + \epsilon_M

For high dimensional tractability, hdbm employs continuous Bayesian shrinkage priors to select mediators and makes the two following assumptions: First, it assumes that all the potential mediators contribute small effects in mediating the exposure-outcome relationship. Second, it assumes that only a small proportion of mediators exhibit large effects ("active" mediators). hdbm uses a Metropolis-Hastings within Gibbs MCMC to generate posterior samples from the model.

Value

hdbm returns a list with 11 elements (each of length ndraws), sampled from the burned in MCMC:

beta.m

Outcome model mediator coefficients

r1

Whether or not each beta.m belongs to the larger normal component (1) or smaller normal component (0)

alpha.a

Mediator model exposure coefficients

r3

Whether or not each alpha.a belongs to the larger normal component (1) or smaller normal component (0)

beta.a

beta.a coefficient

pi.m

Proportion of non zero beta.m coefficients

pi.a

Proportion of non zero alpha.a coefficients

sigma.m0

standard deviation of the smaller normal component for mediator-outcome coefficients (beta.m)

sigma.m1

standard deviation of the larger normal component for mediator-outcome coefficients (beta.m)

sigma.ma0

Standard deviation of the smaller normal component for exposure-mediator coefficients (alpha.a)

sigma.ma1

Standard deviation of the larger normal component for exposure-mediator coefficients (alpha.a)

Author(s)

Alexander Rix

References

Yanyi Song, Xiang Zhou et al. Bayesian Shrinkage Estimation of High Dimensional Causal Mediation Effects in Omics Studies. bioRxiv 10.1101/467399

Examples

library(hdbm)

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

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

# We just include the intercept term in this example.
C <- matrix(1, 1000, 1)
beta.m  <- rep(0, 100)
alpha.a <- rep(0, 100)

set.seed(12345)
hdbm.out <- hdbm(Y, A, M, C, C, beta.m, alpha.a,
                   burnin = 1000, ndraws = 100)

# Which mediators are active?
active <- which(colSums(hdbm.out$r1 * hdbm.out$r3) > 50)
colnames(M)[active]

Synthetic example data for hdbm

Description

Synthetic example data for hdbm

Usage

hdbm.data

Format

A data.frame with 1000 observations on 102 variables:

y

Numeric response variable.

a

Numeric exposure variable.

m[1-100]

Numeric mediator variables