## artificial example:
X <- matrix(c(1, -1, -1, 1, 2, 2, -2, -2), ncol = 2)
Y <- matrix(c(0.07, 0.93, 1.93, 1.07, 2.62, 3.12, 1.38, 0.88), ncol = 2)
op <- par(mfrow = c(1,2))
plot(X[,1], X[,2], xlim = c(-3, 3), ylim = c(-2, 3.5), asp = 1, xlab = "", ylab = "")
rect(-1, -2, 1, 2)
points(Y[,1], Y[,2], xlim = c(-3, 3), col = "gray")
polygon(Y[,1], Y[,2], border = "gray")
fitp <- Procrustes(X, Y)
plot(fitp$Yhat[,1], fitp$Yhat[,2], col = "red", xlim = c(-3, 3), ylim = c(-2, 3.5),
asp = 1, xlab = "", ylab = "")
polygon(fitp$Yhat[,1], fitp$Yhat[,2], border = "red")
par(op)
## MDS example:
eastD <- sim2diss(EW_eng$east)
attr(eastD, "Labels") <- abbreviate(attr(eastD, "Labels"))
fit.east <- mds(eastD, type = "ordinal")
westD <- sim2diss(EW_eng$west)
attr(westD, "Labels") <- abbreviate(attr(westD, "Labels"))
fit.west <- mds(westD, type = "ordinal", init = torgerson(eastD))
fit.proc <- Procrustes(fit.east$conf, fit.west$conf)
fit.proc
## Configuration plots; Procrustes plots.
plot(fit.east, main = "MDS East Germany") ## MDS plot East Germany
plot(fit.west, main = "MDS West Germany") ## MDS plot West Germany
## Procrustes configurations (X and Yhat)
plot(fit.proc, ylim = c(-1, 1), col.X = "cadetblue", col.Yhat = "brown", pch = 19,
legend = list(pos = "topleft", labels = c("East Germany", "West Germany")))
## Procrustes transformations (Y and Yhat)
plot(fit.proc, plot.type = "transplot", length = 0.05, ylim = c(-1,1),
legend = list(pos = "bottomright",
labels = c("West Germany (untransformed)", "West Germany (transformed)")))
Run the code above in your browser using DataLab