IVPP_panelgvar {IVPP} | R Documentation |
The invariance partial pruning (IVPP) algorithm for panel GVAR models
Description
This function implements the IVPP algorithm to compare networks in the multi-group panelGVAR models. The IVPP algorithm is a two-step procedure that first conducts an global invariance test of network difference and then performs partial pruning for the specific edge-level differences. Currently supports the comparison of temporal and contemporaneous networks.
Usage
IVPP_panelgvar(
data,
vars,
idvar,
beepvar,
groups,
global = TRUE,
g_test_net = c("both", "temporal", "contemporaneous"),
net_type = c("sparse", "saturated"),
output_equal = FALSE,
partial_prune = FALSE,
prune_net = c("both", "temporal", "contemporaneous"),
prune_alpha = 0.01,
p_prune_alpha = 0.01,
estimator = "FIML",
standardize = c("none", "z", "quantile"),
ncores = 1,
...
)
Arguments
data |
A data frame containing the long-formatted panel data |
vars |
A character vector of variable names |
idvar |
A character string specifying subject IDs |
beepvar |
A character string specifying the name of wave (time) variable |
groups |
A character string specifying the name of group variable |
global |
A logical value default to TRUE. If FALSE, the global invariance test is skipped. |
g_test_net |
A character vector specifying the network you want to test group-equality on in the global invariance test. Specify "both" if you want to test on both temporal or contemporaneous networks. Specify "temporal" if you want to test only on the temporal network. Specify "contemporaneous" if you want to test only on the contemporaneous network. See the Details section for more information. |
net_type |
A character vector specifying the type of networks to be compared in the global test. Specify "saturated" if you want to estimate and compare the saturated networks. Specify "sparse" if you want to estimate and compare the pruned networks. |
output_equal |
Whether to output the networks that are constrained equal across groups. Default to FALSE. Can set to TRUE if the global tests rejects heterogeneity. |
partial_prune |
A logical value specifying whether to conduct partial pruning test or not. |
prune_net |
A character vector specifying the network you want to partial prune on. Only works when partial_prune = TRUE. |
prune_alpha |
A numeric value specifying the alpha level for the pruning (if net_type = "sparse"). |
p_prune_alpha |
A numeric value specifying the alpha level for the partial pruning (if partial_prune = TRUE). |
estimator |
A character string specifying the estimator to be used. Must be "FIML" |
standardize |
A character string specifying the type of standardization to be used. "none" (default) for no standardization, "z" for z-scores, and "quantile" for a non-parametric transformation to the quantiles of the marginal standard normal distribution. |
ncores |
A numeric value specifying the number of cores you want to use to run the analysis. Default to 1. |
... |
Additional arguments to be passed to the |
Details
The comparison between the fully unconstrained (free) model and tempEq model is a test for group equality in temporal networks. The comparison between fully constrained model (bothEq) and tempEq is a test for group equality in contemporaneous networks. Similarly, the comparison between the free model and contEq model is a test for group equality in contemporaneous networks, and the comparison between bothEq and contEq is a test for group equality in temporal networks.
Value
A list containing the results of IVPP and networks of all groups.
Author(s)
Xinkai Du Maintainer: Xinkai Du xinkai.du.xd@gmail.com
Examples
library(IVPP)
# Generate the network
net_ls <- gen_panelGVAR(n_node = 6,
p_rewire_temp = 0.5,
p_rewire_cont = 0.5,
n_group = 2)
# Generate the data
data <- sim_panelGVAR(temp_base_ls = net_ls$temporal,
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
omnibus_both <- IVPP_panelgvar(data,
vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
g_test_net = "both",
net_type = "sparse",
partial_prune = FALSE,
ncores = 1)
# global test on temporal
omnibus_temp <- IVPP_panelgvar(data,
vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
g_test_net = "temporal",
net_type = "sparse",
partial_prune = FALSE,
ncores = 1)
# global test on cont
omnibus_cont <- IVPP_panelgvar(data,
vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
g_test_net = "contemporaneous",
net_type = "sparse",
partial_prune = FALSE,
ncores = 1)
# partial prune on both networks
pp_both <- IVPP_panelgvar(data,
vars = paste0("V",1:6),
idvar = "subject",
beepvar = "time",
groups = "group",
global = FALSE,
partial_prune = TRUE,
prune_net = "both",
ncores = 1)