View source: R/FullConditionals.R
| Procrustes | R Documentation | 
This function performs a Procrustes transformation on a matrix X to minimize the squared distance between X and another comparable matrix Xstar.
Procrustes(X,
           Xstar,
           translate = FALSE,
           dilate = FALSE,
           sumsq = FALSE)
| X | The matrix to be transformed. | 
| Xstar | The target matrix. | 
| translate | Logical value indicating whether  | 
| dilate | Logical value indicating whether  | 
| sumsq | Logical value indicating whether the sum of squared differences between  | 
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
A list containing:
| X.new | The matrix that is the Procrustes transformed version of  | 
| R | The rotation matrix. | 
| t | The translation vector (if  | 
| d | The scaling factor (is  | 
| ss | The sum of squared differences (if  | 
X is padded out with columns containing 0 if it has fewer columns than Xstar.
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.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.