Discussion:
[R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?
Ellen Pape
2018-10-16 09:51:03 UTC
Permalink
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]]
Marcelino De La Cruz Rot
2018-10-16 10:01:05 UTC
Permalink
Post by Ellen Pape
Hi all,
Maybe adonis2(speciesdataset~ A + B, by="margin") ?
Post by Ellen Pape
I don't know whether this is the correct mailing group to address this
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
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
.
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
Ellen Pape
2018-10-16 10:09:40 UTC
Permalink
Hi,

Yes, but is there no way of testing for the main effects and interaction
simultaneously?

I also thought of first testing the interaction: adonis2(speciesdataset~ A
*** B, by="margin") , and then - if the interaction is not significant-
testing for the main effects by adonis2(speciesdataset~ A *+* B,
by="margin") . Is this "allowed"?

Thanks,
Ellen

On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot <
Post by Marcelino De La Cruz Rot
Post by Ellen Pape
Hi all,
Maybe adonis2(speciesdataset~ A + B, by="margin") ?
Post by Ellen Pape
I don't know whether this is the correct mailing group to address this
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
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
.
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
[[alternative HTML version deleted]]
Marcelino De La Cruz Rot
2018-10-16 10:24:50 UTC
Permalink
Post by Ellen Pape
Hi,
Yes, but is there no way of testing for the main effects and
interaction simultaneously?
In general, this is "not allowed", to say it with your words.
Post by Ellen Pape
adonis2(speciesdataset~ A *** B, by="margin") , and then - if the
interaction is not significant- testing for the main effects by
adonis2(speciesdataset~ A *+* B, by="margin") . Is this "allowed"?
This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
quite sense.
Post by Ellen Pape
Thanks,
Ellen
On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
Post by Ellen Pape
Hi all,
Maybe adonis2(speciesdataset~ A + B, by="margin") ?
Post by Ellen Pape
I don't know whether this is the correct mailing group to
address this
Post by Ellen Pape
I would like to perform a 2-way permanova analysis in R (using
adonis in
Post by Ellen Pape
vegan). By default you are performing sequential tests
(by="terms"), so
Post by Ellen Pape
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
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of
anova. cca it
Post by Ellen Pape
says: "if you select by="margin" -> the current function only
evaluates
Post by Ellen Pape
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
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
       [[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
.
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
Ellen Pape
2018-10-24 08:29:01 UTC
Permalink
Hello,

Yes, but is there no way of testing for the main effects and
Post by Ellen Pape
interaction simultaneously?
In general, this is "not allowed", to say it with your words.

OK, but this is done in general ANOVAs, no? test for interaction and main
effects simultaneously (and then if you have a sign interaction term, you
cannot interpret the tests for the main effects) - at least that is how I
was taught how to do this (but maybe this is wrong?)

FYI - package "RVAideMemoire" does indeed contain a function to perform
type II adonis tests ("adonis.II"), but no type III tests..

best wishes to all,
Ellen

On Tue, 16 Oct 2018 at 12:24, Marcelino De La Cruz Rot <
Post by Ellen Pape
Post by Ellen Pape
Hi,
Yes, but is there no way of testing for the main effects and
interaction simultaneously?
In general, this is "not allowed", to say it with your words.
Post by Ellen Pape
adonis2(speciesdataset~ A *** B, by="margin") , and then - if the
interaction is not significant- testing for the main effects by
adonis2(speciesdataset~ A *+* B, by="margin") . Is this "allowed"?
This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
quite sense.
Post by Ellen Pape
Thanks,
Ellen
On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
Post by Ellen Pape
Hi all,
Maybe adonis2(speciesdataset~ A + B, by="margin") ?
Post by Ellen Pape
I don't know whether this is the correct mailing group to
address this
Post by Ellen Pape
I would like to perform a 2-way permanova analysis in R (using
adonis in
Post by Ellen Pape
vegan). By default you are performing sequential tests
(by="terms"), so
Post by Ellen Pape
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
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of
anova. cca it
Post by Ellen Pape
says: "if you select by="margin" -> the current function only
evaluates
Post by Ellen Pape
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
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
.
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
[[alternative HTML version deleted]]
Marcelino De La Cruz Rot
2018-10-24 08:58:44 UTC
Permalink
Post by Ellen Pape
Hello,
Yes, but is there no way of testing for the main effects and
Post by Ellen Pape
interaction simultaneously?
In general, this is "not allowed", to say it with your words.
OK, but this is done in general ANOVAs, no? test for interaction and
main effects simultaneously (and then if you have a sign interaction
term, you cannot interpret the tests for the main effects) - at least
that is how I was taught how to do this (but maybe this is wrong?)
You are completely right. Maybe I  misunderstood you as, in my opinion,
the tests is for the interaction only (even with the main effects
included in the model), not "for the  main effects and the interaction
simultaneously".
Post by Ellen Pape
FYI - package "RVAideMemoire" does indeed contain a function to
perform type II adonis tests ("adonis.II"), but no type III tests..
Interesting. But this is  the same as adonis2(formula, by="margin"),
isn't it?

Cheers,

Marcelino
Post by Ellen Pape
best wishes to all,
Ellen
On Tue, 16 Oct 2018 at 12:24, Marcelino De La Cruz Rot
Post by Ellen Pape
Hi,
Yes, but is there no way of testing for the main effects and
interaction simultaneously?
In general, this is "not allowed", to say it with your words.
Post by Ellen Pape
adonis2(speciesdataset~ A *** B, by="margin") , and then - if the
interaction is not significant- testing for the main effects by
adonis2(speciesdataset~ A *+* B, by="margin") . Is this "allowed"?
This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
quite sense.
Post by Ellen Pape
Thanks,
Ellen
On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
     > Hi all,
     >
     Maybe adonis2(speciesdataset~ A + B, by="margin") ?
     > I don't know whether this is the correct mailing group to
     address this
     >
     > 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.
Post by Ellen Pape
     > However, since I wanted to circumvent this, I chose for
the option
Post by Ellen Pape
     > by="margin" (adonis2(speciesdataset~A*B, by="margin")) but
then
Post by Ellen Pape
     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
Post by Ellen Pape
     > 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
     > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
     > .
     >
     --
     Marcelino de la Cruz Rot
     Depto. de Biología y Geología
     Física y Química Inorgánica
     Universidad Rey Juan Carlos
     Móstoles España
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
Ellen Pape
2018-10-24 09:52:21 UTC
Permalink
Hi, see my answer concerning the adonis.II below

On Wed, 24 Oct 2018 at 10:58, Marcelino De La Cruz Rot <
Post by Ellen Pape
Hello,
Yes, but is there no way of testing for the main effects and
Post by Ellen Pape
interaction simultaneously?
In general, this is "not allowed", to say it with your words.
OK, but this is done in general ANOVAs, no? test for interaction and
main effects simultaneously (and then if you have a sign interaction
term, you cannot interpret the tests for the main effects) - at least
that is how I was taught how to do this (but maybe this is wrong?)
You are completely right. Maybe I misunderstood you as, in my opinion,
the tests is for the interaction only (even with the main effects
included in the model), not "for the main effects and the interaction
simultaneously".
Post by Ellen Pape
Post by Ellen Pape
FYI - package "RVAideMemoire" does indeed contain a function to
perform type II adonis tests ("adonis.II"), but no type III tests..
Interesting. But this is the same as adonis2(formula, by="margin"),
isn't it?
well, I don't think this is the same, but I don't fully understand, to be
honest. adonis2, "by=margin" for a 2-way permanova tests the effect of the
interaction only between the 2 factors/terms (but is still type I SS?).
adonis.II does a type II SS, for which you get a test for the main effects
and the interaction, but here the order of the terms/factors does not
matter (in contrast to adonis2, by="terms"). Ror the type II SS (and thus
adonis).II, each main effect is tested for after the other main effect, and
the interaction is assumed to be non-significant. The SS for main effect of
a factor is not adjusted for any interactions involving that factor. (this
is info I got from the internet)

I am still puzzled about what would be the best way to analyze my data, but
I have already requested a consult with our statistical dept, so hopefully
they can help me out :)

Best regards,
Ellen
Cheers,
Marcelino
Post by Ellen Pape
best wishes to all,
Ellen
On Tue, 16 Oct 2018 at 12:24, Marcelino De La Cruz Rot
Post by Ellen Pape
Hi,
Yes, but is there no way of testing for the main effects and
interaction simultaneously?
In general, this is "not allowed", to say it with your words.
Post by Ellen Pape
adonis2(speciesdataset~ A *** B, by="margin") , and then - if the
interaction is not significant- testing for the main effects by
adonis2(speciesdataset~ A *+* B, by="margin") . Is this "allowed"?
This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
quite sense.
Post by Ellen Pape
Thanks,
Ellen
On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
Post by Ellen Pape
Hi all,
Maybe adonis2(speciesdataset~ A + B, by="margin") ?
Post by Ellen Pape
I don't know whether this is the correct mailing group to
address this
Post by Ellen Pape
I would like to perform a 2-way permanova analysis in R
(using
Post by Ellen Pape
Post by Ellen Pape
adonis in
Post by Ellen Pape
vegan). By default you are performing sequential tests
(by="terms"), so
Post by Ellen Pape
when you have 2 or more factors, the order of these
factors matter.
Post by Ellen Pape
Post by Ellen Pape
However, since I wanted to circumvent this, I chose for
the option
Post by Ellen Pape
Post by Ellen Pape
by="margin" (adonis2(speciesdataset~A*B, by="margin")) but
then
Post by Ellen Pape
only the
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of
anova. cca it
Post by Ellen Pape
says: "if you select by="margin" -> the current function only
evaluates
Post by Ellen Pape
marginal terms. It will, for instance, ignore main effects
that are
Post by Ellen Pape
Post by Ellen Pape
included in interaction terms."
My question now is: can I somehow get the main effects tested
anyhow, when
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
.
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España
[[alternative HTML version deleted]]
Torsten Hauffe
2018-10-16 08:23:44 UTC
Permalink
"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
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Ellen Pape
2018-10-16 11:53:45 UTC
Permalink
Hi,

I know that A*B = A+B+A:B, but in this case, i.e. doing an adonis2 and
specifying by="terms" will only do the test for the interaction, not the
main effects. If one chooses by="terms", you will get a test for the main
effects and the interaction, but than the order of factors matters.

Best regards
Ellen
Post by Torsten Hauffe
"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
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Jari Oksanen
2018-10-16 15:16:15 UTC
Permalink
vegan::adonis2 only handles marginal effects with by = “margin” (and hence only term A:B of A*B), but RVAideMemoire package has function adonis.II that also can do “type II” and “type III” tests (what ever these mean with adonis) which may be something you are looking for. I haven’t checked how these tests were implemented, but you may do that in your leisure if you think this is what you want to have.

Cheers, Jari Oksanen
Post by Ellen Pape
Hi,
I know that A*B = A+B+A:B, but in this case, i.e. doing an adonis2 and
specifying by="terms" will only do the test for the interaction, not the
main effects. If one chooses by="terms", you will get a test for the main
effects and the interaction, but than the order of factors matters.
Best regards
Ellen
Post by Torsten Hauffe
"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
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Ellen Pape
2018-10-17 12:51:21 UTC
Permalink
ok, thanks, I'll check it out!
Post by Jari Oksanen
vegan::adonis2 only handles marginal effects with by = “margin” (and hence
only term A:B of A*B), but RVAideMemoire package has function adonis.II
that also can do “type II” and “type III” tests (what ever these mean with
adonis) which may be something you are looking for. I haven’t checked how
these tests were implemented, but you may do that in your leisure if you
think this is what you want to have.
Cheers, Jari Oksanen
Post by Ellen Pape
Hi,
I know that A*B = A+B+A:B, but in this case, i.e. doing an adonis2 and
specifying by="terms" will only do the test for the interaction, not the
main effects. If one chooses by="terms", you will get a test for the main
effects and the interaction, but than the order of factors matters.
Best regards
Ellen
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Ellen Pape
Post by Torsten Hauffe
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
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
I would like to perform a 2-way permanova analysis in R (using adonis
in
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of anova. cca
it
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Gian Maria Niccolò Benucci
2018-10-23 00:14:53 UTC
Permalink
Hello all,

thank you for the interesting discussion on the topic. I have an additional
question that i thought would worth to ask directly here instead of opening
a new thread for it. How sensitive is adonis() to differences in sample
numbers of the groups I am comparing? To be more precise, I am trying to
compare the microbial communities in 3 groups of samples (my treatments)
and they have 22, 24, and 24 samples each. I have always thought that an
even design would have been the rule but I found several comments online
that made are confounding.

Thank you for your help!

Gian
Post by Ellen Pape
ok, thanks, I'll check it out!
Post by Jari Oksanen
vegan::adonis2 only handles marginal effects with by = “margin” (and
hence
Post by Jari Oksanen
only term A:B of A*B), but RVAideMemoire package has function adonis.II
that also can do “type II” and “type III” tests (what ever these mean
with
Post by Jari Oksanen
adonis) which may be something you are looking for. I haven’t checked how
these tests were implemented, but you may do that in your leisure if you
think this is what you want to have.
Cheers, Jari Oksanen
Post by Ellen Pape
Hi,
I know that A*B = A+B+A:B, but in this case, i.e. doing an adonis2 and
specifying by="terms" will only do the test for the interaction, not
the
Post by Jari Oksanen
Post by Ellen Pape
main effects. If one chooses by="terms", you will get a test for the
main
Post by Jari Oksanen
Post by Ellen Pape
effects and the interaction, but than the order of factors matters.
Best regards
Ellen
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Ellen Pape
Post by Torsten Hauffe
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
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address
this
Post by Jari Oksanen
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
I would like to perform a 2-way permanova analysis in R (using adonis
in
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
vegan). By default you are performing sequential tests (by="terms"),
so
Post by Jari Oksanen
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of anova. cca
it
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
says: "if you select by="margin" -> the current function only
evaluates
Post by Jari Oksanen
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Ellen Pape
2018-10-25 07:46:54 UTC
Permalink
Hi Jari,

adonis.II in package RVAideMemoire only performs type II SS tests, not type
III. I have googled and could not find any package that contains a type III
adonis test. Any plans for adjusting adonis in vegan for also including
type III tests, by any chance? :-)


Thanks!
Ellen
Post by Jari Oksanen
vegan::adonis2 only handles marginal effects with by = “margin” (and hence
only term A:B of A*B), but RVAideMemoire package has function adonis.II
that also can do “type II” and “type III” tests (what ever these mean with
adonis) which may be something you are looking for. I haven’t checked how
these tests were implemented, but you may do that in your leisure if you
think this is what you want to have.
Cheers, Jari Oksanen
Post by Ellen Pape
Hi,
I know that A*B = A+B+A:B, but in this case, i.e. doing an adonis2 and
specifying by="terms" will only do the test for the interaction, not the
main effects. If one chooses by="terms", you will get a test for the main
effects and the interaction, but than the order of factors matters.
Best regards
Ellen
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Ellen Pape
Post by Torsten Hauffe
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
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
I would like to perform a 2-way permanova analysis in R (using adonis
in
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of anova. cca
it
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Ellen Pape
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Jari Oksanen
2018-10-16 12:45:02 UTC
Permalink
Post by Torsten Hauffe
"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
Post by Torsten Hauffe
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Torsten Hauffe
2018-10-16 11:04:32 UTC
Permalink
I see. Thanks for explaining Jari!
Post by Torsten Hauffe
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Torsten Hauffe
interaction is tested."
This is not entirely correct.
adonis2(speciesdataset~A:B, by="margin") would test the interaction
alone.
Post by Torsten Hauffe
~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
Post by Torsten Hauffe
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Gian Maria Niccolò Benucci
2018-10-29 17:11:22 UTC
Permalink
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
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Torsten Hauffe
interaction is tested."
This is not entirely correct.
adonis2(speciesdataset~A:B, by="margin") would test the interaction
alone.
Post by Torsten Hauffe
~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
Post by Torsten Hauffe
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Jari Oksanen
2018-10-30 09:46:55 UTC
Permalink
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
Post by Gian Maria Niccolò Benucci
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)
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
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Torsten Hauffe
interaction is tested."
This is not entirely correct.
adonis2(speciesdataset~A:B, by="margin") would test the interaction
alone.
Post by Torsten Hauffe
~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
Post by Torsten Hauffe
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
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
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Gian Maria Niccolò Benucci
2018-10-31 22:45:46 UTC
Permalink
Thank you Jari,

So to test if there are significant interaction I should use Stage:Growhouse
i.e. A:B. This will test the interaction and main effects that are marginal
and so removed. How matters then if I include by="margin" or not? The R2
are the same (please see below) but the p-value changes. I assume the
second way is most correct, is it?

*> adonis2(t(otu_fungi_out) ~ Stage : Growhouse, data=metadata_fungi_out,
permutations=9999)*
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 9999

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = 9999)
Df SumOfSqs R2 F Pr(>F)
Stage:Growhouse 3 1.0812 0.23075 1.9998 0.0211 *
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 3 1.0812 0.23075 1.9998 0.006 **
Residual 20 3.6045 0.76925
Total 23 4.6857 1.00000
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Cheers,

