## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 6) library(psychnets) has_cograph <- requireNamespace("cograph", quietly = TRUE) ## ----data-preview------------------------------------------------------------- head(SRL_GPT) ## ----fit-network-------------------------------------------------------------- stepwise_net <- psychnet(data = SRL_GPT, method = "ggm") stepwise_net ## ----summarize-network-------------------------------------------------------- summary(stepwise_net) ## ----fit-certificate---------------------------------------------------------- certificate(stepwise_net) ## ----fit-glasso--------------------------------------------------------------- glasso_net <- psychnet(data = SRL_GPT, method = "glasso") glasso_net ## ----summarize-glasso--------------------------------------------------------- summary(glasso_net) ## ----node-centrality---------------------------------------------------------- net_centralities(stepwise_net) ## ----node-predictability------------------------------------------------------ net_predict(stepwise_net) ## ----plot-network, eval = has_cograph----------------------------------------- cograph::splot(stepwise_net, psych_styling = TRUE, predictability = TRUE) ## ----fit-spearman------------------------------------------------------------- spearman_net <- psychnet(data = SRL_GPT, method = "ggm", cor_method = "spearman") spearman_net ## ----summarize-spearman------------------------------------------------------- summary(spearman_net) ## ----certify-spearman--------------------------------------------------------- certificate(spearman_net)