Closed Brooks0303 closed 1 year ago
Hi! the choice of estimator depends on you research question. Mainly, if you are interested in individual edges then a non-regularized estimator like ggmModSelect
is good, but given the large number of nodes here you could still opt to go with EBICglasso
. The code is not correct for NCT
, you have to use the estimteNetwork
objects directly in NCT. E.g., NCT(Stepwise_part1, Stepwise_part2)
, but it will be quire slow with stepwise estimation and this many nodes.
Another option is to use psychonetrics
for a homogeneity test. See below for some example code.
# Load psychonetrics and dplyr:
library("psychonetrics")
library("dplyr")
# Extract the variable names:
vars <- names(data1)
# Add part variable:
data1$part <- 1
data2$part <- 2
data3$part <- 3
# Combine datasets:
data_combined <- bind_rows(data1, data2, data3)
# form multi-group model:
mod <- ggm(data_combined, vars = vars, groups = "part")
# Estimate saturated model (all edges included):
mod_saturated <- mod %>% runmodel
# Estimate model with saturated networks set equal (equivalent to testing if correlations are equal):
mod_saturated_equal <- mod_saturated %>% groupequal("omega") %>% runmodel
# Compare the models:
compare(
saturated_not_equal = mod_saturated,
saturated_equal = mod_saturated_equal
)
# The model with lower AIC/BIC is preferred.
# You can also compare sparse models. With this number of nodes and sample size, I'd recommend to only use pruning. See Network Psychometrics with R chapter 7:
mod_sparse <- mod_saturated %>% prune(alpha = 0.01) %>% runmodel
# Now to test for equality, we need to compute a "union" model that includes all edges that are present in at least one sample:
mod_sparse_union <- mod_sparse %>% unionmodel %>% runmodel
# Now we can set the edges equal:
mod_sparse_union_equal <- mod_sparse_union %>% groupequal("omega") %>% runmodel
# and compare the models:
compare(
sparse_union_not_equal = mod_sparse_union,
sparse_union_equal = mod_sparse_union_equal
)
# If the equal model is not preferred, then select the mod_sparse model (not the union model as it includss some non-significant edges).
# Extract the networks:
getmatrix(mod_sparse, "omega") # <- replace 'mod_sparse' with preferred model
Oh I forget to change the code, in the latest I only input the estimateNetwork objects in NCT. I do include as many possible edges as possible to see the connections between nodes, so ggm might be a good way. And thank you very much for your response to the NCT sample size and Homogeneity test, I will study these methods carefully.
Thanks again for all your help!!!
Greetings, My data constructed by some parts which have different sample size from 2000 to 10000+, node num is 50+. My objective is to individually construct networks for these segments and then compare the differences in their network structures.
After considering Mr Epskamp‘s valuable advice provided earlier and reading the papers(in this issue) , I have refined my method. I have chosen to use appointed arguments within the 'estimatenetwork' package instead of directly employing 'ggmModselect'. Additionally, I have moved away from using thresholds and have opted for Pearson correlation (which seems to be the default in 'estimatenetwork') instead of 'cor_auto'.
Below is the code implementation:
PLZ help me in these questions:
partX<-estimateNetwork(dataX,default = ('ggmModSelect'),stepwise = FALSE)
Profoundly grateful for your kind consideration of these questions!