-
Couldn't load subscription status.
- Fork 52
Open
Description
I tripped myself up today because I expected paths() to be aware of the variables already adjusted in a DAG just like how it is aware of the exposure and outcome.
library(dagitty)
x <- dagitty('dag {
m [pos="1.000,0.000"]
x [exposure,pos="0.000,1.000"]
y [outcome,pos="2.000,1.000"]
x -> m
y -> m
}')
adjustedNodes(x) <- "m"
paths(x)
#> $paths
#> [1] "x -> m <- y"
#>
#> $open
#> [1] FALSE
paths(x, Z = adjustedNodes(x))
#> $paths
#> [1] "x -> m <- y"
#>
#> $open
#> [1] TRUECreated on 2024-08-27 with reprex v2.1.1
I suggest that adjustedNodes(x) is a better default argument for Z. Happy to make a PR if you agree (as well as check for other locations where this is a sensible default)
Metadata
Metadata
Assignees
Labels
No labels