Multi-dimensional scaling (MDS)

# plot Oregon climate stations
library(maptools)
library(RColorBrewer)
attach(orstationc)

# outlines of Oregon counties (lines)
orotl.shp <- readShapeLines(file.choose(),
     proj4string=CRS("+proj=longlat"))

# plot station names
plot(orotl.shp)
#points(lon, lat, pch=3)
text(lon, lat, labels=as.character(station), cex=.6)

The plot generated above is a conventional map, where the points (stations) are located by their absolute coordinates.  The next display uses only the distances among points to determine the positions of the points relative to one another.

# multidimensional scaling of Oregon climate station data
# example -- latitude and longitude
X <- as.matrix(orstationc[,2:3])
X.scal <- cmdscale(dist(X), k=2, eig=T)
X.scal$points[,1] <- -X.scal$points[,1]
#X.scal$points[,2] <- -X.scal$points[,2]
plot(X.scal$points, type="n")
text(X.scal$points, labels = station, cex=.6)

The next display uses the relative positions of the stations in "climate space" as measured by Euclidian distances between pairs of points.

# multidimensional scaling of Oregon climate station data
# now with climate variables not locations
X <- as.matrix(orstationc[,5:10])
X.scal <- cmdscale(dist(X), k=2, eig=T)
X.scal$points[,1] <- -X.scal$points[,1]
X.scal$points[,2] <- -X.scal$points[,2]
plot(X.scal$points, type="n")
text(X.scal$points, labels = station, cex=.6)

Here's an example of an MDS analysis of the Midwestern pollen data:

# multidimensional scaling of Midwestern pollen data
X <- as.matrix(midwtf2[,7:21])
X.scal <- cmdscale(dist(X), k=2, eig=T)
X.scal$points[,2] <- -X.scal$points[,2]
plot(X.scal$points, type="n")
text(X.scal$points, labels = (format(signif(midwtf2$latitude,digits=3))),
    cex=.6)
plot(X.scal$points, type="n")
text(X.scal$points, labels = (format(signif(midwtf2$longitud,digits=3))),
    cex=.6)