An implementation of the Invariance Partial Pruning (IVPP) approach described in Du, X., Johnson, S. U., Epskamp, S. (in prep) to comparing idiographic and panel network models. IVPP is a two-step method that first test for global network structural difference with invariance test and then inspect specific edge difference with partial pruning.
To install from CRAN:
install.packages("IVPP")
You can install the development version of IVPP from GitHub with:
# install.packages("devtools")
::install_github("xinkaidupsy/IVPP") devtools
An example that uses IVPP to compare panelGVAR models:
library(IVPP)
# Generate the network
<- gen_panelGVAR(n_node = 6,
net_ls p_rewire_temp = 0.5,
p_rewire_cont = 0.5,
n_group = 2)
# Generate the data
<- sim_panelGVAR(temp_base_ls = net_ls$temporal,
data cont_base_ls = net_ls$omega_zeta_within,
n_person = 200,
n_time = 3,
n_group = 2,
n_node = 6)
# global test on both nets
<- IVPP_panelgvar(data,
omnibus_both vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
g_test_net = "both",
net_type = "sparse",
partial_prune = FALSE,
ncores = 2)
# global test on temporal
<- IVPP_panelgvar(data,
omnibus_temp vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
g_test_net = "temporal",
net_type = "sparse",
partial_prune = FALSE,
ncores = 2)
# global test on cont
<- IVPP_panelgvar(data,
omnibus_cont vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
g_test_net = "contemporaneous",
net_type = "sparse",
partial_prune = FALSE,
ncores = 2)
# partial prune on both networks
<- IVPP_panelgvar(data,
pp_both vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
global = FALSE,
net_type = "sparse",
partial_prune = TRUE,
prune_net = "both",
ncores = 2)
An example that uses IVPP to compare N = 1 GVAR models
library(IVPP)
# Generate the network
<- gen_tsGVAR(n_node = 6,
net_ls p_rewire_temp = 0.5,
p_rewire_cont = 0.5,
n_persons = 2)
# Generate the data
<- sim_tsGVAR(beta_base_ls = net_ls$beta,
data kappa_base_ls = net_ls$kappa,
# n_person = 2,
n_time = 100)
# global test on temporal
<- IVPP_tsgvar(data,
omnibus_temp vars = paste0("V",1:6),
idvar = "id",
g_test_net = "temporal",
net_type = "sparse",
partial_prune = FALSE,
ncores = 2)
# global test on cont
<- IVPP_tsgvar(data,
omnibus_cont vars = paste0("V",1:6),
idvar = "id",
g_test_net = "contemporaneous",
net_type = "sparse",
partial_prune = FALSE,
ncores = 2)
# partial prune on both networks
<- IVPP_tsgvar(data,
pp_both vars = paste0("V",1:6),
idvar = "id",
global = FALSE,
net_type = "sparse",
partial_prune = TRUE,
prune_net = "both",
ncores = 2)