Helper Functions for Simulation Studies in Network Psychometrics

Helper functions for setting up simulations in network psychometrics.


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:

  • Network generation

    • genIsing(): generate Ising networks with controllable density and edge weights
    • genGVAR(): generate graphical vector autoregressive (GVAR) models with contemporaneous and temporal networks
  • Data simulation

    • GGMsim(): generate multivariate normal data from Gaussian Graphical Models (GGM)
  • Performance evaluation

    • evalNet(): compute 20+ metrics comparing true vs. estimated networks (sensitivity, specificity, correlations, centrality recovery, and more)

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)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("netsimhelpers")

0.1.0 by Ria H. A. Hoekstra, 2 months ago


Browse source code at https://github.com/cran/netsimhelpers


Authors: Ria H. A. Hoekstra [aut, cre] , Sacha Epskamp [aut]


Documentation:   PDF Manual  


GPL (>= 2) license


Imports mvtnorm, stats, bootnet, qgraph

Suggests testthat


See at CRAN