Learn R Programming

EGAnet (version 0.9.6)

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,
  model = c("glasso", "TMFG"),
  algorithm = c("walktrap", "louvain"),
  type = c("parametric", "resampling"),
  typicalStructure = TRUE,
  plot.typicalStructure = TRUE,
  ncores,
  ...
)

Arguments

data

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

n

Numeric integer. Number of replica samples to generate from the bootstrap analysis. At least 500 is recommended

model

Character. A string indicating the method to use. Defaults to "glasso".

Current options are:

  • "glasso" Estimates the Gaussian graphical model using graphical LASSO with extended Bayesian information criterion to select optimal regularization parameter. See EBICglasso.qgraph

  • "TMFG" Estimates a Triangulated Maximally Filtered Graph. See TMFG

algorithm

A string indicating the algorithm to use. Current options are:

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 Mvnorm function of the mvtnorm package

  • "resampling" Generates n random subsamples of the original data

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

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. Recommended to use maximum number of cores minus one

If you're unsure how many cores your computer has, then use the following code: parallel::detectCores()

...

Additional arguments to be passed to EBICglasso.qgraph or TMFG

Value

Returns a list containing:

n

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

References

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

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
# NOT RUN {
# Load data
wmt <- wmt2[,7:24]

# }
# NOT RUN {
# bootEGA glasso example
boot.wmt <- bootEGA(data = wmt, n = 500, typicalStructure = TRUE,
plot.typicalStructure = TRUE, model = "glasso", type = "parametric", ncores = 4)
# }
# NOT RUN {
# Load data
intwl <- intelligenceBattery[,8:66]

# }
# NOT RUN {
# bootEGA TMFG example
boot.intwl <- bootEGA(data = intelligenceBattery[,8:66], n = 500, typicalStructure = TRUE,
plot.typicalStructure = TRUE, model = "TMFG", type = "parametric", ncores = 4)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab