Assess if a variable confounds a relationship
is_confounder(.tdy_dag, z, x, y, direct = FALSE)
input graph, an object of class tidy_dagitty or dagitty
tidy_dagitty
dagitty
a character vector, the potential confounder
a character vector, the variables z may confound.
logical. Only consider direct confounding? Default is FALSE
FALSE
Logical. Is the variable a confounder?
# NOT RUN { dag <- dagify(y ~ z, x ~ z) is_confounder(dag, "z", "x", "y") is_confounder(dag, "x", "z", "y") # }
Run the code above in your browser using DataCamp Workspace