A basic function to estimate `EGA`

for multidimensional structures.
This function does *not* include the unidimensional check and it does not
plot the results. This function can be used as a streamlined approach
for quick `EGA`

estimation when unidimensionality or visualization
is not a priority

## Arguments

- data
Matrix or data frame. Should consist only of variables to be used in the analysis

- n
Numeric (length = 1). Sample size if

`data`

provided is a correlation matrix- corr
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`

)- na.data
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

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

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

- verbose
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`

, and`community.consensus`

## Value

Returns a list containing:

- network
A matrix containing a network estimated using

`link[EGAnet]{network.estimation}`

- wc
A vector representing the community (dimension) membership of each node in the network.

`NA`

values mean that the node was disconnected from the network- n.dim
A scalar of how many total dimensions were identified in the network

- cor.data
The zero-order correlation matrix

- n
Number of cases in

`data`

## References

**Original simulation and implementation of EGA**

Golino, H. F., & Epskamp, S. (2017).
Exploratory graph analysis: A new approach for estimating the number of dimensions in psychological research.
*PLoS ONE*, *12*, e0174035.

**Introduced unidimensional checks, simulation with continuous and dichotomous data**

Golino, H., Shi, D., Christensen, A. P., Garrido, L. E., Nieto, M. D., Sadana, R., & Thiyagarajan, J. A. (2020).
Investigating the performance of Exploratory Graph Analysis and traditional techniques to identify the number of latent factors: A simulation and tutorial.
*Psychological Methods*, *25*, 292-320.

**Compared all** `igraph`

**community detection algorithms, simulation with continuous and polytomous data**

Christensen, A. P., Garrido, L. E., Guerra-Pena, K., & Golino, H. (2023).
Comparing community detection algorithms in psychometric networks: A Monte Carlo simulation.
*Behavior Research Methods*.

## See also

`plot.EGAnet`

for plot usage in `EGAnet`

## Author

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

## Examples

```
# Obtain data
wmt <- wmt2[,7:24]
# Estimate EGA
ega.wmt <- EGA.estimate(data = wmt)
# Estimate EGA with TMFG
ega.wmt.tmfg <- EGA.estimate(data = wmt, model = "TMFG")
# Estimate EGA with an {igraph} function (Fast-greedy)
ega.wmt.greedy <- EGA.estimate(
data = wmt,
algorithm = igraph::cluster_fast_greedy
)
```