Uses the factor loadings matrix, presumably from an exploratory factor analysis, to generate lavaan compatible confirmatory factory analysis syntax.
Usage
efa_cfa_syntax(
loadings,
simple = TRUE,
min.loading = NA,
single.item = c("keep", "drop", "none"),
identified = TRUE,
constrain0 = FALSE
)Arguments
- loadings
matrix of factor loadings
- simple
logical; Should the perfect simple structure be returned (default) when converting EFA results to CFA syntax? If
FALSE, items can cross-load on multiple factors.- min.loading
numeric between 0 and 1 indicating the minimum (absolute) value of the loading for a variable on a factor when converting EFA results to CFA syntax. Must be specified when
simple = FALSE.- single.item
character indicating how single-item factors should be treated. Use
"keep"(default) to keep them in the model when generating the CFA syntax,"drop"to remove them, or"none"indicating the CFA syntax should not be generated for this model and""is returned.- identified
logical; Should identification check for rotational uniqueness a la Millsap (2001) be performed? If the model is not identified
""is returned.- constrain0
logical; Should variable(s) with all loadings below
min.loadingstill be included in model syntax? IfTRUE, variable(s) will load onto first factor with the loading constrained to 0.
References
Millsap, R. E. (2001). When trivial constraints are not trivial: The choice of uniqueness constraints in confirmatory factor analysis. *Structural Equation Modeling, 8*(1), 1-17. doi:10.1207/S15328007SEM0801_1
Examples
loadings <- matrix(c(rep(.2, 3), rep(.6, 3), rep(.8, 3), rep(.3, 3)), ncol = 2)
# simple structure
efa_cfa_syntax(loadings)
#> [1] "f1 =~ v4 + v5 + v6\nf2 =~ v1 + v2 + v3"
# allow cross-loadings and check if model is identified
efa_cfa_syntax(loadings, simple = FALSE, min.loading = .25)
#> [1] ""
# allow cross-loadings and ignore identification check
efa_cfa_syntax(loadings, simple = FALSE, min.loading = .25, identified = FALSE)
#> [1] "f1 =~ v4 + v5 + v6\nf2 =~ v1 + v2 + v3 + v4 + v5 + v6"