Learn R Programming

Rdimtools (version 1.0.6)

do.mmds: Metric Multidimensional Scaling

Description

Metric MDS is a nonlinear method that is solved iteratively. We adopt a well-known SMACOF algorithm for updates with uniform weights over all pairwise distances after initializing the low-dimensional configuration via classical MDS.

Usage

do.mmds(
  X,
  ndim = 2,
  preprocess = c("null", "center", "scale", "cscale", "decorrelate", "whiten"),
  maxiter = 100,
  abstol = 1e-06
)

Arguments

X

an \((n\times p)\) matrix or data frame whose rows are observations and columns represent independent variables.

ndim

an integer-valued target dimension (default: 2).

preprocess

an option for preprocessing the data. Default is "null". See also aux.preprocess for more details.

maxiter

maximum number of iterations for metric MDS updates (default: 100).

abstol

stopping criterion for metric MDS iterations (default: 1e-6).

Value

a named list containing

Y

an \((n\times ndim)\) matrix whose rows are embedded observations.

trfinfo

a list containing information for out-of-sample prediction.

References

leeuw_applications_1977Rdimtools

borg_modern_2010Rdimtools

Examples

Run this code
# NOT RUN {
## load iris data
data(iris)
X     = as.matrix(iris[,1:4])
lab   = as.factor(iris[,5])

## compare with other methods
pca2d <- do.pca(X, ndim=2)
cmd2d <- do.mds(X, ndim=2)
mmd2d <- do.mmds(X, ndim=2)

## Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(pca2d$Y, col=lab, pch=19, main="PCA")
plot(cmd2d$Y, col=lab, pch=19, main="Classical MDS")
plot(mmd2d$Y, col=lab, pch=19, main="Metric MDS")
par(opar)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab