Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-11-01 Thread Jari Oksanen
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 
mailto:gian.benu...@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=)

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

Permutation: free
Number of permutations: 

Terms added sequentially (first to last)

   Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
Stage10.4877 0.48769  2.7060 0.10408 0.0238 *
Growhouse10.3765 0.37647  2.0889 0.08034 0.0561 .
Stage:Growhouse  10.2171 0.21708  1.2045 0.04633 0.2376
Residuals   203.6045 0.18023 0.76925
Total   234.6857 1.0
---
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=)

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

Permutation: free
Number of permutations: 

Terms added sequentially (first to last)

   Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
Growhouse10.3765 0.37647  2.0889 0.08034 0.0563 .
Stage10.4877 0.48769  2.7060 0.10408 0.0271 *
Growhouse:Stage  10.2171 0.21708  1.2045 0.04633 0.2364
Residuals   203.6045 0.18023 0.76925
Total   234.6857 1.0
---
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 
mailto:jbre...@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 

Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-11-01 Thread Gian Maria Niccolò Benucci
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=)

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

Permutation: free
Number of permutations: 

Terms added sequentially (first to last)

Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
Stage10.4877 0.48769  2.7060 0.10408 0.0238 *
Growhouse10.3765 0.37647  2.0889 0.08034 0.0561 .
Stage:Growhouse  10.2171 0.21708  1.2045 0.04633 0.2376
Residuals   203.6045 0.18023 0.76925
Total   234.6857 1.0
---
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=)

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

Permutation: free
Number of permutations: 

Terms added sequentially (first to last)

Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
Growhouse10.3765 0.37647  2.0889 0.08034 0.0563 .
Stage10.4877 0.48769  2.7060 0.10408 0.0271 *
Growhouse:Stage  10.2171 0.21708  1.2045 0.04633 0.2364
Residuals   203.6045 0.18023 0.76925
Total   234.6857 1.0
---
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  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
> jbre...@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 <
> gian.benu...@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 

Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-11-01 Thread Steve Brewer
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
jbre...@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 
mailto:gian.benu...@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=)*
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = )
   Df SumOfSqs  R2  F Pr(>F)
Stage:Growhouse  3   1.0812 0.23075 1.9998 0.0211 *
Residual20   3.6045 0.76925
Total   23   4.6857 1.0
---
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=)*
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = , by = "margin")
   Df SumOfSqs  R2  F Pr(>F)
Stage:Growhouse  3   1.0812 0.23075 1.9998  0.006 **
Residual20   3.6045 0.76925
Total   23   4.6857 1.0
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Cheers,

Gian

On Tue, 30 Oct 2018 at 05:47, Jari Oksanen 
mailto:jari.oksa...@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 <
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=)
Permutation test 

Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-31 Thread 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=)*
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = )
Df SumOfSqs  R2  F Pr(>F)
Stage:Growhouse  3   1.0812 0.23075 1.9998 0.0211 *
Residual20   3.6045 0.76925
Total   23   4.6857 1.0
---
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=)*
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = , by = "margin")
Df SumOfSqs  R2  F Pr(>F)
Stage:Growhouse  3   1.0812 0.23075 1.9998  0.006 **
Residual20   3.6045 0.76925
Total   23   4.6857 1.0
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Cheers,

Gian

On Tue, 30 Oct 2018 at 05:47, Jari Oksanen  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 <
> 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=)
> > Permutation test for adonis under reduced model
> > Marginal effects of terms
> > Permutation: free
> > Number of permutations: 
> >
> > adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
> > metadata_fungi_out, permutations = , by = "margin")
> >Df SumOfSqs  R2  F Pr(>F)
> > Stage:Growhouse  3   1.0812 0.23075 1.9998  1e-04 ***
> > Residual20   3.6045 0.76925
> > Total   23   4.6857 1.0
> > ---
> > 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=)
> > Permutation test for adonis under reduced model
> > Marginal effects of terms
> > Permutation: free
> > Number of permutations: 
> >
> > adonis2(formula = t(otu_fungi_out) ~ Stage * Growhouse, data =
> > metadata_fungi_out, permutations = , by = "margin")
> >Df SumOfSqs  R2  F Pr(>F)
> > Stage:Growhouse  1   0.2171 0.04633 1.2045 0.2443
> > Residual20   3.6045 0.76925
> > Total   23   4.6857 1.0
> >>
> >
> > 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=)
> > Call:
> > adonis(formula = t(otu_fungi_out) ~ Stage * Growhouse, data =
> > metadata_fungi_out,  permutations = )
> >
> > Permutation: free
> > Number of permutations: 
> >
> > Terms added sequentially (first to last)
> >
> >Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
> > Stage10.4877 0.48769  2.7060 0.10408 0.0247 *
> > Growhouse10.3765 0.37647  2.0889 0.08034 0.0542 .
> > Stage:Growhouse  10.2171 0.21708  1.2045 0.04633 0.2507
> > Residuals   203.6045 0.18023 0.76925
> > Total   234.6857 1.0
> > ---
> > 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  wrote:
> >
> >>
> >>
> >> On 16/10/18 11:23, Torsten 

Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-30 Thread 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  
> 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=)
> Permutation test for adonis under reduced model
> Marginal effects of terms
> Permutation: free
> Number of permutations: 
> 
> adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
> metadata_fungi_out, permutations = , by = "margin")
>Df SumOfSqs  R2  F Pr(>F)
> Stage:Growhouse  3   1.0812 0.23075 1.9998  1e-04 ***
> Residual20   3.6045 0.76925
> Total   23   4.6857 1.0
> ---
> 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=)
> Permutation test for adonis under reduced model
> Marginal effects of terms
> Permutation: free
> Number of permutations: 
> 
> adonis2(formula = t(otu_fungi_out) ~ Stage * Growhouse, data =
> metadata_fungi_out, permutations = , by = "margin")
>Df SumOfSqs  R2  F Pr(>F)
> Stage:Growhouse  1   0.2171 0.04633 1.2045 0.2443
> Residual20   3.6045 0.76925
> Total   23   4.6857 1.0
>> 
> 
> 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=)
> Call:
> adonis(formula = t(otu_fungi_out) ~ Stage * Growhouse, data =
> metadata_fungi_out,  permutations = )
> 
> Permutation: free
> Number of permutations: 
> 
> Terms added sequentially (first to last)
> 
>Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
> Stage10.4877 0.48769  2.7060 0.10408 0.0247 *
> Growhouse10.3765 0.37647  2.0889 0.08034 0.0542 .
> Stage:Growhouse  10.2171 0.21708  1.2045 0.04633 0.2507
> Residuals   203.6045 0.18023 0.76925
> Total   234.6857 1.0
> ---
> 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  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  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]]
>>> 
>>> 

Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-29 Thread 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=)
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 

adonis2(formula = t(otu_fungi_out) ~ Stage:Growhouse, data =
metadata_fungi_out, permutations = , by = "margin")
Df SumOfSqs  R2  F Pr(>F)
Stage:Growhouse  3   1.0812 0.23075 1.9998  1e-04 ***
Residual20   3.6045 0.76925
Total   23   4.6857 1.0
---
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=)
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 

adonis2(formula = t(otu_fungi_out) ~ Stage * Growhouse, data =
metadata_fungi_out, permutations = , by = "margin")
Df SumOfSqs  R2  F Pr(>F)
Stage:Growhouse  1   0.2171 0.04633 1.2045 0.2443
Residual20   3.6045 0.76925
Total   23   4.6857 1.0
>

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=)
Call:
adonis(formula = t(otu_fungi_out) ~ Stage * Growhouse, data =
metadata_fungi_out,  permutations = )

Permutation: free
Number of permutations: 

Terms added sequentially (first to last)

Df SumsOfSqs MeanSqs F.Model  R2 Pr(>F)
Stage10.4877 0.48769  2.7060 0.10408 0.0247 *
Growhouse10.3765 0.37647  2.0889 0.08034 0.0542 .
Stage:Growhouse  10.2171 0.21708  1.2045 0.04633 0.2507
Residuals   203.6045 0.18023 0.76925
Total   234.6857 1.0
---
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  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  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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-25 Thread Ellen Pape
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


On Tue, 16 Oct 2018 at 17:16, Jari Oksanen  wrote:

> 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
>
> > On 16 Oct 2018, at 14:53 pm, Ellen Pape  wrote:
> >
> > 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
> >
> > On Tue, 16 Oct 2018 at 12: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
> >>
> >> On Tue, 16 Oct 2018 at 11:51, Ellen Pape  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
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-24 Thread Ellen Pape
Hi, see my answer concerning the adonis.II below

On Wed, 24 Oct 2018 at 10:58, Marcelino De La Cruz Rot <
marcelino.delac...@urjc.es> wrote:

> El 24/10/2018 a las 10:29, Ellen Pape escribió:
> > Hello,
> >
> > 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.
> >
> > 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".
>
> >
>
>> > 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
>
>
> >
> > best wishes to all,
> > Ellen
> > On Tue, 16 Oct 2018 at 12:24, Marcelino De La Cruz Rot
> > mailto:marcelino.delac...@urjc.es>> wrote:
> >
> > El 16/10/2018 a las 12:09, Ellen Pape escribió:
> > > 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.
> >
> > >
> > > 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"?
> >
> > This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
> > quite sense.
> >
> >
> > >
> > > Thanks,
> > > Ellen
> > >
> > > On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
> > > mailto:marcelino.delac...@urjc.es>
> >  > >> wrote:
> > >
> > > El 16/10/2018 a las 11:51, Ellen Pape escribió:
> > > > Hi all,
> > > >
> > > Maybe adonis2(speciesdataset~ A + B, by="margin") ?
> > >
> > >
> > >
> > > > 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
> > 
> >  > 

Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-24 Thread Marcelino De La Cruz Rot
El 24/10/2018 a las 10:29, Ellen Pape escribió:
> Hello,
>
> 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.
>
> 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".

