Learn R Programming

EGAnet (version 1.1.0)

bootEGA: Dimension Stability Analysis of EGA

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

bootEGA(
  data,
  n = NULL,
  uni.method = c("expand", "LE"),
  iter,
  type = c("parametric", "resampling"),
  seed = 1234,
  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,
  ...
)

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

Arguments

data

Matrix or data frame. Includes the variables to be used in the bootEGA analysis

n

Integer. Sample size if 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.

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

seed

Numeric. Seed to reproduce results. Defaults to 1234. For random results, set to NULL

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:

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

Author

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

References

# Original implementation of bootEGA
Christensen, A. P., & Golino, H. (2021). Estimating the stability of the number of factors via Bootstrap Exploratory Graph Analysis: A tutorial. Psych, 3(3), 479-500.

# Structural consistency (see dimensionStability)
Christensen, A. P., Golino, H., & Silvia, P. J. (2020). A psychometric network perspective on the validity and validation of personality trait questionnaires. European Journal of Personality, 34(6), 1095-1108.

See Also

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]

# 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, seed = 1234)

# bootEGA Louvain example
boot.wmt <- bootEGA(data = wmt, iter = 500, algorithm = "louvain",
plot.type = "qgraph", type = "parametric", ncores = 2, seed = 1234)

# bootEGA Spinglass example
boot.wmt <- bootEGA(data = wmt, iter = 500, model = "TMFG", plot.type = "qgraph",
algorithm = igraph::cluster_spinglass, type = "parametric", ncores = 2)


Run the code above in your browser using DataLab