Last data update: 2014.03.03

R: Kruskal's Non-metric Multidimensional Scaling
isoMDSR Documentation

Kruskal's Non-metric Multidimensional Scaling

Description

One form of non-metric multidimensional scaling

Usage

isoMDS(d, y = cmdscale(d, k), k = 2, maxit = 50, trace = TRUE,
       tol = 1e-3, p = 2)

Shepard(d, x, p = 2)

Arguments

d

distance structure of the form returned by dist, or a full, symmetric matrix. Data are assumed to be dissimilarities or relative distances, but must be positive except for self-distance. Both missing and infinite values are allowed.

y

An initial configuration. If none is supplied, cmdscale is used to provide the classical solution, unless there are missing or infinite dissimilarities.

k

The desired dimension for the solution, passed to cmdscale.

maxit

The maximum number of iterations.

trace

Logical for tracing optimization. Default TRUE.

tol

convergence tolerance.

p

Power for Minkowski distance in the configuration space.

x

A final configuration.

Details

This chooses a k-dimensional (default k = 2) configuration to minimize the stress, the square root of the ratio of the sum of squared differences between the input distances and those of the configuration to the sum of configuration distances squared. However, the input distances are allowed a monotonic transformation.

An iterative algorithm is used, which will usually converge in around 10 iterations. As this is necessarily an O(n^2) calculation, it is slow for large datasets. Further, since for the default p = 2 the configuration is only determined up to rotations and reflections (by convention the centroid is at the origin), the result can vary considerably from machine to machine.

Value

Two components:

points

A k-column vector of the fitted configuration.

stress

The final stress achieved (in percent).

Side Effects

If trace is true, the initial stress and the current stress are printed out every 5 iterations.

References

T. F. Cox and M. A. A. Cox (1994, 2001) Multidimensional Scaling. Chapman & Hall.

Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge University Press.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

cmdscale, sammon

Examples

swiss.x <- as.matrix(swiss[, -1])
swiss.dist <- dist(swiss.x)
swiss.mds <- isoMDS(swiss.dist)
plot(swiss.mds$points, type = "n")
text(swiss.mds$points, labels = as.character(1:nrow(swiss.x)))
swiss.sh <- Shepard(swiss.dist, swiss.mds$points)
plot(swiss.sh, pch = ".")
lines(swiss.sh$x, swiss.sh$yf, type = "S")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MASS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MASS/isoMDS.Rd_%03d_medium.png", width=480, height=480)
> ### Name: isoMDS
> ### Title: Kruskal's Non-metric Multidimensional Scaling
> ### Aliases: isoMDS Shepard
> ### Keywords: multivariate
> 
> ### ** Examples
> 
> swiss.x <- as.matrix(swiss[, -1])
> swiss.dist <- dist(swiss.x)
> swiss.mds <- isoMDS(swiss.dist)
initial  value 2.979731 
iter   5 value 2.431486
iter  10 value 2.343353
final  value 2.338839 
converged
> plot(swiss.mds$points, type = "n")
> text(swiss.mds$points, labels = as.character(1:nrow(swiss.x)))
> swiss.sh <- Shepard(swiss.dist, swiss.mds$points)
> plot(swiss.sh, pch = ".")
> lines(swiss.sh$x, swiss.sh$yf, type = "S")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>