Test for the presence of local factors, as in local_factors()
, with additional flexibility.
Source: R/test_local_factors.R
test_local_factors.Rd
Test for the presence of local factors, as in local_factors()
, with additional flexibility.
Value
Returns a list with the following components:
has_local_factors
Logical equal toTRUE
if local factors are present.n_small
Integer denoting the number of small loadings in sparse rotation.gamma_n
Integer denoting the critical value to comparen_small
to.h_n
Number denoting the cutoff used to determine which loadings are small.loadings
Matrix 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