mmds: Metric (classical) Multidimensional Scaling (a.k.a Principal...

View source: R/mmds.R

mmdsR Documentation

Metric (classical) Multidimensional Scaling (a.k.a Principal Coordinate Analysis) of a (squared Euclidean) Distance Matrix.

Description

mmds: Perform a Metric Multidimensional Scaling (MMDS) of an (squared Euclidean) distance matrix measured between a set of objects (with or without masses).

Usage

mmds(DistanceMatrix, masses = NULL)

Arguments

DistanceMatrix

A squared (assumed to be Euclidean) distance matrix

masses

A vector of masses (i.e., a set of non-negative numbers with a sum of 1) of same dimensionality as the number of rows of DistanceMatrix.

Details

mmds gives factor scores that make it possible to draw a map of the objects such that the distances between objects on the map best approximate the original distances between objects.

Value

Sends back a list

LeF

factor scores for the objects.

eigenvalues

the eigenvalues for the factor scores (i.e., a variance).

tau

the percentage of explained variance by each dimension.

Contributions

give the proportion of explained variance by an object for a dimension.

Method

MMDS transform the squared Euclidean distance matrix into a (double centered) covariance-like matrix which is then analyzed via its eigen-decomposition. The factor scores of each dimension are scaled such that their variance (i.e., the sum of their weighted squared factor scores) is equal to the eigen-value of the corresponding dimension. Note that if the masses vector is absent, equal masses (i.e., 1 divided by number of objects) are used.

Technicalities

the distance matrix to be analyzed is supposed to be a squared Euclidean distance matrix. Note also that a non Euclidean distance matrix will have negative eigenvalues that will be ignored by mmds which, therefore, gives the best Euclidean approximation to this non-Euclidean distance matrix (note that, non-metric MDS maybe a better method in these cases).

Author(s)

Herve Abdi

References

The procedure and references are detailed in: Abdi, H. (2007). Metric multidimensional scaling. In N.J. Salkind (Ed.): Encyclopedia of Measurement and Statistics. Thousand Oaks (CA): Sage. pp. 598–605.

(Paper available from https://personal.utdallas.edu/~herve/).

See Also

GraphDistatisCompromise distatis

Examples


# An example of MDS from Abdi (2007)
# Discriminability of Brain States
# Table 1.
# 1. Get the distance matrix
D <- matrix(c(
0.00, 3.47, 1.79, 3.00, 2.67, 2.58, 2.22, 3.08,
3.47, 0.00, 3.39, 2.18, 2.86, 2.69, 2.89, 2.62,
1.79, 3.39, 0.00, 2.18, 2.34, 2.09, 2.31, 2.88,
3.00, 2.18, 2.18, 0.00, 1.73, 1.55, 1.23, 2.07,
2.67, 2.86, 2.34, 1.73, 0.00, 1.44, 1.29, 2.38,
2.58, 2.69, 2.09, 1.55, 1.44, 0.00, 1.19, 2.15,
2.22, 2.89, 2.31, 1.23, 1.29, 1.19, 0.00, 2.07,
3.08, 2.62, 2.88, 2.07, 2.38, 2.15, 2.07, 0.00),
ncol = 8, byrow=TRUE)
rownames(D) <- c('Face','House','Cat','Chair','Shoe','Scissors','Bottle','Scramble')
colnames(D) <- rownames(D)
# 2. Call mmds
BrainRes <- mmds(D)
# Note that compared to Abdi (2007)
# the factor scores of mmds are equal to F / sqrt(nrow(D))
# the eigenvalues of mmds are equal to \Lambda *{1/nrow(D)}
# (ie., the normalization differs but the results are proportional)
# 3. Now a pretty plot with the prettyPlot function from prettyGraphs
prettyGraphs::prettyPlot(BrainRes$FactorScore,
           display_names = TRUE,
           display_points = TRUE,
           contributionCircles = TRUE,
           contributions = BrainRes$Contributions)
# 4. et Voila!

DistatisR documentation built on Dec. 5, 2022, 9:05 a.m.