Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/check_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ check_dag <- function(
# - required is NULL and current adjustment not NULL
# - OR we have a collider in current adjustments
incorrectly_adjusted = (is.null(adjustment_set) && !is.null(adjustment_nodes)) ||
(!is.null(collider) && collider %in% adjustment_nodes), # nolint
(!is.null(collider) && any(collider %in% adjustment_nodes)), # nolint
current_adjustments = adjustment_nodes,
minimal_adjustments = minimal_adjustments,
collider = collider
Expand Down
9 changes: 9 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Dominicy
Dordrecht
Dorie
Dunson
Dunkler
Durbin
Dxy
Döring
Expand All @@ -88,6 +89,8 @@ Gabry
Gazen
Gelman
Gnanadesikan
Graham
Gregorich
Guilford
Hartig
HDI
Expand Down Expand Up @@ -158,6 +161,7 @@ Michalos
Moosbrugger
Monette
Mora
Morrissey
Multicollinearity
MuMIn
NFI
Expand All @@ -178,6 +182,9 @@ OSF
OSX
Olkin
PNFI
Papeş
Pandey
Park
Pek
Petrov
polychoric
Expand All @@ -202,6 +209,7 @@ Rousseeuw
Routledge
Rouder
Rouder's
Ruxton
SEM
SRMR
Scheepers
Expand All @@ -220,6 +228,7 @@ Specifity
Sphericity
Springer
Stata
Strohmaier
Subscales
TLI
Technometrics
Expand Down
18 changes: 18 additions & 0 deletions tests/testthat/test-check_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,21 @@ test_that("check_dag, formula-interface", {
)
expect_identical(dag, dag2)
})


test_that("check_dag handles multiple colliders correctly - issue #878", {
# This test reproduces the error from issue #878
# The DAG has multiple colliders (both 'a' and 'b' are colliders)
# because they both have multiple incoming paths from 'c' and 'd'
# This test FAILS while bug exists, PASSES after fix
expect_no_error(
check_dag(
y ~ x + a + b,
a ~ c + d,
b ~ c + d,
outcome = "y",
exposure = "x",
adjusted = ~ a + b
)
)
})
Loading