Skip to main content
QUICK REVIEW

[Paper Review] Bayesian multilevel compositional data analysis with the R package multilevelcoda

Flora Le, Dorothea Dumuid|arXiv (Cornell University)|Nov 19, 2024
Geochemistry and Geologic MappingComputer Science3 citations
TL;DR

This paper introduces the R package multilevelcoda, which enables Bayesian multilevel compositional data analysis using isometric log-ratio (ilr) transformations to handle multilevel compositional data—such as time-use or macronutrient intake—where parts sum to a constant. The method integrates Bayesian hierarchical modeling with compositional data principles, allowing robust inference on relative changes while accounting for nested data structures and uncertainty via posterior sampling.

ABSTRACT

Multilevel compositional data, such as data sampled over time that are non-negative and sum to a constant value, are common in various fields. However, there is currently no software specifically built to model compositional data in a multilevel framework. The R package multilevelcoda implements a collection of tools for modelling compositional data in a Bayesian multivariate, multilevel pipeline. The user-friendly setup only requires the data, model formula, and minimal specification of the analysis. This paper outlines the statistical theory underlying the Bayesian compositional multilevel modelling approach and details the implementation of the functions available in multilevelcoda, using an example dataset of compositional daily sleep-wake behaviours. This innovative method can be used to gain robust answers to scientific questions using the increasingly available multilevel compositional data from intensive, longitudinal studies.

Motivation & Objective

  • To address the lack of software for modeling multilevel compositional data in a Bayesian framework.
  • To enable robust statistical inference on relative changes in compositional parts across nested or longitudinal structures.
  • To integrate Bayesian multilevel modeling with compositional data analysis (CoDA) techniques, particularly the isometric log-ratio (ilr) transformation.
  • To provide a user-friendly R package that requires minimal specification beyond data and model formula.
  • To support scientific inquiry into complex multilevel compositional data from intensive longitudinal studies.

Proposed method

  • Utilizes the isometric log-ratio (ilr) transformation to remove linear dependence among compositional parts that sum to a constant.
  • Applies Bayesian hierarchical modeling to the transformed ilr coordinates, enabling multilevel structure modeling with random effects at multiple levels.
  • Employs Markov Chain Monte Carlo (MCMC) sampling, specifically the No-U-Turn Sampler (NUTS), for posterior inference.
  • Supports both response and predictor variables as compositional data by transforming them into ilr coordinates before modeling.
  • Uses posterior predictive checks and credible intervals to assess model fit and quantify uncertainty.
  • Integrates with R’s Stan engine via the cmdstanr interface for efficient MCMC computation.
Figure 2: Difference in stress for 1-10 minutes of reallocation between time awake in bed and other behaviours. TST = total sleep time, WAKE = time awake in bed, MVPA = moderate-to-vigorous physical activity, LPA = light physical activity, SB = sedentary behaviour.
Figure 2: Difference in stress for 1-10 minutes of reallocation between time awake in bed and other behaviours. TST = total sleep time, WAKE = time awake in bed, MVPA = moderate-to-vigorous physical activity, LPA = light physical activity, SB = sedentary behaviour.

Experimental results

Research questions

  • RQ1How can Bayesian multilevel models be adapted to handle compositional data that sum to a constant across multiple levels of nesting?
  • RQ2What is the impact of time-use reallocations on health outcomes when modeled using compositional data analysis in a multilevel framework?
  • RQ3How does the multilevelcoda package improve inference accuracy and uncertainty quantification compared to standard multilevel models applied to raw compositional data?
  • RQ4To what extent can Bayesian methods with informative priors enhance estimation in small-sample multilevel compositional data settings?
  • RQ5How can marginal effects and average marginal effects be meaningfully interpreted in the context of multilevel compositional data?

Key findings

  • The multilevelcoda package successfully enables Bayesian multilevel modeling of compositional data by transforming parts via the isometric log-ratio (ilr) method, eliminating multicollinearity and enabling valid inference.
  • Posterior samples from the model allow direct computation of credible intervals and marginal effects, facilitating intuitive interpretation of relative changes in compositional parts.
  • The method demonstrates robust performance in small sample settings due to the incorporation of prior information and full uncertainty quantification via MCMC.
  • Model fit can be assessed using posterior predictive checks, which are feasible due to the availability of posterior predictive distributions.
  • The package supports both response and predictor variables as compositional, extending the applicability of multilevel models to complex longitudinal and nested compositional data structures.
  • The implementation is user-friendly, requiring only data, model formula, and minimal configuration, making advanced compositional analysis accessible to non-expert users.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.