I have a SEM model that contains indicator variables some of which are connected to two latent variables. Due to the many variables, latent constructs and higher order factors, the built-in layouts: tree, tree2, circle, circle2, spring
do not produce acceptable and readable results.
The package semptools provides a function (set_sem_layout()) to set the layout (https://cran.r-project.org/web/packages/semptools/vignettes/quick_start_sem.html) but the indicator_factor matrix, which is a required argument, seems to expect exactly one factor for each indicator variable.
How can I define a custom layout if an indicator variable is connected to more factors? With a simple example I illustrate the question below:
fit_struct <- sem('f1 =~ NA*x1 + x2 + x3
f2 =~ NA*x3 + x4 + x5
#variance standardization
f1~~ 1*f1
f2~~ 1*f2
#regression
y ~ f1 + f2', data=df_struct_reg)
sem_o <- summary(fit_struct, standardized=TRUE, fit.measures=TRUE)
p <- semPaths(fit_struct, whatLabels="est",
sizeMan = 5.25,
node.width = 1,
edge.label.cex = .75,
style = "LISREL",
mar = c(5, 4, 4, 4),
layout = "tree",
width = 12, height = 15)
# Looking at node labels, order
semPaths(fit_struct, intercepts = F, nodeLabels = 1:6)
I would like a layout where x3 is connected to both f1 and f2. Indicator order I can specify, factor layout, too. How can I define an indicator_factor matrix that assigns x3 to f1 and f2?