Gian
Post by Jari Oksanen
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 <
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)
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
Post by Torsten Hauffe
"adonis2(speciesdataset~A*B, by="margin") but then only the effect of
the
Post by Torsten Hauffe
interaction is tested."
This is not entirely correct.
adonis2(speciesdataset~A:B, by="margin") would test the interaction
alone.
Post by Torsten Hauffe
~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
Post by Torsten Hauffe
Post by Ellen Pape
Hi all,
I don't know whether this is the correct mailing group to address this
I would like to perform a 2-way permanova analysis in R (using adonis
in
Post by Torsten Hauffe
Post by Ellen Pape
vegan). By default you are performing sequential tests (by="terms"),
so
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Torsten Hauffe
Post by Ellen Pape
effect of the interaction is tested. On the "help page" of anova. cca
it
Post by Torsten Hauffe
Post by Ellen Pape
says: "if you select by="margin" -> the current function only
evaluates
Post by Torsten Hauffe
Post by Ellen Pape
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
Post by Torsten Hauffe
Post by Ellen Pape
the interaction term is not significant?
Thanks,
Ellen
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
--
Gian Maria Niccolò Benucci, Ph.D.
Postdoctoral research associate
Michigan State University
Department of Plant, Soil and Microbial Sciences
1066 Bogue Street
48825 East Lansing, MI
Lab: +1 (517) 844-6966
Email: ***@gmail.com


