| Title: | Resistant Procrustes Methods for Multivariate Data |
|---|---|
| Description: | Provides resistant alternatives to the standard Procrustes analysis for comparing multivariate datasets, including seven resistant Procrustean methods and their associated permutation tests, as well as the standard Procrustes analysis and its permutation tests. Methods are based on Tang and Jackson (2026) "Improving and evaluating resistant alternatives to Procrustes analysis for multivariate dataset matching" <doi:10.1002/env.70073>. |
| Authors: | Xiaozhuo Tang [aut, cre] |
| Maintainer: | Xiaozhuo Tang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-10-11 10:49:17 UTC |
| Source: | https://github.com/cran/ResistantProcrustes |
Biweight Method Permutation Test Performs a permutation test for the Biweight method.
Biweight_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)Biweight_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the Biweight method. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
Huber Method Permutation Test Performs a permutation test for the Huber method.
Huber_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)Huber_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the Huber method. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
The Improved Least Median of Squares (ILMS) Permutation Test Performs a permutation test for the ILMS method.
ILMS_permute( P_mat, Q_mat, P_N, S0, nR = 0, s_l_LMS = 1e-09, s_u_LMS = 10, verbose = FALSE )ILMS_permute( P_mat, Q_mat, P_N, S0, nR = 0, s_l_LMS = 1e-09, s_u_LMS = 10, verbose = FALSE )
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the ILMS method. |
nR |
Number of randomly sampled subsets. If |
s_l_LMS |
Lower bound for the scale s. |
s_u_LMS |
Upper bound for the scale s. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
P_mat <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) Q_mat <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) result_ILMS <- LMS_LTS_estimator(P_mat,Q_mat,nR=0,s_l_LMS=0.000000001,s_u_LMS=10) S0 <- result_ILMS$s P_N <- 10 permute_fit <- ILMS_permute(P_mat,Q_mat,P_N,S0,nR=0,s_l_LMS=0.000000001,s_u_LMS=10)P_mat <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) Q_mat <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) result_ILMS <- LMS_LTS_estimator(P_mat,Q_mat,nR=0,s_l_LMS=0.000000001,s_u_LMS=10) S0 <- result_ILMS$s P_N <- 10 permute_fit <- ILMS_permute(P_mat,Q_mat,P_N,S0,nR=0,s_l_LMS=0.000000001,s_u_LMS=10)
Least median of squares (LMS) method Align two matrices using the LMS.
LMS_estimator(X1, X2, nR, s_l_LMS = 1e-09, s_u_LMS = 10)LMS_estimator(X1, X2, nR, s_l_LMS = 1e-09, s_u_LMS = 10)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
nR |
Number of randomly sampled subsets. |
s_l_LMS |
Lower bound for the scale s. |
s_u_LMS |
Upper bound for the scale s. |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1,and scale s.
Improved Least median of squares (ILMS) method Align two matrices using the ILMS.
LMS_LTS_estimator(X1, X2, nR = 0, s_l_LMS = 1e-09, s_u_LMS = 10)LMS_LTS_estimator(X1, X2, nR = 0, s_l_LMS = 1e-09, s_u_LMS = 10)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
nR |
Number of randomly sampled subsets. |
s_l_LMS |
Lower bound for the scale s. |
s_u_LMS |
Upper bound for the scale s. |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1,and scale s.
X1 <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) X2 <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) fit <- LMS_LTS_estimator(X1,X2,nR=0,s_l_LMS=0.000000001,s_u_LMS=10)X1 <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) X2 <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) fit <- LMS_LTS_estimator(X1,X2,nR=0,s_l_LMS=0.000000001,s_u_LMS=10)
The Least Median of Squares (LMS) Permutation Test Performs a permutation test for the LMS method.
LMS_permute( P_mat, Q_mat, P_N, S0, nR = 0, s_l_LMS = 1e-09, s_u_LMS = 10, verbose = FALSE )LMS_permute( P_mat, Q_mat, P_N, S0, nR = 0, s_l_LMS = 1e-09, s_u_LMS = 10, verbose = FALSE )
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the LMS method. |
nR |
Number of randomly sampled subsets. If |
s_l_LMS |
Lower bound for the scale s. |
s_u_LMS |
Upper bound for the scale s. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
Least trimmed squares (LTS) method Align two matrices using the ILMS.
LTS_estimator(X1, X2, nR)LTS_estimator(X1, X2, nR)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
nR |
Number of randomly sampled subsets. |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1, and least trimmed squares.
The Least Trimmed Squares (LTS) Permutation Test Performs a permutation test for the LTS method.
LTS_permute(P_mat, Q_mat, P_N, S0, nR = 0, verbose = FALSE)LTS_permute(P_mat, Q_mat, P_N, S0, nR = 0, verbose = FALSE)
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the LTS method. |
nR |
Number of randomly sampled subsets. If |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
Huber and Biweight methods Align two matrices using the Huber and Biweight loss functions via iterative majorization.
majorization(X1, X2, tuning_con, loss)majorization(X1, X2, tuning_con, loss)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
tuning_con |
Tuning constant beyond which the resistant loss functions become flat. |
loss |
Specifies the loss function to use: |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1, weight matrix, objective function value, and convergence.
Huber and Biweight Methods with Automatic Tuning Constant Selection Align two matrices using Huber or biweight loss functions via iterative majorization, with automatic selection of the tuning constant.
majorization_tuned(X1, X2, loss)majorization_tuned(X1, X2, loss)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
loss |
Specifies the loss function to use: |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1, weight matrix, objective function value, and convergence.
Repeated Median Method without reflection Align two matrices using repeated median method that cannot deal with reflection
MM2_estimator_no_reflection(X1, X2)MM2_estimator_no_reflection(X1, X2)
X1 |
This matrix is fixed during the transformation |
X2 |
This matrix is transformed to fit the other matrix |
A list containing rotation matrix,scaling,translation of matrix X1, translation of matrix X2, objective function, and sum of square value
Repeated Median Method with reflection Align two matrices using the repeated median method while allowing for reflection. This method is recommended for practical applications where reflected configurations may occur.
MM2_estimator_with_reflection(X1, X2)MM2_estimator_with_reflection(X1, X2)
X1 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
X2 |
A matrix representing the configuration to be transformed to best align with X1. |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1 and X2, objective function value, and the sum of squared errors.
Repeated Median Method Permutation Test Performs a permutation test for the repeated median method.
MM2_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)MM2_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)
P_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
Q_mat |
A matrix representing the configuration to be transformed to
best align with |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the repeated median method. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
The standard Procrustes analysis Align two matrices using Procrustes analysis
Procrustes_fun(X1, X2)Procrustes_fun(X1, X2)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1, and the sum of square values.
X1 <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) X2 <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) fit <- Procrustes_fun(X1,X2)X1 <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) X2 <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) fit <- Procrustes_fun(X1,X2)
Standard Procrustes Analysis Permutation Test Performs a permutation test for the standard Procrustes analysis.
Procrustes_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)Procrustes_permute(P_mat, Q_mat, P_N, S0, verbose = FALSE)
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the Procrustes analysis. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |
P_mat <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) Q_mat <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) result_Procrustes <- Procrustes_fun(P_mat,Q_mat) S0 <- result_Procrustes$s P_N <- 10 permute_fit <- Procrustes_permute(P_mat,Q_mat,P_N,S0)P_mat <- matrix(c( 0.3068822, -1.24752606, -2.1150143, 4.24520347, 0.5271354, 1.64468795, -0.1264126, -0.08113392, -1.4749896, -2.26016700, -0.2347269, -1.27047483, -0.4833630, 1.43158341, -2.3499156, 0.85892382, -2.1021129, 0.40267502, 0.5812934, -0.57210742, 0.7397990, 1.54898604, -1.2173015, -0.65486036, -0.6093984, -1.16937177, 0.3833907, -0.72611343, -0.8423056, 1.22427834 ), ncol = 2, byrow = TRUE) Q_mat <- matrix(c( 1.96990726, -1.67860936, 1.16952104, -3.19996198, -1.64680983, 3.40009837, 1.51340633, 0.90762220, 6.02678651, -1.29463718, 2.56525182, -0.70441947, 0.08388971, 3.87254957, 4.11361309, 4.77780158, -0.91329668, 0.01870814, 0.73714253, -0.50391759, -1.60842305, 3.07780435, 3.90039741, 1.29926458, 3.31127451, -0.28114418, 0.85909201, -0.86365691, 1.52112556, 4.02668249 ), ncol = 2, byrow = TRUE) result_Procrustes <- Procrustes_fun(P_mat,Q_mat) S0 <- result_Procrustes$s P_N <- 10 permute_fit <- Procrustes_permute(P_mat,Q_mat,P_N,S0)
S-estimator method Align two matrices using the S-estimator.
S_estimator(X1, X2, c_value, A_value, nR, s_l = 1e-09, s_u = 10)S_estimator(X1, X2, c_value, A_value, nR, s_l = 1e-09, s_u = 10)
X1 |
A matrix representing the configuration to be transformed to best align with X2. |
X2 |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
c_value |
It controls where the loss function begins to flatten. |
A_value |
It is a normalization constant used in the S-estimator defining equation. |
nR |
Number of randomly sampled subsets. |
s_l |
Lower bound for the scale s. |
s_u |
Upper bound for the scale s. |
A list containing the estimated rotation matrix, scaling factor,translation vectors for X1,and scale s.
S-estimator Permutation Test Performs a permutation test for the S-estimator method.
S_permute( P_mat, Q_mat, P_N, S0, nR = 0, s_l = 1e-09, s_u = 10, verbose = FALSE )S_permute( P_mat, Q_mat, P_N, S0, nR = 0, s_l = 1e-09, s_u = 10, verbose = FALSE )
P_mat |
A matrix representing the configuration to be transformed to best align with Q_mat. |
Q_mat |
A matrix representing the fixed configuration that remains unchanged during the transformation. |
P_N |
Number of permutations. |
S0 |
Observed objective function value from the S-estimator method. |
nR |
Number of randomly sampled subsets. If |
s_l |
Lower bound for the scale s. |
s_u |
Upper bound for the scale s. |
verbose |
Logical; if |
A list containing:
count_n |
The number of permuted objective function values less than or equal to the observed value. |
p_value |
The permutation test p-value. |
S |
A vector of objective function values obtained from the permutations. |