Microbiome Mediation Analysis with Accelerated Failure Time Model

Introduction

Welcome to the AFTMicroMed vignette! This document provides an overview of the AFTMicroMed package. The package implements a novel method for a causal mediation framework for microbiome data with survival outcomes. An accelerated failure time model is used to estimate mediation effects for individual microbial mediators while adjusting for covariates. Microbiome mediators are modeled using a two-part marginal framework that accounts for excess zeros and non-zero relative abundances through a zero-inflated beta distribution. AFTMicroMed package is a software extension of our methodology work.

Installation

To install the package, please use:

# install.packages("AFTMicroMed")

fit_AFTMicroMed.R

Example Usage

We will use the example data built in the package to demonstrate how to use the main function.

library(AFTMicroMed)

fit_AFTMicroMed.R

# load example data
data(example_data)
CovZ <- example_data$CovZ
X <- example_data$X
Time  <- example_data$Time
Status <- example_data$status
mediator.tab <- example_data$mediator.tab

fit_AFTMicroMed.R

First, set up parallel computing using setup_parallel function with the number cores you want.

cl <- setup_parallel(n_cores = 2)

fit_AFTMicroMed.R

Run main function with the following arguments.

results <- fit_AFTMicroMed(
mediator.tab = mediator.tab,
 X            = X,
 Time         = Time,
 evnt_status  = Status,
 CovZ         = CovZ,
 med_indices  = c(1:10),
 keep_raw     = FALSE,
 control      = list(verbose = FALSE),
 log          = FALSE
 )
parallel::stopCluster(cl)
print(results)

fit_AFTMicroMed.R

The function returns a data frame containing the mediator index, the estimated values and standard errors of the beta coefficients, and the Z-scores and p-values for NIE_1, NIE_2, and NIE, respectively.