Go back

library(efast)
library(corrplot)
options(width = 70)
data("roi_volume")
efast_hemi_fit <- readRDS("efast_fit.rds")

A wider array of residual structures is available using the more general efast() function. Just as in the hemisphere models, the residual structure in the general function is represented as residual covariances between the observed variables. For example, we can use the Holzinger & Swineford (1939) data to run an exploratory factor analysis with residual covariances between the x4 and x7 variables and the x5 and x9 variables:

res_struct <- list(
 c("x4", "x7"),
 c("x5", "x9")
)
fit <- efast(
  data    = lavaan::HolzingerSwineford1939[,7:15], 
  M       = 3, 
  rstruct = res_struct
)
summary(fit)

The lavaan syntax of any model from the efast package is available as a component of the fitted model (fit@external$syntax). This means that any EFAST model can be easily extended with further variables. An example in the case of the hemisphere model from the previous tutorials could be predicting participant phenotype on the basis of the estimated factors. This extension would amount to adding the following line to the current example model syntax:

phenotype_variable ~ F1 + F2 + F3 + F4 + F5 + F6

The extended model can then be fitted by a call to the fitting function from the lavaan package:

lavaan(
  model          = extended_model, 
  data           = raw_data, 
  auto.fix.first = FALSE, 
  auto.var       = TRUE, 
  auto.efa       = TRUE, 
  information    = "observed", 
  std.ov         = TRUE
)

By adding this extension, lavaan will in one step find those factors that best explain the covariance between brain regions and the phenotype of interest, reasonably similar to the idea of PLS regression. In this way, the EFAST model can serve as a starting point for an ESEM with structural parameters.

Full syntax

Below is the full syntax for the the fitted EFAST model on the brain imaging data from both hemispheres, with 6 latent factors and a symmetry structure. Within this syntax, the efast package adds additional constraints to aid in convergence of the parameters. In addition, syntax is added for the lateralization indices.

cat(efast_hemi_fit@external$syntax)


vankesteren/efast documentation built on March 5, 2024, 9:41 p.m.