*----- Do not print this email unless you really need to. Save paper and
protect the environment! -----*

[[alternative HTML version deleted]]
Steve Brewer
2018-11-01 15:06:16 UTC
Permalink
Gian,

I am bit confused by what your concern is. First, if the imbalance is not that severe, the approach you take to analyzing a two-way permanova (type I, type II, type III ss) is not going to matter that much. Indeed, if the design were balanced, they would give you identical results. Second, regardless of the lack of balance, for the models y ~ A + B + A:B and y ~ B + A + A:B, the test for the interaction will be the same. So, I don’t understand why you would want to drop the main effects from the model, effectively combining them with interaction. That doesn’t make any sense to me. The problem is with the tests of the main effects.

My advice is to run both models (i.e., A first, then B first) using type I ss. As mentioned, both models will give you the same interaction result. If the interaction is all that you’re interested in, problem solved. Interpret only the interaction and and ignore the main effects. If the interaction is not significant and low, then interpret only the main effects, focusing only on the second main effect in each of the differently-ordered models (which are equivalent to Type II ss tests). And these results will tell you pretty the same thing as type III tests if there is little or no interaction. I would not worry about trying to estimate the main effects while controlling for the interaction (Ellen’s question), which cannot be done using type I or type II SS in 2-way permanova using adonis. But why would you want to? The lack of a balanced design results in the main effects and the interaction not being independent of one another. Forcing that independence by using type III ss can only work by essentially "throwing away" some of the information associated with the main effects, possibly resulting in an overly conservative test. The lower the interaction, however, the less is thrown away and the less it matters.


