The latest ancombc2 vignette (april 26th, 2026) suggests that interactions can be specified in the group formula :
Tests for interactions are supported by specifying the interactions in the fix_formula. Please ensure that interactions between variables are included using the * operator, as the : operator is not recognized by the ancombc2 function and will result in an error.
Additionally, when the group variable contains interaction terms, only the main effect will be considered in multi-group comparisons.
However, specifying an interaction in the group formula will result in an error. I have narrowed it down to the lines 133-135 of the data_sanity_check function used by ancombc2( ) :
# Lines 133-135
else if (!is.numeric(meta_data[, group])) {
meta_data[, group] = as.factor(meta_data[, group])
n_level = nlevels(meta_data[, group])
# The following code will return an error :
ancombc2(data = pseq,
tax_level_ = "Family",
fix_formula = "age * bmi + region",
group = "age * bmi",
struc_zero = TRUE,
neg_lb = TRUE)
I'm using ANCOMBC version 2.12.1.
The latest
ancombc2vignette (april 26th, 2026) suggests that interactions can be specified in thegroupformula :However, specifying an interaction in the
groupformula will result in an error. I have narrowed it down to the lines 133-135 of thedata_sanity_checkfunction used byancombc2( ):I'm using ANCOMBC version 2.12.1.