[R] results from sammon()

Jari Oksanen jarioksa at sun3.oulu.fi
Wed Apr 20 16:21:43 CEST 2005


On Wed, 2005-04-20 at 12:35 +0200, Domenico Cozzetto wrote:
> Thanks for the attention paid to my rpoblem. Please find enclosed
> the matrix with my dissimilarities. This is the only case in
> which sammon(), from the MASS package, gives me this kind of problems.
> I'm using the implementation of sammon provided by the package MASS and the
> starting configuration is the default one.
> Here are the values for the other actual parameters
> niter = 100, trace = FALSE, magic = 0.2, tol = 1e-4
> 

Domenico,

I had a look at your dissimilarity matrix, and indeed, they gave all NaN
in sammon() of MASS. This is speculation: sammon() uses cmdscale to get
starting configuration, and cmdscale puts two points (20 and 21) at zero
distance from each other. Sammon scaling checks against zero
dissimilarities in input, put it seems that it doesn't check against
zero dissimilarities in starting configuration. Moving one point
slightly seems to solve your problem. In the following, diss is the
dissimilarity matrix you sent. The trick is to calculate the same
starting configuration that sammon() would use (y), but then move one of
the conflicting points slightly and give that as the starting
configuration:

> y <- cmdscale(diss)
> range(dist(y))
[1] 0.000000 1.443101
> y[21,] <- y[21,] + 0.01
> sam <- sammon(diss, y)
Initial stress        : 0.23260
stress after  10 iters: 0.09420, magic = 0.461
stress after  20 iters: 0.08072, magic = 0.500
stress after  30 iters: 0.07838, magic = 0.500
stress after  40 iters: 0.07754, magic = 0.500
stress after  50 iters: 0.07710, magic = 0.500
stress after  60 iters: 0.07681, magic = 0.500
stress after  70 iters: 0.07663, magic = 0.500
stress after  80 iters: 0.07653, magic = 0.500

cheers, jari oksanen
-- 
Jari Oksanen <jarioksa at sun3.oulu.fi>




More information about the R-help mailing list