View source: R/dynamic.network.compare.R
| dynamic.network.compare | R Documentation |
A permutation implementation to determine statistical significance of whether the dynamic network structures are different from one another
dynamic.network.compare(
data,
paired = FALSE,
corr = c("auto", "cor_auto", "pearson", "spearman"),
na.data = c("pairwise", "listwise"),
model = c("BGGM", "glasso", "TMFG"),
id = NULL,
group = NULL,
n.embed = 5,
n.embed.optimize = FALSE,
tau = 1,
delta = 1,
use.derivatives = 1,
na.derivative = c("none", "kalman", "rowwise", "skipover"),
zero.jitter = 0.001,
iter = 1000,
ncores,
seed = NULL,
verbose = TRUE,
...
)
data |
Matrix or data frame. Should consist only of variables to be used in the analysis as well as an ID column |
paired |
Boolean (length = 1).
Whether groups are repeated measures representing
paired samples.
Defaults to |
corr |
Character (length = 1).
Method to compute correlations.
Defaults to
For other similarity measures, compute them first and input them
into |
na.data |
Character (length = 1).
How should missing data be handled?
Defaults to
|
model |
Character (length = 1).
Defaults to
|
id |
Numeric or character (length = 1).
Number or name of the column identifying each individual.
Defaults to |
group |
Numeric or character (length = 1).
Number of the column identifying group membership.
Defaults to |
n.embed |
Numeric (length = 1).
Defaults to |
n.embed.optimize |
Boolean (length = 1).
If |
tau |
Numeric (length = 1).
Defaults to |
delta |
Numeric (length = 1).
Defaults to |
use.derivatives |
Numeric (length = 1).
Defaults to
Generally recommended to leave "as is" |
na.derivative |
Character (length = 1).
How should missing data in the embeddings be handled?
Available options (see Boker et al. (2018) in
|
zero.jitter |
Numeric (length = 1).
Small amount of Gaussian noise added to zero variance derivatives to prevent
estimation failures. For more than one variable, noise is generated
multivariate normal distribution to ensure orthogonal noise is added.
The jitter preserves the overall structure but avoids singular
covariance matrices during network estimation.
Defaults to |
iter |
Numeric (length = 1).
Number of permutations to perform.
Defaults to |
ncores |
Numeric (length = 1).
Number of cores to use in computing results.
Defaults to |
seed |
Numeric (length = 1).
Defaults to |
verbose |
Boolean (length = 1).
Should progress be displayed?
Defaults to |
... |
Additional arguments that can be passed on to
|
Returns a list:
network |
Data frame with row names of each measure, empirical value ( |
edges |
List containing matrices of values for empirical values ( |
Hudson Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>
sF
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.
# Three similar groups
# Set seed
set.seed(42)
# Simulate dynamic data
participants <- lapply(
seq_len(50), function(i){
# Get output
output <- simDFM(
variab = 6, timep = 15,
nfact = 2, error = 0.100,
dfm = "DAFS", loadings = 0.60,
autoreg = 0.80, crossreg = 0.10,
var.shock = 0.36, cov.shock = 0.18,
burnin = 2000
)
# Add ID
df <- data.frame(
ID = i,
Group = rep(1:3, each = 5),
output$data
)
# Return data
return(df)
}
)
# Put participants into a data frame
df <- do.call(rbind.data.frame, participants)
## Not run:
# Perform comparison
dynamic.network.compare(
data = df, paired = TRUE,
# EGA arguments
corr = "auto", na.data = "pairwise", model = "glasso",
# dynEGA arguments
id = "ID", group = "Group", n.embed = 3,
tau = 1, delta = 1, use.derivatives = 1,
# Permutation arguments
iter = 1000, ncores = 2, verbose = TRUE, seed = 42
)
## End(Not run)
# Two similar groups and one different
# Simulate dynamic data
participants <- lapply(
seq_len(50), function(i){
# Get output
output <- simDFM(
variab = 4, timep = 5,
nfact = 3, error = 0.100,
dfm = "DAFS", loadings = 0.60,
autoreg = 0.80, crossreg = 0.10,
var.shock = 0.36, cov.shock = 0.18,
burnin = 2000
)
# Add ID
df <- data.frame(
ID = i,
Group = rep(3, each = 5),
output$data
)
# Return data
return(df)
}
)
# Replace group 3
new_group <- do.call(rbind.data.frame, participants)
df[df$Group == 3,] <- new_group
## Not run:
# Perform comparison
dynamic.network.compare(
data = df, paired = TRUE,
# EGA arguments
corr = "auto", na.data = "pairwise", model = "glasso",
# dynEGA arguments
id = "ID", group = "Group", n.embed = 3,
tau = 1, delta = 1, use.derivatives = 1,
# Permutation arguments
iter = 1000, ncores = 2, verbose = TRUE, seed = 42
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.