Skip to contents

Estimates the number of substantive dimensions after controlling for wording effects. EGA is applied to a residual correlation matrix after subtracting and random intercept factor with equal unstandardized loadings from all the regular and unrecoded reversed items in the database


  n = NULL,
  corr = c("auto", "cor_auto", "pearson", "spearman"), = c("pairwise", "listwise"),
  model = c("glasso", "TMFG"),
  algorithm = c("leiden", "louvain", "walktrap"),
  uni.method = c("expand", "LE", "louvain"),
  plot.EGA = TRUE,
  verbose = FALSE,



Matrix or data frame. Should consist only of variables to be used in the analysis. Must be raw data and not a correlation matrix


Numeric (length = 1). Sample size if data provided is a correlation matrix


Character (length = 1). Method to compute correlations. Defaults to "auto". Available options:

  • "auto" --- Automatically computes appropriate correlations for the data using Pearson's for continuous, polychoric for ordinal, tetrachoric for binary, and polyserial/biserial for ordinal/binary with continuous. To change the number of categories that are considered ordinal, use ordinal.categories (see polychoric.matrix for more details)

  • "cor_auto" --- Uses cor_auto to compute correlations. Arguments can be passed along to the function

  • "pearson" --- Pearson's correlation is computed for all variables regardless of categories

  • "spearman" --- Spearman's rank-order correlation is computed for all variables regardless of categories

For other similarity measures, compute them first and input them into data with the sample size (n)

Character (length = 1). How should missing data be handled? Defaults to "pairwise". Available options:

  • "pairwise" --- Computes correlation for all available cases between two variables

  • "listwise" --- Computes correlation for all complete cases in the dataset


Character (length = 1). Defaults to "glasso". Available options:

  • "BGGM" --- Computes the Bayesian Gaussian Graphical Model. Set argument ordinal.categories to determine levels allowed for a variable to be considered ordinal. See ?BGGM::estimate for more details

  • "glasso" --- Computes the GLASSO with EBIC model selection. See EBICglasso.qgraph for more details

  • "TMFG" --- Computes the TMFG method. See TMFG for more details


Character or igraph cluster_* function (length = 1). Defaults to "walktrap". Three options are listed below but all are available (see community.detection for other options):

  • "leiden" --- See cluster_leiden for more details

  • "louvain" --- By default, "louvain" will implement the Louvain algorithm using the consensus clustering method (see community.consensus for more information). This function will implement consensus.method = "most_common" and consensus.iter = 1000 unless specified otherwise

  • "walktrap" --- See cluster_walktrap for more details


Character (length = 1). What unidimensionality method should be used? Defaults to "louvain". Available options:

  • "expand" --- Expands the correlation matrix with four variables correlated 0.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 method was used in the Golino et al.'s (2020) Psychological Methods simulation

  • "LE" --- Applies the Leading Eigenvector algorithm (cluster_leading_eigen) on the empirical correlation matrix. If the number of dimensions is 1, then the Leading Eigenvector solution is used; otherwise, regular EGA is used. This method was used in the Christensen et al.'s (2023) Behavior Research Methods simulation

  • "louvain" --- Applies the Louvain algorithm (cluster_louvain) on the empirical correlation matrix. If the number of dimensions is 1, then the Louvain solution is used; otherwise, regular EGA is used. This method was validated Christensen's (2022) PsyArXiv simulation. Consensus clustering can be used by specifying either "consensus.method" or "consensus.iter"


Boolean (length = 1). If TRUE, returns a plot of the network and its estimated dimensions. Defaults to TRUE


Boolean (length = 1). Whether messages and (insignificant) warnings should be output. Defaults to FALSE (silent calls). Set to TRUE to see all messages and warnings for every function call


Additional arguments to be passed on to auto.correlate, network.estimation, community.detection, community.consensus, and EGA


Returns a list containing:


Results from EGA


A list containing information about the random-intercept model (if the model converged):

  • fit --- The fit object for the random-intercept model using cfa

  • lavaan.args --- The arguments used in cfa

  • loadings --- Standardized loadings from the random-intercept model

  • correlation --- Residual correlations after accounting for the random-intercept model


link[EGAnet]{tefi} for the estimated structure


Plot output if plot.EGA = TRUE


Selection of CFA Estimator
Rhemtulla, M., Brosseau-Liard, P. E., & Savalei, V. (2012). When can categorical variables be treated as continuous? A comparison of robust continuous and categorical SEM estimation methods under suboptimal conditions. Psychological Methods, 17, 354-373.

See also

plot.EGAnet for plot usage in EGAnet


Alejandro Garcia-Pardina <>, Francisco J. Abad <>, Alexander P. Christensen <>, Hudson Golino <hfg9s at>, Luis Eduardo Garrido <>, and Robert Moulder <>


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

# riEGA example
riEGA(data = wmt, plot.EGA = FALSE)
#> Warning: Some variables did not belong to a dimension: wmt16 
#> Use caution: These variables have been removed from the TEFI calculation
#> The random-intercept model converged. Wording effects likely. Results are only valid if data are unrecoded.
#> Model: GLASSO (EBIC with gamma = 0)
#> Correlations: auto
#> Lambda: 0.0529902216958668 (n = 100, ratio = 0.1)
#> Number of nodes: 18
#> Number of edges: 62
#> Edge density: 0.405
#> Non-zero edge weights: 
#>       M    SD    Min   Max
#>  -0.015 0.057 -0.163 0.171
#> ----
#> Algorithm:  Walktrap
#> Number of communities:  4
#>  wmt1  wmt2  wmt3  wmt4  wmt5  wmt6  wmt7  wmt8  wmt9 wmt10 wmt11 wmt12 wmt13 
#>     1     2     2     1     2     3     3     3     4     4     4     2     1 
#> wmt14 wmt15 wmt16 wmt17 wmt18 
#>     4     2    NA     1     2 
#> ----
#> Unidimensional Method: Louvain
#> Unidimensional: No
#> ----
#> TEFI: -9.771
#> ----
#> Random-Intercept Estimator:  ml 
#> Random-Intercept Loading:  0.601 0.644 0.625 0.629 0.628 0.669 0.644 0.626 0.644 0.656 0.589 0.597 0.594 0.620 0.618 0.613 0.590 0.557
# no plot for CRAN checks