View source: R/test_local_factors.R
test_local_factors | R Documentation |
local_factors()
, with additional flexibility.Test for the presence of local factors, as in local_factors()
, with additional flexibility.
test_local_factors(X, r, loadings = NULL)
X |
A (usually standardized) t by n matrix of observations. |
r |
An integer denoting the number of factors in X. |
loadings |
(optional) Matrix that represents a sparse basis of the loading space. |
Returns a list with the following components:
has_local_factors
Logical equal to TRUE
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 compare n_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).
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.