netsimhelpers

netsimhelpers provides tools for designing and evaluating simulation studies in network psychometrics.

Overview

netsimhelpers simplifies simulation studies by providing easy-to-use functions for:

Installation

You can install the current developmental version in R using the remotes-package:

install.packages("remotes")
remotes::install_github("RiaHoekstra/netsimhelpers")

Example

library(netsimhelpers)

Generate Ising network

ising_net <- genIsing(n_node = 10, inclusion = 0.3)

Simulate data based on a GGM

netsimhelpers works seamlessly with existing packages such as bootnet for additional network generation:

library(bootnet) # for additional network generation

# Generate GGM using bootnet package
ggm_net <- bootnet::genGGM(Nvar = 6)

# Simulate data based on GGM using netsimhelpers
sim_data <- GGMsim(n_obs = 100, omega = ggm_net)

Generate GVAR network model

# Generate GVAR network using netsimhelpers
true_gvar <- genGVAR(n_node = 5)

# Inspect networks
true_gvar$PCC   # contemporaneous network
true_gvar$PDC   # temporal network

Evaluate network model estimation

# Generate GGM
true_ggm <- bootnet::genGGM(Nvar = 6)
est_ggm <- true_ggm

# Perfect evaluation
evaluation <- evalNet(true_ggm, est_ggm)

Minimal simulation workflow

library(netsimhelpers)
library(bootnet)
library(graphicalVAR)

# Generate true netwrok model
true_net <- genGVAR(n_node = 5)

# Simulate data based on network model
sim_data <- as.data.frame(graphicalVAR::graphicalVARsim(nTime = 200, beta = true_net$beta, kappa = true_net$kappa))

# Estimate network
est_net <- estimateNetwork(sim_data, default = "graphicalVAR")

# Evaluate recovery
eval_contemp <- evalNet(true_net$PCC, est_net$PCC)
eval_temporal <- evalNet(true_net$PDC, est_net$PDC)