Take a DAG graph object and, in the simplest case, create a single-world intervention template corresponding to a world in which the fixed nodes are set to a given value. Alternatively, tell [qd_swig()] which values fixed nodes will be set to.
Usage
qd_swig(
graph_obj,
fixed_nodes,
custom_values = NULL,
fixed_sep = "vlin",
sep_point_size = 15
)
Arguments
- graph_obj
A DAG object created by [qd_dag()].
- fixed_nodes
A vector containing the nodes to be intervened upon.
- custom_values
A named vector containing alternative labels identifying explicit values for fixed nodes (e.g.,
c("A" = "1")
).- fixed_sep
A character string indicating which character to use as a separator in fixed nodes. Defaults to
"vlin"
. Runsep_opts(TRUE)
for available options.- sep_point_size
A numerical value specifying the point size for fixed node separators.
Examples
# Provide a DAG object and a list of nodes to be fixed
library(magrittr)
edges <- c("A -> Y",
"L -> { A Y }")
dag <- qd_dag(edges)
#>
#>
#> CHECKED: The diagram is a DAG.
#> -------------------------------------------------------------------------
#> Make sure everything is matched up properly!
#> To stop printing data to the console, set 'verbose' to FALSE.
#> -------------------------------------------------------------------------
#> ........................ NODE DATAFRAME ........................
#>
#> id type label alpha_id
#> 1 1 <NA> A A
#> 2 2 <NA> L L
#> 3 3 <NA> Y Y
#>
#> ........................ EDGE DATAFRAME ........................
#>
#> id from to rel
#> 1 1 1 3 <NA>
#> 2 2 2 1 <NA>
#> 3 3 2 3 <NA>
swig <- dag %>%
qd_swig(fixed.nodes = "A",
custom.values = c("A" = "1"))
#> Error in qd_swig(., fixed.nodes = "A", custom.values = c(A = "1")): unused arguments (fixed.nodes = "A", custom.values = c(A = "1"))
swig %>% DiagrammeR::render_graph()
#> Error: object 'swig' not found