# \donttest{
# 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, omega = "full")
# Run model:
mod <- mod %>%runmodel %>%prune(alpha = 0.05)
# Remove an edge (example):
mod <- mod %>%fixpar("omega",1,2) %>%runmodel
# Stepup search
mod <- mod %>%stepup(alpha = 0.05)
# }
Run the code above in your browser using DataLab