Example programs and commands Multidimensional scaling with Isomap # All lines preceded by the "#" character are comments or output. # All other left-justified lines are my input ###################### Isomap in R ############ # # Isomap builds a graph from the data, connecting only nearby points # with edges. install.packages("vegan") # This contains "isomap()" library(vegan) ### Build the isomap graphs for 3 iris species data(iris); # Recall: 3 species, 50 plants each, 4-variate data # Isomap graphs, k=3 nearest neighbors by Euclidean distance y<-iris[iris$Species=="setosa",1:4] idist <- dist(y); imap<-isomap(idist,k=3); plot(imap) y<-iris[iris$Species=="versicolor",1:4] idist <- dist(y); imap<-isomap(idist,k=3); plot(imap) y<-iris[iris$Species=="virginica",1:4] idist <- dist(y); imap<-isomap(idist,k=3); plot(imap) %%%%%%%%%%%%%%%%%%%%% cmdscale() in Octave pkg load statistics D=zeros(8,8); for i=1:8 for j=1:8 D(i,j)=abs(i-j); end end Y=cmdscale(D)