Perform the following steps to perform multidimensional scaling using the metric method:
- First, you can perform metric MDS with a maximum of two dimensions:
> swiss.dist =dist(swiss) > swiss.mds = cmdscale(swiss.dist, k=2)
- You can then plot the swiss data in a two-dimension scatter plot:
> plot(swiss.mds[,1], swiss.mds[,2], type = "n", main = "cmdscale (stats)") > text(swiss.mds[,1], swiss.mds[,2], rownames(swiss), cex = 0.9, xpd = TRUE)
- In addition, you can perform nonmetric MDS with isoMDS:
> library(MASS) > swiss.nmmds = isoMDS(swiss.dist, k=2) initial value 2.979731 ...