Title: | Exploratory Factor Analysis with Structured Residuals |
---|---|
Description: | Create and estimate EFA and EFA with structured residuals (EFAST) models using structural equation modeling. |
Authors: | Erik-Jan van Kesteren |
Maintainer: | Erik-Jan van Kesteren <[email protected]> |
License: | GPL-3 |
Version: | 0.6.3 |
Built: | 2024-11-14 05:44:57 UTC |
Source: | https://github.com/vankesteren/efast |
This function is a thin wrapper around corrplot
cplot( mat, tl.pos = "n", cl.pos = "n", method = "square", addgrid.col = NA, ... )
cplot( mat, tl.pos = "n", cl.pos = "n", method = "square", addgrid.col = NA, ... )
mat |
<matrix> or <list<matrix>> the matrix or list of matrices to be displayed. |
tl.pos |
<string> text label position, see corrplot::corrplot() |
cl.pos |
<string> color label position, see corrplot::corrplot() |
method |
<string> drawing method, see corrplot::corrplot() |
addgrid.col |
<string> grid colour see corrplot::corrplot() |
... |
other arguments passed to corrplot::corrplot() |
Get correlation matrix decomposition
decomposition(fit)
decomposition(fit)
fit |
an efast model |
The decomposition returns four components: the observed correlation matrix, the factor-implied covaraiance, the residual variance, and the structural covariance matrix. You can plot these matrices using corrplot.
This function estimates efa models with residual covariance.
efast( data, M, rstruct, sample.nobs = NULL, auto.fix.first = FALSE, auto.var = TRUE, auto.efa = TRUE, information = "observed", std.ov = TRUE, ... )
efast( data, M, rstruct, sample.nobs = NULL, auto.fix.first = FALSE, auto.var = TRUE, auto.efa = TRUE, information = "observed", std.ov = TRUE, ... )
data |
<data.frame> the dataset or <matrix> covariance matrix |
M |
<numeric> How many factors, minimum 2 |
rstruct |
<list> residual structure (see details) |
sample.nobs |
<numeric> sample size (if data = covmat, see lavaan) |
auto.fix.first |
<bool> see lavaan |
auto.var |
<bool> see lavaan |
auto.efa |
<bool> see lavaan |
information |
<character> see lavaan |
std.ov |
<bool> see lavaan |
... |
other arguments passed to lavaan |
Residual structure (in the form of residual covariances) can be added to the EFA through a list of pairs of variable names. See the example for more information.
## Not run: # Use a lavaan test dataset test_data <- lavaan::HolzingerSwineford1939[,7:15] # create an EFA model test_efa <- efast(test_data, 3) # create a (simple) residual structure res_struct <- list( c("x4", "x7"), c("x5", "x9") ) # create an efast model test_efast <- efast(test_data, 3, res_struct) compare the models lavaan::lavTestLRT(test_efa, test_efast) ## End(Not run)
## Not run: # Use a lavaan test dataset test_data <- lavaan::HolzingerSwineford1939[,7:15] # create an EFA model test_efa <- efast(test_data, 3) # create a (simple) residual structure res_struct <- list( c("x4", "x7"), c("x5", "x9") ) # create an efast model test_efast <- efast(test_data, 3, res_struct) compare the models lavaan::lavTestLRT(test_efa, test_efast) ## End(Not run)
This function estimates efa models in the same way that efast models are estimated: using lavaan.
efast_efa( data, M, sample.nobs = NULL, auto.fix.first = FALSE, auto.var = TRUE, auto.efa = TRUE, information = "observed", std.ov = TRUE, ... )
efast_efa( data, M, sample.nobs = NULL, auto.fix.first = FALSE, auto.var = TRUE, auto.efa = TRUE, information = "observed", std.ov = TRUE, ... )
data |
<data.frame> the dataset or <matrix> covariance matrix |
M |
<numeric> How many factors, minimum 2 |
sample.nobs |
<numeric> sample size (if data = covmat, see lavaan) |
auto.fix.first |
<bool> see lavaan |
auto.var |
<bool> see lavaan |
auto.efa |
<bool> see lavaan |
information |
<character> see lavaan |
std.ov |
<bool> see lavaan |
... |
other arguments passed to lavaan |
The constrained model constrains the residual covariance to be equal across the different ROIs.
## Not run: # create a test dataset test_data <- simulate_efast() fit_efa <- efast_efa(simdat, M = 4) summary(fit_efa) ## End(Not run)
## Not run: # create a test dataset test_data <- simulate_efast() fit_efa <- efast_efa(simdat, M = 4) summary(fit_efa) ## End(Not run)
This function estimates efast models with covariance due to hemispheric symmetry.
efast_hemi( data, M, lh_idx, rh_idx, roi_names, constrain = FALSE, sample.nobs = NULL, auto.fix.first = FALSE, auto.var = TRUE, auto.efa = TRUE, information = "observed", std.ov = TRUE, ... )
efast_hemi( data, M, lh_idx, rh_idx, roi_names, constrain = FALSE, sample.nobs = NULL, auto.fix.first = FALSE, auto.var = TRUE, auto.efa = TRUE, information = "observed", std.ov = TRUE, ... )
data |
<data.frame> the dataset or <matrix> covariance matrix |
M |
<numeric> How many factors, minimum 2 |
lh_idx |
<numeric> column numbers of left hemisphere variables |
rh_idx |
<numeric> column numbers of right hemisphere variables |
roi_names |
<character> optional names of rois |
constrain |
<bool> whether to constrain the symmetry (see details) |
sample.nobs |
<numeric> sample size (if data = covmat, see lavaan) |
auto.fix.first |
<bool> see lavaan |
auto.var |
<bool> see lavaan |
auto.efa |
<bool> see lavaan |
information |
<character> see lavaan |
std.ov |
<bool> see lavaan |
... |
other arguments passed to lavaan |
The constrained model constrains the residual covariance to be equal across the different ROIs.
## Not run: # create a test dataset test_data <- simulate_efast() fit_efast <- efast_hemi(test_data, M = 4, 1:17, 18:34) summary(fit_efast) ## End(Not run)
## Not run: # create a test dataset test_data <- simulate_efast() fit_efast <- efast_hemi(test_data, M = 4, 1:17, 18:34) summary(fit_efast) ## End(Not run)
Get loadings
efast_loadings(fit, symmetry = FALSE)
efast_loadings(fit, symmetry = FALSE)
fit |
efa or efast model |
symmetry |
whether to display the left and right hemisphere loadings side-by-side |
Check whether an object is an efast model
is_efast(x)
is_efast(x)
x |
any object |
Check whether an object is an efast-efa model
is_efast_efa(x)
is_efast_efa(x)
x |
any object |
Check whether an object is an efast-hemi model
is_efast_hemi(x)
is_efast_hemi(x)
x |
any object |
The lateralization index (LI) is calculated as (sum of the uniquenesses for the contralateral homologues) / (total residual variance after accounting for the exploratory factors). Thus, if there is no symmetry at all, the LI is 1, and if all the residual variance is explained by symmetry, the LI is 0.
lateralization(fit)
lateralization(fit)
fit |
an efast model |
parameter estimates table of lateralization per ROI
This data has been synthesised on the basis of real-world data from the Cam-CAN cohort. It contains 68 grey matter volume measurements (34 LH and 34 RH ROIs) for 647 participants.
data(roi_volume)
data(roi_volume)
A data frame with 647 rows and 68 columns
Simulate a dataset as in the simulations of Van Kesteren & Kievit (2019). There are 17 regions of interest, measured in both the left and right hemisphere. These ROIs have a predefined amount of correlation over and above that expected by only the underlying factors.
simulate_efast( N = 650L, lam_lat = 0.595, lam_bil = 0.7, psi_cov = 0.5, cor_uniq = 0.4 )
simulate_efast( N = 650L, lam_lat = 0.595, lam_bil = 0.7, psi_cov = 0.5, cor_uniq = 0.4 )
N |
<int> Sample size |
lam_lat |
<numeric> factor loading for the lateralised factor |
lam_bil |
<numeric> factor loading for the bilateral factors |
psi_cov |
<numeric> covariances of latent variables in (0, 1) |
cor_uniq |
<numeric> residual correlation |
data frame with 17 regions of interest, bilaterally measured with 4 underlying factors and contralateral homology.
Van Kesteren, E. J., & Kievit, R. K. (2019) Exploratory factor analysis with structured residuals applied to brain morphology.