Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 13, 2024
1 parent 036ff87 commit c473a1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
3 changes: 1 addition & 2 deletions R/check_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,8 @@ check_dag <- function(...,
list(
# no adjustment needed when
# - required and current adjustment sets are NULL
# - OR required and current adjustments are identical
# - AND we have no collider in current adjustments
adjustment_not_needed = ((is.null(adjustment_set) && is.null(adjustment_nodes)) || identical(all_required_adjustments, all_allowed_adjustments)) && is.null(collider),
adjustment_not_needed = is.null(adjustment_set) && is.null(adjustment_nodes) && is.null(collider),
# incorrect adjustment when
# - required is NULL and current adjustment not NULL
# - OR required and current adjustments are *not* identical
Expand Down
40 changes: 20 additions & 20 deletions tests/testthat/_snaps/check_dag.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Identification of direct and total effects
Model is correctly specified.
No adjustment needed to estimate the direct and total effect of `x` on `y`.
All minimal sufficient adjustments to estimate the direct and total effect were done.

---
Expand Down Expand Up @@ -56,8 +56,8 @@
Identification of direct and total effects
Model is correctly specified.
No adjustment needed to estimate the direct and total effect of `x` on `y`.
Incorrectly adjusted!
To estimate the direct and total effect, at least adjust for `b` and `c`. Currently, the model only adjusts for `c`. You possibly also need to adjust for `b` to block biasing paths.

---
Expand All @@ -72,8 +72,8 @@
Identification of direct and total effects
Model is correctly specified.
No adjustment needed to estimate the direct and total effect of `x` on `y`.
Incorrectly adjusted!
To estimate the direct and total effect, at least adjust for `b` and `c`. Currently, the model only adjusts for `c`. You possibly also need to adjust for `b` to block biasing paths.

---
Expand All @@ -89,7 +89,7 @@
Identification of direct and total effects
Model is correctly specified.
No adjustment needed to estimate the direct and total effect of `wt` on `mpg`.
All minimal sufficient adjustments to estimate the direct and total effect were done.

# check_dag, multiple adjustment sets
Expand Down Expand Up @@ -120,7 +120,7 @@
Identification of direct and total effects
Model is correctly specified.
No adjustment needed to estimate the direct and total effect of `podcast` on `exam`.
All minimal sufficient adjustments to estimate the direct and total effect were done.

# check_dag, different adjustements for total and direct
Expand Down Expand Up @@ -155,13 +155,13 @@
Identification of direct effects
Model is correctly specified.
No adjustment needed to estimate the direct effect of `exposure` on `outcome`.
Incorrectly adjusted!
To estimate the direct effect, at least adjust for `x1` and `x2`. Currently, the model only adjusts for `x1`. You possibly also need to adjust for `x2` to block biasing paths.
Identification of total effects
Model is correctly specified.
No adjustment needed to estimate the total effect of `exposure` on `outcome`.
All minimal sufficient adjustments to estimate the total effect were done.

---
Expand All @@ -176,13 +176,13 @@
Identification of direct effects
Model is correctly specified.
No adjustment needed to estimate the direct effect of `exposure` on `outcome`.
Incorrectly adjusted!
To estimate the direct effect, at least adjust for `x1` and `x2`. Currently, the model only adjusts for `x2`. You possibly also need to adjust for `x1` to block biasing paths.
Identification of total effects
Model is correctly specified.
No adjustment needed to estimate the total effect of `exposure` on `outcome`.
Incorrectly adjusted!
To estimate the total effect, at least adjust for . Currently, the model only adjusts for `x2`.

---
Expand All @@ -198,12 +198,12 @@
Identification of direct effects
Model is correctly specified.
No adjustment needed to estimate the direct effect of `exposure` on `outcome`.
All minimal sufficient adjustments to estimate the direct effect were done.
Identification of total effects
Model is correctly specified.
No adjustment needed to estimate the total effect of `exposure` on `outcome`.
Incorrectly adjusted!
To estimate the total effect, at least adjust for . Currently, the model only adjusts for `x1` and `x2`.

# check_dag, collider bias
Expand All @@ -218,13 +218,13 @@
Identification of direct effects
Model is correctly specified.
No adjustment needed to estimate the direct effect of `agegroup` on `SMD_ICD11`.
Incorrectly adjusted!
To estimate the direct effect, at least adjust for `edgroup3`, `gender_kid`, `pss4_kid_sum_2sd`, `residence` and `sm_h_total_kid`. Currently, the model only adjusts for `edgroup3`, `gender_kid`, `pss4_kid_sum_2sd` and `residence`. You possibly also need to adjust for `sm_h_total_kid` to block biasing paths.
Identification of total effects
Model is correctly specified.
No adjustment needed to estimate the total effect of `agegroup` on `SMD_ICD11`.
All minimal sufficient adjustments to estimate the total effect were done.

---
Expand Down

0 comments on commit c473a1f

Please sign in to comment.