Steve




Stephen Brewer
***@olemiss.edu<mailto:***@olemiss.edu>
Professor
Department of Biology
PO Box 1848
University of Mississippi
University, Mississippi 38677-1848
Brewer web page - https://jstephenbrewer.wordpress.com
FAX - 662-915-5144 Phone - 662-202-5877





On Oct 31, 2018, at 5:45 PM, Gian Maria Niccolò Benucci <***@gmail.com<mailto:***@gmail.com>> wrote:

Thank you Jari,

So to test if there are significant interaction I should use Stage:Growhouse
i.e. A:B. This will test the interaction and main effects that are marginal
and so removed. How matters then if I include by="margin" or not? The R2
are the same (please see below) but the p-value changes. I assume the
second way is most correct, is it?

*> adonis2(t(otu_fungi_out) ~ Stage : Growhouse, data=metadata_fungi_out,
permutations=9999)*
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 9999

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = 9999)
Df SumOfSqs R2 F Pr(>F)
Stage:Growhouse 3 1.0812 0.23075 1.9998 0.0211 *
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 3 1.0812 0.23075 1.9998 0.006 **
Residual 20 3.6045 0.76925
Total 23 4.6857 1.00000
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Cheers,

Gian

On Tue, 30 Oct 2018 at 05:47, Jari Oksanen <***@oulu.fi<mailto:***@oulu.fi>> wrote:

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 <
***@gmail.com<mailto:***@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 <***@oulu.fi<mailto:***@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 <***@gmail.com<mailto:***@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-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
--
Gian Maria Niccolò Benucci, Ph.D.
Postdoctoral research associate
Michigan State University
Department of Plant, Soil and Microbial Sciences
1066 Bogue Street
48825 East Lansing, MI
Lab: +1 (517) 844-6966
Email: ***@gmail.com<mailto:***@gmail.com>


