select_controls | R Documentation |
Wraps adjustmentSets to construct a dataset with covariates that (asymptotically) allow unbiased estimation of causal effects from observational data.
select_controls(
x,
data,
exposure = NULL,
outcome = NULL,
which_set = c("first", "sample", "all"),
...
)
x |
An input graph of class |
data |
A |
exposure |
Atomic character, name of the exposure variable. |
outcome |
Atomic character, name of the outcome variable. |
which_set |
Atomic character, indicating which set of covariates to
select in case there are multiple. Valid choices are in
|
... |
Other arguments passed to adjustmentSets |
If which_set = "all"
, returns a list of data.frames
to allow for
sensitivity analyses. Otherwise, returns a data.frame
.
adjustmentSets
dag <- dagitty::dagitty('dag {x -> y}')
df <- data.frame(x = rnorm(10), y = rnorm(10))
df1 <- select_controls(dag, df, exposure = "x", outcome = "y")
class(df1) == "data.frame"
df2 <- select_controls(dag, df, exposure = "x", outcome = "y", which_set = "sample")
class(df2) == "data.frame"
lst1 <- select_controls(dag, df, exposure = "x", outcome = "y", which_set = "all")
class(lst1) == "list"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.