A permutation implementation to determine statistical significance of whether the network structures are different from one another
Arguments
- base
- Matrix or data frame. Should consist only of variables to be used in the analysis. First dataset 
- comparison
- Matrix or data frame. Should consist only of variables to be used in the analysis. Second dataset 
- corr
- Character (length = 1). Method to compute correlations. Defaults to - "auto". Available options:- "auto"— Automatically computes appropriate correlations for the data using Pearson's for continuous, polychoric for ordinal, tetrachoric for binary, and polyserial/biserial for ordinal/binary with continuous. To change the number of categories that are considered ordinal, use- ordinal.categories(see- polychoric.matrixfor more details)
- "cor_auto"— Uses- cor_autoto compute correlations. Arguments can be passed along to the function
- "pearson"— Pearson's correlation is computed for all variables regardless of categories
- "spearman"— Spearman's rank-order correlation is computed for all variables regardless of categories
 - For other similarity measures, compute them first and input them into - datawith the sample size (- n)
- na.data
- Character (length = 1). How should missing data be handled? Defaults to - "pairwise". Available options:- "pairwise"— Computes correlation for all available cases between two variables
- "listwise"— Computes correlation for all complete cases in the dataset
 
- model
- Character (length = 1). Defaults to - "glasso". Available options:- "BGGM"— Computes the Bayesian Gaussian Graphical Model. Set argument- ordinal.categoriesto determine levels allowed for a variable to be considered ordinal. See- ?BGGM::estimatefor more details
- "glasso"— Computes the GLASSO with EBIC model selection. See- EBICglasso.qgraphfor more details
- "TMFG"— Computes the TMFG method. See- TMFGfor more details
 
- iter
- Numeric (length = 1). Number of permutations to perform. Defaults to - 1000(recommended)
- ncores
- Numeric (length = 1). Number of cores to use in computing results. Defaults to - ceiling(parallel::detectCores() / 2)or half of your computer's processing power. Set to- 1to not use parallel computing
- verbose
- Boolean (length = 1). Should progress be displayed? Defaults to - TRUE. Set to- FALSEto not display progress
- seed
- Numeric (length = 1). Defaults to - NULLor random results. Set for reproducible results. See Reproducibility and PRNG for more details on random number generation in- EGAnet
- ...
- Additional arguments that can be passed on to - auto.correlate,- network.estimation,- community.detection,- community.consensus,- EGA, and- jsd
Value
Returns a list:
- network
- Data frame with row names of each measure, empirical value ( - statistic), and p-value based on the permutation test (- p.value)
- edges
- List containing matrices of values for empirical values ( - statistic), p-values (- p.value), and Benjamini-Hochberg corrected p-values (- p.adjusted)
References
Frobenius Norm 
Ulitzsch, E., Khanna, S., Rhemtulla, M., & Domingue, B. W. (2023).
A graph theory based similarity metric enables comparison of subpopulation psychometric networks.
Psychological Methods.
Jensen-Shannon Similarity (1 - Distance) 
De Domenico, M., Nicosia, V., Arenas, A., & Latora, V. (2015).
Structural reducibility of multilayer networks.
Nature Communications, 6(1), 1–9.
Total Network Strength 
van Borkulo, C. D., van Bork, R., Boschloo, L., Kossakowski, J. J., Tio, P., Schoevers, R. A., Borsboom, D., & Waldorp, L. J. (2023).
Comparing network structures on three aspects: A permutation test.
Psychological Methods, 28(6), 1273–1285.
Author
Hudson Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>
Examples
# Load data
wmt <- wmt2[,7:24]
# Set groups (if necessary)
groups <- rep(1:2, each = nrow(wmt) / 2)
# Groups
group1 <- wmt[groups == 1,]
group2 <- wmt[groups == 2,]
if (FALSE) # Perform comparison
results <- network.compare(group1, group2)
# Print results
print(results)
#> Error: object 'results' not found
# Plot edge differences
plot(results) # \dontrun{}
#> Error: object 'results' not found