Last active
August 16, 2019 09:09
-
-
Save SachaEpskamp/7e4b5bea30be2ac9eb724eedd86c9d39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install from github: | |
devtools::install_github("sachaepskamp/qgraph") | |
library("qgraph") | |
# Example network to play with: | |
# Load data: | |
library("psychTools") | |
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: | |
object <- qgraph(Results$graph, layout = "spring", cut = 0, theme = "colorblind", title = "Using qgraph") | |
# Now as ggraph: | |
library("ggplot2") | |
as.ggraph(object) + ggtitle("Using ggraph") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment