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:"beta.min"
— Applies themodularity
-adjusted (Q
) beta-min criterion to threshold the implied partial correlation matrix $$Q \times \sqrt{\frac{\log{(p)}}{n}}$$"EGA"
(default) — AppliesEGA
to obtain the (sparse) regularized network structure, communities, and memberships"probability"
— Estimates communities based on the non-regularized empirical partial correlation matrix and sparsity is set using probabilities for the within- (p.in
) and between-community (p.out
) connectivity
- 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"
andsearch = FALSE
. Defaults toNULL
but must be set- opt
Character vector (length = 1). Fit index used to select from when searching over models (only applies to
search = TRUE
). Available options include maximum likelihood (default;"logLik"
) and standardized root mean residual ("SRMR"
)- constrain.structure
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- constrain.zeros
Boolean (length = 1). Whether zeros in the estimated network loading matrix should be retained when optimizing the network loadings. Defaults to
TRUE
which ensures that zero networks loadings are retained. 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 beta-min condition)
egm_ega_search <- EGM(data, EGM.model = "beta.min")
if (FALSE) { # \dontrun{
# Estimate EGM (using EGA search)
egm_ega_search <- EGM(
data, EGM.model = "EGA", search = TRUE
)
# Estimate EGM (using search)
egm_search <- EGM(
data, EGM.model = "probability", search = TRUE,
communities = 3, # need communities or structure
p.in = 0.95 # only need 'p.in'
)} # }