The bioBakery help forum

Multiple variables used as the references

Hi,

I am running an analysis with one predictor of interest and several categorical covariates. As the tutorial said, for the reference parameter, “semi-colon delimited for multiple variables”.

My current code goes like this:
Maaslin2(input_data, input_metadata,‘demo_output’, transform = “AST”,
max_significance = 0.1,
fixed_effects = c(“sex”,“age_group”,“BMI_g”,“smoking”,
“alcohol”,“MET_g”,“red_meat”),
normalization = ‘NONE’,
reference = c(“age_group,50plus”,“BMI_g,24minus”,“smoking,non-smoker”,
“alcohol,no”,“MET_g,A”,“red_meat,1pw_minus”))

but it doesn’t work well for the covariates. So I wonder how to set the reference parameter for multiple variables.

Thank you!
Yuhan

HI Yuhan,
try doing the following for your references, rather than having them as a vector.

reference = “age_group,50plus;BMI_g,24minus;smoking,non-smoker;alcohol,no;MET_g,A;red_meat,1pw_minus”

Hi @ayuhhh,

Apologies for not being clearer in the tutorial! We should add an example where we set multiple references for different variables - I will add that to our improvements list.

I haven’t tried @nickp60 method, thank you for offering that one! Adding more parentheses should also work (e.g. -

reference = c((“age_group,50plus”),(“BMI_g,24minus”),(“smoking,non-smoker”),
(“alcohol,no”),(“MET_g,A”),(“red_meat,1pw_minus”)))

I hope this helps!
Best,
Kelsey