samplesMDS {RiboSort} | R Documentation |
A object produced by the function RiboSort is a matrix with columns representing samples and rows representing species. samplesMDS
and speciesMDS
produce MDS plots of samples and species respectively.
samplesMDS(x, dissimilarity = "euclidean", type = "non-metric", labels=TRUE) speciesMDS(x, dissimilarity = "euclidean", type = "non-metric", labels=TRUE)
x |
A numeric matrix, dataframe or a "RiboSort" object, ie. an object produced by the RiboSort function |
dissimilarity |
The distance measure to be used computing dissimilarities between samples or species. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given. |
type |
The type of Multi-dimensional Scaling to be used. |
labels |
A logical argument. When TRUE, labels are included in the MDS plot. If FALSE, labels are omitted. |
These functions allow for simple and quick production of Multi-dimensional Scaling plots. A choice of dissimilarities is available, aswell as the option to specify the desired type of multi-dimensional scaling. Note that at least three samples are required to produce a two-dimensional plot.
When deciding upon a dissimilarity measure, consult the description of available distance measures in the helpfile ?dist
.
When choosing which type of multi-dimensional scaling to use, the following elaboration on the options available may aid your choice.
classical :
Classical multi-dimensional scaling of a data matrix. Also known as principal coordinates analysis.
sammon :
Sammon's non-linear mapping, also known as metric least squares multi-dimensional scaling.
non-metric :
Kruskal's form of non-metric multidimensional scaling.
If type = "classical"
, a matrix with two columns whose rows give the coordinates of the points chosen to represent the dissimilarities.
If type = "sammon"
or "non-metric"
, a list containing the following two components:
points |
A two-column vector of the fitted configuration. |
stress |
The final stress achieved (in percent). |
If there appears an error stating that the initial 'configuration has duplicates', this implies that the dissimilarity specified is not suitable. Its use in producing a distance matrix, led to the creation of duplicates in the initial configuration (computed via Classical MDS), and thus prevented an MDS plot from being created. Try alternative dissimilarity measures.
If there appears an error stating that the k in 'cmdscale(d, k) must be a value in {1,2,...,n-1}', then this implies that you have less than three samples represented in the object (usually the RiboSort object, x) supplied to samplesMDS. It is not sensible to create a two-dimensional plot when less than three samples are being compared. The difference between two samples can easily be illustrated on a one-dimensional graph (i.e. a line).
For a more interactive and less limited approach to producing multi-dimensional scaling graphs, see the functions listed below under: See Also.
Una Scallan, una.scallan@ucd.ie
RiboSort
, link{dist}
, cmdscale
, sammon
, code{isoMDS}
#---Example 1 data(demo.beckman) file.copy(system.file(demo.beckman, package = "RiboSort"), ".") #copying demo datafiles provided with RiboSort into the current working directory y=RiboSort(data=demo.beckman, dataformat="beckman", dye="D4") samplesMDS(y,dissimilarity="euclidean", type="non-metric", labels=TRUE) #---Example 2 data(demo.abi.multiple) file.copy(system.file(demo.abi.multiple, package = "RiboSort"), ".") y=RiboSort(data=demo.abi.multiple, dataformat="abimultiple") samplesMDS(y,dissimilarity="manhattan", type="sammon", labels=TRUE) #---Example 3 data(demo.standard) file.copy(system.file(demo.standard, package = "RiboSort"), ".") y=RiboSort(data=demo.standard, dataformat="standard", repeats=2, mergerepeats="presentinone") par(mfrow=c(1,2)) #setting graphics window to display 2 graphs samplesMDS(y,dissimilarity="canberra", type="classical", labels=TRUE) speciesMDS(y,dissimilarity="canberra", type="classical", labels=TRUE)