*----- Do not print this email unless you really need to. Save paper and
protect the environment! -----*

[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[[alternative HTML version deleted]]
Gian Maria Niccolò Benucci
2018-11-01 18:10:09 UTC
Permalink
Thank you very much Steve,

I really appreciate you answer. I do not want to drop the main effects out
form the model, I was just trying to understand how adonis works. I was
more confused on how to use the adonis function correctly rather than on
the theory that is behind it. I have an almost "fully crossed" design (that
was the plan, the fact is that I have to remove 2 samples because of the
poor sequencing results) with two factors "Growhouse" and "Stage" in this
case. I am of course interested in the effect of the main factors, but I
also wanted to see if there was a significant interaction and if my
developmental stage (i.e. mature or young) was influenced by where my
organism where growing (i.e. growhouse 1 or 2).

Iif I do as you said, Type I SS for ~ A + B + A*B depends on order so... it
is sequential SS(A) SS(B|A) SS(A*B|A B)

The interaction is not significant, so maybe worth in this case perform a
Type II test directly?
adonis(t(otu_fungi_out) ~ Stage + Growhouse + Stage : Growhouse,
data=metadata_fungi_out, permutations=9999)

Call:
adonis(formula = t(otu_fungi_out) ~ Stage + Growhouse +
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.0238 *
Growhouse 1 0.3765 0.37647 2.0889 0.08034 0.0561 .
Stage:Growhouse 1 0.2171 0.21708 1.2045 0.04633 0.2376
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
adonis(t(otu_fungi_out) ~ Growhouse + Stage + Stage : Growhouse,
data=metadata_fungi_out, permutations=9999)

Call:
adonis(formula = t(otu_fungi_out) ~ Growhouse + Stage +
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)
Growhouse 1 0.3765 0.37647 2.0889 0.08034 0.0563 .
Stage 1 0.4877 0.48769 2.7060 0.10408 0.0271 *
Growhouse:Stage 1 0.2171 0.21708 1.2045 0.04633 0.2364
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
Gian,
I am bit confused by what your concern is. First, if the imbalance is not
that severe, the approach you take to analyzing a two-way permanova (type
I, type II, type III ss) is not going to matter that much. Indeed, if the
design were balanced, they would give you identical results. Second,
regardless of the lack of balance, for the models y ~ A + B + A:B and y ~
B + A + A:B, the test for the interaction will be the same. So, I don’t
understand why you would want to drop the main effects from the model,
effectively combining them with interaction. That doesn’t make any sense to
me. The problem is with the tests of the main effects.
My advice is to run both models (i.e., A first, then B first) using type I
ss. As mentioned, both models will give you the same interaction result. If
the interaction is all that you’re interested in, problem solved. Interpret
only the interaction and and ignore the main effects. If the interaction is
not significant and low, then interpret only the main effects, focusing
only on the second main effect in each of the differently-ordered models
(which are equivalent to Type II ss tests). And these results will tell you
pretty the same thing as type III tests if there is little or no
interaction. I would not worry about trying to estimate the main effects
while controlling for the interaction (Ellen’s question), which cannot be
done using type I or type II SS in 2-way permanova using adonis. But why
would you want to? The lack of a balanced design results in the main
effects and the interaction not being independent of one another. Forcing
that independence by using type III ss can only work by essentially
"throwing away" some of the information associated with the main effects,
possibly resulting in an overly conservative test. The lower the
interaction, however, the less is thrown away and the less it matters.
Steve
Stephen Brewer
Professor
Department of Biology
PO Box 1848
University of Mississippi
University, Mississippi 38677-1848
Brewer web page - https://jstephenbrewer.wordpress.com
FAX - 662-915-5144 Phone - 662-202-5877
On Oct 31, 2018, at 5:45 PM, Gian Maria Niccolò Benucci <
Thank you Jari,
So to test if there are significant interaction I should use
Stage:Growhouse
i.e. A:B. This will test the interaction and main effects that are marginal
and so removed. How matters then if I include by="margin" or not? The R2
are the same (please see below) but the p-value changes. I assume the
second way is most correct, is it?
*> adonis2(t(otu_fungi_out) ~ Stage : Growhouse, data=metadata_fungi_out,
permutations=9999)*
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 9999
adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = 9999)
Df SumOfSqs R2 F Pr(>F)
Stage:Growhouse 3 1.0812 0.23075 1.9998 0.0211 *
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 3 1.0812 0.23075 1.9998 0.006 **
Residual 20 3.6045 0.76925
Total 23 4.6857 1.00000
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Cheers,
Gian
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 <
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)
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
"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
Hi all,
I don't know whether this is the correct mailing group to address this
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
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
*----- Do not print this email unless you really need to. Save paper and
protect the environment! -----*
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
Jari Oksanen
2018-11-01 18:29:45 UTC
Permalink
Gian,

The marginal tests for one-term models had a problem in vegan 2.5-1 and vegan 2.5-2. This is fixed in vegan 2.5-3, so please upgrade. (It never occurred to me that people would use marginal tests for one-term models where the fitted model is compared against the empty model, and that case was not handled correctly: any other test — total or sequential — should yield identical results in this case and marginal tests make no sense).

I haven’t even considered implementing type-XXX tests in vegan::adonis. The function uses standard R stats functions which only allow sequential tests or tests of marginal terms (ignoring non-marginal main effects when there are interactions). However, if you are interested in interaction term A:B, your really should inspect the model A+B+A:B. It makes no sense in any sense to study model A:B without the main effects. That would give misleading results for A:B. The interpretation of ~A:B is based on standard R stats::model.matrix() in vegan, and these seem to expand a bit differently for factors A & B and continuous variables A & B. So beware, brother beware. Use stats::model.matrix() to see how they really unfold in your case.

Cheers, Giari

On 1 Nov 2018, at 20:10, Gian Maria Niccolò Benucci <***@gmail.com<mailto:***@gmail.com>> wrote:

Thank you very much Steve,

I really appreciate you answer. I do not want to drop the main effects out
form the model, I was just trying to understand how adonis works. I was
more confused on how to use the adonis function correctly rather than on
the theory that is behind it. I have an almost "fully crossed" design (that
was the plan, the fact is that I have to remove 2 samples because of the
poor sequencing results) with two factors "Growhouse" and "Stage" in this
case. I am of course interested in the effect of the main factors, but I
also wanted to see if there was a significant interaction and if my
developmental stage (i.e. mature or young) was influenced by where my
organism where growing (i.e. growhouse 1 or 2).

