Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different results from vegan depending on input type #147

Closed
GSatten opened this issue Nov 14, 2015 · 1 comment
Closed

different results from vegan depending on input type #147

GSatten opened this issue Nov 14, 2015 · 1 comment

Comments

@GSatten
Copy link

@GSatten GSatten commented Nov 14, 2015

i am trying to use the adonis function in vegan to run the permanova analysis. but i am getting very different results depending on how i call adonis.

if i call adonis using a distance object such as the following:

bc=vegdist( data, method='bray')
adonis(bc~var)

i get a very different result than if i convert bc (a dist object) into a matrix:

bc=as.matrix( vegdist(data, method='bray') )
adonis(bc~var)

what is causing this difference and which is correct?

@jarioksa
Copy link
Contributor

@jarioksa jarioksa commented Nov 15, 2015

You should supply either a distance object or data. If you supply a matrix, it is regarded as data and dissimilarities are calculated. So the following should be equivalent:

bc <- vegdist(data, method="bray")
adonis(bc ~ var)
adonis(data ~ var)

The second form you had would be equivalent to:

adonis(vegdist(as.matrix(vegdist(data))) ~ var)

which makes no sense. I suggest you follow the document and supply either a distance object or data.

@jarioksa jarioksa closed this Nov 15, 2015
jarioksa added a commit that referenced this issue Nov 20, 2015
Several functions accept either 'dist' object or raw data from
which they calculate distances. If users supply their distances
as square matrices (or data frames) these may be taken as raw
data and we end up calculateing distances of distances. Most
such functions had a test for symmetric square matrices that
probably hold distances, but now these tests are made more
consistent and robust.

Should fix problems like issue #147
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants