Description Usage Arguments Details Value BUGS Author(s) See Also Examples
This function computes and returns the distance matrix determined by using the specified distance metric to compute the distances between the columns of a data matrix.
1  distanceMatrix(dataset, metric, ...)

dataset 
A numeric matrix or an 
metric 
A character string defining the distance metric. This
can be 
... 
Additional parameters to be passed on to

This function differs from dist
in two ways, both of
which are motivated by common practice in the analysis of microarray
or proteomics data. First, it computes distances between column vectors
instead of between row vectors. In a typical microarray experiment,
the data is organized so the rows represent genes and the columns
represent different biological samples. In many applications,
relations between the biological samples are more interesting than
relationships between genes. Second, distanceMatrix
adds
additional distance metrics based on correlation.
pearson
The most common metric used in the microarray literature is
the pearson
distance, which can be computed in terms of the
Pearson correlation coefficient as (1cor(dataset))/2
.
uncentered correlation
This metric was introduced in
the Cluster and TreeView software from the Eisen lab at
Stanford. It is computed using the formulas for Pearson
correlation, but assuming that both vectors have mean zero.
spearman
The spearman
metric used the same formula, but
substitutes the Spearman rank correlation for the Pearson
correlation.
absolute pearson
The absolute pearson
metric used the absolute
correlation coefficient; i.e., (1abs(cor(dataset)))
.
sqrt pearson
The sqrt pearson
metric used the square root of the
pearson distance metric; i.e., sqrt(1cor(dataset))
.
weird
The weird
metric uses the Euclidean distance between
the vectors of correlation coefficients; i.e., dist(cor(dataset)).
A distance matrix in the form of an object of class dist
, of
the sort returned by the dist
function or the as.dist
function.
It would be good to have a better name for the weird
metric.
Kevin R. Coombes krc@silicovore.com
1 2 3 4 5 6  dd < matrix(rnorm(100*5, rnorm(100)), nrow=100, ncol=5)
distanceMatrix(dd, 'pearson')
distanceMatrix(dd, 'euclid')
distanceMatrix(dd, 'sqrt')
distanceMatrix(dd, 'weird')
rm(dd) # cleanup

Loading required package: cluster
Loading required package: oompaBase
1 2 3 4
2 0.2012268
3 0.1889633 0.2482720
4 0.2012166 0.2556228 0.1926675
5 0.2143330 0.2216406 0.1631911 0.2450713
1 2 3 4
2 13.45239
3 13.44829 14.41575
4 14.38574 15.64331 14.09931
5 14.39902 13.82005 12.02163 15.88411
1 2 3 4
2 0.6343924
3 0.6147574 0.7046588
4 0.6343762 0.7150144 0.6207535
5 0.6547258 0.6657937 0.5712988 0.7001019
1 2 3 4
2 0.5916602
3 0.5525073 0.7233480
4 0.5827305 0.7330127 0.5697370
5 0.6160565 0.6504490 0.4790061 0.6994729
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.