Learn R Programming

EGAnet (version 1.2.3)

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", "louvain"),
  iter,
  type = c("parametric", "resampling"),
  seed = 1234,
  corr = c("cor_auto", "pearson", "spearman"),
  EGA.type = c("EGA", "EGA.fit", "hierEGA", "riEGA"),
  model = c("glasso", "TMFG"),
  model.args = list(),
  algorithm = c("walktrap", "leiden", "louvain"),
  algorithm.args = list(),
  consensus.method = c("highest_modularity", "most_common", "iterative", "lowest_tefi"),
  consensus.iter = 100,
  typicalStructure = TRUE,
  plot.typicalStructure = TRUE,
  plot.args = list(),
  ncores,
  progress = TRUE,
  ...
)

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 "louvain". 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.

  • louvain Applies the Louvain algorithm (cluster_louvain) on the empirical correlation matrix using a resolution parameter = 0.95. If the number of dimensions is 1, then the Louvain solution is used; otherwise, regular EGA is used. This method was validated in the Christensen (2022) 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

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

EGA.type

Character. Type of EGA model to use.

Current options are:

  • EGA Uses standard exploratory graph analysis

  • EGA.fit Uses tefi to determine best fit of EGA

  • hierEGA Uses hierarhical exploratory graph analysis

  • riEGA Uses random-intercept exploratory graph analysis

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 Defaults to "walktrap". Current options are:

  • walktrap Computes the Walktrap algorithm using cluster_walktrap

  • leiden Computes the Leiden algorithm using cluster_leiden. Defaults to objective_function = "modularity"

  • louvain Computes the Louvain 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)

consensus.method

Character. What consensus clustering method should be used? Defaults to "highest_modularity". Current options are:

  • highest_modularity Uses the community solution that achieves the highest modularity across iterations

  • most_common Uses the community solution that is found the most across iterations

  • iterative Identifies the most common community solutions across iterations and determines how often nodes appear in the same community together. A threshold of 0.30 is used to set low proportions to zero. This process repeats iteratively until all nodes have a proportion of 1 in the community solution.

  • lowest_tefi Uses the community solution that achieves the lowest tefi across iterations

consensus.iter

Numeric. Number of iterations to perform in consensus clustering for the Louvain algorithm (see Lancichinetti & Fortunato, 2012). Defaults to 100

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

List. A list of additional arguments for the network plot. 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()

progress

Boolean. Should progress be displayed? Defaults to TRUE. For Windows, FALSE is about 2x faster

...

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]

if (FALSE) {
# Standard EGA example
boot.wmt <- bootEGA(
  data = wmt, iter = 500,
  type = "parametric", ncores = 2
)

# Produce Methods section
methods.section(boot.wmt)

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

# Spinglass example
boot.wmt.spinglass <- bootEGA(
  data = wmt, iter = 500,
  algorithm = igraph::cluster_spinglass, # use any function from {igraph}
  type = "parametric", ncores = 2
)

# EGA fit example
boot.wmt.fit <- bootEGA(
  data = wmt, iter = 500,
  EGA.type = "EGA.fit",
  type = "parametric", ncores = 2
)

# Hierarchical EGA example
boot.wmt.hier <- bootEGA(
  data = wmt, iter = 500,
  EGA.type = "hierEGA",
  type = "parametric", ncores = 2
)

# Random-intercept EGA example
boot.wmt.ri <- bootEGA(
  data = wmt, iter = 500,
  EGA.type = "riEGA",
  type = "parametric", ncores = 2
)}

Run the code above in your browser using DataLab