Procrustes: Procrustean Similarity Transformations

Description Usage Arguments Details Value References Examples

View source: R/Procrustes.R

Description

Solves the Procrustean problem of fitting one (MDS) configuration (testee) to another (target) MDS configuration.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Procrustes(X, Y)

## S3 method for class 'procr'
plot(x, plot.type = "jointplot", plot.dim = c(1,2), main, xlab, ylab, 
                     xlim, ylim, asp = 1, pch = 20, col.X = "cadetblue", 
                     col.Y = "gray", col.Yhat = "coral1", 
                     label.conf = list(label = TRUE, pos = 3, cex = 0.8), 
                     arrows = TRUE, length = 0.10, 
                     legend = list(plot = TRUE, labels = c("Target", "Testee"), 
                                   pos = "bottomright"), ...) 

Arguments

X

Target configuration

Y

Testee configuration

x

Object of class procr

plot.type

Either "jointplot" or "transplot"

plot.dim

Vector with dimensions to be plotted.

main

Plot title.

xlab

Label of x-axis.

ylab

Label of y-axis.

xlim

Scale x-axis.

ylim

Scale y-axis.

pch

Plot symbol.

asp

Aspect ratio.

col.X

Color target configuration.

col.Y

Color testee configuration.

col.Yhat

Color transformed configuration.

label.conf

List with arguments for plotting the labels of the configurations in a configuration plot (logical value whether to plot labels or not, label position, label color).

length

length of the edges of the arrow head (in inches).

arrows

For "transplot" only, whether arrows should be plotted or not.

legend

List with arguments for plotting the legend.

...

Additional plot arguments.

Details

Y is going to be modified by finding an optimal dilation factor, an optimal translation and rotation for Y such that it is a similar as possible to X. X remains untouched.

Value

Returns an object of class procr with:

X

Input target configuration

Y

Input testee configuration

Yhat

Procrustes transformed (fitted) configuration

translation

Translation vector

dilation

Dilation factor

rotation

Rotation-reflection matrix

confdistX

Configuration distances X

confdistY

Configuration distances Y

confdistYhat

Configuration distances of fitted configuration

congcoef

Congruence coefficient

aliencoef

Alienation coefficient

pairdist

Pairwise object distances (sorted)

References

Borg, I., & Groenen, P. J. F. (2005). Modern Multidimensional Scaling (2nd ed.). Springer.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## 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)")))

Example output

Loading required package: plotrix

Call: Procrustes(X = fit.east$conf, Y = fit.west$conf)

Congruence coefficient: 0.965

Rotation matrix:
     D1    D2
D1 1.00 -0.01
D2 0.01  1.00

Translation vector: 0 0 
Dilation factor: 0.923 

Warning messages:
1: In plot.window(...) : "legend" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "legend" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :
  "legend" is not a graphical parameter
4: In axis(side = side, at = at, labels = labels, ...) :
  "legend" is not a graphical parameter
5: In box(...) : "legend" is not a graphical parameter
6: In title(...) : "legend" is not a graphical parameter

smacof documentation built on Feb. 11, 2021, 3 a.m.