criterion: String indicating the criterion to minimize. Any criterion from fit can be used.
matrices: Vector of strings indicating which matrices should be searched. Will default to network structures and factor loadings.
prunealpha: Minimal alpha used to consider edges to be removed
addalpha: Maximum alpha used to consider edges to be added
verbose: Logical, should messages be printed?
...: Arguments sent to runmodel
Details
The full algorithm is as follows:
Evaluate all models in which an edge is removed that has p > prunealpha, or an edge is added that has a modification index with p < addalpha
If none of these models improve the criterion, return the previous model and stop the algorithm
Update the model to the model that improved the criterion the most
Evaluate all other considered models that improved the criterion
If none of these models improve the criterion, go to 1, else go to 3
Returns
An object of the class psychonetrics (psychonetrics-class )
Author(s)
Sacha Epskamp
See Also
prune, stepup
Examples
# Load bfi data from psych package:library("psychTools")data(bfi)# Also load dplyr for the pipe operator:library("dplyr")# Let's take the agreeableness items, and gender:ConsData <- bfi %>% select(A1:A5, gender)%>% na.omit # Let's remove missingness (otherwise use Estimator = "FIML)# Define variables:vars <- names(ConsData)[1:5]# Let's fit a full GGM:mod <- ggm(ConsData, vars = vars)# Run model:mod <- mod %>% runmodel
# Model searchmod <- mod %>% prune(alpha=0.01)%>% modelsearch