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
461 stars 98 forks source link

Random effects / dbrda with unifrac distances ? #626

Closed ladrub closed 8 months ago

ladrub commented 8 months ago

I am working on a microbiome longitudinal analysis.

I have two arms (antibiotics treatment vs placebo). We extracted the 16s RNA of each patient at different months from inclusions (from inclusion : months 3, 6, 12, 18) and I want to test the beta-diversity between the two arms, taking into account the random effect of repeated measures and fixed effect of time.

I want to test if beta diversity will significantly vary in time in treatment arm compared to placebo arm.

So I did a permANOVA on each arm, and one on all data, and observed that Unifrac and Unweighted distances varied significantly in treatment arm, but not in placebo arm, which is quite comforting.

But I would like to build a more generalized model, taking into account the samples from the same subject as random effects.

I checked this thread with a similar issue : https://github.com/vegandevs/vegan/issues/429 and tested dbrda for the visualization, however it seems it only calculated bray or jaccard distances, not unifrac/ weighted unifrac ?

Any kind of help/suggestions would be of great help.

Kind regards, Ruben Ladeira

jarioksa commented 8 months ago

You can use any distances / dissimilarities as input. You only need to take care that R knows they are distances. If unsure, try to change your input with as.dist, and if it works, you are OK.