# nmds query

Hey forum,
I am using the thetayc measure to give me a similarity matrix for all the samples I am interested in comparing.
This matrix, I then import into R for nmds and heatmaps.
So,
Question 1. Is there a way I can convert the column matrix (of similarity measures between samples) into a square matrix using mothur or R?
Question 2. Is it correct for me to use nmds with such a matrix?

Thanks!

R can do everything! but you dont need to do question 1 but for question 2

whenever you generate a similarity matrix, it is a triangular matrix as you compare every pair of samples… the diagonals being the comparison with a sample with itself, and the top triangle the same as the bottom triangle (e.g sample 1 vs sample 2 is in the bottom, but sample 2 vs sample 1 is in the top… they are the same comparison)

the nMDS algorithm requires such a triangular matrix to generate the ordination (graph). So whatever data you generate that tells you it is a similarity matrix should in most cases be a triangular matrix (unless you’ve opted somewhere to get a column format)

I’m wondering if many people recognize what an nMDS actually does to your data before it generates the ordination. It ranks all data in the matrix. Most similar =1, next most similar = 2…
… 1…2 …3
1
2… 0.89
3… 0.56 … 0.45

… 1… 2… 3
1
2 … 1 … >> this is the actual data the the nMDS is trying to show you! (it’s actually quite robust… eg against outliers)
3 … 2 … 3

Sorry my triangular matrix doesn’t come out so well. Hope you get the picture.
All the best

He is quite right - R can do anything. But… you have to figure out how to tell R how to do it first! FYI - mothur can do nmds as well using the nmds command. It’s pretty streamlined in mothur and has the same syntax as the pcoa/pca commands.

Pat

Thanks guys for all your help! That was informative.

Hey,
Thanks for that little crash course on NMDS. I have another doubt regarding all this.
If I feed a distance matrix (constructed using mothur) that shows the distance between the samples I am studying.
I notice that most of the pairs of samples you would see as being similar (just by a glance at the matrix) do cluster close to each other in the NMDS, but occasionally the clustering does not seem to be faithful to the similarity in the input matrix. However, when I do a metric MDS, it is more faithful (but people criticize it for other reasons). Is it common to see some samples not clustering close together in the nmds ordination, while actually being close in the input matrix?

Hi everyone,
IÂ´m interested in this topic, specially in that last unanswered question.

Maybe itÂ´s related to my question. WhatÂ´s the difference between:

1. running mothurÂ´s nmds command (like in 454 SOP)
2. running metaMDS in R package “vegan” with mothurÂ´s shared file (slightly modified for R).

I get different ordination values/plots.