ggmModSelect | R Documentation |
This function will search for an optimal Gaussian graphical model by minimizing the (extended) Bayesian information criterion of unregularized GGM models. Selecting unregularized GGMs according to EBIC has been shown to converge to the true model (Foygel & Drton, 2010). The algorithm starts with refitting models from the glassopath, and subsequently adds and removes edges until EBIC can no longer be improved (see details). Note, contrary to EBICglasso
, the default for the EBIC hyperparameter gamma is set to 0, indicating BIC model selection.
ggmModSelect(S, n, gamma = 0, start = c("glasso", "empty", "full"), stepwise = TRUE,
considerPerStep = c("subset", "all"), verbose = TRUE, nCores = 1, checkPD = TRUE,
criterion = 'ebic', ...)
S |
A covariance or correlation matrix |
n |
Sample size used in computing |
gamma |
EBIC tuning parameter. 0 (default) leads to BIC model selection. 0.25 or 0.5 are typical choices for more conservative model selection. |
start |
What model should stepwise search start from? |
stepwise |
Logical indicating if stepwise model search should be used. |
considerPerStep |
|
verbose |
Logical, should progress reports be printed to the console? |
nCores |
The number of cores to use in testing models. |
checkPD |
If |
criterion |
String indicating an output of |
... |
Arguments sent to |
The full algorithm is as follows:
1. Run glasso to obtain 100 models
2. Refit all models without regularization
3. Choose the best according to EBIC
4. Test all possible models in which one edge is changed (added or removed)
5. If no edge can be added or changed to improve EBIC, stop here
6. Change the edge that best improved EBIC, now test all other edges that would have also lead to an increase in EBIC again
7. If no edge can be added or changed to improve EBIC, go to 4, else, go to 6.
When stepwise = FALSE
, steps 4 to 7 are ignored. When considerPerStep = "all"
, all edges are considered at every step. Note that this algorithm is very slow in higher dimensions (e.g., above 30-40 nodes). Note that EBIC computation is slightly different as in EBICglasso
and instead follows the implementation in Lavaan.
A list with the following elements:
graph |
The optimal partial correlation network |
EBIC |
EBIC corresponding to optimal network. |
Sacha Epskamp
Foygel, R., & Drton, M. (2010). Extended Bayesian information criteria for Gaussian graphical models. In Advances in neural information processing systems (pp. 604-612).
## Not run:
# Load data:
library("psych")
data(bfi)
# Compute polychoric correlations:
corMat <- cor_auto(bfi[,1:25])
# Optimize network:
Results <- ggmModSelect(corMat, nrow(bfi), gamma = 0.5, nCores = 8)
# Plot results:
qgraph(Results$graph, layout = "spring", cut = 0)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.