Skip to contents

because is designed as a modular framework. While the core package handles standard Bayesian SEMs, specialized functionality is provided through extension packages.

Available packages

PhyBaSE (because.phybase)

The because.phybase package adds support for phylogenetic covariance structures, enabling the fitting of Phylogenetic Bayesian Structural Equation Models (PhyBaSE; von Hardenberg & Gonzalez-Voyer, 2025).

Features

  • Phylogenetic Covariance: Incorporates phylogenetic relatedness into because models.
  • Phylogenetic Uncertainty: Supports multiPhylo objects to account for uncertainty in tree topology or branch lengths.
  • Measurement error: Accounting for measurement error in traits both providing repeated measures as well as specifying known measurement error variances.
  • Phylogenetic missing data imputation: informs imputation of missing data using phylogenetic relationships.
  • Seamless Integration: Designed to work transparently with because via S3 method dispatch.

Planned packages

Detection/Occupancy (because.detection)

Status: In Development Adds support for hierarchical single-season occupancy and Capture-Mark-Recapture (CMR) models within the causal inference framework.

Spatial (because.spatial)

Status: Planned Will add support for spatially structured residuals (CAR/SAR models).


Developing Extensions

because uses a robust S3 generic “hook” system that allows developers to add support for new families or structures without modifying the core package.

If you are interested in building an extension, please refer to the documentation for the internal generics in R/generics.R. Key hooks include:

  • jags_family_definition: Define custom JAGS likelihood blocks.
  • prepare_structure_data: Pre-process custom structural objects (trees, matrices).
  • get_inits_hook: Provide specialized initial values.
  • normalize_equations_hook: Handle specialized variable aliases.