Hello,

I am reaching out for an issue with Adonis.

The result gives me a wrong Df per level, it assigns 1 Df instead of 4.

Can you please help me to figure out the reason? Is the result reliable?

Thank you in advance for your help.

Chiara

Hello,

I am reaching out for an issue with Adonis.

The result gives me a wrong Df per level, it assigns 1 Df instead of 4.

Can you please help me to figure out the reason? Is the result reliable?

Thank you in advance for your help.

Chiara

Hello Chiara,

We may be able to help.

Can you post the full command you ran, along with the input metadata file?

2 Likes

Hello,

Thank you very much for your help.

Here it is the command:

```
qiime diversity adonis \
--i-distance-matrix bray_curtis_distance_matrix.qza \
--m-metadata-file METADATA.txt \
--p-formula "Depth*Temperature*SALINITY" \
--o-visualization adonisleaf.qzv
```

Here is the metadata copied by a txt file

#SampleID | description | Region | Type | Depth | Temperature | leaf_area | SALINITY |
---|---|---|---|---|---|---|---|

deep_far_ag_1 | CS_deep | CS | LEAF | 18 | 27 | 3.2 | 26.35 |

deep_far_ag_4 | CS_deep | CS | LEAF | 18 | 27 | 3.1 | 26.35 |

deep_far_ag_3 | CS_deep | CS | LEAF | 18 | 27 | 3 | 26.35 |

shallow_ag_1 | CS_shallow | CS | LEAF | 10 | 27 | 2.3 | 26.45 |

shallow_ag_2 | CS_shallow | CS | LEAF | 10 | 27 | 2.2 | 26.45 |

shallow_ag_3 | CS_shallow | CS | LEAF | 10 | 27 | 2.6 | 26.45 |

43 | EMS_deep | EMS | LEAF | 14 | 26 | 1.2 | 26.6 |

45 | EMS_deep | EMS | LEAF | 14 | 26 | 1.3 | 26.6 |

43-LM1 | EMS_deep | EMS | LEAF | 14 | 26 | 1.1 | 26.6 |

44-LM1 | EMS_deep | EMS | LEAF | 14 | 26 | 1.4 | 26.6 |

45-LM1 | EMS_deep | EMS | LEAF | 14 | 26 | 0.9 | 26.6 |

1 | EMS_shallow | EMS | LEAF | 7 | 27 | 0.7 | 26.53 |

13-LM1 | EMS_shallow | EMS | LEAF | 7 | 27 | 0.8 | 26.53 |

14-LM1 | EMS_shallow | EMS | LEAF | 7 | 27 | 0.9 | 26.53 |

15-LM1 | EMS_shallow | EMS | LEAF | 7 | 27 | 0.9 | 26.53 |

14mR1 | RS_deep | RS | LEAF | 14 | 27 | 4.1 | 21.2 |

14mR2 | RS_deep | RS | LEAF | 14 | 23 | 4.4 | 21.2 |

14mR3 | RS_deep | RS | LEAF | 14 | 23 | 3.3 | 21.2 |

9mR1 | RS_shallow | RS | LEAF | 9 | 23 | 4 | 21.33 |

9mR2 | RS_shallow | RS | LEAF | 9 | 23 | 4.2 | 21.33 |

9mR3 | RS_shallow | RS | LEAF | 9 | 23 | 3.8 | 21.33 |

Thank you very much!

I look forward to hearing from you.

Best regards,

Chiara

Thanks @colinbrislawn for editing my command.

I wish to underline that the script I launched was in that correct form, but for some reasons, I could not copy paste it properly.

Thus, unfortunately the issue is not a typing error.

Can you please help me to figure the error out?

Thank you very much in advance!

Best,

Chiara

1 Like

Hello Chiara,

Thanks for posting that!

Here's the issue:

```
--p-formula "Depth*Temperature*SALINITY"
```

ADONIS uses that R formula (examples from datacamp and R4DS.).

Calling `*`

between your variables will 'cross' them, including both variables and their interaction effect in the model. You are crossing three variables, so inside that formula are a lot of effects! One of the combinations has fewer than 4 levels leading to 1 Degree of Freedom.

ADONIS does not work like a typical linear model! Instead of considering explanatory variables equally, **the adonis() test partitions out predictive variables one at a time in the order of your choosing.** This means that the order of these interaction effects will change the meaning of the ADONIS result.

Modeling is tricky and there's a lot to try next.

I would suggest trying formulas like

`--p-formula "Depth + Temperature"`

`--p-formula "Depth * Temperature"`

and see for yourself how crossing works.

P.S. Your code is 100% correct, I put it into a box for esthetics

1 Like

Thank you very much @colinbrislawn for your suggestions.

I apologize, but I wish to ask you another suggestion: what formula would you suggest to run a multivariate test?

In my outcome all the Df were 1 not only the one with less than 4 levels. I also tried to run "Temperature * Salinity" but still the Df were 1 for both factors. How should I interprete this?

Thank you a lot for your help.

Best,

Chiara

Hello Chiara,

That's a great question because it's really central to your study. The exact same formula may make perfect sense or be confounding depending on sample blocking and how your cohorts were set up.

This is a perfect question to bring to the PI who designed the study, or to the statistician on your team. Who chose to use these cohorts?

Df = 1 means there were two groups. The number of groups comes from the R formulas you use.

(ADONIS is a clever twist on the ANOVA test. This comprehensive walkthrough of the ANOVA test may be helpful.)

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.