Learn R Programming

IMIFA (version 1.3.1)

Procrustes: Procrustes Transformation

Description

This function performs a Procrustes transformation on a matrix X to minimize the squared distance between X and another comparable matrix Xstar.

Usage

Procrustes(X, Xstar, translate = FALSE, dilate = FALSE, sumsq = FALSE)

Arguments

X

The matrix to be transformed.

Xstar

The target matrix.

translate

Logical value indicating whether X should be translated (defaults to FALSE).

dilate

Logical value indicating whether X should be dilated (defaults to FALSE).

sumsq

Logical value indicating whether the sum of squared differences between X and Xstar should be calculated and returned.

Value

A list containing:

X.new

The matrix that is the Procrustes transformed version of X.

R

The rotation matrix.

t

The translation vector (if isTRUE(translate)).

d

The scaling factor (is isTRUE(dilate)).

ss

The sum of squared differences (if isTRUE(sumsq)).

Details

R, tt, and d are chosen so that:

$$d \times \mathbf{X} \mathbf{R} + 1\hspace*{-3pt}1 \underline{t}^\top \approx X^\star$$

X.new is given by:

$$X_{\textrm{new}} = d \times \mathbf{X} \mathbf{R} + 1\hspace*{-3pt}1 \underline{t}^\top$$

References

Borg, I. and Groenen, P. J. F. (1997) Modern Multidimensional Scaling. Springer-Verlag, New York, pp. 340-342.

Examples

Run this code
# NOT RUN {
# Match two matrices, allowing translation and dilation
mat1     <- diag(rnorm(10))
mat2     <- 0.05 * matrix(rnorm(100), 10, 10) + mat1
proc     <- Procrustes(X=mat1, Xstar=mat2, translate=TRUE, dilate=TRUE, sumsq=TRUE)

# Extract the transformed matrix, rotation matrix, translation vector and scaling factor
mat_new  <- proc$X.new
mat_rot  <- proc$R
mat_t    <- proc$t
mat_d    <- proc$d

# Compare the sum of squared differences to a Procestean transformation with rotation only
mat_ss   <- proc$ss
mat_ss2  <- Procrustes(X=mat1, Xstar=mat2, sumsq=TRUE)$ss
# }

Run the code above in your browser using DataLab