derive_formula | R Documentation |
Uses the form
attribute of edges in an augmented DAG to
construct formulae for the relationship between exposure
and outcome
.
derive_formula(x, exposure, outcome, data = NULL, ...)
x |
An object of class |
exposure |
Atomic character, indicating the exposure node in |
outcome |
Atomic character, indicating the outcome node in |
data |
Optional, a |
... |
Additional arguments, passed to
|
The form
attribute of an augmented DAG of class dagitty
should
contain information about the functional form for the relationships specified
in the DAG. For this function, the form
attribute must be an additive
function as also accepted by formula
. The form
attribute may contain a leading intercept and constant slopes, which will be
parsed out. If the form
attribute does not meet these requirements, the
resulting formula
may be invalid. For example:
form=".5+x1"
would return ~x1
.
form="2*x1*x2"
would return ~x1+x2+x1:x2
.
form="-.2-.2*I(x3^2)"
would return ~I(x3^2)
.
A list
of objects with class formula
.
hasArg
get_edges
adjustmentSets
x <- dagitty::dagitty('dag {
C
O
X
Y
O <- X [form="I(X^2)"]
C -> X
Y -> O [form="Y*X"]
}')
f1 <- derive_formula(x, outcome = "O", exposure = "X")
f2 <- derive_formula(x, outcome = "O", exposure = "Y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.