help mdsmat dialog: mdsmat
also see: mds postestimation
-------------------------------------------------------------------------------
Title
[MV] mdsmat -- Multidimensional scaling of proximity data in a matrix
Syntax
mdsmat matname [, options]
options description
-------------------------------------------------------------------------
Model
method(method) method for performing MDS
loss(loss) loss function
transform(tfunction) permitted transformations of dissimilarities
normalize(norm) normalization method; default is
normalize(principal)
names(namelist) variable names corresponding to row and
column names of the matrix; required with
all but shape(full)
shape(full) matname is a square symmetric matrix; the
default
shape(lower) matname is a vector with the rowwise lower
triangle (with diagonal)
shape(llower) matname is a vector with the rowwise strictly
lower triangle (no diagonal)
shape(upper) matname is a vector with the rowwise upper
triangle (with diagonal)
shape(uupper) matname is a vector with the rowwise strictly
upper triangle (no diagonal)
s2d(standard) convert similarity to dissimilarity:
dissim(ij) = sqrt(sim(ii)+sim(jj)-2sim(ij))
s2d(oneminus) convert similarity to dissimilarity:
dissim(ij) = 1-sim(ij)
Model 2
dimension(#) configuration dimensions; default is
dimension(2)
force fix problems in proximity information
addconstant make distance matrix positive semidefinite
(classical MDS only)
weight(matname) specifies a weight matrix with the same shape
as the proximity matrix
Reporting
neigen(#) maximum number of eigenvalues to display;
default is neigen(10) (classical MDS only)
config display table with configuration coordinates
noplot suppress configuration plot
Minimization
initialize(initopt) start with configuration given in initopt
tolerance(#) tolerance for configuration matrix; default
is tolerance(1e-4)
ltolerance(#) tolerance for loss criterion; default is
ltolerance(1e-8)
iterate(#) perform maximum of # iterations; default is
iterate(1000)
protect(#) perform # optimizations and report best
solution; default is protect(1)
nolog suppress the iteration log
trace display current configuration in iteration
log
gradient display current gradient matrix in iteration
log
+ sdprotect(#) advanced; see description below
-------------------------------------------------------------------------
See [MV] mds postestimation for features available after estimation.
method description
-------------------------------------------------------------------------
classical classical MDS; default if neither loss() nor transform()
is specified
modern modern MDS; default if loss() or transform() is
specified; except when loss(stress) and
transform(monotonic) are specified
nonmetric nonmetric (modern) MDS; default when loss(stress) and
transform(monotonic) are specified
-------------------------------------------------------------------------
loss description
-------------------------------------------------------------------------
stress stress criterion, normalized by distances; the default
nstress stress criterion, normalized by disparities
sstress squared stress criterion, normalized by distances
nsstress squared stress criterion, normalized by disparities
strain strain criterion (with transform(identity) is equivalent
to classical MDS)
sammon Sammon mapping
-------------------------------------------------------------------------
tfunction description
-------------------------------------------------------------------------
identity no transformation; disparity = dissimilarity; the
default
power power alpha: disparity = dissimilarity^alpha
monotonic weakly monotonic increasing functions (nonmetric
scaling); only with loss(stress)
-------------------------------------------------------------------------
norm description
-------------------------------------------------------------------------
principal principal orientation; location=0; the
default
classical Procrustes rotation toward classical solution
target(matname)[, copy] Procrustes rotation toward matname; ignore
naming conflicts if copy is specified
-------------------------------------------------------------------------
initopt description
-------------------------------------------------------------------------
classical start with classical solution; the default
random[(#)] start at random configuration, setting seed
to #
from(matname)[, copy] start from matname; ignore naming conflicts
if copy is specified
-------------------------------------------------------------------------
Menu
Statistics > Multivariate analysis > Multidimensional scaling (MDS) > MDS
of proximity matrix
Description
mdsmat performs multidimensional scaling (MDS) for two-way proximity data
with an explicit measure of similarity or dissimilarity between objects,
where the proximities are found in matrix matname. mdsmat performs
classical metric MDS as well as modern metric and nonmetric MDS; see the
loss() and transform() options.
If your proximities are stored as variables in long format, see [MV]
mdslong. If you are looking for MDS on a dataset on the basis of
dissimilarities between observations over variables, see [MV] mds.
Computing the classical solution is straightforward, but with modern MDS
the minimization of the loss criteria over configurations is a
high-dimensional problem that is easily beset by convergence to local
minimums. mds, mdsmat, and mdslong provide options to control the
minimization process (1) by allowing the user to select the starting
configuration and (2) by selecting the best solution among multiple
minimization runs from random starting configurations.
Options
+-------+
----+ Model +------------------------------------------------------------
method(method) specifies the method for MDS.
method(classical) specifies classical metric scaling, also known as
"principal coordinates analysis" when used with Euclidean
proximities. Classical MDS obtains equivalent results to modern
MDS with loss(strain) and transform(identity) without weights.
The calculations for classical MDS are fast; consequently,
classical MDS is generally used to obtain starting values for
modern MDS. If the options loss() and transform() are not
specified, mds computes the classical solution, likewise if
method(classical) is specified loss() and transform() are not
allowed.
method(modern) specifies modern scaling. If method(modern) is
specified but not loss() or transform(), then loss(stress) and
transform(identity) are assumed. All values of loss() and
transform() are valid with method(modern).
method(nonmetric) specifies nonmetric scaling, which is a type of
modern scaling. If method(nonmetric) is specified, loss(stress)
and transform(monotonic) are assumed. Other values of loss() and
transform() are not allowed.
loss(loss) specifies the loss criterion.
loss(stress) specifies that the stress loss function be used,
normalized by the squared Euclidean distances. This criterion is
often called Kruskal's stress-1. Optimal configurations for
loss(stress) and for loss(nstress) are equivalent up to a scale
factor, but the iteration paths may differ. loss(stress) is the
default.
loss(nstress) specifies that the stress loss function be used,
normalized by the squared disparities, i.e., transformed
dissimilarities. Optimal configurations for loss(stress) and for
loss(nstress) are equivalent up to a scale factor, but the
iteration paths may differ.
loss(sstress) specifies that the squared stress loss function be
used, normalized by the fourth power of the Euclidean distances.
loss(nsstress) specifies that the squared stress criterion,
normalized by the fourth power of the disparities (transformed
dissimilarities) be used.
loss(strain) specifies the strain loss criterion. Classical scaling
is equivalent to loss(strain) and transform(identity) but is
computed by a faster noniterative algorithm. Specifying
loss(strain) still allows transformations.
loss(sammon) specifies the Sammon (1969) loss criterion.
transform(tfunction) specifies the class of allowed transformations of
the dissimilarities; transformed dissimilarities are called
disparities.
transform(identity) specifies that the only allowed transformation is
the identity; i.e., disparities are equal to dissimilarities.
transform(identity) is the default.
transform(power) specifies that disparities are related to the
dissimilarities by a power function,
disparity = dissimilarity^alpha, alpha>0
transform(monotonic) specifies that the disparities are a weakly
monotonic function of the dissimilarities. This is also known as
nonmetric MDS. Tied dissimilarities are handled by the primary
method; i.e., ties may be broken but are not necessarily broken.
transform(monotonic) is valid only with loss(stress).
normalize(norm) specifies a normalization method for the configuration.
Recall that the location and orientation of an MDS configuration is
not defined ("identified"); an isometric transformation (i.e.,
translation, reflection, or orthonormal rotation) of a configuration
preserves interpoint Euclidean distances.
normalize(principal) performs a principal normalization, in which the
configuration columns have zero mean and correspond to the
principal components, with positive coefficient for the
observation with lowest value of id(). normalize(principal) is
the default.
normalize(classical) normalizes by a distance-preserving Procrustean
transformation of the configuration toward the classical
configuration in principal normalization; see [MV] procrustes.
normalize(classical) is not valid if method(classical) is
specified.
normalize(target(matname) [, copy]) normalizes by a
distance-preserving Procrustean transformation toward matname;
see [MV] procrustes. matname should be an n x p matrix, where n
is the number of observations and p is the number of dimensions,
and the rows of matname should be ordered with respect to id().
The rownames of matname should be set correctly but will be
ignored if copy is also specified.
Note on normalize(classical) and normalize(target()): the Procrustes
transformation comprises any combination of translation, reflection,
and orthonormal rotation -- these transformations preserve distance.
Dilation (uniform scaling) would stretch distances and is not
applied. However, the output reports the dilation factor, and the
reported Procrustes statistic is for the dilated configuration.
names(namelist) is required with all but shape(full). The number of
names should equal the number of rows (and columns) of the full
similarity or dissimilarity matrix, and should not contain
duplicates.
shape(shape) specifies the storage mode of the existing similarity or
dissimilarity matrix matname. The following storage modes are
allowed:
full specifies that matname is a symmetric n x n matrix.
lower specifies that matname is a row or column vector of length
n(n+1)/2, with the rowwise lower triangle of the similarity or
dissimilarity matrix including the diagonal.
D(11) D(21) D(22) D(31) D(32) D(33) ... D(n1) D(n2) ... D(nn)
llower specifies that matname is a row or column vector of length
n(n-1)/2, with the rowwise lower triangle of the similarity or
dissimilarity matrix excluding the diagonal.
D(21) D(31) D(32) D(41) D(42) D(43) ... D(n1) D(n2) ...
D(nn-1)
upper specifies that matname is a row or column vector of length
n(n+1)/2, with the rowwise upper triangle of the similarity or
dissimilarity matrix including the diagonal.
D(11) D(12) ... D(1n) D(22) D(23) ... D(2n) D(33) D(34) ...
D(3n) ... D(nn)
uupper specifies that matname is a row or column vector of length
n(n-1)/2, with the rowwise upper triangle of the similarity or
dissimilarity matrix excluding the diagonal.
D(12) D(13) ... D(1n) D(23) D(24) ... D(2n) D(34) D(35) ...
D(3n) ... D(n-1n)
s2d(standard|oneminus) specifies how similarities are converted into
dissimilarities. By default, the command assumes dissimilarity data.
Specifying s2d() indicates that your proximity data are similarities.
Dissimilarity data should have zeros on the diagonal (i.e., an object
is identical to itself) and nonnegative off-diagonal values.
Dissimilarities need not satisfy the triangular inequality, D(i,j)^2
< D(i,h)^2 + D(h,j)^2. Similarity data should have ones on the
diagonal (i.e., an object is identical to itself) and have
off-diagonal values between zero and one. In either case,
proximities should be symmetric. See option force if your data
violate these assumptions.
The available s2d() options, standard and oneminus, are defined as
follows:
standard dissim(ij) = sqrt(sim(ii)+sim(jj)-2sim(ij)) =
sqrt(2(1-sim(ij)))
oneminus dissim(ij) = 1-sim(ij)
s2d(standard) is the default.
s2d() should be specified only with measures in similarity form.
+---------+
----+ Model 2 +----------------------------------------------------------
dimension(#) specifies the dimension of the approximating configuration.
# defaults to 2 and should not exceed the number of positive
eigenvalues of the centered distance matrix.
force corrects problems with the supplied proximity and weight
information. force specifies that the dissimilarity matrix is to be
symmetrized; the mean of D(i,j) and D(j,i) is used. Also, problems
on the diagonal (similarities: D(i,i)!= 1; dissimilarities:
D(i,i)!=0) are fixed. force does not fix missing values or out of
range values (i.e., D(i,j)<0; or similarities with D(i,j)>1).
Analogously, force symmetrizes the weight matrix.
addconstant, specifies that if the double-centered distance matrix is not
positive semidefinite (psd), a constant should be added to the
squared distances to make it psd, and, hence, Euclidean.
weight(matname) specifies a symmetric weight matrix with the same shape
as the proximity matrix; i.e., if shape(lower) is specified, the
weight matrix must have this shape. Weights should be nonnegative.
Missing weights are assumed to be 0. Weights must also be
irreducible; i.e., it is not possible to split the objects into
disjointed groups with all intergroup weights 0. weight() is not
allowed with method(classical), but see loss(strain).
+-----------+
----+ Reporting +--------------------------------------------------------
neigen(#) specifies the number of eigenvalues to be included in the
table. The default is neigen(10). Specifying neigen(0) suppresses
the table. This option is allowed with classical MDS only.
config displays the table with the coordinates of the approximating
configuration. This table may also be displayed using the
postestimation command estat config; see [MV] mds postestimation.
noplot suppresses the graph of the approximating configuration. The
graph can still be produced later via mdsconfig, which also allows
the standard graphics options for fine tuning the plot; see [MV] mds
postestimation.
+--------------+
----+ Minimization +-----------------------------------------------------
These options are available only with method(modern) or
method(nonmetric):
initialize(initopt) specifies the initial values of the criterion
minimization process.
initialize(classical), the default, uses the solution from classical
metric scaling as initial values. With protect(), all but the
first run start from random perturbations from the classical
solution. These random perturbations are independent and
normally distributed with standard error equal to the product of
sdprotect(#) and the standard deviation of the dissimilarities.
initialize(classical) is the default.
initialize(random) starts an optimization process from a random
starting configuration. These random configurations are
generated from independent normal distributions with standard
error equal to the product of sdprotect(#) and the standard
deviation of the dissimilarities. The means of the configuration
are irrelevant in MDS.
initialize(from(matname) [, copy]) sets the initial value to matname.
matname should be an n x p matrix, where n is the number of
observations and p is the number of dimensions, and the rows of
matname should be ordered with respect to id(). The rownames of
matname should be set correctly but will be ignored if copy is
specified. With protect(), the second-to-last runs start from
random perturbations from matname. These random perturbations
are independent normal distributed with standard error equal to
the product of sdprotect(#) and the standard deviation of the
dissimilarities.
tolerance(#) specifies the tolerance for the configuration matrix. When
the relative change in the configuration from one iteration to the
next is less than or equal to tolerance(), the tolerance()
convergence criterion is satisfied. The default is tolerance(1e-4).
ltolerance(#) specifies the tolerance for the fit criterion. When the
relative change in the fit criterion from one iteration to the next
is less than or equal to ltolerance(), the ltolerance() convergence
is satisfied. The default is ltolerance(1e-8).
Both the tolerance() and ltolerance() criteria must be satisfied for
convergence.
iterate(#) specifies the maximum number of iterations. The default is
iterate(1000).
protect(#) requests that # optimizations be performed and that the best
of the solutions be reported. The default is protect(1). See option
initialize() on starting values of the runs. The output contains a
table of the return code, the criterion value reached, and the seed
of the random number used to generate the starting value. Specifying
a large number, such as protect(50), provides reasonable insight
whether the solution found is a global minimum and not just a local
minimum.
If any of the options log, trace, or gradient is also specified,
iteration reports will be printed for each optimization run. Beware:
this option will produce a lot of output.
nolog suppresses the iteration log, showing the progress of the
minimization process.
trace displays the configuration matrices in the iteration report.
Beware: this option may produce a lot of output.
gradient displays the gradient matrices of the fit criterion in the
iteration report. Beware: this option may produce a lot of output.
Remarks
The purpose of multidimensional scaling (MDS) is to produce a
representation of a dissimilarity relation between a set of n objects by
Euclidean distances between a constructed configuration of points in a
low-dimensional Euclidean space, typically two-dimensional. If this
low-dimensional representation offers a good enough approximation, we may
plot the points in this low-dimensional space and interpret the
(Euclidean, straight line) distance between the points as the
dissimilarity between the original objects. Points mapped close together
are similar; points mapped widely apart are dissimilar.
mdsmat performs MDS on a similarity or dissimilarity matrix matname. You
may enter the matrix as a symmetric square matrix or as a vector (matrix
with one row or column) with only the upper or lower triangle; see option
shape() for details. A dissimilarity matrix has 0 diagonal elements and
nonnegative off-diagonal elements. A similarity matrix has 1s at the
diagonal and off-diagonal elements in the range [0,1]. If you provide a
square matrix (i.e., shape(full)), names of the objects are obtained from
the matrix row and column names. The row names should all be distinct,
and the column names should equal the row names. Equation names, if any,
are ignored. In any of the vectorized shapes, names are specified with
option names(), and the matrix row and column names are ignored.
See option force if your matrix violates these assumptions.
Modern MDS allows missing values by zero weights; if you specify a
proximity matrix matname with missing values, but no weight matrix, an
appropriate weight matrix is automatically generated. With classical
MDS, matname should not contain missing values, and weight() is not
allowed.
When you have multiple independent measures of the dissimilarities, you
may specify the mean of these dissimilarities as the combined measure and
specify 1/#measures or 1/variance(measures) as weights. For more
discussion of using weights in MDS, we refer to Borg and Groenen (2005,
sec. 11.3).
Examples
A famous example in the MDS literature is the data on the percentage of
times that pairs of Morse code signals for two numbers (1,..,9,0) were
declared the same by 598 subjects. We enter the lower triangle of the
data matrix, excluding the diagonal. This is called the llower shape
(notice the extra "l" to tell it apart from lower that includes the
diagonal). For clarity, we enter each row on a separate line; we could
have typed the numbers as one long row as well.
. matrix input Morse = ( ///
62 ///
16 59 ///
6 23 38 ///
12 8 27 56 ///
12 14 33 34 30 ///
20 25 17 24 18 65 ///
37 25 16 13 10 22 65 ///
57 28 9 7 5 8 31 58 ///
52 18 9 7 5 18 15 39 79 )
These are proximity data in similarity format, but in the range [0,100]
rather than [0,1] as required by mdsmat.
. matrix Morse = 0.01 * Morse
Classical MDS
. mdsmat Morse, shape(llower) s2d(st) names(1 2 3 4 5 6 7 8 9 0)
Modern MDS
. mdsmat Morse, shape(llower) s2d(st) names(1 2 3 4 5 6 7 8 9 0)
method(modern)
(note: loss(stress) and transform(identity) are assumed)
. mdsmat Morse, shape(llower) s2d(st) names(1 2 3 4 5 6 7 8 9 0)
loss(sstress)
Nonmetric MDS
. mdsmat Morse, shape(llower) s2d(st) names(1 2 3 4 5 6 7 8 9 0)
loss(stress) transform(monotonic)
Saved results
mdsmat saves the following in e():
Scalars
e(N) number of underlying observations
e(p) number of dimensions in the approximating
configuration
e(np) number of strictly positive eigenvalues
e(addcons) constant added to squared dissimilarities to force
positive semidefiniteness
e(mardia1) Mardia measure 1
e(mardia2) Mardia measure 2
e(critval) Loss criterion value
e(wsum) sum of weights
e(alpha) parameter of transform(power)
e(ic) iteration count
e(rc) return code
e(converged) 1 if converged, 0 otherwise
Macros
e(cmd) mdsmat
e(cmdline) command as typed
e(method) classical or modern MDS method
e(method2) nonmetric if method(nonmetric)
e(loss) loss criterion
e(losstitle) description loss criterion
e(dmatrix) name of analyzed matrix
e(tfunction) identity, power, or monotonic, transformation
function(C-)
e(transftitle) description of transformation
e(mxlen) maximum length of category labels
e(dtype) similarity or dissimilarity; type of proximity data
e(s2d) standard or oneminus (when e(dtype) is similarity)
e(unique) 1 if eigenvalues are distinct, 0 otherwise
e(init) initialization method
e(iseed) seed for init(random)
e(seed) seed for solution
e(norm) normalization method
e(targetmatrix) name of target matrix for normalize(target)
e(properties) nob noV for modern or nonmetric MDS; nob noV eigen
for classical MDS
e(estat_cmd) program used to implement estat
e(predict) program used to implement predict
e(marginsnotok) predictions disallowed by margins
Matrices
e(D) dissimilarity matrix
e(Disparities) disparity matrix for nonmetric MDS
e(Y) approximating configuration coordinates
e(Ev) eigenvalues
e(W) weight matrix
e(norm_stats) normalization statistics
e(linearf) two element vector defining the linear
transformation; distance equals first element
plus second element times dissimilarity
References
Borg, I., and P. J. F. Groenen. 2005. Modern Multidimensional Scaling:
Theory and Applications. 2nd ed. New York: Springer.
Sammon Jr., J. W. 1969. A nonlinear mapping for data structure analysis.
IEEE Transactions on Computers 18: 401-409.
Also see
Manual: [MV] mdsmat
Help: [MV] mds postestimation;
[MV] mds, [MV] mdslong; [MV] biplot, [MV] ca, [MV] factor, [MV]
pca