>
> 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


>
> best wishes to all,
> Ellen
> On Tue, 16 Oct 2018 at 12:24, Marcelino De La Cruz Rot 
> mailto:marcelino.delac...@urjc.es>> wrote:
>
> El 16/10/2018 a las 12:09, Ellen Pape escribió:
> > 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.
>
> >
> > 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"?
>
> This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
> quite sense.
>
>
> >
> > Thanks,
> > Ellen
> >
> > On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
> > mailto:marcelino.delac...@urjc.es>
>  >> wrote:
> >
> >     El 16/10/2018 a las 11:51, Ellen Pape escribió:
> >     > Hi all,
> >     >
> >     Maybe adonis2(speciesdataset~ A + B, by="margin") ?
> >
> >
> >
> >     > 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
> >     > .
> >     >
> >
> >     --
> >     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

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-24 Thread Ellen Pape
Hello,

  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.

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 <
marcelino.delac...@urjc.es> wrote:

> El 16/10/2018 a las 12:09, Ellen Pape escribió:
> > 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.
>
> >
> > 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"?
>
> This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes
> quite sense.
>
>
> >
> > Thanks,
> > Ellen
> >
> > On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot
> > mailto:marcelino.delac...@urjc.es>> wrote:
> >
> > El 16/10/2018 a las 11:51, Ellen Pape escribió:
> > > Hi all,
> > >
> > Maybe adonis2(speciesdataset~ A + B, by="margin") ?
> >
> >
> >
> > > 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
> > > .
> > >
> >
> > --
> > 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]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-22 Thread Gian Maria Niccolò Benucci
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




On Wed, 17 Oct 2018 at 08:51, Ellen Pape  wrote:

> ok, thanks, I'll check it out!
>
> On Tue, 16 Oct 2018 at 17:16, Jari Oksanen  wrote:
>
> > 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
> >
> > > On 16 Oct 2018, at 14:53 pm, Ellen Pape  wrote:
> > >
> > > 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
> > >
> > > On Tue, 16 Oct 2018 at 12: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
> > >>
> > >> On Tue, 16 Oct 2018 at 11:51, Ellen Pape 
> 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
> >
> >
>
> [[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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-17 Thread Ellen Pape
ok, thanks, I'll check it out!

On Tue, 16 Oct 2018 at 17:16, Jari Oksanen  wrote:

> 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
>
> > On 16 Oct 2018, at 14:53 pm, Ellen Pape  wrote:
> >
> > 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
> >
> > On Tue, 16 Oct 2018 at 12: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
> >>
> >> On Tue, 16 Oct 2018 at 11:51, Ellen Pape  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
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread 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

> On 16 Oct 2018, at 14:53 pm, Ellen Pape  wrote:
> 
> 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
> 
> On Tue, 16 Oct 2018 at 12: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
>> 
>> On Tue, 16 Oct 2018 at 11:51, Ellen Pape  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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread Torsten Hauffe
I see. Thanks for explaining Jari!

On Tue, 16 Oct 2018 at 14:54, Jari Oksanen  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  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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread Jari Oksanen



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  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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread 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

On Tue, 16 Oct 2018 at 12: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
>
> On Tue, 16 Oct 2018 at 11:51, Ellen Pape  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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread Marcelino De La Cruz Rot
El 16/10/2018 a las 12:09, Ellen Pape escribió:
> 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.

>
> 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"?

This is analogous to, e.g., an ANCOVA, isn't it? Therefore it makes 
quite sense.


>
> Thanks,
> Ellen
>
> On Tue, 16 Oct 2018 at 12:01, Marcelino De La Cruz Rot 
> mailto:marcelino.delac...@urjc.es>> wrote:
>
> El 16/10/2018 a las 11:51, Ellen Pape escribió:
> > Hi all,
> >
> Maybe adonis2(speciesdataset~ A + B, by="margin") ?
>
>
>
> > 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
> > .
> >
>
> -- 
> 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

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread 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

On Tue, 16 Oct 2018 at 11:51, Ellen Pape  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


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread Ellen Pape
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 <
marcelino.delac...@urjc.es> wrote:

> El 16/10/2018 a las 11:51, Ellen Pape escribió:
> > Hi all,
> >
> Maybe adonis2(speciesdataset~ A + B, by="margin") ?
>
>
>
> > 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
> > .
> >
>
> --
> 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]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] 2-way adonis (PERMANOVA) incl interaction - how to test for main effects?

2018-10-16 Thread Marcelino De La Cruz Rot
El 16/10/2018 a las 11:51, Ellen Pape escribió:
> Hi all,
>
Maybe adonis2(speciesdataset~ A + B, by="margin") ?



> 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
> .
>

-- 
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

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology