This function generates population-level parameter matrices for simulation studies in partially confirmatory factor analysis (PCFA), bifactor models, and MTMM-type structures. This function constructs the true loading matrix, latent factor correlation matrix, and residual covariance matrix.
The function supports: - Multiple general factors Multiple specific (method) factors - Flexible loading magnitudes - Correlated general and/or specific factors - Optional sparse specific factor structure - Residual covariance structures - Identification constraints for CFA-type estimation
Integer. Number of general factors.
Integer. Number of items loading on each general factor.
Integer. Number of specific (group/testlet/method) factors.
Integer. Number of items loading on each specific factor.
Integer. Number of blocks used to evenly distribute specific-factor loadings across item clusters. When greater than 1, each specific factor is partitioned into multiple non-zero blocks. Useful for MTMM designs.
Numeric vector. Population loading values for general factors.
Numeric vector. Population loading values for specific factors.
Numeric. Cross-loading value.
Integer. Cross-loading per factor for specific factors.
Numeric. Correlation among general factors.
Numeric. Correlation among specific factors.
Integer. number of nonzero factor correlation for special factor. Controls sparsity of specific factor correlation (large value means dense). default= 999: full correlated
Integer. Random seed for reproducibility.
Numeric. Residual correlation strength.
Integer. Number of residual covariance elements within factor
Integer. Number of residual covariance elements between factor
A list containing:
Loading matrix.
Implied population correlation matrix.
Latent factor covariance matrix.
Diagonal residual variances (uniqueness terms).
Indicator matrix specifying which loadings are fixed to 1 for model identification (especially useful for non-standard CFA or MTMM estimation).
Residual covariance matrix (error covariance matrix).
If no general factor is desired (i.e., simple CFA), set the general factor component to zero. n_generals =0. The resulting structure corresponds to a standard multi-factor CFA model.
params <- sim_matrix(
n_generals = 1,
items_per_general = 6,
n_specifics = 2,
items_per_specific = 3
)
str(params)
#> List of 6
#> $ A : num [1:6, 1:3] 0.7 0.7 0.7 0.7 0.7 0.7 0.3 0.3 0.3 0 ...
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : chr [1:6] "item1" "item2" "item3" "item4" ...
#> .. ..$ : chr [1:3] "G1" "S1" "S2"
#> $ R : num [1:6, 1:6] 1 0.58 0.58 0.49 0.49 0.49 0.58 1 0.58 0.49 ...
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : chr [1:6] "item1" "item2" "item3" "item4" ...
#> .. ..$ : chr [1:6] "item1" "item2" "item3" "item4" ...
#> $ Phi : num [1:3, 1:3] 1 0 0 0 1 0 0 0 1
#> $ uniquenesses: Named num [1:6] 0.42 0.42 0.42 0.42 0.42 0.42
#> ..- attr(*, "names")= chr [1:6] "item1" "item2" "item3" "item4" ...
#> $ fixloading : num [1:6, 1:3] 0 1 0 0 0 0 1 0 0 0 ...
#> $ ecm : num [1:6, 1:6] 0.42 0 0 0 0 0 0 0.42 0 0 ...