Function to fit the Exploratory Graph Model
Arguments
- data
Matrix or data frame. Should consist only of variables to be used in the analysis. Can be raw data or a correlation matrix
- EGM.model
Character vector (length = 1). Sets the procedure to conduct
EGM
. Available options:"EGA"
(default) — AppliesEGA
to obtain the (sparse) regularized network structure, communities, and memberships"standard"
— Applies the standard EGM model which estimates communities based on the non-regularized empirical partial correlation matrix and sparsity is set usingp.in
andp.out
- communities
Numeric vector (length = 1). Number of communities to use for the
"standard"
type of EGM. Defaults toNULL
. Providing no input will use the communities and memberships output from the Walktrap algorithm (cluster_walktrap
) based on the empirical non-regularized partial correlation matrix- structure
Numeric or character vector (length =
ncol(data)
). Can be theoretical factors or the structure detected byEGA
. Defaults toNULL
- search
Boolean (length = 1). Whether a search over parameters should be conducted. Defaults to
FALSE
. Set toTRUE
to select a model over a variety of parameters that optimizes theopt
objective- p.in
Numeric vector (length = 1). Probability that a node is randomly linked to other nodes in the same community. Within community edges are set to zero based on
quantile(x, prob = 1 - p.in)
ensuring the lowest edge values are set to zero (i.e., most probable to not be randomly connected). Only used forEGM.type = "standard"
. Defaults toNULL
but must be set- p.out
Numeric vector (length = 1). Probability that a node is randomly linked to other nodes not in the same community. Between community edges are set to zero based on
quantile(x, prob = 1 - p.out)
ensuring the lowest edge values are set to zero (i.e., most probable to not be randomly connected). Only used forEGM.type = "standard"
. Defaults toNULL
but must be set- opt
Character vector (length = 1). Fit index used to select from when searching over models (only applies to
EGM.type = "search"
). Available options include:"AIC"
"BIC"
"CFI"
"chisq"
"logLik"
"RMSEA"
"SRMR"
"TEFI"
"TEFI.adj"
"TLI"
Defaults to
"SRMR"
- constrained
Boolean (length = 1). Whether memberships of the communities should be added as a constraint when optimizing the network loadings. Defaults to
TRUE
which ensures assigned loadings are guaranteed to never be smaller than any cross-loadings. Set toFALSE
to freely estimate each loading similar to exploratory factor analysis- verbose
Boolean (length = 1). Should progress be displayed? Defaults to
TRUE
. Set toFALSE
to not display progress- ...
Additional arguments to be passed on to
auto.correlate
,network.estimation
,community.detection
,community.consensus
,community.unidimensional
,EGA
, andnet.loads
Author
Hudson F. Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>
Examples
# Get depression data
data <- depression[,24:44]
# Estimate EGM (using EGA)
egm_ega <- EGM(data)
# Estimate EGM (using EGA) specifying communities
egm_ega_communities <- EGM(data, communities = 3)
# Estimate EGM (using EGA) specifying structure
egm_ega_structure <- EGM(
data, structure = c(
1, 1, 1, 2, 1, 1, 1,
1, 1, 1, 3, 2, 2, 2,
2, 3, 3, 3, 3, 3, 2
)
)
# Estimate EGM (using standard)
egm_standard <- EGM(
data, EGM.model = "standard",
communities = 3, # specify number of communities
p.in = 0.95, # probability of edges *in* each community
p.out = 0.80 # probability of edges *between* each community
)
if (FALSE) { # \dontrun{
# Estimate EGM (using EGA search)
egm_ega_search <- EGM(
data, EGM.model = "EGA", search = TRUE
)
# Estimate EGM (using EGA search and AIC criterion)
egm_ega_search_AIC <- EGM(
data, EGM.model = "EGA", search = TRUE, opt = "AIC"
)
# Estimate EGM (using search)
egm_search <- EGM(
data, EGM.model = "standard", search = TRUE,
communities = 3, # need communities or structure
p.in = 0.95 # only need 'p.in'
)} # }