lme4
formula syntax. The Cosmos-Hub automatically translates user-selected variables into valid MaAsLin3 formulas, supporting a wide range of study designs. This extends beyond the typical “Fixed” and “Random” effects by implementing other variables such as:
Interaction Terms
salmonella_enterica*days_of_life
salmonella_enterica
differs across days of life.Group Effects
group(variable)
Ordered Effects
ordered(variable)
Note: Ordered effects can be combined similarly with fixed/random effects.
Strata Effects
strata(variable)
Fixed Effects (Simple relationships)
Interaction Terms
Random Effects (Repeated Measures or Hierarchies)
Group, Ordered, and Strata Variables
Scenario | Formula Syntax | Description | |
---|---|---|---|
Fixed Effects | ~ diet + age | Basic effects of variables like diet or age | |
Random Effects | `~ diet + (1 | subject_id)` | Accounts for repeated measurements within individuals |
Interaction Terms | ~ diet * sex | Tests whether the effect of one variable depends on another | |
Fixed + Random + Interaction | `~ diet * sex + (1 | subject_id)` | Full model with main, interaction, and repeated effects |
Group Effects | ~ group(diet) | Treats all levels of a categorical variable jointly | |
Ordered Effects | ~ ordered(stage) | Tests stepwise effects in ordinal variables (e.g., Stage I < II < III) | |
Strata Effects (Exclusive) | ~ strata(pair_id) | For matched case-control studies (cannot be combined with other effects) |
Combination | Example | |
---|---|---|
Fixed + Random | `~ age + (1 | subject_id)` |
Fixed + Interaction | ~ age + treatment + age:treatment | |
Fixed + Group | ~ group(treatment) + age | |
Fixed + Ordered | ~ ordered(dose_level) + age | |
Fixed + Random + Group | `~ group(treatment) + age + (1 | subject_id)` |
Fixed + Random + Interaction | `~ treatment * timepoint + (1 | subject_id)` |
Strata Only | ~ strata(pair_id) |
var1:var2
models whether the effect of var1
changes across var2
.group(var)
aggregates all levels for joint testing.ordered(var)
evaluates progression across ordered categories.strata(var)
conditions the analysis on matched groups (e.g., case-control pairs) and cannot be combined with other effects.strata
with random
) are flagged before submission.