Iif I do as you said, Type I SS for ~ A + B + A*B depends on order so... it
is sequential SS(A) SS(B|A) SS(A*B|A B)

The interaction is not significant, so maybe worth in this case perform a
Type II test directly?

adonis(t(otu_fungi_out) ~ Stage + Growhouse + Stage : Growhouse,
data=metadata_fungi_out, permutations=9999)

Call:
adonis(formula = t(otu_fungi_out) ~ Stage + Growhouse +
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.0238 *
Growhouse 1 0.3765 0.37647 2.0889 0.08034 0.0561 .
Stage:Growhouse 1 0.2171 0.21708 1.2045 0.04633 0.2376
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

adonis(t(otu_fungi_out) ~ Growhouse + Stage + Stage : Growhouse,
data=metadata_fungi_out, permutations=9999)

Call:
adonis(formula = t(otu_fungi_out) ~ Growhouse + Stage +
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)
Growhouse 1 0.3765 0.37647 2.0889 0.08034 0.0563 .
Stage 1 0.4877 0.48769 2.7060 0.10408 0.0271 *
Growhouse:Stage 1 0.2171 0.21708 1.2045 0.04633 0.2364
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 Thu, 1 Nov 2018 at 11:06, Steve Brewer <***@olemiss.edu<mailto:***@olemiss.edu>> wrote:

Gian,

I am bit confused by what your concern is. First, if the imbalance is not
that severe, the approach you take to analyzing a two-way permanova (type
I, type II, type III ss) is not going to matter that much. Indeed, if the
design were balanced, they would give you identical results. Second,
regardless of the lack of balance, for the models y ~ A + B + A:B and y ~
B + A + A:B, the test for the interaction will be the same. So, I don’t
understand why you would want to drop the main effects from the model,
effectively combining them with interaction. That doesn’t make any sense to
me. The problem is with the tests of the main effects.

My advice is to run both models (i.e., A first, then B first) using type I
ss. As mentioned, both models will give you the same interaction result. If
the interaction is all that you’re interested in, problem solved. Interpret
only the interaction and and ignore the main effects. If the interaction is
not significant and low, then interpret only the main effects, focusing
only on the second main effect in each of the differently-ordered models
(which are equivalent to Type II ss tests). And these results will tell you
pretty the same thing as type III tests if there is little or no
interaction. I would not worry about trying to estimate the main effects
while controlling for the interaction (Ellen’s question), which cannot be
done using type I or type II SS in 2-way permanova using adonis. But why
would you want to? The lack of a balanced design results in the main
effects and the interaction not being independent of one another. Forcing
that independence by using type III ss can only work by essentially
"throwing away" some of the information associated with the main effects,
possibly resulting in an overly conservative test. The lower the
interaction, however, the less is thrown away and the less it matters.


Steve




Stephen Brewer
***@olemiss.edu<mailto:***@olemiss.edu>
Professor
Department of Biology
PO Box 1848
University of Mississippi
University, Mississippi 38677-1848
Brewer web page - https://jstephenbrewer.wordpress.com<https://jstephenbrewer.wordpress.com/>
FAX - 662-915-5144<tel:662-915-5144> Phone - 662-202-5877<tel:662-202-5877>





On Oct 31, 2018, at 5:45 PM, Gian Maria Niccolò Benucci <
***@gmail.com<mailto:***@gmail.com>> wrote:

Thank you Jari,

So to test if there are significant interaction I should use
Stage:Growhouse
i.e. A:B. This will test the interaction and main effects that are marginal
and so removed. How matters then if I include by="margin" or not? The R2
are the same (please see below) but the p-value changes. I assume the
second way is most correct, is it?

*> adonis2(t(otu_fungi_out) ~ Stage : Growhouse, data=metadata_fungi_out,
permutations=9999)*
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 9999

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = 9999)
Df SumOfSqs R2 F Pr(>F)
Stage:Growhouse 3 1.0812 0.23075 1.9998 0.0211 *
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 3 1.0812 0.23075 1.9998 0.006 **
Residual 20 3.6045 0.76925
Total 23 4.6857 1.00000
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Cheers,

Gian

On Tue, 30 Oct 2018 at 05:47, Jari Oksanen <***@oulu.fi<mailto:***@oulu.fi>> wrote:

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 <

***@gmail.com<mailto:***@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 <***@oulu.fi<mailto:***@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 <***@gmail.com<mailto:***@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-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology







*----- Do not print this email unless you really need to. Save paper and
protect the environment! -----*

[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology




[[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-***@r-project.org<mailto:R-sig-***@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[[alternative HTML version deleted]]

Loading...