multimedia
multimedia is an R package for multimodal mediation analysis of microbiome data. It has been designed to help integration of relative abundance, survey, and metabolomic data through causal mediation analysis.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 2 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.3%) to scientific vocabulary
Keywords
causal-inference
data-integration
mediation-analysis
microbiome
Last synced: 6 months ago
·
JSON representation
Repository
multimedia is an R package for multimodal mediation analysis of microbiome data. It has been designed to help integration of relative abundance, survey, and metabolomic data through causal mediation analysis.
Basic Info
- Host: GitHub
- Owner: krisrs1128
- License: cc0-1.0
- Language: R
- Default Branch: main
- Homepage: https://krisrs1128.github.io/multimedia
- Size: 23.6 MB
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
- Releases: 2
Topics
causal-inference
data-integration
mediation-analysis
microbiome
Created about 2 years ago
· Last pushed 7 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
title: "multimedia"
output: md_document
---
```{r, echo = FALSE}
knitr::knit_hooks$set(output = multimedia::ansi_aware_handler)
knitr::opts_chunk$set(fig.path = "man/figures/README-")
options(crayon.enabled = TRUE)
set.seed(20240313)
```
# multimedia
[](https://github.com/krisrs1128/multimedia/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/github/krisrs1128/multimedia/)
[](https://mybinder.org/v2/gh/krisrs1128/multimedia/main/)
`multimedia` is an R package for **multi**modal **media**tion analysis of
microbiome data. It streamlines data curation, mediation and outcome model
specification, and statistical inference for direct and indirect effects. By
defining causal relationships across data modalities, it can support principled
data integration. You can read more about the package in our preprint:
[Jiang H, Miao X, Thairu MW, Beebe M, Grupe DW, Davidson RJ, Handelsman J, Sankaran K. Multimedia: multimodal mediation analysis of microbiome data. Microbiol Spectr 0:e01131-24.](https://doi.org/10.1128/spectrum.01131-24)
The preprint describes the scientific context and interpretation for two of the
vignettes in this package. One gives a multi-omics analysis of IBD, and the
other describes how to simultaneously model 16S profiles and survey responses in
a mindfulness intervention study.
## Installation
You can install the stable [CRAN version](https://cran.r-project.org/package=multimedia) with:
``` r
install.packages("multimedia")
```
You can install the development version from
[GitHub](https://github.com/krisrs1128/multimedia) with:
``` r
# install.packages("devtools")
devtools::install_github("krisrs1128/multimedia")
```
## Example
Here is a simple example of estimating direct and indirect effects.
The data are randomly generated (no real effects), but we imagine that
the ASV columns mediate the relationship between `treatment` and `PHQ`. This is
mimics the possibility that the microbiome (ASV = Amplicon Sequence Variant)
mediates the relationship between a treatment and depression (PHQ = Patient
Health Questionnaire). You can find more details in the `random.Rmd` vignette.
The original data here are a `SummarizedExperiment`. The package can also take
phyloseq objects and data.frames.
```{r, message = FALSE}
library(multimedia)
demo_joy()
```
Next, we specify which columns are the treatment, mediators, and outcomes.
Notice that we can use `tidyselect` syntax to match multiple columns.
```{r}
exper <- mediation_data(demo_joy(), "PHQ", "treatment", starts_with("ASV"))
exper
```
Next, we fit all mediation analysis components and estimate effects. By default,
the package uses linear models -- see the vignettes for examples using sparse
regression, random forests, and bayesian hierarchical models instead.
```{r}
model <- multimedia(exper) |>
estimate(exper)
model
```
In any mediation analysis, there are several types of effects that could be
interesting, each corresponding to different ways of traveling from the
treatment to the outcome in the mediation analysis causal graph. In the block
below, `direct_effect` captures treatment effects that bypass the microbiome;
`indirect_effect` are effects that are mediated by ASV relative abundances.
Since this example uses a linear model, the effects are identical for the two
indirect settings.
```{r}
direct_effect(model, exper)
indirect_overall(model, exper)
```
The package also includes helpers to visualize and perform inference on these
effects. For example,
```{r, fig.height = 3, fig.width = 6, dpi = 300, out.width=500, fig.align="center", message = FALSE}
boot <- bootstrap(model, exper, c(direct = direct_effect))
library(ggplot2)
ggplot(boot$direct) +
geom_histogram(aes(direct_effect), bins = 20) +
scale_y_continuous(expand = c(0, 0)) +
theme_classic() +
labs(x = "Direct Effect", y = "Frequency", title = "Bootstrap Distribution")
```
If we want to use a different type of model, we can just modify the original
`multimedia` specification. Below we use a sparse regression model, which
correctly recovers that the direct effects are 0.
```{r}
multimedia(exper, glmnet_model(lambda = .1)) |>
estimate(exper) |>
direct_effect()
```
## Help
We welcome questions and comments about the package either through
[github](https://github.com/krisrs1128/multimedia/issues) or [email](mailto:ksankaran@wisc.edu).
```{r, eval = FALSE, include = FALSE}
library(hexSticker)
library(showtext)
img <- "~/Downloads/source.jpeg"
font_add_google("Dosis", "dosis")
sticker(img, package = "multimedia", h_color = "#a92645", h_fill = "#f7f7f7", p_size = 35, p_y = 1.4, s_x = 1, s_y = .75, s_width = .47, p_color = "#0c0c0c", dpi = 500, p_family = "dosis")
usethis::use_logo("multimedia.png")
```
```{r}
sessionInfo()
```
Owner
- Name: Kris Sankaran
- Login: krisrs1128
- Kind: user
- Website: https://krisrs1128.github.io/LSLab/
- Repositories: 145
- Profile: https://github.com/krisrs1128
GitHub Events
Total
- Create event: 3
- Release event: 1
- Issues event: 5
- Watch event: 1
- Delete event: 2
- Issue comment event: 7
- Push event: 9
- Pull request event: 2
Last Year
- Create event: 3
- Release event: 1
- Issues event: 5
- Watch event: 1
- Delete event: 2
- Issue comment event: 7
- Push event: 9
- Pull request event: 2
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Kris Sankaran | s****s@g****m | 162 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 2
- Average time to close issues: 16 days
- Average time to close pull requests: about 3 hours
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 1.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 2
- Average time to close issues: 2 days
- Average time to close pull requests: about 3 hours
- Issue authors: 3
- Pull request authors: 1
- Average comments per issue: 0.75
- Average comments per pull request: 1.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jiyanxu (2)
- alicia-ruiz (1)
- lizardman472 (1)
- Ivy-ops (1)
Pull Request Authors
- krisrs1128 (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 114 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
cran.r-project.org: multimedia
Multimodal Mediation Analysis
- Homepage: https://krisrs1128.github.io/multimedia/
- Documentation: http://cran.r-project.org/web/packages/multimedia/multimedia.pdf
- License: CC0
-
Latest release: 0.2.0
published over 1 year ago
Rankings
Dependent packages count: 28.1%
Dependent repos count: 34.7%
Average: 49.8%
Downloads: 86.6%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.50 depends
- cli * depends
- dplyr * depends
- fansi * depends
- formula.tools * depends
- ggplot2 * depends
- glue * depends
- insight * depends
- progress * depends
- purrr * depends
- rlang * depends
- tibble * depends
- tidygraph * depends
- tidyr * depends
- brms * suggests
- glmnet * suggests
- glmnetUtils * suggests
- knitr * suggests
- patchwork * suggests
- ranger * suggests
- rmarkdown * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite