vegan icon indicating copy to clipboard operation
vegan copied to clipboard

Adonis2 output for multivariate formula using "by=margin" feature

Open emilyklann opened this issue 4 years ago • 2 comments

Hello,

I am relatively new to using vegan (and to analyzing microbiome data in general). I apologize if this seems like a silly question.

I am using adonis2 to test for significance between unifrac measures for two groups over time (treatment and controls). However, I also want to take into account the variance due to cage effects. My model looks like this:

adonis2(dist_rarefied17_unifrac ~ Time + Group + Cage, data=miceV4, 
    permutations=999, method="unifrac", by="margin")

From what I could tell by reading information about adonis2, adding "by=margin", seems to allow for all variables to be taken into account evenly (not sequentially as with "by=terms"). Therefore, I would assume that the output would be similar to that of a standard regression. However, the degrees of freedom for the degrees of freedom and the R-squared value for my 'Group' variable is zero and the F-value is -Inf. Further, the degrees of freedom for my 'Cage' variable is one less than it should be.

I thought that maybe the zeros for the 'Group' variable simply meant that it does not contribute to or explain any of the observed variance. However, this doesn't explain the discrepancy with the degrees of freedom. I hope this makes sense. Any help in understanding how this function works with the "by=margin" option would be much appreciated!

emilyklann avatar Dec 20 '19 20:12 emilyklann