[R] how to create initial configuraton for isoMDS

LiLi (Z) Li.NJ.Li at huawei.com
Mon Apr 25 20:09:50 CEST 2016


I'm trying to use isoMDS to project a directed graph to 2-dim vectors, but I got an error.

#here is the code to create the graph using igraph package and run isoMDS on it.
g<-make_graph(c(1,2, 2,3, 2,4, 3,4, 4,5, 5,6, 3,6, 1,6, 2,5),directed=TRUE)
dist<-distances(g, mode="out")

# below is content of the dist matrix
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    0    1    2    2    2    1
[2,]  Inf    0    1    1    1    2
[3,]  Inf  Inf    0    1    2    1
[4,]  Inf  Inf  Inf    0    1    2
[5,]  Inf  Inf  Inf  Inf    0    1
[6,]  Inf  Inf  Inf  Inf  Inf    0

# and here is the error message:
Error in isoMDS(dist) :
  an initial configuration must be supplied with NA/Infs in 'd'

It appears that isoMDS doesn't like the "Inf" values in the dist matrix, although help(isoMDS) suggests it accepts them if proper initial configuration is provided:

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.


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


The desired dimension for the solution, passed to cmdscale.

My questions is: how do I provide the y argument for this example to work?
Any help and suggestion is appreciated.

	[[alternative HTML version deleted]]

More information about the R-help mailing list