Learn R Programming

EGAnet (version 1.2.3)

EGA.fit: EGA Optimal Model Fit using the Total Entropy Fit Index (tefi)

Description

Estimates the best fitting model using EGA. The number of steps in the cluster_walktrap detection algorithm is varied and unique community solutions are compared using tefi.

Usage

EGA.fit(
  data,
  n = NULL,
  uni.method = c("expand", "LE"),
  corr = c("cor_auto", "pearson", "spearman"),
  model = c("glasso", "TMFG"),
  algorithm = c("leiden", "walktrap"),
  algorithm.args = list(steps = c(3:8), resolution_parameter = seq(0, 2, 0.001))
)

Value

Returns a list containing:

EGA

The EGA output for the best fitting model

steps

The number of steps used in the best fitting model from the cluster_walktrap algorithm

resolution_parameter

The resolution parameter used in the best fitting model from the cluster_leiden algorithm

EntropyFit

The tefi Index for the unique solutions given the range of steps (vector names represent the number of steps)

Lowest.EntropyFit

The lowest value for the tefi Index

Arguments

data

Matrix or data frame. Dataset or correlation matrix

n

Integer. Sample size (if the data provided is a correlation matrix)

uni.method

Character. What unidimensionality method should be used? Defaults to "LE". Current options are:

  • expand Expands the correlation matrix with four variables correlated .50. If number of dimension returns 2 or less in check, then the data are unidimensional; otherwise, regular EGA with no matrix expansion is used. This is the method used in the Golino et al. (2020) Psychological Methods simulation.

  • LE Applies the leading eigenvalue algorithm (cluster_leading_eigen) on the empirical correlation matrix. If the number of dimensions is 1, then the leading eigenvalue solution is used; otherwise, regular EGA is used. This is the final method used in the Christensen, Garrido, and Golino (2021) simulation.

corr

Type of correlation matrix to compute. The default uses cor_auto. Current options are:

  • cor_auto Computes the correlation matrix using the cor_auto function from qgraph.

  • pearson Computes Pearson's correlation coefficient using the pairwise complete observations via the cor function.

  • spearman Computes Spearman's correlation coefficient using the pairwise complete observations via the cor function.

model

Character. A string indicating the method to use. Defaults to "glasso"

Current options are:

  • "glasso" Estimates the Gaussian graphical model using graphical LASSO with extended Bayesian information criterion to select optimal regularization parameter. See EBICglasso.qgraph

  • "TMFG" Estimates a Triangulated Maximally Filtered Graph. See TMFG

algorithm

A string indicating the algorithm to use or a function from igraph Defaults to "walktrap". Current options are:

algorithm.args

List. A list of additional arguments for cluster_walktrap or cluster_leiden. Options are:

  • steps Number of steps used in the Walktrap algorithm. Defaults to c(3:8)

  • leiden Resolution parameter used in the Leiden algorithm. Defaults to seq(0, 2, .001). Higher values lead to smaller communities, lower values lead to larger communities

Author

Hudson Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>

References

# Entropy fit measures
Golino, H., Moulder, R. G., Shi, D., Christensen, A. P., Garrido, L. E., Neito, M. D., Nesselroade, J., Sadana, R., Thiyagarajan, J. A., & Boker, S. M. (in press). Entropy fit indices: New fit measures for assessing the structure and dimensionality of multiple latent variables. Multivariate Behavioral Research.

# Simulation for EGA.fit
Jamison, L., Christensen, A. P., & Golino, H. (under review). Optimizing Walktrap's community detection in networks using the Total Entropy Fit Index. PsyArXiv.

# Leiden algorithm
Traag, V. A., Waltman, L., & Van Eck, N. J. (2019). From Louvain to Leiden: guaranteeing well-connected communities. Scientific Reports, 9(1), 1-12.

# Walktrap algorithm
Pons, P., & Latapy, M. (2006). Computing communities in large networks using random walks. Journal of Graph Algorithms and Applications, 10, 191-218.

See Also

bootEGA to investigate the stability of EGA's estimation via bootstrap, EGA to estimate the number of dimensions of an instrument using EGA, and CFA to verify the fit of the structure suggested by EGA using confirmatory factor analysis.

Examples

Run this code
# Load data
wmt <- wmt2[,7:24]

if (FALSE) {
# Estimate EGA
ega.wmt <- EGA(
  data = wmt, 
  plot.EGA = FALSE # No plot for CRAN checks
)

# Estimate optimal EGA
fit.wmt <- EGA.fit(data = wmt)

# Plot optimal fit
plot(fit.wmt$EGA)

# Estimate CFAs
cfa.ega <- CFA(ega.wmt, estimator = "WLSMV", data = wmt)
cfa.fit <- CFA(fit.wmt$EGA, estimator = "WLSMV", data = wmt)

# Compare CFAs
lavaan::lavTestLRT(
  cfa.ega$fit, cfa.fit$fit,
  method = "satorra.bentler.2001"
)}

Run the code above in your browser using DataLab