# bootEGA: Dimension Stability Analysis of 'EGA' In EGAnet: Exploratory Graph Analysis - A Framework for Estimating the Number of Dimensions in Multivariate Data Using Network Psychometrics

## Description

`bootEGA` Estimates the number of dimensions of n bootstraps using the empirical (partial) correlation matrix (parametric) or resampling from the empirical dataset (non-parametric). It also estimates a typical median network structure, which is formed by the median or mean pairwise (partial) correlations over the n bootstraps.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```bootEGA( data, uni = TRUE, iter, type = c("parametric", "resampling"), corr = c("cor_auto", "pearson", "spearman"), model = c("glasso", "TMFG"), model.args = list(), algorithm = c("walktrap", "louvain"), algorithm.args = list(), typicalStructure = TRUE, plot.typicalStructure = TRUE, plot.type = c("GGally", "qgraph"), plot.args = list(), ncores, ... ) ```

## Arguments

 `data` Matrix or data frame. Includes the variables to be used in the `bootEGA` analysis `uni` Boolean. Should unidimensionality be checked? Defaults to `TRUE`. Set to `FALSE` to check for multidimensionality only. If `TRUE`, then the same number of variables as the original data (i.e., from argument `data`) are generated from a factor model with one factor and loadings of .70. These data are then appended to the original data and dimensionality is checked. If the number of dimensions is one or two, then the original data are unidimensional; otherwise, the data are multidimensional (see Golino, Shi, et al., 2020 for more details) `iter` Numeric integer. Number of replica samples to generate from the bootstrap analysis. At least `500` is recommended `type` Character. A string indicating the type of bootstrap to use. Current options are: `"parametric"` Generates `n` new datasets (multivariate normal random distributions) based on the original dataset, via the `mvrnorm` function `"resampling"` Generates n random subsamples of the original data `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. Current options are: `glasso` Estimates the Gaussian graphical model using graphical LASSO with extended Bayesian information criterion to select optimal regularization parameter. This is the default method `TMFG` Estimates a Triangulated Maximally Filtered Graph `model.args` List. A list of additional arguments for `EBICglasso.qgraph` or `TMFG` `algorithm` A string indicating the algorithm to use or a function from `igraph` Current options are: `walktrap` Computes the Walktrap algorithm using `cluster_walktrap` `louvain` Computes the Walktrap algorithm using `cluster_louvain` `algorithm.args` List. A list of additional arguments for `cluster_walktrap`, `cluster_louvain`, or some other community detection algorithm function (see examples) `typicalStructure` Boolean. If `TRUE`, returns the typical network of partial correlations (estimated via graphical lasso or via TMFG) and estimates its dimensions. The "typical network" is the median of all pairwise correlations over the n bootstraps. Defaults to `TRUE` `plot.typicalStructure` Boolean. If `TRUE`, returns a plot of the typical network (partial correlations), which is the median of all pairwise correlations over the n bootstraps, and its estimated dimensions. Defaults to `TRUE` `plot.type` Character. Plot system to use. Current options are `qgraph` and `GGally`. Defaults to `"GGally"`. `plot.args` List. A list of additional arguments for the network plot. For `plot.type = "qgraph"`: `vsize` Size of the nodes. Defaults to 6. For `plot.type = "GGally"` (see `ggnet2` for full list of arguments): `vsize` Size of the nodes. Defaults to 6. `label.size` Size of the labels. Defaults to 5. `alpha` The level of transparency of the nodes, which might be a single value or a vector of values. Defaults to 0.7. `edge.alpha` The level of transparency of the edges, which might be a single value or a vector of values. Defaults to 0.4. `legend.names` A vector with names for each dimension `color.palette` The color palette for the nodes. For custom colors, enter HEX codes for each dimension in a vector. See `color_palette_EGA` for more details and examples `ncores` Numeric. Number of cores to use in computing results. Defaults to `parallel::detectCores() / 2` or half of your computer's processing power. Set to `1` to not use parallel computing If you're unsure how many cores your computer has, then use the following code: `parallel::detectCores()` `...` Additional arguments. Used for deprecated arguments from previous versions of `EGA`

## Value

Returns a list containing:

 `iter` Number of replica samples in bootstrap `boot.ndim` Number of dimensions identified in each replica sample `boot.wc` Item allocation for each replica sample `bootGraphs` Networks of each replica sample `summary.table` Summary table containing number of replica samples, median, standard deviation, standard error, 95% confidence intervals, and quantiles (lower = 2.5% and upper = 97.5%) `frequency` Proportion of times the number of dimensions was identified (e.g., .85 of 1,000 = 850 times that specific number of dimensions was found) `EGA` Output of the original `EGA` results `typicalGraph` A list containing: `graph` Network matrix of the median network structure `typical.dim.variables` An ordered matrix of item allocation `wc` Item allocation of the median network

## Author(s)

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

## References

# Original implementation of bootEGA
Christensen, A. P., & Golino, H. (2019). Estimating the stability of the number of factors via Bootstrap Exploratory Graph Analysis: A tutorial. PsyArXiv. doi: 10.31234/osf.io/9deay

# Structural consistency (see `dimStability`)
Christensen, A. P., Golino, H., & Silvia, P. J. (in press). A psychometric network perspective on the validity and validation of personality trait questionnaires. European Journal of Personality. doi: 10.1002/per.2265

`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.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28``` ```# Load data wmt <- wmt2[,7:24] # bootEGA glasso example ## plot.type = "qqraph" used for CRAN checks ## plot.type = "GGally" is the default boot.wmt <- bootEGA(data = wmt, iter = 500, plot.type = "qgraph", type = "parametric", ncores = 2) # bootEGA TMFG example boot.wmt <- bootEGA(data = wmt, iter = 500, model = "TMFG", plot.type = "qgraph", type = "parametric", ncores = 2) # bootEGA Louvain example boot.wmt <- bootEGA(data = wmt, iter = 500, algorithm = "louvain", plot.type = "qgraph", type = "parametric", ncores = 2) # bootEGA Spinglass example boot.wmt <- bootEGA(data = wmt, iter = 500, model = "TMFG", plot.type = "qgraph", algorithm = igraph::cluster_spinglass, type = "parametric", ncores = 2) # Load data intwl <- intelligenceBattery[,8:66] # Another bootEGA example boot.intwl <- bootEGA(data = intwl, iter = 500, plot.type = "qgraph", type = "parametric", ncores = 2) ```