# ccmm: Causal Compositional Mediation Model In ccmm: Compositional Mediation Model

## Description

Estimate the direct and indirect (mediation) effects of treatment on the outcome when intermediate variables (mediators) are compositional and high-dimensional.

## Usage

 ```1 2``` ```ccmm(y, M, tr, x = NULL, w = NULL, method.est.cov = "bootstrap", n.boot = 2000, sig.level = 0.05, tol = 1e-06, max.iter = 5000) ```

## Arguments

 `y` Vector of continuous outcomes `M` Matrix of compositional data `tr` Vector of continuous or binary treatments `x` Matrix of covariates `w` Vector of weights on samples `method.est.cov` One of two options ("bootstrap", "normal") to estimate the variance of indirect effects `n.boot` Number of bootstrap samples `sig.level` Significance level to estimate bootstrap confidence intervals for direct and indirect effects of treatment `tol` Error tolerance `max.iter` Maximum number of iteration in a debias procedure

## Value

If method.est.cov is "bootstrap",

 `DE` Direct effect of treatment on an outcome `DE.CI` Bootstrap confidence interval for the direct effect `TIDE` Total indirect effect of treatment on an outcome `TIDE.CI` Bootstrap confidence interval for the indirect effect `IDEs` Component-wise indirect effects of treatment on an outcome `IDE.CIs` Bootstrap confidence intervals for the component-wise indirect effects

If method.est.cov is "normal",

 `DE` Direct effect of treatment on an outcome `Var.DE` Variance of the direct effect `TIDE` Total indirect effect of treatment on an outcome `Var.TIDE` Variance of the indirect effect `IDEs` Component-wise indirect effects of treatment on an outcome `Var.IDEs` Variances of the component-wise indirect effects

## Author(s)

Michael B. Sohn

Maintainer: Michael B. Sohn <msohn@mail.med.upenn.edu>

## References

Sohn, M.B. and Li, H. (2017). Compositional Mediation Analysis for Microbiome Studies (AOAS: In revision)

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```# Load test data data(ccmm_test_data); outcome <- ccmm_test_data[,1]; treatment <- ccmm_test_data[,2]; mediators <- as.matrix(ccmm_test_data[,3:22]); covariates <- as.matrix(ccmm_test_data[,23:24]); # Run CCMM rslt.ccmm <- ccmm(outcome, mediators, treatment, covariates); ```

### Example output

```Warning message:
In est.param\$intercept * rep(1, n) :
Recycling array of length 1 in array-vector arithmetic is deprecated.