vegandevs / vegan

R package for community ecologists: popular ordination methods, ecological null models & diversity analysis
https://vegandevs.github.io/vegan/
GNU General Public License v2.0
442 stars 96 forks source link

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

Open emilyklann opened 4 years ago

emilyklann commented 4 years ago

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!

jarioksa commented 4 years ago

Hi,

I don't have your data and can't replicate the problem. Here some points to study:

emilyklann commented 4 years ago

Hello,

Thank you so much for your quick reply! I think that my issue is with an unbalanced design. The sample sizes for each combination are not equal.

Considering this, do you think the results that I am getting are invalid?

Thank you and happy holidays! :)

Emily Klann

Sent from my iPhone

On Dec 21, 2019, at 10:55 AM, Jari Oksanen notifications@github.com wrote:

 [External Email]

Hi,

I don't have your data and can't replicate the problem. Here some points to study:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_vegandevs_vegan_issues_338-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAKGNL3Z6T6QD5G4WNQLNAKLQZY36XA5CNFSM4J6CCWVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHO6SBA-23issuecomment-2D568191236&d=DwMFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=3LF_9N64-1SumLL1G7toeLLDe_71zrDPvsIeyNcEjGU&m=AGkwZbMe9E1V8UuULsv8i5-CEUTYBhq7eWPrau9vLD4&s=-XojMS6Ogd9EVMO0xBeufcDgzKqK5bjAUtbxp363eXc&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AKGNL37WX4HR54GITCO3LTDQZY36XANCNFSM4J6CCWVA&d=DwMFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=3LF_9N64-1SumLL1G7toeLLDe_71zrDPvsIeyNcEjGU&m=AGkwZbMe9E1V8UuULsv8i5-CEUTYBhq7eWPrau9vLD4&s=OSdJnj10dDuQu7Dx4uNnCGh34952VPoVCLtTsaFi5hs&e=.