Learn R Programming

EFA.dimensions (version 0.1.8.8)

ESEM: Exploratory Structural Equation Modeling

Description

An easy-to-use function for exploratory structural equation measurement models via lavaan

Usage

ESEM(data, Nfactors = NULL, extraction = 'ml', rotation = 'geominT',  
     corkind = 'pearson', anchors = NULL, estimator = 'ML', delta = .01, 
     ordered = FALSE, target = NULL, target_keys = NULL, verbose = TRUE)

Value

A list with the loadings, the anchors, and the esem_model output.

Arguments

data

A dataframe with the variables (and no other variables).
Example: data = data_RSE

Nfactors

The number of factors to extract. If not specified, then the EMPKC function will be used to determine the number of factors.

extraction

The factor extraction method for the analysis. The options are 'ml' (the default), 'paf', 'image', 'minres', 'uls', 'ols', 'wls', 'gls', 'alpha', and 'fullinfo'.

rotation

The factor rotation method for the analysis.
The orthogonal rotation options are: 'varimax' (the default), 'quartimax', 'bentlerT', 'equamax', 'geominT', 'bigeominT', 'bifactorT', 'entropy', and 'none'.
The oblique rotation options are: 'promax' (the default), 'quartimin', 'oblimin', 'oblimax', 'simplimax', 'bentlerQ', 'geominQ', 'bigeominQ', 'bifactorQ', and 'none'.

corkind

The kind of correlation matrix to be used if data is not a correlation matrix. The options are 'pearson' (the default), 'kendall', 'spearman', 'gamma', and 'polychoric'.

anchors

(optional) The names of the anchor variables in data, if any.
Example: anchors = c('v1', 'v5', 'v8')

estimator

The name of the lavaan estimator to be used in the analyses.
The options for basic estimators (continuous data) are ML, GLS, WLS, DWLS, ULS, DLS, and PML.
The options for robust estimators are MLM, MLMVS, MLMV, MLF, MLR, WLSM, WLSMVS, WLSMV, ULSM, ULSMVS, and ULSMV.
Example: estimator = 'ML'

delta

When rotation = 'geominQ' or 'geominT', delta is a tuning parameter for the geomin criterion. It acts as a small constant that is added to prevent mathematical problems when a factor loading is exactly zero. Delta is sometimes referred to as 'epsilon'.

ordered

(optional) Set ordered = TRUE for ordered, categorical data (e.g., binary or Likert scale responses). The default is FALSE, for continuous data.

target

(optional) A target loading matrix to be used instead of a data-driven EFA loading matrix.

target_keys

(optional) A vector of numbers that will be used to create a target loading matrix (instead of using the above "target" argument). The length of target_keys should be equal to the number of variables in data. Each value in target_keys indicates the factor that the ith variable should be free to load on. For example, c(2, 1, 3) would indicate that the first variable loads on the second factor, the second variable loads on the first factor, and the third variable loads on the third factor. The target matrix that is generated by target_keys will have 'NA' for all of the loading variables, which indicates that the actual loadings should be estimated in the analyses. All other elements in the created target will be zeros.
Example: target_keys = c(1, 1, 2, 1, 2, 1, 1, 2, 2, 2)

verbose

(optional) Should detailed results be displayed in console?
TRUE (default) or FALSE

Author

Brian P. O'Connor

Details

This function is for lavaan measurement models and not for structural models.

The function can be run with just a single line of code, as in

ESEM(data=data_RSE, Nfactors = 2)

or

ESEM(data=data_RSE, target_keys = c(1, 1, 2, 1, 2, 1, 1, 2, 2, 2))

Inside the function, there are two broad steps in the analyses: preparing ESEM model code, and then running the lavaan cfa function (Rosseel, 2012) using the prepared ESEM model code.

It is the ESEM model code that distinguishes ESEM from a regular CFA. In a typical CFA, an equation is written for each latent variable specifying the items or variables that load onto each latent variable. Cross-loadings are usually not provided or are not possible in CFA. In ESEM, longer, more elaborate equations for each latent variable are created. These equations contain coefficients/loadings for every item/variable on each latent variable. The coefficients come from either a preliminary exploratory factor analysis or from a specific target loading matrix.

The preliminary exploratory factor analysis approach is empirically driven. The extraction method is usually ML, or a robust version of ML. The rotation method is usually oblique geomin, which has an epsilon value that researchers can adjust to reduce the size of cross-loadings and factor correlations. Morin (2023) recommended using a delta (sometimes called epsilon) value of .5 to maximally reduce factor correlations, which in turn helps to obtain more accurate estimates of relations between constructs. The ESEM function in this package uses ML as the default factor extraction method and geominT (oblique) as the default rotation method.

The target loading matrix approach is more deliberately guided by the researcher's theoretical assumptions or perhaps by a prior factor model for the data. "When using a target rotation, researchers are able to specify the main indicators for each construct, allowing these loadings to be freely estimated, but 'targeting' all cross-loadings to be as close to zero as possible while allowing them to be freely estimated. When based on a target rotation procedure, ESEM can be considered a fundamentally confirmatory method" (Swami et al., 2023, p. 7). For the ESEM function in this package, simply use the "target" argument, or the "target_keys"" argument, to provide a target loading matrix. The function will then use the GPArotation package to conduct a targeted rotation of the EFA loadings instead of using geomin rotation.

When either target or target_keys are provided, then rotation must be either 'targetQ' (oblique) or 'targetT' (orthogonal).

The preliminary exploratory factor analysis approach and the target loading matrix approach both produce a rotated loading matrix. The ESEM function identifies the highest loading item/variable on each factor and uses these items as anchors in the subsequent CFA. The rotated loadings for non-anchor variables, in contrast, are treated as starting-point loadings in the CFA. The automatic anchor-finding method is by-passed if anchor variables are provided by the user on the "anchors" argument.

References

Afolabi, K. & Konold, T. R. (2024). The circle of methods for evaluating latent variable measurement models: EFA, CFA, and ESEM. Practical Assessment, Research, and Evaluation, 29, Article 15

Morin, A. J. (2023). Exploratory structural equation modeling. In R. Hoyle (Ed.), Handbook of structural equation modeling (2nd ed.). Guilford.

Prokofieva, M., Zarate, D., Parker, A., Palikara, O., & Stavropoulos, V. (2023). Exploratory structural equation modeling: A streamlined step by step approach using the R Project software. BMC Psychiatry, 23(1), Article 546. https://doi.org/10.1186/s12888-023-05028-9

Rosseel, Y. (2012). lavaan: An R package for structural equation modeling. Journal of Statistical Software, 48, 136.

Swami, V., Maano, C., & Morin, A. J. S. (2023). A guide to exploratory structural equation modeling (ESEM) and bifactor-ESEM in body image research. Body Image, 47, Article 101641. https://doi.org/10.1016/j.bodyim.2023.101641

Examples

Run this code
ESEM(data=data_RSE, Nfactors = 2)
# \donttest{
# creating and using a target loading matrix for the ESEM
F1_target <- c(NA, NA, 0, NA, 0, NA, NA, 0, 0, 0)
F2_target <- c(0, 0, NA, 0, NA, 0, 0, NA, NA, NA)
RSE_target <- cbind(F1_target, F2_target)
rownames(RSE_target) <- names(data_RSE)
RSE_target

ESEM(data=data_RSE, target = RSE_target) 

# more simply: use target_keys to create a target loading matrix for the ESEM
ESEM(data=data_RSE, target_keys = c(1, 1, 2, 1, 2, 1, 1, 2, 2, 2)) 
# }

Run the code above in your browser using DataLab