Skip to contents

Given two matrices of factors (true and estimated), find the rotation that minimizes the Frobenius norm of the difference between the true factors and rotated estimate.

Usage

min_norm(f_true, f_hat, single_trait_thresh = 0.98, return_Q = FALSE)

Arguments

f_true

Matrix of true factors (M x K1)

f_hat

Matrix of estimated factors (M x K2)

single_trait_thresh

Threshold to identify single trait factors. A factor is considered a single trait factor if the maximum absolute value of its entries is greater than this threshold after normalizing the factor to have unit norm. Single trait factors are removed from both f_true and f_hat before matching. Default is 0.98.

return_Q

Logical. If TRUE, return the optimal rotation matrix.

Value

A list with the following elements:

solution

A data frame with the following columns:

  • true_ix: Index of the true factor

  • est_ix: Index of the matching estimated factor

  • max_true_val: Maximum absolute value of the true factor

  • max_hat_val: Maximum absolute value of the estimated factor

  • penalty: The squared Frobenius norm penalty for the matched pair

  • match_score: The matching score (absolute inner product) for the matched pair

frob_n

The Frobenius norm of the difference between the best matching factors.

Q

(optional) The optimal matching matrix. Returned if return_Q = TRUE.

best_est

(optional) The best matching estimated factors. Returned if return_Q = TRUE.

best_true

(optional) The true factors corresponding to the best matching. Returned if return_Q = TRUE.