test_indep_factors: Tests the (m+1)x(m+1)-minor constraints of an m-factor model...

View source: R/tests-factoranalysis.R

test_indep_factorsR Documentation

Tests the (m+1)x(m+1)-minor constraints of an m-factor model by the maximum of a high-dimensional independent sum

Description

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.

Usage

test_indep_factors(X, factors = 2, E = 1000, random = FALSE, nr_minors = 10000)

Arguments

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.

Value

Named list with two entries: Test statistic (TSTAT) and p-value (PVAL).

Examples

# 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)

NilsSturma/TestGGM documentation built on June 30, 2023, 3:09 p.m.