fernandoPalluzzi / SEMgraph

Causal Structure Learning and Network Analysis with Structural Equation Modeling.
GNU General Public License v3.0
21 stars 1 forks source link

SEMgsa constant pathway status across datasets #34

Closed andreanuzzo closed 4 months ago

andreanuzzo commented 1 year ago

Hi,

I was trying to run SEMgsa for my datasets. However, I noticed that the status of the pathways (as in act or inh) was constant throughout the results.

When I dug into the SEMgsa function, I noticed that the status is actually called on the simplified igraph object itself. Specifically in lines 131-136 on semUtils.R

     ig <- simplify(g[[k]], remove.loops = TRUE)
     if (length(E(ig)$weight) == 0) E(ig)$weight <- 1
     adj <- as.matrix(get.adjacency(ig, attr = "weight"))
     adj <- colSums(adj)
     nodes <- ifelse(adj >= 1, 1, ifelse(adj == 0, 0, -1))
     status <- ifelse(sum(nodes) >= 1, 1, ifelse(sum(nodes) == 0, 0, -1))

whereas the variable sign (i.e. up or down) is called on the results fit by the SEMricf function.

Doesn't this mean that the pathways will be always "act" or "inh" regardless of the data matrix or group you pass to the function SEMgsa? Is it a feature?

I am asking because you have a different version of SEMgsa() in the SEMgsa_replication/Help.R which looks different and I don't know which one I should be using.

Thanks for the help!

fernandoPalluzzi commented 4 months ago

Dear Andrea,

Maybe it is too late, but I will try to answer.

First of all, thank you for your interest in SEMgraph. Unfortunately, with my relocation one year ago, I discontinued the development version, but I'm now restarting it.

I have recently updated the SEMgsa function, aligning it to the CRAN version (the official one). The SEMgsa replication code is now outdated now and I will replace it soon.

I will close this thread now, but if you still want to use SEMgsa, I suggest you to use either the latest CRAN or the latest version on this repo.

Thanks again for using SEMgraph.