jtextor / dagitty

Graphical analysis of structural causal models / graphical causal models.
GNU General Public License v2.0
255 stars 47 forks source link

Suggested change in moral graphs: lines connected to adjusted variables disappear #71

Open HeikoBreitsohl opened 1 year ago

HeikoBreitsohl commented 1 year ago

Thanks for a great tool!

In order to align the moral graph feature more closely with Shrier & Platt (2008), I would suggest that, when setting variables to "adjusted", lines connected to those variables to any other variables should disappear from the moral graph (but not from the normal view, of course). This would correspond to Step 6 in S&P.

For background: The DAGitty manual cites S&P when describing moral graphs. When teaching DAGitty, I find it difficult to explain to students why the result in DAGitty looks different from that in S&P, even though the principles are the same. Aside from teaching, as the paths connecting the adjusted variables are blocked, should those lines (in the moral graph) not disappear anyway?

Thanks! Heiko

jtextor commented 1 year ago

Hi Heiko, thank you for the suggestion. The term "moral graph" is usually reserved for the transformation where we just link all parents of the same node with undirected arrows and then remove all arrowheads. The specific construction in S&P is technically the moral graph of the ancestral graph of the proper back-door graph -- in words, this is made by first removing all first edges on proper causal paths, then removing all non-ancestors of X, Y, Z, and only then performing moralization. In that sense maybe the citation in the manual is wrong rather than what dagitty currently does.

However it would be easy to add the view you're requesting as another option to the menu (called something like ancestor moral back-door graph) as this is calculated internally anyway when computing adjustment sets. Thoughts?

HeikoBreitsohl commented 1 year ago

Hi Johannes, thanks for your response! Your explanation makes perfect sense to me. As I look at this issue primarily from teaching perspective, I think having both options available would be great. I like to make students create and use their own DAGs manually first, after which they can check whether DAGitty "agrees".

By the way, it seems to me that the moral graph is a good segway from DAGs to UAGs. Would you agree? If yes, are you aware of an accessible piece of literature that explains UAGs (vs. DAGs)?