Skip to contents

We often want to access the DAG for different mediation-related S4 objects. This generic helps us access these graphical model edges lists. See method instantiations for specific examples.

Usage

edges(object)

Arguments

object

An object whose DAG structure we want to access.

Value

The output depends on the S4 object that is passed. For multimedia objects, this will return an edgelist as a two column data.frame.

Examples

exper <- demo_joy() |>
    mediation_data("PHQ", "treatment", starts_with("ASV"))
multimedia(exper) |>
    edges()
#> # A tbl_graph: 8 nodes and 17 edges
#> #
#> # A directed acyclic simple graph with 1 component
#> #
#> # Node Data: 8 × 3 (active)
#>   name      node_type    id
#>   <chr>     <fct>     <int>
#> 1 1         intercept     1
#> 2 treatment treatment     2
#> 3 ASV1      mediator      3
#> 4 ASV2      mediator      4
#> 5 ASV3      mediator      5
#> 6 ASV4      mediator      6
#> 7 ASV5      mediator      7
#> 8 PHQ       outcome       8
#> #
#> # Edge Data: 17 × 3
#>    from    to state 
#>   <int> <int> <chr> 
#> 1     1     3 active
#> 2     1     4 active
#> 3     1     5 active
#> # ℹ 14 more rows