find_local_factors {l1rotation} | R Documentation |
Find the rotation of the loading matrix with the smallest l1-norm, as in local_factors()
, with additional flexibility.
Description
Find the most sparse rotation of an orthonormal basis of the loading space of a t by n matrix X. Additional flexibility with the initial_loadings
argument allows the user to specify any orthonormal basis rather than defaulting to PCA.
Usage
find_local_factors(X, r, initial_loadings, parallel = FALSE, n_cores = NULL)
Arguments
X |
A (usually standardized) t by n matrix of observations. |
r |
An integer denoting the number of factors in X. |
initial_loadings |
Matrix that represents an orthonormal basis of the loading space. If not supplied, PCA is used by default in this function and also in |
parallel |
A logical denoting whether the algorithm should be run in parallel. |
n_cores |
An integer denoting how many cores should be used, if parallel == TRUE. |
Value
Returns a list with the following components:
-
initial_loadings
Principal Component estimate of the loading matrix (if not supplied). -
rotated_loadings
Matrix that is the rotation of the loading matrix that produces the smallest l1-norm. -
rotation_diagnostics
A list containing 3 components:-
R
Rotation matrix that when used to rotateinitial_loadings
produces the smallest l1-norm. -
l1_norm
Vector of lengthr
containing the value of the l1 norm each solution generates. -
sol_frequency
Vector of lengthr
containing the frequency in the initial grid of each solution.
-
Examples
# Minimal example with 2 factors, where X is a 224 by 207 matrix
r <- 2
M <- nrow(example_data)
n <- ncol(example_data)
# Compute PCA estimates
basis <- svd(example_data / sqrt(M), nu = M, nv = n)
initial_loadings <- sqrt(n) * basis$v[, 1:r]
# Find minimum rotation using orthonormal basis initial_loadings
rotation_result <- find_local_factors(X = example_data, r = r, initial_loadings = initial_loadings)