Procrustes: Procrustes Transformation

View source: R/FullConditionals.R

ProcrustesR Documentation

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.

Details

R, tt, and d are chosen so that:

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

X.new is given by:

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

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)).

Note

X is padded out with columns containing 0 if it has fewer columns than Xstar.

References

Borg, I. and Groenen, P. J. F. (1997) Modern Multidimensional Scaling: Theory and Applications. Springer Series in Statistics. New York, NY, USA: Springer-Verlag, pp. 340-342.

Examples

# 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 Procrustean transformation with rotation only
mat_ss   <- proc$ss
mat_ss2  <- Procrustes(X=mat1, Xstar=mat2, sumsq=TRUE)$ss

Keefe-Murphy/IMIFA documentation built on Jan. 31, 2024, 2:15 p.m.