-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hi Jonas,
I've encountered an unexpected result when using the condition() function on a moderated MGM object. When comparing the pairwise weighted adjacency matrices of different conditioned networks, they appear to be identical, which is counterintuitive given that the networks are conditioned on different levels of the moderator.
I can replicate the behavior shown in the example code provided in your blog. However, the conditioned network remained identical, while subgroup analysis found some differences existed across the three subnetworks for each condition.
I am wondering about the possible reasons for these identical results.Is this issue related to the dataset, or could it be a bug in the condition() function? Besides, are there any additional steps or checks I should perform to ensure the moderation effects are being correctly applied in the conditioned networks?
Thank you for your time and assistance in addressing this issue! :)
Code and Output
mgm_obj <- mgm(
data = df_stressors_lca %>% as.matrix(),
type = c(rep("c", 19), "c"),
level = c(rep(2, 19), 3),
lambdaSel = "EBIC",
lambdaGam = 0.25,
ruleReg = "AND",
moderators = 20
)
l_mgm_cond <- list()
for(g in 1:3) l_mgm_cond[[g]] <- condition(object = mgm_obj,
values = list("20" = g))
identical(l_mgm_cond[]$pairwise$wadj, l_mgm_cond[]$pairwise$wadj)
Output: TRUE
Additional information
Description of system environment:
- Operating System: macOS Sonoma 14.5
- R version: 4.4.1 (2024-06-14)
- mgm package version: 1.2.14
My dataset consists of:
- more than 500+ samples in each moderation level
- 19 binary nodes
- 1 moderator variable (3 levels)