Roey Angel
2012-Oct-11 21:11 UTC
[R] In vegan package: running adonis (or similar) on a distance matrix
Hi, Using Vegan package I was wondering if there's a way to use a distance matrix as an input for adonis (or any of the other similar hypothesis testing functions) instead of the usual species by sample table. Working in the field of microbial ecology, what I'm trying to do is to overcome the problem of having to use discrete units such as species or OTUs, which are problematic in microbial ecology (if not outright theoretically false). What I have instead is a phylometric distance matrix between all my samples based on a phylogenetic tree. Some people have apparently made such a python implementation <http://qiime.org/scripts/compare_categories.html>, but I'd rather use R. Thanks in advance, Roey
Jari Oksanen
2012-Oct-12 08:09 UTC
[R] In vegan package: running adonis (or similar) on a distance matrix
Roey Angel <angel <at> mpi-marburg.mpg.de> writes:> > Hi, > Using Vegan package I was wondering if there's a way to use a distance > matrix as an input for adonis (or any of the other similar hypothesis > testing functions) instead of the usual species by sample table. > Working in the field of microbial ecology, what I'm trying to do is to > overcome the problem of having to use discrete units such as species or > OTUs, which are problematic in microbial ecology (if not outright > theoretically false). > What I have instead is a phylometric distance matrix between all my > samples based on a phylogenetic tree. >Dear Roye Angel, According to the documentation, this can be done. See description of the first argument ('formula') in ?adonis. Your distances (dissmilarities) must be in standard R form and inherit from class "dist". If they are in some other form, you should change them to "dist" class. This may succeed with command as.dist(). Cheers, Jari Oksanen
Roey Angel
2012-Oct-15 09:43 UTC
[R] In vegan package: running adonis (or similar) on a distance matrix
Dear Jari Oksanen, Many thanks for your reply; adonis() does seem to accept a distance matrix as an input. Regarding the documentation, what got me confused is that 'data' is described as; "the data frame from which A, B, and C would be drawn." but of course this refers only to the design of the experiment and not the response variable. Perhaps it might be useful to redefine it as 'design' or 'explanatory variables' etc. Roey -- Dr. Roey Angel Max-Planck-Institute for Terrestrial Microbiology Karl-von-Frisch-Strasse 10 D-35043 Marburg, Germany Office: +49-(0)6421178832 Mobile: +49-(0)17661278588