The plot() method for the performance::check_dag() function.
# S3 method for class 'see_check_dag'
plot(
x,
size_point = 20,
size_text = 4.5,
colors = NULL,
which = "all",
effect = "total",
check_colliders = TRUE,
...
)A check_dag object.
Numeric value specifying size of point geoms.
Numeric value specifying size of text elements.
Character vector of length five, indicating the colors (in
hex-format) for different types of variables, which are assigned in following
order: outcome, exposure, adjusted, unadjusted, and collider.
Character string indicating which plot to show. Can be either
"all", "current" or "required".
Character string indicating which effect for the required model
is to be estimated. Can be either "total" or "direct".
Logical indicating whether to highlight colliders.
Set to FALSE if the algorithm to detect colliders is very slow.
Currently not used.
A ggplot2-object.
library(performance)
# incorrect adjustment
dag <- check_dag(
y ~ x + b + c,
x ~ b,
outcome = "y",
exposure = "x"
)
dag
#> # Check for correct adjustment sets
#> - Outcome: y
#> - Exposure: x
#>
#> Identification of direct and total effects
#>
#> Incorrectly adjusted!
#> To estimate the direct and total effect, at least adjust for `b`. Currently, the model does not adjust for any variables.
#>
plot(dag)
# plot only model with required adjustments
plot(dag, which = "required")
# collider-bias?
dag <- check_dag(
y ~ x + c + d,
x ~ c + d,
b ~ x,
b ~ y,
outcome = "y",
exposure = "x",
adjusted = "c"
)
plot(dag)
# longer labels, automatic detection of outcome and exposure
dag <- check_dag(
QoL ~ age + education + gender,
age ~ education
)
plot(dag)