Hello Gian, These formulae expand into different models. Compare
model.matrix(~ Stage:Growhouse, data=metadata_fungi_out) model.matrix(~ Stage*Growhouse, data=metadata_fungi_out) The first model (Stage:Growhouse) will also contain (implicitly) main effects and all these terms are marginal and can be removed, whereas the latter Stage*Growhouse expands to explicit main effects and interaction effects, and only the interaction effects are marginal and can be removed. This is also reflected in the degrees of freedom in your anova table: In the first case Stage:Growhouse has 3 df, and in the latter only 1 df (and the main effects ignored had 2 df). Ciao, Giari > On 29 Oct 2018, at 19:11, Gian Maria Niccolò Benucci <gian.benu...@gmail.com> > wrote: > > Hello Jari, > > It is a little bit confusing. If A*B unfolds in A+B+A:B then A:B is the > real interaction component. > So, which if the code below will test the variance for the interaction > alone? > >> adonis2(t(otu_fungi_out) ~ *Stage : Growhouse*, data=metadata_fungi_out, > by = "margin", permutations=9999) > Permutation test for adonis under reduced model > Marginal effects of terms > Permutation: free > Number of permutations: 9999 > > adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data = > metadata_fungi_out, permutations = 9999, by = "margin") > Df SumOfSqs R2 F Pr(>F) > Stage:Growhouse 3 1.0812 0.23075 1.9998 1e-04 *** > Residual 20 3.6045 0.76925 > Total 23 4.6857 1.00000 > --- > Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > >> adonis2(t(otu_fungi_out) ~ *Stage * Growhouse*, data=metadata_fungi_out, > by = "margin", permutations=9999) > Permutation test for adonis under reduced model > Marginal effects of terms > Permutation: free > Number of permutations: 9999 > > adonis2(formula = t(otu_fungi_out) ~ Stage * Growhouse, data = > metadata_fungi_out, permutations = 9999, by = "margin") > Df SumOfSqs R2 F Pr(>F) > Stage:Growhouse 1 0.2171 0.04633 1.2045 0.2443 > Residual 20 3.6045 0.76925 > Total 23 4.6857 1.00000 >> > > The results is clearly very different. Also, in a normal adonis call I > didn't have any significance for the interaction that I have instead if I > use A:B. So ~ A*B will not test for interactions at all? > >> *adonis*(t(otu_fungi_out) ~ Stage * Growhouse, data=metadata_fungi_out, > permutations=9999) > Call: > adonis(formula = t(otu_fungi_out) ~ Stage * Growhouse, data = > metadata_fungi_out, permutations = 9999) > > Permutation: free > Number of permutations: 9999 > > Terms added sequentially (first to last) > > Df SumsOfSqs MeanSqs F.Model R2 Pr(>F) > Stage 1 0.4877 0.48769 2.7060 0.10408 0.0247 * > Growhouse 1 0.3765 0.37647 2.0889 0.08034 0.0542 . > Stage:Growhouse 1 0.2171 0.21708 1.2045 0.04633 0.2507 > Residuals 20 3.6045 0.18023 0.76925 > Total 23 4.6857 1.00000 > --- > Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 >> > > Thank you! > > Gian > > > > > > On Tue, 16 Oct 2018 at 08:54, Jari Oksanen <jari.oksa...@oulu.fi> wrote: > >> >> >> On 16/10/18 11:23, Torsten Hauffe wrote: >>> "adonis2(speciesdataset~A*B, by="margin") but then only the effect of >> the >>> interaction is tested." >>> >>> This is not entirely correct. >>> adonis2(speciesdataset~A:B, by="margin") would test the interaction >> alone. >>> ~A*B unfolds to ~A+B+A:B >> >> Well, it was correct: the only **marginal** effect in ~A+B+A:B is A:B (A >> and B are not marginal), and by = "margin" will only analyse marginal >> effects. >> >> Cheers, Jari Oksanen >>> >>> On Tue, 16 Oct 2018 at 11:51, Ellen Pape <ellen.p...@gmail.com> wrote: >>> >>>> Hi all, >>>> >>>> I don't know whether this is the correct mailing group to address this >>>> question: >>>> >>>> I would like to perform a 2-way permanova analysis in R (using adonis in >>>> vegan). By default you are performing sequential tests (by="terms"), so >>>> when you have 2 or more factors, the order of these factors matter. >>>> However, since I wanted to circumvent this, I chose for the option >>>> by="margin" (adonis2(speciesdataset~A*B, by="margin")) but then only the >>>> effect of the interaction is tested. On the "help page" of anova. cca it >>>> says: "if you select by="margin" -> the current function only evaluates >>>> marginal terms. It will, for instance, ignore main effects that are >>>> included in interaction terms." >>>> >>>> >>>> My question now is: can I somehow get the main effects tested anyhow, >> when >>>> the interaction term is not significant? >>>> >>>> Thanks, >>>> Ellen >>>> >>>> [[alternative HTML version deleted]] >>>> >>>> _______________________________________________ >>>> R-sig-ecology mailing list >>>> R-sig-ecology@r-project.org >>>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology >>>> >>> >>> [[alternative HTML version deleted]] >>> >>> _______________________________________________ >>> R-sig-ecology mailing list >>> R-sig-ecology@r-project.org >>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology >>> >> _______________________________________________ >> R-sig-ecology mailing list >> R-sig-ecology@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology >> > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology