netsimhelpers provides tools for designing and
evaluating simulation studies in network psychometrics.
netsimhelpers simplifies simulation studies by providing
easy-to-use functions for:
genIsing(): generate Ising networks with controllable
density and edge weightsgenGVAR(): generate graphical vector autoregressive
(GVAR) models with contemporaneous and temporal networksGGMsim(): generate multivariate normal data from
Gaussian Graphical Models (GGM)evalNet(): compute 20+ metrics comparing true
vs. estimated networks (sensitivity, specificity, correlations,
centrality recovery, and more)You can install the current developmental version in R using the remotes-package:
install.packages("remotes")
remotes::install_github("RiaHoekstra/netsimhelpers")library(netsimhelpers)ising_net <- genIsing(n_node = 10, inclusion = 0.3)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 using netsimhelpers
true_gvar <- genGVAR(n_node = 5)
# Inspect networks
true_gvar$PCC # contemporaneous network
true_gvar$PDC # temporal network# Generate GGM
true_ggm <- bootnet::genGGM(Nvar = 6)
est_ggm <- true_ggm
# Perfect evaluation
evaluation <- evalNet(true_ggm, est_ggm)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)