View source: R/tests-factoranalysis.R
test_indep_factors | R Documentation |
The minors are estimated by grouping the data into independent subsets. Each group is used to form an unbiased estimate of all minors. The test statistic is the maximum of the average of the independent studentized estimates. A Gaussian multiplier bootstrap procedure is used to estimate the limiting distribution of the test statistic and to compute the p-value of the test.
test_indep_factors(X, factors = 2, E = 1000, random = FALSE, nr_minors = 10000)
X |
Matrix with observed data. The number of columns corresponds to the number of observed variables. Each row corresponds to one sample. |
factors |
Integer, number of latent factors |
E |
Integer, number of bootstrap iterations. |
random |
Logical. If TRUE, the minors are chosen randomly. If FALSE, all possible minors are tested. |
nr_minors |
Integer, number of randomly chosen minors that are tested. |
Named list with two entries: Test statistic (TSTAT
) and p-value (PVAL
).
# Covariance matrix corresponding to the two-factor analysis model
m=10
Gamma = matrix(stats::rnorm(2*m),m,2)
Psi = diag(rep(1,m))
cov = Psi + Gamma %*% t(Gamma)
# Sample data from the two-factor analysis model
X = MASS::mvrnorm(500, mu=rep(0,nrow(cov)), Sigma=cov)
# Apply the test
test_indep_factors(X, random=TRUE, nr_minors=100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.