adonis vs. adonis2 I am trying to conduct permanova tests on a dataset. There are multiple options for doing this in R and I am not sure how to decide what to use.
What is the difference between adonis() and adonis2() in the R vegan package? Also, what are the "by" and "strata" arguments for? It seems to me like these are the most important differences between adonis and adonis2.
 A: So both adonis and adonis2 essentially get at the same goal. They are an implementation of a non-parametric permutation based MANOVA (often called PERMANOVA). The goal of this test is to tell you if there are significant differences in your response variables among your groupings. In adonis terms are tested sequentially and this is the only option. This means that the order you enter your variables is important (if design is unbalanced). For example using the dune and dune.env data sets in vegan, adonis(dune~Management+Use, data=dune.env) will give a different result than adonis(dune~Use+Management, data=dune.env). This is because the first explanatory variable is added to the model. Then the next one is added to see if it explains significantly more variation not explained by the previous variables. This is equivalent to using by="terms" in adonis2. If you don't want the order to matter you can use adonis2 with by="margin", or if you want to check if the model as a whole is significant you can use by=NULL. Order does not matter when by="margin" because the significance is tested against a model that includes all other variables not just the ones preceding it in the formula. It seems that strata is now deprecated in favor of defining blocks in the permutations argument now (see adonis help). Anyway, these arguments allow you to specify how to restrict which rows can be exchanged during the permutation procedure used to calculate p values.
It's also worth noting that adonis and adonis2 also use different code to do similar things. According to the help page, adonis "is directly based on the algorithm of Anderson (2001)" which was about a permutational manova, while adonis2 is "based on the principles of McArdle & Anderson (2001)." That paper is actually about distance-based redundancy analysis (multivariate multiple regression) which can be used as a MANOVA by transforming categorical variables into dummy variables of 1's and 0's. This is likely why adonis2 has some additional flexibility compared to adonis.
A: Assuming that you have a disease and two confounding factors sex and age. So I would built the following model -distance_matrix~ disease + sex + age.
If you wish to take into account confounding factors while executing PERMANOVA would you use "margin" or NULL?
It seems that "terms" test sequentially, so the model won't really incorporate the confounders.
