How to select fixed_effects

Hi,
I am a newbie to the Maaslin2 package. I used my data and have this error:

AGP_fit_data <- Maaslin2(
  mpse2_4groups_keep.Phylum.heatmap_Phylum.data_aggregate_t_sel, 
  sampleda_select_F_sub, 
  'AGP_Family_output3',
  normalization  = "NONE",
  fixed_effects = c("Group","bmi"),
  random_effects = c("sex"),
  reference = c("Group,Normal"))

If i change fixed_effects = c("Group","bmi") to fixed_effects = c("Group"), everything goes smoothly
Here is my question : compare to demo data, Group equeal to diagnosis and bmi equal to dysbiosis, but why things go wrong when i run in my data?
Could you tell me how to fix it and draw the plot down below(correlation between bacterial abundance and bmi)

Much appreciate.
Rainjie
subset_data.csv (11.0 KB)

Hi @user1,

Hope your are doing well!

The issue seems to be that you have BMI coded as a factor and not a numeric. When coded as a factor Maaslin2 will treat it as if it’s a categorical variable and not a numeric variable. I would check what type of variable BMI is and then change it to a numeric with:

as.numeric(BMI)

Cheers,
Jacob Nearing

1 Like

You are right!, I should double-check this, sorry to bother you :grinning: