{EGAnet}R Documentation

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


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.

  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))



Matrix or data frame. Dataset or correlation matrix


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


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.


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.


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


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


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


Returns a list containing:


The EGA output for the best fitting model


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


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


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


The lowest value for the tefi Index


Hudson Golino <hfg9s at> and Alexander P. Christensen <>


# 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
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.


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

# Estimate EGA
## plot.type = "qqraph" used for CRAN checks
## plot.type = "GGally" is the default
ega.wmt <- EGA(data = wmt, plot.type = "qgraph")

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

# Plot optimal fit
plot(fit.wmt$EGA, plot.type = "qgraph")

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

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

[Package EGAnet version 1.1.0 Index]