Test for the presence of local factors, as in local_factors(), with additional flexibility.
Source: R/test_local_factors.R
test_local_factors.RdTest for the presence of local factors, as in local_factors(), with additional flexibility.
Value
Returns a list with the following components:
has_local_factorsLogical equal toTRUEif local factors are present.n_smallInteger denoting the number of small loadings in sparse rotation.gamma_nInteger denoting the critical value to comparen_smallto.h_nNumber denoting the cutoff used to determine which loadings are small.loadingsMatrix that is the rotation of the loadings that produces the smallest l1-norm (if not supplied).
Examples
# Minimal example with 2 factors, where X is a 224 by 207 matrix
r <- 2
M <- nrow(example_data)
n <- ncol(example_data)
# Find minimum rotation
rotation_result <- find_local_factors(X = example_data, r)
# Test if sparse basis has local factors
test_result <- test_local_factors(
X = example_data,
r = r,
loadings = rotation_result$rotated_loadings
)
test_result$has_local_factors
#> [1] TRUE