## ----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--------------------------------------------------------------
net <- psychnet(data = SRL_GPT, method = "glasso")
net

## ----summarize-network--------------------------------------------------------
summary(net)

## ----optimality-certificate---------------------------------------------------
certificate(net)

## ----node-centrality----------------------------------------------------------
net_centralities(net)

## ----node-predictability------------------------------------------------------
net_predict(net)

## ----plot-network, eval = has_cograph-----------------------------------------
cograph::splot(net, psych_styling = TRUE)

## ----fit-spearman-------------------------------------------------------------
spearman_net <- psychnet(data = SRL_GPT, method = "glasso", cor_method = "spearman")
spearman_net

## ----summarize-spearman-------------------------------------------------------
summary(spearman_net)

## ----fit-threshold------------------------------------------------------------
threshold_net <- psychnet(data = SRL_GPT, method = "glasso", threshold = 0.1)
threshold_net

## ----summarize-threshold------------------------------------------------------
summary(threshold_net)

## ----fit-nonparanormal--------------------------------------------------------
npn_net <- psychnet(data = SRL_GPT, method = "huge")
npn_net

## ----summarize-nonparanormal--------------------------------------------------
summary(npn_net)

## ----certify-nonparanormal----------------------------------------------------
certificate(npn_net)

