## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE, comment = "#>", message = FALSE, warning = FALSE,
  fig.width = 7, fig.height = 5.5
)
library(idiographic)
data(esm_srl)
vars <- c("efficacy", "value", "planning", "monitoring", "effort",
          "regulation", "motivated", "enjoyment", "anxiety")
has_cograph <- requireNamespace("cograph", quietly = TRUE)

## ----audit--------------------------------------------------------------------
preprocess(esm_srl, vars = vars, id = "name", subject = "Quinn")

## ----fit----------------------------------------------------------------------
fit <- fit_graphical_var(esm_srl, vars = vars, id = "name", subject = "Quinn",
                         penalize_diagonal = FALSE, gamma = 0.1,
                         n_lambda = 8)
fit

## ----summary------------------------------------------------------------------
summary(fit)

## ----edges-temporal-----------------------------------------------------------
edges(fit, network = "temporal", n = 5)

## ----edges-contemp------------------------------------------------------------
edges(fit, network = "contemporaneous", n = 8)

## ----nodes--------------------------------------------------------------------
nodes(fit)

## ----plot-all, eval=has_cograph-----------------------------------------------
plot(fit)

## ----plot-temporal, eval=has_cograph------------------------------------------
plot(fit, layer = "temporal")

## ----plot-contemp, eval=has_cograph-------------------------------------------
plot(fit, layer = "contemporaneous")

## ----plot-mixed, eval=has_cograph---------------------------------------------
plot(fit, mixed = TRUE)

