Last chance! 50% off unlimited learning
Sale ends in
EGA
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.
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,
...
)
Matrix or data frame.
Includes the variables to be used in the bootEGA
analysis
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)
Numeric integer.
Number of replica samples to generate from the bootstrap analysis.
At least 500
is recommended
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
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.
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
List.
A list of additional arguments for EBICglasso.qgraph
or TMFG
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
List.
A list of additional arguments for cluster_walktrap
, cluster_louvain
,
or some other community detection algorithm function (see examples)
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
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
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
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
Returns a list containing:
Number of replica samples in bootstrap
Number of dimensions identified in each replica sample
Item allocation for each replica sample
Networks of each replica sample
Summary table containing number of replica samples, median, standard deviation, standard error, 95% confidence intervals, and quantiles (lower = 2.5% and upper = 97.5%)
Proportion of times the number of dimensions was identified (e.g., .85 of 1,000 = 850 times that specific number of dimensions was found)
Output of the original EGA
results
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
# 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. 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.
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.
# NOT RUN {
# Load data
wmt <- wmt2[,7:24]
# }
# NOT RUN {
# 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)
# }
# NOT RUN {
# Load data
intwl <- intelligenceBattery[,8:66]
# }
# NOT RUN {
# Another bootEGA example
boot.intwl <- bootEGA(data = intwl, iter = 500,
plot.type = "qgraph", type = "parametric", ncores = 2)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab