dagitty icon indicating copy to clipboard operation
dagitty copied to clipboard

Indicate "incorrectly adjusted" in `adjustementSets()`?

Open strengejacke opened this issue 1 year ago • 1 comments

When using this Model code in https://www.dagitty.net/dags.html,

dag {
B [adjusted]
D [outcome]
E [exposure]
B -> D
E -> B
E -> D
}

the tool informs me about incorrect adjustments: image

However, dagitty::adjustmentSets() just returns an empty list for the total effect, not indicating that B should not be adjusted:

dag <- dagitty::dagitty("dag {
B [adjusted]
D [outcome]
E [exposure]
B -> D
E -> B
E -> D
}")

# empty list - what does this mean?
dagitty::adjustmentSets(dag)

dagitty::adjustmentSets(dag, effect = "direct")
#> { B }

Current workaround is to check for adjusted node lengths:

r <- dagitty::adjustmentSets(dag)
# incorrectly adjusted?
(!length(r) && length(dagitty::adjustedNodes(dag)) > 0)
#> [1] TRUE

It would be great if dagitty::adjustmentSets() would directly yield a warning about incorrect adjustments, instead of returning an empty list.

strengejacke avatar Aug 02 '24 16:08 strengejacke