0
$\begingroup$

I've trying to preform a PERMANOVA using adonis2 on a dissimilarity matrix. My code looks like this.

adonis2(formula = bray_curtis_dist ~ treatment, data = metadata, 
        permutations = 999)

For the metadata, if I change around the order of my samples (say I order by treatment rather than by ID), the results change drastically. Does adonis2 not match sample names?

This is my results if the metadata is arranged first by ID and then second by Supplement Type. It seems like the SumOfSqs are not the same between the two, and the pvaules are very different. Why does this happen? I get these same values every time I load up a metadata file arranged by either ID or treatment. These files are exactly the same, minus the order of samples.

Thanks!

Permutation test for adonis under reduced model
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 255

adonis2(formula = bray_curtis_dist ~ Supplement_Type + Sequence + 
    Supplement_Type:Sequence, data = metadata)
                         Df SumOfSqs      R2      F Pr(>F)
Supplement_Type           1  0.05667 0.01934 0.2781 0.7325
Sequence                  1  0.37653 0.12854 1.8482 0.7656
Supplement_Type:Sequence  1  0.05133 0.01752 0.2519 0.8125
Residual                 12  2.44477 0.83459              
Total                    15  2.92930 1.00000   

####

Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 255

adonis2(formula = bray_curtis_dist ~ Supplement_Type + Sequence + 
    Supplement_Type:Sequence, data = metadata)
                         Df SumOfSqs      R2      F Pr(>F)
Supplement_Type           1  0.15567 0.05314 0.7539 0.3365
Sequence                  1  0.27412 0.09358 1.3276 0.7344
Supplement_Type:Sequence  1  0.02166 0.00739 0.1049 1.0000
Residual                 12  2.47785 0.84588              
Total                    15  2.92930 1.00000         
$\endgroup$
4
  • $\begingroup$ I'm not familiar with adonis2() but I suspect that this might be related to the problem with Type I ANOVA, with terms added sequentially when data aren't balanced. $\endgroup$
    – EdM
    Commented Feb 15 at 19:05
  • $\begingroup$ By not balanced, are you referring to sample number? I have 20 samples, 10 subjects. Each volunteer has matching samples and one group is not over represented. $\endgroup$ Commented Feb 15 at 19:43
  • $\begingroup$ Your model summaries only show 15 degrees of freedom, which seems inconsistent with your having 20 samples. Double-check your data for missing values, etc. $\endgroup$
    – EdM
    Commented Feb 15 at 20:02
  • $\begingroup$ Ah, my bad. I meant to say I have 16 total samples, with 8 subjects. I believe 15 Df makes sense. $\endgroup$ Commented Feb 16 at 12:18

1 Answer 1

0
$\begingroup$

The results are changing because the metadata object must be in the same order as your bray_curtis_dist object—vegan isn't using the sample names, so shuffling the rows of metadata is essentially annotating the same distance matrix with a totally different combination of labels. From the documentation:

the data frame for the independent variables, with rows in the same order as the community data matrix or dissimilarity matrix named on the LHS of formula.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.